bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] Missing files when option --wildcards is used


From: Eric Blake
Subject: Re: [Bug-tar] Missing files when option --wildcards is used
Date: Thu, 11 Dec 2014 09:23:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 12/11/2014 09:18 AM, ROMANO MASPERO wrote:
> The problem is, on my compiler, if I do something like:
> 
> bool is_found = ISFOUND (cursor);
> 
> the compiler downgrades cursor->found_count to a bool type (8 bit), so if 
> cursor->found_count is a multiple of 256 then ISFOUND returns 0.

That is NOT compliant behavior for a C99 compiler (all non-zero values
must be collapsed to 1, regardless of original size), but IS the
behavior to expect when using gnulib's <stdbool.h> replacement on a C89
compiler (where there is no native bool support, and where gnulib
documents that such assignments are unsafe).  Since we don't require a
C99 compiler in tar, this is a bug in our source code, and we should
instead write:

bool is_found = !!ISFOUND (cursor);

or some similar construct that guarantees a C89-compliant force-to-1
semantics that we need; or fix the ISFOUND() macro to guarantee bool
output to begin with.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
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]