Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completion not working when chaining shell commands #21

Closed
alexherbo2 opened this issue Jan 3, 2014 · 1 comment
Closed

completion not working when chaining shell commands #21

alexherbo2 opened this issue Jan 3, 2014 · 1 comment

Comments

@alexherbo2
Copy link
Contributor

3017531 shell_completion uses command completion after semicolons

Not bad, but it expects shell in option is POSIX. for instance, shell commands can be chained with && and the and in fish is and.

@mawww
Copy link
Owner

mawww commented Jan 3, 2014

kak scripts are written under the assumption that %opt{shell} is a posix shell, some even use bash extensions, adding support for arbitrary shells is not a goal at the moment. supporting the && and | makes sense.

In fish AFAIK and is actually a command that takes another command as parameter, it is not in Kakoune scope to provide completion for arbitrary shell commands, shell style completion is only a quick and dirty helper.

@mawww mawww closed this as completed in 540d82c Jan 3, 2014
krobelus added a commit to krobelus/kakoune that referenced this issue Mar 18, 2023
When Kakoune's terminal is shown on my laptop monitor and I plug
in my external monitor, the terminal's workspace will move to that
external monitor. When this happens, Kakoune may segfault.
There are multiple resize events (SIGWINCH) in quick succession;
it crashes because we handle SIGWINCH during rendering.

The problem happens during execution of "TerminalUI::Screen::output"
(frame mawww#18). When we receive SIGWINCH while writing to stdout, write(2)
fails with EAGAIN, prompting us to handle pending events (See ae001a1
(Run EventManager whenever writing to a file descriptor would block,
2022-05-10)).  We update the screen size in check_resize() here:

	mawww#4  Kakoune::TerminalUI::check_resize (force=<optimized out>) at terminal_ui.cc:683
	mawww#5  Kakoune::TerminalUI::get_next_key () at terminal_ui.cc:719
	mawww#6  operator() (__closure=0x555555984198) at terminal_ui.cc:484
	mawww#7  std::__invoke_impl<void, Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>&, Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode> (__f=...) at /usr/include/c++/12.2.1/bits/invoke.h:61
	mawww#8  std::__invoke_r<void, Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>&, Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode> (__fn=...) at /usr/include/c++/12.2.1/bits/invoke.h:111
	mawww#9  std::_Function_handler<void(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode), Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)> >::_M_invoke(const std::_Any_data &, Kakoune::FDWatcher &, Kakoune::FdEvents &&, Kakoune::EventMode &&) (__functor=..., __args#0=..., __args#1=<optimized out>, __args#2=<optimized out>) at /usr/include/c++/12.2.1/bits/std_function.h:290
	mawww#10 std::function<void (Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>::operator()(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode) const (__args#2=<optimized out>, __args#1=<optimized out>,  __args#0=...) at /usr/include/c++/12.2.1/bits/std_function.h:591
	mawww#11 Kakoune::FDWatcher::run (mode=Kakoune::EventMode::Urgent, events=<optimized out>) at event_manager.cc:28
	mawww#12 Kakoune::EventManager::handle_next_events (mode=mode@entry=Kakoune::EventMode::Urgent, sigmask=sigmask@entry=0x0, block=<optimized out>, block@entry=false) at event_manager.cc:143
	mawww#13 Kakoune::write (fd=1, data=...) at file.cc:273
	mawww#14 Kakoune::BufferedWriter<4096>::flush () at string.hh:236
	mawww#15 Kakoune::BufferedWriter<4096>::write (data="t file.hh:145
	mawww#16 Kakoune::TerminalUI::Screen::set_face (face=..., writer=...) at terminal_ui.cc:255
	mawww#17 operator() (line=..., __closure=<synthetic pointer>) at terminal_ui.cc:326
	mawww#18 Kakoune::TerminalUI::Screen::output (force=force@entry=true, synchronized=<optimized out>, writer=...) at terminal_ui.cc:402
	mawww#19 Kakoune::TerminalUI::redraw (force=force@entry=true) at terminal_ui.cc:571
	mawww#20 Kakoune::TerminalUI::refresh (force=<optimized out>) at terminal_ui.cc:592
	mawww#21 Kakoune::Client::redraw_ifn () at client.cc:282
	mawww#22 Kakoune::ClientManager::redraw_clients () at client_manager.cc:232
	mawww#23 Kakoune::run_server (session=..., server_init=..., client_init=..., init_buffer="fish-rust/src/ast.rs", init_coord=..., flags=Kakoune::ServerFlags::None, ui_type=Kakoune::UIType::Terminal,
	    debug_flags=<optimized out>, files=ArrayView<Kakoune::StringView> = {...}) at main.cc:893
	mawww#24 main (argc=<optimized out>, argv=<optimized out>) at main.cc:1243

