bugfindutils - Bugs: bug #59083, enhancement: find -D exec

 
 

bug #59083: enhancement: find -D exec

Submitter:  None
Submitted:  Tue 08 Sep 2020 09:07:23 PM UTC
   
 
Category:  find Severity:  2 - Minor
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  berny
Originator Name:  Philip Rowlands Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  None
Fixed Release:  4.8.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 22 Sep 2020 09:18:01 PM UTC, comment #3: 

Thanks for checking.  Pushed.

Regarding the varying argc numbers: this depends on the length
of the arguments ... the sum of which always a bit below 128k
(apart from the last run, obviously):


$ ~/findutils/find/find -D exec /usr -exec echo {} + 2>&1 \
     | grep 'DebugExec.*argc=' \
     | awk '{print $1, $2, $3, $4, length($0)}'
DebugExec: launching process (argc=3136): 137380
DebugExec: launching process (argc=1451): 133920
DebugExec: launching process (argc=2034): 135127
DebugExec: launching process (argc=2422): 135919
DebugExec: launching process (argc=2052): 135217
DebugExec: launching process (argc=1996): 135045
...
DebugExec: launching process (argc=2363): 135778
DebugExec: launching process (argc=250): 14865


Bernhard Voelker <berny>
Group administrator
Fri 18 Sep 2020 10:37:55 PM UTC, comment #2: 

Thanks, that certainly helps for the original grep example. Interesting to see the argc count varying across a large run, e.g.

$ ./find -D exec /usr -exec echo {} + |& grep 'DebugExec.*argc=' | cut -c1-41 | head
DebugExec: launching process (argc=4263):
DebugExec: launching process (argc=3119):
DebugExec: launching process (argc=2207):
DebugExec: launching process (argc=1546):
DebugExec: launching process (argc=1733):
DebugExec: launching process (argc=2103):
DebugExec: launching process (argc=1652):
DebugExec: launching process (argc=1774):
DebugExec: launching process (argc=1526):
DebugExec: launching process (argc=1761):

Anonymous
Wed 16 Sep 2020 10:41:04 PM UTC, comment #1: 

Good spot.  The attached addresses it.

(file #49799)

Bernhard Voelker <berny>
Group administrator
Tue 08 Sep 2020 09:07:23 PM UTC, original submission:  

The snippet which brought this to my attention is


if find -name '*.txt' -exec grep somestring {} +; then echo somestring found; fi


which is fragile because, depending how many greps are launched, some may find a match (and exit 0), some may not (and exit 1), and find reasonably takes a worst-case exit status from the commands exec'd.

What made this harder to debug was the lack of useful output from find -D exec; the only output controlled by DebugExec is from show_outstanding_execdirs().

It seems launch() is the right place to add more debug output, perhaps before fflush() / after waitpid().

For example "launching 'grep' with 4000 pathnames" and "process 'grep' exited with status 1" messages in the debug output would make it much clearer.

If there's support for this, I can try to craft a patch.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #49799:  0001-find-improve-D-exec-debug-output.patch added by berny (5KiB - text/x-patch - [PATCH] find: improve '-D exec' debug output)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by berny (Updated the item)
  • -email is unavailable- added by None (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-01-09 berny Open/ClosedOpen Closed
    2021-01-09 berny Fixed ReleaseNone 4.8.0
    2020-09-22 berny StatusCode Review Fixed
    2020-09-16 berny Attached File- Added 0001-find-improve-D-exec-debug-output.patch, #49799
        Severity3 - Normal 2 - Minor
        StatusNone Code Review
        Assigned toNone berny

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code