coreutils
[Top][All Lists]
Advanced

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

Re: new snapshot available: coreutils-8.20.119-54cdb0


From: Assaf Gordon
Subject: Re: new snapshot available: coreutils-8.20.119-54cdb0
Date: Mon, 11 Feb 2013 12:35:01 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

Follow-up:

Assaf Gordon wrote, On 02/11/2013 12:27 PM:
> Strange failure with numfmt on an eccentric system (Mac OS X 10.6.8): some 
> errors are not reported correctly.
> 
> [ ... ]
> 
> In the source code, it seems to be related to this part, in 
> parse_format_string(), line 972:
>  970   i += strspn (fmt + i, " ");
>  971   errno = 0;
>  972   pad = strtol (fmt + i, &endptr, 10);
>  973   if (errno != 0) 
>  974     error (EXIT_FAILURE, 0,
>  975            _("invalid format %s (width overflow)"), quote (fmt));
>  976            
> 
> On this system (Mac OS X):
>    fmt = 'hello%'
>    i = 6
>    fmt+i = ''
> 
> And 'strtol' returns errno=EINVAL (22) instead of 0 - causing the incorrect 
> error message.
> 

This is likely the reason, 'man strtol' has this to say (on this computer):
===
  ERRORS
     [EINVAL]           The value of base is not supported or no conversion
                        could be performed (the last feature is not portable
                        across all platforms).
===

Would it be better to explicitly check for this case, or replace with xstrtol ?

-gordon



reply via email to

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