bug-findutils
[Top][All Lists]
Advanced

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

[bug #24873] Duplicate fprint option corrupts output


From: Federico Mena Quintero
Subject: [bug #24873] Duplicate fprint option corrupts output
Date: Tue, 18 Nov 2008 18:22:29 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686) Gecko/20040107 Galeon/1.3.7

URL:
  <http://savannah.gnu.org/bugs/?24873>

                 Summary: Duplicate fprint option corrupts output
                 Project: findutils
            Submitted by: federicomena
            Submitted on: Tue 18 Nov 2008 06:22:27 PM GMT
                Category: find
                Severity: 3 - Normal
              Item Group: Wrong result
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.5.2
           Fixed Release: None

    _______________________________________________________

Details:

Say you have a command line like this:

  find dirname -type f \( -name '*.foo' -fprint /tmp/out1     \
                          -o -name '*.bar' -fprint /tmp/out1 \)  \
               -o -name '*.baz' -fprint /tmp/out2

What happens then is that /tmp/out1 gets opened twice on different file
descriptors.  As the search results for each get written to each FD, the
file's contents get overwritten at random times (depending on when stdio
flushes its buffers for each FD).

The fprint action should detect duplicate filenames (or device/inode pairs
for the opened files?) and just write to the file in order.

I caught this in Debian's apt-move script, by the way ("how did this ever
work!?") :)




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?24873>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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