Thereafter, "TerminalUI::Screen::output" resumes and crashes due to
a buffer overflow in "lines" which has been resized.
krobelus added a commit to krobelus/kakoune that referenced this issue Mar 18, 2023
When Kakoune's terminal is shown on my laptop monitor and I plug
in my external monitor, the terminal's workspace will move to that
external monitor. When this happens, Kakoune may segfault.
There are multiple resize events (SIGWINCH) in quick succession;
it crashes because we handle SIGWINCH during rendering.

The problem happens during execution of "TerminalUI::Screen::output"
(frame mawww#18). When we receive SIGWINCH while writing to stdout, write(2)
fails with EAGAIN, prompting us to handle pending events (See ae001a1
(Run EventManager whenever writing to a file descriptor would block,
2022-05-10)).  We update the screen size in check_resize() here:

	mawww#4  Kakoune::TerminalUI::check_resize (force=<optimized out>) at terminal_ui.cc:683
	mawww#5  Kakoune::TerminalUI::get_next_key () at terminal_ui.cc:719
	mawww#6  operator() (__closure=0x555555984198) at terminal_ui.cc:484
	mawww#7  std::__invoke_impl<void, Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>&, Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode> (__f=...) at /usr/include/c++/12.2.1/bits/invoke.h:61
	mawww#8  std::__invoke_r<void, Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>&, Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode> (__fn=...) at /usr/include/c++/12.2.1/bits/invoke.h:111
	mawww#9  std::_Function_handler<void(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode), Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)> >::_M_invoke(const std::_Any_data &, Kakoune::FDWatcher &, Kakoune::FdEvents &&, Kakoune::EventMode &&) (__functor=..., __args#0=..., __args#1=<optimized out>, __args#2=<optimized out>) at /usr/include/c++/12.2.1/bits/std_function.h:290
	mawww#10 std::function<void (Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>::operator()(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode) const (__args#2=<optimized out>, __args#1=<optimized out>,  __args#0=...) at /usr/include/c++/12.2.1/bits/std_function.h:591
	mawww#11 Kakoune::FDWatcher::run (mode=Kakoune::EventMode::Urgent, events=<optimized out>) at event_manager.cc:28
	mawww#12 Kakoune::EventManager::handle_next_events (mode=mode@entry=Kakoune::EventMode::Urgent, sigmask=sigmask@entry=0x0, block=<optimized out>, block@entry=false) at event_manager.cc:143
	mawww#13 Kakoune::write (fd=1, data=...) at file.cc:273
	mawww#14 Kakoune::BufferedWriter<4096>::flush () at string.hh:236
	mawww#15 Kakoune::BufferedWriter<4096>::write (data="t file.hh:145
	mawww#16 Kakoune::TerminalUI::Screen::set_face (face=..., writer=...) at terminal_ui.cc:255
	mawww#17 operator() (line=..., __closure=<synthetic pointer>) at terminal_ui.cc:326
	mawww#18 Kakoune::TerminalUI::Screen::output (force=force@entry=true, synchronized=<optimized out>, writer=...) at terminal_ui.cc:402
	mawww#19 Kakoune::TerminalUI::redraw (force=force@entry=true) at terminal_ui.cc:571
	mawww#20 Kakoune::TerminalUI::refresh (force=<optimized out>) at terminal_ui.cc:592
	mawww#21 Kakoune::Client::redraw_ifn () at client.cc:282
	mawww#22 Kakoune::ClientManager::redraw_clients () at client_manager.cc:232
	mawww#23 Kakoune::run_server (session=..., server_init=..., client_init=..., init_buffer="fish-rust/src/ast.rs", init_coord=..., flags=Kakoune::ServerFlags::None, ui_type=Kakoune::UIType::Terminal,
	    debug_flags=<optimized out>, files=ArrayView<Kakoune::StringView> = {...}) at main.cc:893
	mawww#24 main (argc=<optimized out>, argv=<optimized out>) at main.cc:1243

