[Toybox] [PATCH 1/2] tar: don't recurse into excluded directories

William Djupström william at deepztream.com
Sun Jun 21 12:24:29 PDT 2020


ping?

On 09/06/2020 8:32 pm, William Djupström via Toybox wrote:
>
> On 09/06/2020 8:11 pm, Rob Landley wrote:
>
>>
>> On 6/9/20 10:10 AM, William Djupström via Toybox wrote:
>>> On 09/06 09:56, Rob Landley wrote:
>>>> I applied this locally, but what's a test case?
>>>>
>>>>    $ mkdir -p boing/subb/ping
>>>>    $ tar cvf boing.tar boing --exclude sub
>>>>    boing/
>>>>    boing/subb/
>>>>    boing/subb/ping/
>>>>    $ tar tvf boing.tar
>>>>    drwxr-xr-x landley/landley   0 2020-06-09 09:50 boing/
>>>>    drwxr-xr-x landley/landley   0 2020-06-09 09:50 boing/subb/
>>>>    drwxr-xr-x landley/landley   0 2020-06-09 09:50 boing/subb/ping/
>>>>    $ tar cvf boing.tar boing --exclude subb
>>>>    boing/
>>>>    boing/subb/
>>>>    boing/subb/ping/
>>> --exclude takes in a file containing exclusions
>> According to 
>> https://www.gnu.org/software/tar/manual/html_node/exclude.html
>> that's --exclude-from ?
> Crap, yeah that's what I've been talking about all this time, I only 
> use -X so I didn't realise
> that wasn't --exclude :/
>>
>> Still with the host tar:
>>
>>    $ mkdir -p boing/splat/bang
>>    $ echo splat > splat.txt
>>    $ tar cvf boing.tar boing --exclude splat.txt
>>    boing/
>>    boing/splat/
>>    boing/splat/bang/
>>    $ tar tf boing.tar
>>    boing/
>>    boing/splat/
>>    boing/splat/bang/
>>
>> Hmmm...
>>
>>    $ tar cvf boing.tar boing --exclude splat.txt
>>    boing/
>>    boing/splat/
>>    boing/splat/bang/
>>    $ echo boing/splat > splat.txt
>>    $ tar cvf boing.tar boing --exclude splat.txt
>>    boing/
>>    boing/splat/
>>    boing/splat/bang/
>>
>>    $ echo splat > splat.txt
>>    $ tar cvf boing.tar boing --exclude-from splat.txt
>>    boing/
>>    boing/splat/
>>    boing/splat/bang/
>
> host tar requires --exclude-from to be placed before the input files
>
>     $ mkdir -p folder/skip/oof
>     $ chmod 000 folder/skip/oof
>     $ ./toybox tar -X <(echo skip) -cvf test.tar folder
>     folder/
>     tar: folder/skip/oof: Permission denied
>
>     $ tar -X <(echo skip) -cvf test.tar folder
>     folder/
>
>     $ tar -cvf test.tar folder -X <(echo skip)
>     folder/
>     folder/skip/
>     tar: folder/skip/oof: Cannot open: Permission denied
>
>>
>>>    $ mkdir -p skip/dir
>>>    $ chmod 000 skip/dir
>>>    $ ./toybox tar --exclude <(echo skip) -cf test.tar skip
>>>    tar: skip/dir: Permission denied
>>>    $ echo $?
>>>    1
>> That's another example of --exclude failing, which I've provided 
>> plenty of. The
>> behavior of that command is no different with or without the 
>> --exclude argument.
>>
>> Can you show me an example of --exclude _working_?
>>
>> Rob
> //William
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



More information about the Toybox mailing list