[bug #64442] xargs closes stdin on receiving SIGUSR1 or SIGUSR2

anonymous <[email protected]>
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <[email protected]>
Follow-up Comment #4, bug #64442 (project findutils):

Here is a diff between a normal xargs execution and one interrupted with
SIGUSR1.
Normal execution is just running xargs and entering ^D.

--- strace-normal.txt	2023-07-19 14:31:18.639157032 +0300
+++ strace-usr1.txt	2023-07-19 14:21:40.390915386 +0300
 newfstatat(0, "", {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x9), ...},
AT_EMPTY_PATH) = 0
-read(0, "", 1024)                       = 0
+read(0, 0x565271e47710, 1024)           = ? ERESTARTSYS (To be restarted if
SA_RESTART is set)
+--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=946742, si_uid=1000}
---
+rt_sigreturn({mask=[]})                 = -1 EINTR (Interrupted system call)
 pipe2([3, 4], 0)                        = 0
 fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
-clone(child_stack=NULL,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7f9e4a386a10) = 947550
+clone(child_stack=NULL,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7fdbe000fa10) = 946743
 close(4)                                = 0
 read(3, "", 4)                          = 0
 close(3)                                = 0
---- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=947550,
si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
-getpid()                                = 947549
-wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 947550
+getpid()                                = 946735
+wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 946743
+--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=946743,
si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
 lseek(0, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
 close(0)                                = 0
+openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 0
+newfstatat(0, "", {st_mode=S_IFREG|0644, st_size=2998, ...}, AT_EMPTY_PATH) =
0
+read(0, "# Locale name alias data base.\n#"..., 4096) = 2998
+read(0, "", 4096)                       = 0
+close(0)                                = 0
+openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/findutils.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
+openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/findutils.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
+openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/findutils.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
+openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/findutils.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
+openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/findutils.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
+openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/findutils.mo", O_RDONLY) =
-1 ENOENT (No such file or directory)
+write(2, "xargs: ", 7)                  = 7
+write(2, "error closing file", 18)      = 18
+write(2, "\n", 1)                       = 1
 close(1)                                = 0
 close(2)                                = 0
-exit_group(0)                           = ?
-+++ exited with 0 +++
+exit_group(1)                           = ?
++++ exited with 1 +++

*I removed lines that are the same but with different adresses due to ASLR

(file #54941, file #54942)

    _______________________________________________________

Additional Item Attachment:

File name: strace-normal.txt              Size:5 KB
    <https://file.savannah.gnu.org/file/strace-normal.txt?file_id=54941>

File name: strace-usr1.txt                Size:6 KB
    <https://file.savannah.gnu.org/file/strace-usr1.txt?file_id=54942>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64442>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.