bugfindutils - Bugs: bug #41721, Adding amin Test delays output to...

 
 

bug #41721: Adding amin Test delays output to stdout or redirect to file

Submitter:  ken <bken>
Submitted:  Thu 27 Feb 2014 01:18:20 PM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  None Status:  Invalid
Privacy:  Public Assigned to:  jay
Originator Name:  Open/Closed:  Closed
Release:  4.2.27 Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 26 Apr 2014 04:35:15 PM UTC, comment #1: 

~/source/GNU/findutils$ rm -f /tmp/TRACE-simple.txt /tmp/test-simple.find /tmp/TRACE-complex.txt /tmp/test-complex.find; \
strace -tt -o /tmp/TRACE-simple.txt /home/james/source/GNU/findutils/installed-64/bin/find-4.2.27 . -type f > /tmp/test-simple.find  ; \
strace -tt  -o /tmp/TRACE-complex.txt /home/james/source/GNU/findutils/installed-64/bin/find-4.2.27 .  -type f -amin -1440 -a -amin +30  > /tmp/test-complex.find

~/source/GNU/findutils$ for f in  /tmp/TRACE-simple.txt /tmp/TRACE-complex.txt ; do echo; echo "${f}"; sed -n -f firstwrite.sed  < "${f}"; sed -n -e '$ p' < "${f}"; done

/tmp/TRACE-simple.txt
17:17:07.195124 execve("/home/james/source/GNU/findutils/installed-64/bin/find-4.2.27", ["/home/james/source/GNU/findutils"..., ".", "-type", "f"], [/* 42 vars */]) = 0
17:17:07.216931 write(1, "./xfind/patch-for-findutils-4.1."..., 4096) = 4096
17:17:14.894501 exit_group(1)           = ?

/tmp/TRACE-complex.txt
17:17:14.901656 execve("/home/james/source/GNU/findutils/installed-64/bin/find-4.2.27", ["/home/james/source/GNU/findutils"..., ".", "-type", "f", "-amin", "-1440", "-a", "-amin", "+30"], [/* 42 vars */]) = 0
17:17:22.103478 write(2, "/home/james/source/GNU/findutils"..., 63) = 63
17:17:40.617822 exit_group(1)           = ?

As you can see in the second example, there is a significant delay between find's start and the first output.  This is because more conditions are specified, so fewer files match.   But there is also a significant delay between the first output and the program exit.   This demonstrates that the output is not being written at the end of the execution of the program.

You're likely also seeing the effect of stdio buffering.   See http://www.gnu.org/software/libc/manual/html_node/Stream-Buffering.html for a brief explanation.

Lastly, findutils 4.2.27 (the release against which you made this bug report) is very old now (it was released on 2005-12-06).  Please upgrade.


James Youngman <jay>
Group administrator
Thu 27 Feb 2014 01:18:20 PM UTC, original submission:  


consider the 2 commands below.

find . -type f > ~/test.find
output is immediately sent to file

find . -type f -amin -1440 -a -amin +30 > ~/test.find
output is not sent to file until find completes task


the negative side effect is that when you tail and follow test.find for the 2nd command, you can't monitor found files as find locates them.




ken <bken>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Posted a comment)
  • -email is unavailable- added by bken (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-04-26 jay StatusNone Invalid
        Assigned toNone jay
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code