Thereafter, "TerminalUI::Screen::output" resumes and crashes due to
a buffer overflow in "lines" which has been resized.
krobelus added a commit to krobelus/kakoune that referenced this issue Apr 16, 2023
When Kakoune's terminal is shown on my laptop monitor and I plug
in my external monitor, the terminal's workspace will move to that
external monitor. When this happens, Kakoune may segfault.
There are multiple resize events (SIGWINCH) in quick succession;
it crashes because we handle SIGWINCH during rendering.

The problem happens during execution of "TerminalUI::Screen::output"
(frame mawww#18). When we receive SIGWINCH while writing to stdout, write(2)
fails with EAGAIN, prompting us to handle pending events (See ae001a1
(Run EventManager whenever writing to a file descriptor would block,
2022-05-10)).  We update the screen size in check_resize() here:

	mawww#4  Kakoune::TerminalUI::check_resize (force=<optimized out>) at terminal_ui.cc:683
	mawww#5  Kakoune::TerminalUI::get_next_key () at terminal_ui.cc:719
	mawww#6  operator() (__closure=0x555555984198) at terminal_ui.cc:484
	mawww#7  std::__invoke_impl<void, Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>&, Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode> (__f=...) at /usr/include/c++/12.2.1/bits/invoke.h:61
	mawww#8  std::__invoke_r<void, Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>&, Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode> (__fn=...) at /usr/include/c++/12.2.1/bits/invoke.h:111
	mawww#9  std::_Function_handler<void(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode), Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)> >::_M_invoke(const std::_Any_data &, Kakoune::FDWatcher &, Kakoune::FdEvents &&, Kakoune::EventMode &&) (__functor=..., __args#0=..., __args#1=<optimized out>, __args#2=<optimized out>) at /usr/include/c++/12.2.1/bits/std_function.h:290
	mawww#10 std::function<void (Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>::operator()(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode) const (__args#2=<optimized out>, __args#1=<optimized out>,  __args#0=...) at /usr/include/c++/12.2.1/bits/std_function.h:591
	mawww#11 Kakoune::FDWatcher::run (mode=Kakoune::EventMode::Urgent, events=<optimized out>) at event_manager.cc:28
	mawww#12 Kakoune::EventManager::handle_next_events (mode=mode@entry=Kakoune::EventMode::Urgent, sigmask=sigmask@entry=0x0, block=<optimized out>, block@entry=false) at event_manager.cc:143
	mawww#13 Kakoune::write (fd=1, data=...) at file.cc:273
	mawww#14 Kakoune::BufferedWriter<4096>::flush () at string.hh:236
	mawww#15 Kakoune::BufferedWriter<4096>::write (data="t file.hh:145
	mawww#16 Kakoune::TerminalUI::Screen::set_face (face=..., writer=...) at terminal_ui.cc:255
	mawww#17 operator() (line=..., __closure=<synthetic pointer>) at terminal_ui.cc:326
	mawww#18 Kakoune::TerminalUI::Screen::output (force=force@entry=true, synchronized=<optimized out>, writer=...) at terminal_ui.cc:402
	mawww#19 Kakoune::TerminalUI::redraw (force=force@entry=true) at terminal_ui.cc:571
	mawww#20 Kakoune::TerminalUI::refresh (force=<optimized out>) at terminal_ui.cc:592
	mawww#21 Kakoune::Client::redraw_ifn () at client.cc:282
	mawww#22 Kakoune::ClientManager::redraw_clients () at client_manager.cc:232
	mawww#23 Kakoune::run_server (session=..., server_init=..., client_init=..., init_buffer="fish-rust/src/ast.rs", init_coord=..., flags=Kakoune::ServerFlags::None, ui_type=Kakoune::UIType::Terminal,
	    debug_flags=<optimized out>, files=ArrayView<Kakoune::StringView> = {...}) at main.cc:893
	mawww#24 main (argc=<optimized out>, argv=<optimized out>) at main.cc:1243

