bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: anonymous
Subject: [bug #64442] xargs closes stdin on receiving SIGUSR1 or SIGUSR2
Date: Tue, 18 Jul 2023 10:52:34 -0400 (EDT)

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

                 Summary: xargs closes stdin on receiving SIGUSR1 or SIGUSR2
                   Group: findutils
               Submitter: None
               Submitted: Tue 18 Jul 2023 02:52:32 PM UTC
                Category: xargs
                Severity: 3 - Normal
              Item Group: Wrong result
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 4.9.0
         Discussion Lock: Any
           Fixed Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Tue 18 Jul 2023 02:52:32 PM UTC By: Anonymous
1. the version of findutils you are using:

$ xargs --version
xargs (GNU findutils) 4.9.0
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.


2. what you were trying to do:
Move selected image files to a different location.

3. the exact command line that you used:

find . -type f | sort | sxiv -iof | tr '\n' '\0' | xargs -0rP0 mv -t ../dest


4. what you expected to happen:
On receiving SIGUSR1 or SIGUSR2 xargs adjusts its proc_max and keeps waiting
for input.

5. precisely what did happen:
xargs errors with:

xargs: error closing file

exits with 1 and breaks my pipeline as selected items will not be processed
anymore.

Notes:
N1. This can be reproduces by just running

$ xargs

and sending SIGUSR1 or SIGUSR2 from a different terminal

$ pkill -USR1 xargs


N2. I've pinpointed that the error message comes from gnulib/closein.c

N3. This behaviour is reproducible on my Arch Linux x86_64 machine
but isn't on Termux on my armv7l Android phone.

N4. Current workaround is to replace xargs with a while loop but it's less
efficient as I have to run mv on every single item which is just less
efficient.

There is also this workaround

tr '\n' '\0' | find -files0-from - -maxdepth 0 -exec mv -t ../dest +

which works for filenames but not for arbitrary input.

N5. This bug is not very critical as in most cases when I pkill xargs it has
already read in all input so no error happens.
I run some scripts that process large files in parallel so sometimes I adjust
parallelism with pkill -USR1(or -USR2) xargs but one time it 'killed' my xargs
that was waiting on hundreds of items and I had to select them anew.







    _______________________________________________________

Reply to this item at:

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

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]