My understanding is that backup files are generated iff Kakoune crashes or receives a SIGHUP. Backup files are generated as hidden files in the same directory as the text file being edited.
Are these assumptions correct? I feel I'm misunderstanding how Kakoune works, because:
SIGKILL. (and, for example, if I or another user happen to shut down my workstation without saving my work).-i switch work?The following signals will trigger a backup: SIGSEGV, SIGFPE, SIGQUIT, SIGTERM, SIGPIPE. Backups are also created whenever an error occurs when the client communicates with the server.
If no backups were generated when the editor crashed, I would say that's a bug, but I don't recall ever experiencing such issues. Maybe you can test that by manually sending one of the above signals to a kak process, and see if a backup is generated for the currently edited -and unsaved- buffer?
Unfortunately there's no builtin way to periodically create backups at the moment. Maybe that could be handled by a script.
The -i flag is only used when applying a filter to a file with -f, it works pretty much like sed's -i.
An autobackup script would be a nice complement to the autorestore one https://github.com/mawww/kakoune/blob/master/rc/extra/autorestore.kak
Backups are also created whenever an error occurs when the client communicates with the server.
[..] If no backups were generated when the editor crashed, I would say that's a bug, but I don't recall ever experiencing such issues.
Once or twice every day, I get the following error when I use kak -c
socket read failed: Success
disconnecting
The kak daemon and all my kak clients are suddenly closed and no backup files are created.
Unfortunately I am still unable to reproduce this bug consistently. I'll update once I can.
Re: 76f072a:
After updating to HEAD, the error reported on kak -c is now:
socket read failed: Interrupted system call
disconnecting
The kak daemon and all the clients are then closed.
I'm still not able to reproduce it predictably.
kill -sighup $kak_pid produces a backup.What system are you running on ? Are you running the Kakoune server in daemon mode, or just launch it as kak and then connect additional clients ?
What system are you running on ?
Linux 4.9.48-1-lts x86_64 Arch GNU/Linux
Are you running the Kakoune server in daemon mode (1), or just launch it as kak and then connect additional clients (2) ?
Message: Process 31347 (kak) of user 1000 dumped core.
Stack trace of thread 31347:
#0 0x00007f540c2938a0 raise (libc.so.6)
#1 0x00007f540c294f09 abort (libc.so.6)
#2 0x00007f540c2d6517 __libc_message (libc.so.6)
#3 0x00007f540c2dcc84 malloc_printerr (libc.so.6)
#4 0x00007f540c2e0125 _int_malloc (libc.so.6)
#5 0x00007f540c2e1af4 malloc (libc.so.6)
#6 0x00007f540c362eb5 __backtrace_symbols (libc.so.6)
#7 0x0000007f8a623f2f _ZNK7Kakoune9Backtrace4descEv (kak)
#8 0x0000007f8a7188db _ZN7Kakoune14signal_handlerEi (kak)
#9 0x00007f540c293920 __restore_rt (libc.so.6)
#10 0x00007f540c3b6a31 __memmove_avx_unaligned_erms (libc.so.6)
#11 0x0000007f8a769ec5 _ZNK7Kakoune13OptionManager18unregister_watcherERNS_20OptionManagerWatcherE (kak)
#12 0x0000007f8a639837 _ZN7Kakoune6Client13change_bufferERNS_6BufferE (kak)
#13 0x0000007f8a687184 _ZN7Kakoune7Context13change_bufferERNS_6BufferE (kak)
#14 0x0000007f8a657db9 n/a (kak)
#15 0x0000007f8a643e98 _ZN7Kakoune14CommandManager22execute_single_commandENS_9ArrayViewIKNS_6StringEEERNS_7ContextERKNS_12ShellContextENS_12DisplayCoordE (kak)
#16 0x0000007f8a647080 _ZN7Kakoune14CommandManager7executeENS_10StringViewERNS_7ContextERKNS_12ShellContextE (kak)
#17 0x0000007f8a65ca38 n/a (kak)
#18 0x0000007f8a643e98 _ZN7Kakoune14CommandManager22execute_single_commandENS_9ArrayViewIKNS_6StringEEERNS_7ContextERKNS_12ShellContextENS_12DisplayCoordE (kak)
#19 0x0000007f8a647080 _ZN7Kakoune14CommandManager7executeENS_10StringViewERNS_7ContextERKNS_12ShellContextE (kak)
#20 0x0000007f8a6d73ec _ZNK7Kakoune11HookManager8run_hookENS_10StringViewES1_RNS_7ContextE (kak)
#21 0x0000007f8a7bc279 _ZN7Kakoune6Window23run_hook_in_own_contextENS_10StringViewES1_NS_6StringE (kak)
#22 0x0000007f8a7bc4df _ZN7Kakoune6Window14set_dimensionsENS_12DisplayCoordE (kak)
#23 0x0000007f8a63931e _ZN7Kakoune6ClientC1EOSt10unique_ptrINS_13UserInterfaceESt14default_deleteIS2_EEOS1_INS_6WindowES3_IS7_EENS_13SelectionListEiNS_7HashMapINS_6StringESD_LNS_12MemoryDomainE12EEESD_St8functionIFviEE (kak)
#24 0x0000007f8a63f6b1 _ZN7Kakoune13ClientManager13create_clientEOSt10unique_ptrINS_13UserInterfaceESt14default_deleteIS2_EEiNS_7HashMapINS_6StringES8_LNS_12MemoryDomainE12EEENS_10StringViewENS_8OptionalINS_11BufferCoordEEESt8functionIFviEE (kak)
#25 0x0000007f8a78d351 _ZN7Kakoune6Server8Accepter22handle_available_inputEv (kak)
#26 0x0000007f8a68fa74 _ZN7Kakoune12EventManager18handle_next_eventsENS_9EventModeEP10__sigset_t (kak)
#27 0x0000007f8a71f4e1 _ZN7Kakoune10run_serverENS_10StringViewES0_S0_NS_8OptionalINS_11BufferCoordEEENS_11ServerFlagsENS_6UITypeENS_9ArrayViewIKS0_EE (kak)
#28 0x0000007f8a62024a main (kak)
#29 0x00007f540c27ff6a __libc_start_main (libc.so.6)
#30 0x0000007f8a6210fa _start (kak)
gdb backtrace after kak -c:
#0 0x00007f540c2938a0 in raise () from /usr/lib/libc.so.6
#1 0x00007f540c294f09 in abort () from /usr/lib/libc.so.6
#2 0x00007f540c2d6517 in __libc_message () from /usr/lib/libc.so.6
#3 0x00007f540c2dcc84 in malloc_printerr () from /usr/lib/libc.so.6
#4 0x00007f540c2e0125 in _int_malloc () from /usr/lib/libc.so.6
#5 0x00007f540c2e1af4 in malloc () from /usr/lib/libc.so.6
#6 0x00007f540c362eb5 in backtrace_symbols () from /usr/lib/libc.so.6
#7 0x0000007f8a623f2f in Kakoune::Backtrace::desc() const ()
#8 0x0000007f8a7188db in Kakoune::signal_handler(int) ()
#9 <signal handler called>
#10 0x00007f540c3b6a31 in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
#11 0x0000007f8a769ec5 in Kakoune::OptionManager::unregister_watcher(Kakoune::OptionManagerWatcher&) const ()
#12 0x0000007f8a639837 in Kakoune::Client::change_buffer(Kakoune::Buffer&) ()
#13 0x0000007f8a687184 in Kakoune::Context::change_buffer(Kakoune::Buffer&) ()
#14 0x0000007f8a657db9 in ?? ()
#15 0x0000007f8a643e98 in Kakoune::CommandManager::execute_single_command(Kakoune::ArrayView<Kakoune::String const>, Kakoune::Context&, Kakoune::ShellContext const&, Kakoune::DisplayCoord) ()
#16 0x0000007f8a647080 in Kakoune::CommandManager::execute(Kakoune::StringView, Kakoune::Context&, Kakoune::ShellContext const&) ()
#17 0x0000007f8a65ca38 in ?? ()
#18 0x0000007f8a643e98 in Kakoune::CommandManager::execute_single_command(Kakoune::ArrayView<Kakoune::String const>, Kakoune::Context&, Kakoune::ShellContext const&, Kakoune::DisplayCoord) ()
#19 0x0000007f8a647080 in Kakoune::CommandManager::execute(Kakoune::StringView, Kakoune::Context&, Kakoune::ShellContext const&) ()
#20 0x0000007f8a6d73ec in Kakoune::HookManager::run_hook(Kakoune::StringView, Kakoune::StringView, Kakoune::Context&) const ()
#21 0x0000007f8a7bc279 in Kakoune::Window::run_hook_in_own_context(Kakoune::StringView, Kakoune::StringView, Kakoune::String) ()
#22 0x0000007f8a7bc4df in Kakoune::Window::set_dimensions(Kakoune::DisplayCoord) ()
#23 0x0000007f8a63931e in Kakoune::Client::Client(std::unique_ptr<Kakoune::UserInterface, std::default_delete<Kakoune::UserInterface> >&&, std::unique_ptr<Kakoune::Window, std::default_delete<Kakoune::Window> >&&, Kakoune::SelectionList, int, Kakoune::HashMap<Kakoune::String, Kakoune::String, (Kakoune::MemoryDomain)12>, Kakoune::String, std::function<void (int)>) ()
#24 0x0000007f8a63f6b1 in Kakoune::ClientManager::create_client(std::unique_ptr<Kakoune::UserInterface, std::default_delete<Kakoune::UserInterface> >&&, int, Kakoune::HashMap<Kakoune::String, Kakoune::String, (Kakoune::MemoryDomain)12>, Kakoune::StringView, Kakoune::Optional<Kakoune::BufferCoord>, std::function<void (int)>) ()
#25 0x0000007f8a78d351 in Kakoune::Server::Accepter::handle_available_input() ()
#26 0x0000007f8a68fa74 in Kakoune::EventManager::handle_next_events(Kakoune::EventMode, __sigset_t*) ()
#27 0x0000007f8a71f4e1 in Kakoune::run_server(Kakoune::StringView, Kakoune::StringView, Kakoune::StringView, Kakoune::Optional<Kakoune::BufferCoord>, Kakoune::ServerFlags, Kakoune::UIType, Kakoune::ArrayView<Kakoune::StringView const>) ()
#28 0x0000007f8a62024a in main ()
Hum, seems this is related with a hook you have on WinResize, that triggers a buffer change. Not sure yet why it breaks but could you post that hook if its in your config ?
Hum, seems this is related with a hook you have on WinResize, that triggers a buffer change. Not sure yet why it breaks but could you post that hook if its in your config ?
I don't have one on my config. The only WinResize hook that was raising an error was the one reported in #1591.
was that happening on a man buffer then ?
was that happening on a man buffer then ?
I think so, because I kept getting errors when resizing doc buffers.
I believe this is fixed by f268546.
Most helpful comment
An
autobackupscript would be a nice complement to theautorestoreone https://github.com/mawww/kakoune/blob/master/rc/extra/autorestore.kak