bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]


From: Eric Blake
Subject: Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]
Date: Wed, 22 Jun 2011 15:53:01 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

On 06/22/2011 03:49 PM, Paul Eggert wrote:
> On 06/22/11 14:10, Eric Blake wrote:
>> +    @prohibit='\[PATH''_MAX'
> 
> Doesn't this go too far?  For example, gnulib's lib/stat.c does this:
> 
>       /* Due to mingw's oddities, ...
>          Fortunately, mingw PATH_MAX is small enough for stack
>          allocation.  */
>       char fixed_name[PATH_MAX + 1] = {0};
> 
> and this seems reasonable, so long as the code in question runs
> only when PATH_MAX is known to be a reasonable constant.

Yes, and I admitted as much in my email:

>> Within gnulib itself, there are some exceptions: lib/tmpname.c
>> and lib/stat.c use char[PATH_MAX] but only on mingw, where we
>> know the value is constant and small.  But this new rule helped
>> catch some violations in libvirt.

That's where the joy of per-file exceptions is handy (that is, you can
just as easily add an exemption for the few files that use [PATH_MAX...]
after auditing them for safety, once the syntax-check rule has called
your attention to the need to do an audit).

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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