<div dir="ltr">Hello Rob,<div><br></div><div>Thank you again with your great support!<br><br>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:<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="monospace">rm -rf /tmp/foo; mkdir /tmp/foo<br></font><font face="monospace">ln -sf /tmp/bar /tmp/foo/bar<br></font><font face="monospace">/mnt/sdc/android/kernel/prebuilts/build-tools/path/linux-x86/tar czf /tmp/foo.tar.gz -C /tmp/foo/ .<br></font><font face="monospace">rm -rf /tmp/foo; mkdir /tmp/foo<br></font><font face="monospace">/mnt/sdc/android/kernel/prebuilts/build-tools/path/linux-x86/tar xf foo.tar.gz -C foo/ # This is okay<br></font><font face="monospace">/mnt/sdc/android/kernel/prebuilts/build-tools/path/linux-x86/tar xf foo.tar.gz -C foo/ # This is an error</font></blockquote><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">The content of the archive was:</font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="monospace">$ /mnt/sdc/android/kernel/prebuilts/build-tools/path/linux-x86/tar tvf foo.tar.gz<br> drwxr-xr-x elsk/primarygroup 0 2023-04-24 14:17 ./<br>lrwxrwxrwx elsk/primarygroup 0 2023-04-24 14:17 ./bar -> /tmp/bar</font></blockquote><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">The second extraction generates the following error:</font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">tar: './bar' /tmp/bar not under '/tmp/foo'<br>tar: had errors</blockquote><div><br></div><div>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).</div><div><br></div><div>Is this an intended behavior or a bug?</div></div></div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 18, 2023 at 2:57 PM Yifan Hong <<a href="mailto:elsk@google.com">elsk@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">It works like a charm! Thanks! I am updating AOSP in <a href="http://r.android.com/2526561" target="_blank">r.android.com/2526561</a> and I'll update prebuilts later.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 18, 2023 at 2:42 PM Yifan Hong <<a href="mailto:elsk@google.com" target="_blank">elsk@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks for your quick reply! I'll pick that commit and see how it goes.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 18, 2023 at 2:33 PM Rob Landley <<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 4/18/23 12:14, Yifan Hong wrote:<br>
> +Matthias Männich <mailto:<a href="mailto:maennich@google.com" target="_blank">maennich@google.com</a>> <br>
> Hello Rob, may I ask if you have a chance to take a look at this issue? Thank<br>
> you for your time!<br>
<br>
Sorry, too many open windows accumulated while I was traveling<br>
(<a href="https://landley.net/notes-2023.html#15-04-2023" rel="noreferrer" target="_blank">https://landley.net/notes-2023.html#15-04-2023</a>), got buried in the shuffle. :)<br>
<br>
Try commit 827dfe3fe1bc.<br>
<br>
Rob<br>
</blockquote></div>
</blockquote></div>
</blockquote></div>