Bug 2056462

Summary: SIGINT not passed to scl based process when using sudo
Product: Red Hat Enterprise Linux 9 Reporter: Michal Domonkos <mdomonko>
Component: scl-utilsAssignee: Michal Domonkos <mdomonko>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0Keywords: AutoVerified, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: scl-utils-2.0.3-3.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 15:28:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Domonkos 2022-02-21 10:07:19 UTC
This bug was initially created as a copy of Bug #1967686

I am copying this bug because: 



Description of problem:

CTRL+C fails with error when command is invoked with sudo in scl environment.

Version-Release number of selected component (if applicable):
scl-utils-2.0.2-13.el8.x86_64

How reproducible:
Always when using sudo

Steps to Reproduce:
1.scl enable gcc-toolset-10 -- sudo tail -f /var/log/messages
2.ctrl+c


Actual results:
Jun  3 11:09:36  systemd[1]: Started /usr/bin/systemctl start man-db-
:
:
Jun  3 11:13:57  systemd[1]: Started Session 5 of user root.
^CProblem with executing command "/bin/bash /var/tmp/sclCpPZ9l"



Expected results:
Jun  3 11:09:36 vm252-219 systemd[1]: Started /usr/bin/systemctl start man-db-
:
:
Jun  3 11:13:57 vm252-219 systemd[1]: Started Session 5 of user root.
^C

Additional info:

Process stays on.

ps -ef | grep scl
root       54119   54082  0 11:06 pts/0    00:00:00 /usr/bin/scl enable gcc-toolset-10 bash
root       54120   54119  0 11:06 pts/0    00:00:00 /bin/bash /var/tmp/scluvOXF4
root       54163   54124  0 11:06 pts/0    00:00:00 grep --color=auto scl

 pstree -Aap 54119
scl,54119 enable gcc-toolset-10 bash
  `-bash,54120 /var/tmp/scluvOXF4
      `-bash,54124
          `-pstree,54483 -Aap 54119

- Issue seen only when using sudo for root and other users

1] Exits normally 
# scl enable gcc-toolset-10 bash
# tail -f /var/log/messages
Ctrl+C

2] Throws error

# scl enable gcc-toolset-10 bash
# sudo tail -f /var/log/messages
 Ctrl+C

3] strace
strace -ffo strace.out scl enable gcc-toolset-10 -- sudo tail -f /var/log/messages
:
:
openat(AT_FDCWD, "/var/tmp/sclaiLlVn", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
write(3, "eval \"SCLS=( ${X_SCLS[*]} )\"\n 't"..., 62) = 62
close(3)                                = 0
rt_sigaction(SIGINT, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f471aed8880}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f471aed8880}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
clone(child_stack=NULL, flags=CLONE_PARENT_SETTID|SIGCHLD, parent_tid=[54899]) = 54899
wait4(54899, 0x7ffd1515bbe8, 0, NULL)   = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
wait4(54899, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], 0, NULL) = 54899
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f471aed8880}, NULL, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f471aed8880}, NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=54899, si_uid=0, si_status=SIGINT, si_utime=0, si_stime=0} ---
write(2, "Problem with executing command \""..., 62) = 62

Comment 8 errata-xmlrpc 2022-05-17 15:28:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: scl-utils), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:3764