Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
What happens here is that scl simply treats any abnormal process termination as an error and doesn't handle SIGINT in any special way. The reason it "works" when using bash as the scl command and running tail in it (as described in Comment 0) is simply because scl is not involved there at all, and bash doesn't print an error on SIGINT.
Normally, using sudo in the same scenario would behave the same way (no error), however this is a peculiarity of gcc-toolset-10 which ships a sudo wrapper (see Bug 849452 and a fixup Bug 1319936) that actually runs another scl instance nested - and scl, as mentioned above, prints an error on SIGINT. So it's actually the nested scl instance that yields the error, not the parent one (but that's not important here.)
Anyway, handling SIGINT fixes all of the above, here's the patch:
https://github.com/sclorg/scl-utils/commit/9147d3b66e0a263c2eb427b7892b34c925363854
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 (scl-utils bug fix and enhancement update), 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:1959
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