Thereafter, "TerminalUI::Screen::output" resumes and crashes due to
a buffer overflow in "lines" which has been resized.
krobelus added a commit to krobelus/kakoune that referenced this issue Apr 24, 2023
When Kakoune's terminal is shown on my laptop monitor and I plug
in my external monitor, the terminal's workspace will move to that
external monitor. When this happens, Kakoune may segfault.
There are multiple resize events (SIGWINCH) in quick succession;
it crashes because we handle SIGWINCH during rendering.

The problem happens during execution of "TerminalUI::Screen::output"
(frame mawww#18). When we receive SIGWINCH while writing to stdout, write(2)
fails with EAGAIN, prompting us to handle pending events (See ae001a1
(Run EventManager whenever writing to a file descriptor would block,
2022-05-10)).  We update the screen size in check_resize() here:

	mawww#4  Kakoune::TerminalUI::check_resize (force=<optimized out>) at terminal_ui.cc:683
	mawww#5  Kakoune::TerminalUI::get_next_key () at terminal_ui.cc:719
	mawww#6  operator() (__closure=0x555555984198) at terminal_ui.cc:484
	mawww#7  std::__invoke_impl<void, Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>&, Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode> (__f=...) at /usr/include/c++/12.2.1/bits/invoke.h:61
	mawww#8  std::__invoke_r<void, Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>&, Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode> (__fn=...) at /usr/include/c++/12.2.1/bits/invoke.h:111
	mawww#9  std::_Function_handler<void(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode), Kakoune::TerminalUI::TerminalUI()::<lambda(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)> >::_M_invoke(const std::_Any_data &, Kakoune::FDWatcher &, Kakoune::FdEvents &&, Kakoune::EventMode &&) (__functor=..., __args#0=..., __args#1=<optimized out>, __args#2=<optimized out>) at /usr/include/c++/12.2.1/bits/std_function.h:290
	mawww#10 std::function<void (Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode)>::operator()(Kakoune::FDWatcher&, Kakoune::FdEvents, Kakoune::EventMode) const (__args#2=<optimized out>, __args#1=<optimized out>,  __args#0=...) at /usr/include/c++/12.2.1/bits/std_function.h:591
	mawww#11 Kakoune::FDWatcher::run (mode=Kakoune::EventMode::Urgent, events=<optimized out>) at event_manager.cc:28
	mawww#12 Kakoune::EventManager::handle_next_events (mode=mode@entry=Kakoune::EventMode::Urgent, sigmask=sigmask@entry=0x0, block=<optimized out>, block@entry=false) at event_manager.cc:143
	mawww#13 Kakoune::write (fd=1, data=...) at file.cc:273
	mawww#14 Kakoune::BufferedWriter<4096>::flush () at string.hh:236
	mawww#15 Kakoune::BufferedWriter<4096>::write (data="t file.hh:145
	mawww#16 Kakoune::TerminalUI::Screen::set_face (face=..., writer=...) at terminal_ui.cc:255
	mawww#17 operator() (line=..., __closure=<synthetic pointer>) at terminal_ui.cc:326
	mawww#18 Kakoune::TerminalUI::Screen::output (force=force@entry=true, synchronized=<optimized out>, writer=...) at terminal_ui.cc:402
	mawww#19 Kakoune::TerminalUI::redraw (force=force@entry=true) at terminal_ui.cc:571
	mawww#20 Kakoune::TerminalUI::refresh (force=<optimized out>) at terminal_ui.cc:592
	mawww#21 Kakoune::Client::redraw_ifn () at client.cc:282
	mawww#22 Kakoune::ClientManager::redraw_clients () at client_manager.cc:232
	mawww#23 Kakoune::run_server (session=..., server_init=..., client_init=..., init_buffer="fish-rust/src/ast.rs", init_coord=..., flags=Kakoune::ServerFlags::None, ui_type=Kakoune::UIType::Terminal,
	    debug_flags=<optimized out>, files=ArrayView<Kakoune::StringView> = {...}) at main.cc:893
	mawww#24 main (argc=<optimized out>, argv=<optimized out>) at main.cc:1243

Thereafter, "TerminalUI::Screen::output" resumes and crashes due to
a buffer overflow in "lines" which has been resized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants