bug-global
[Top][All Lists]
Advanced

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

Re: [PATCH] Fixed 64bits bug where large long sysconf(ARG_MAX) values ar


From: Shigio YAMAGUCHI
Subject: Re: [PATCH] Fixed 64bits bug where large long sysconf(ARG_MAX) values are cast into a negative int
Date: Sat, 15 Jan 2011 21:21:24 +0900

Hi,
> I found this bug while running "global -u -v" on a 64 bits system.
...
>  This cause of this bug was very well hidden because negative values
> were changed to zero. I cannot understand why: a limit of zero still
> does not work, it just hides this bug.
...
> diff --git a/libutil/xargs.c b/libutil/xargs.c
> index 94627dd..a1dba63 100644
> --- a/libutil/xargs.c
> +++ b/libutil/xargs.c
> @@ -38,6 +38,7 @@
>  #include "xargs.h"
>  
>  #if !defined(ARG_MAX) && defined(_SC_ARG_MAX)
> +/* FIXME: in theory sysconf() can return -1L for unlimited */
>  #define ARG_MAX         sysconf(_SC_ARG_MAX)
>  #endif
>  
> @@ -70,7 +71,7 @@ static XARGS *xargs_open_generic(const char *, int);
>  static int
>  exec_line_limit(int length)
>  {
> -     int limit = 0;
> +     long limit = 0;
>  
>  #ifdef ARG_MAX
>       /*
> @@ -105,7 +106,8 @@ exec_line_limit(int length)
>       limit = 2047 - length - 80;
>  #endif
>       if (limit < 0)
> -             limit = 0;
> +               die("Negative exec line limit = %ld", limit);
> +
>       return limit;
>  }
>  /*

I have committed your patch.
Thank you.

> Deeply sorry for the duplicated posts. I thought the list was
> *rejecting* my first attempts for various reasons (one reason per
> attempt...), so I kept trying to post in different ways. I carefully
> waited several hours after each attempt but this was apparently not
> enough.

Please don't worry. Your behavior is natural.
The reaction of this mailing list might sometimes be late.

Basically, since this mailing list is moderated, most mails are not
accepted without my management procedure. However, it seems that you
are escaping from the moderation.:-O  (I will leave it as it is.)
In fact, because I had been being hospitalized for about one week,
I was not able to check this mailing list until today.

Anyway, thank you for your contribution!
--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



reply via email to

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