Hello Rob,

Thank you again with your great support!

I come back with a different issue (it could be an intended behavior). If
the archive contains a symlink that points outside of the archive,
extracting it a second time will refuse to overwrite the symlink. Repro:

rm -rf /tmp/foo; mkdir /tmp/foo
> ln -sf /tmp/bar /tmp/foo/bar
> /mnt/sdc/android/kernel/prebuilts/build-tools/path/linux-x86/tar czf
> /tmp/foo.tar.gz -C /tmp/foo/ .
> rm -rf /tmp/foo; mkdir /tmp/foo
> /mnt/sdc/android/kernel/prebuilts/build-tools/path/linux-x86/tar xf
> foo.tar.gz -C foo/ # This is okay
> /mnt/sdc/android/kernel/prebuilts/build-tools/path/linux-x86/tar xf
> foo.tar.gz -C foo/ # This is an error


The content of the archive was:

> $ /mnt/sdc/android/kernel/prebuilts/build-tools/path/linux-x86/tar tvf
> foo.tar.gz
> drwxr-xr-x elsk/primarygroup         0  2023-04-24 14:17 ./
> lrwxrwxrwx elsk/primarygroup         0  2023-04-24 14:17 ./bar -> /tmp/bar


The second extraction generates the following error:

> tar: './bar' /tmp/bar not under '/tmp/foo'
> tar: had errors


I was expecting that /tmp/foo/bar gets overwritten with the symlink. I
guess it is because tar tries to dereference the symlink before writing the
symlink, and it detects that it is writing outside of where it should be
writing (which is good).

Is this an intended behavior or a bug?


On Tue, Apr 18, 2023 at 2:57 PM Yifan Hong <e...@google.com> wrote:

> It works like a charm! Thanks! I am updating AOSP in r.android.com/2526561
> and I'll update prebuilts later.
>
> On Tue, Apr 18, 2023 at 2:42 PM Yifan Hong <e...@google.com> wrote:
>
>> Thanks for your quick reply! I'll pick that commit and see how it goes.
>>
>> On Tue, Apr 18, 2023 at 2:33 PM Rob Landley <r...@landley.net> wrote:
>>
>>> On 4/18/23 12:14, Yifan Hong wrote:
>>> > +Matthias Männich <mailto:maenn...@google.com>
>>> > Hello Rob, may I ask if you have a chance to take a look at this
>>> issue? Thank
>>> > you for your time!
>>>
>>> Sorry, too many open windows accumulated while I was traveling
>>> (https://landley.net/notes-2023.html#15-04-2023), got buried in the
>>> shuffle. :)
>>>
>>> Try commit 827dfe3fe1bc.
>>>
>>> Rob
>>>
>>
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to