patchfindutils - Patches: patch #5280, environment size is not subtracted...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #5280: environment size is not subtracted in one case

Submitter:  Miloslav Trmac <mitr>
Submitted:  Mon 07 Aug 2006 12:05:14 AM UTC
   
 
Category:  xargs bugfix Priority:  5 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  jay Originator Name: 
Open/Closed:  Closed Release:  None
Fixed Release:  None

Sun 29 Apr 2007 12:51:07 AM UTC, comment #5: 

The code under consideration has now been changed and so the point is moot; the patch is obsolete I guess.

James Youngman <jay>
Group administrator
Sat 21 Apr 2007 01:54:15 PM UTC, comment #4: 

ping

James Youngman <jay>
Group administrator
Sat 24 Feb 2007 06:47:08 PM UTC, comment #3: 

Is this still a problem?

James Youngman <jay>
Group administrator
Mon 28 Aug 2006 02:30:26 PM UTC, comment #2: 

The relevant condition is basically
if (128K + env_size <= ctl->posix_arg_size_max
    && 128K + env_size >= ctl->posix_arg_size_min)
  arg_max = 128K + env_size;

... thus find attempts to use 128K + 2*env_size, which can fail
if 128K + 2 * env_size > ARG_MAX.

The first condition is equivalent to
if (128K + env_size <= ARG_MAX - 2K && ...)

So find can fail
if (env_size <= ARG_MAX - 130K && 2*env_size > ARG_MAX - 128K);

ARG_MAX = 128K on Linux, so the bug can't happen on Linux.  I don't
know what ARG_MAX is in other operating systems.

Miloslav Trmac <mitr>
Mon 07 Aug 2006 09:39:20 AM UTC, comment #1: 

I agree that that line does nothing and that this bug report is valid.   I'm trying to make sure we also agree on the severity (or not) of the problem.

Are you saying that on systems with ARG_MAX > 128KiB, the code as it now stands  can fail with E2BIG?

James Youngman <jay>
Group administrator
Mon 07 Aug 2006 12:05:14 AM UTC, original submission:  

First, findutils-4.2.28 bc_init_controlinfo() contains the line
      ctl->posix_arg_size_max - size_of_environment;
... which does nothing at all.

Nevertheless environment size is correctly subtracted in the first
case in bc_use_sensible_arg_max () - so it works correctly on Linux
- but not in the other cases.

The attached patch:
- removes the abovementioned line without an assignment
- modifies bc_use_sensible_arg_max() to subtract env_size in the
  third case.

I have tested the result on i386 Linux: it passes the test suite
and (find -exec echo {} +) with a large environment seems to work.
I don't have any other platform readily available.

Miloslav Trmac <mitr>

 

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

Attached Files
file #10476:  p added by mitr (1KiB - application/octet-stream - Subtract environment size from ctl->arg_max)

 

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)
  •  

    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.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-04-29 jay StatusNeed Info Wont Do
        Open/ClosedOpen Closed
    2007-02-24 jay StatusNone Need Info
    2006-08-07 jay Assigned toNone jay
    2006-08-07 mitr Attached File- Added p, #10476

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code