Re: Job control: process running from pipe doesn't get focus

2023-12-18 Thread Chet Ramey

On 12/15/23 12:28 PM, Maksym Telychko wrote:


Bash Version: 5.2
Patch Level: 21
Release Status: release

Description:
Process does not become foreground when run from a pipe.

Repeat-By:
 Conditions are very special, and I am not sure who in the chain is cause 
of bug.

 In short the bug in the following line, but it should executed not from a 
running terminal emulator:
 uxterm -e bash -c 'echo /etc/fstab | { FILE="$(cat)" ; sudoedit 
"$FILE" ; }'
 It line of script must be run automatically from the WM.

 The chain to reproduce:
 
 | sway wm | | uxterm| |  bash  ... sudoedit |

 | i3 wm   | --> | alacritty |  -> | |
 | weston  | |   | | |

 swaywm config file:
 exec_always uxterm -e bash -c 'echo /etc/fstab | { FILE="$(cat)" ; sudoedit 
"$FILE" ; }'

 If sudoedit running not from a pipe, it works good. Some of terminal 
emulators do not reproduces
 the problem, such as `foot` or `xfce4-terminal`.

 The result of the chain is an editor isn't gain a focus and I cant type 
anything.

 Again, I'm not sure that is definetely bash, but could you please check 
that. Thank you.


You might start by running a system call tracer like strace against the
sudoedit process or the bash process that's calling it and seeing what
they're doing.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



OpenPGP_signature.asc
Description: OpenPGP digital signature


Job control: process running from pipe doesn't get focus

2023-12-15 Thread Maksym Telychko
From: maksym
To: bug-bash@gnu.org
Subject: Job control: process running from pipe doesn't get focus

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt 
-fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   
  -fstack-clash-protection -fcf-protection -g 
-ffile-prefix-map=/build/bash/src=/usr/src/debug/bash -flto=auto 
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' 
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' 
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS
uname output: Linux inspiron 6.1.61-1-lts #1 SMP PREEMPT_DYNAMIC Thu, 02 Nov 
2023 12:57:06 + x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.2
Patch Level: 21
Release Status: release

Description:
Process does not become foreground when run from a pipe.

Repeat-By:
Conditions are very special, and I am not sure who in the chain is cause of 
bug.

In short the bug in the following line, but it should executed not from a 
running terminal emulator:
uxterm -e bash -c 'echo /etc/fstab | { FILE="$(cat)" ; sudoedit "$FILE" 
; }'
It line of script must be run automatically from the WM.

The chain to reproduce:

| sway wm | | uxterm| |  bash  ... sudoedit |
| i3 wm   | --> | alacritty |  -> | |
| weston  | |   | | |

swaywm config file:
exec_always uxterm -e bash -c 'echo /etc/fstab | { FILE="$(cat)" ; 
sudoedit "$FILE" ; }'

If sudoedit running not from a pipe, it works good. Some of terminal 
emulators do not reproduces
the problem, such as `foot` or `xfce4-terminal`.

The result of the chain is an editor isn't gain a focus and I cant type 
anything.

Again, I'm not sure that is definetely bash, but could you please check 
that. Thank you.