tar using --transform flag is replacing symlinks when extracting archive
1
vote
0
answers
192
views
When I unpack a tar.gz archive using this command on Ubuntu 22.04.5 LTS:
tar -xvf foo-bar-linux-x64.tar.xz --transform "s:^[^/]*:foo-bar:"
everything is unpacked into a foo-bar
folder instead a foo-bar-linux-x64
folder (which is the one by default as encapsulated in the archive), but I notice that all symbolic links existing in the archive file structure now point to -> foo-bar
instead of their respective libraries, e.g. in ./foo-bar/lib/
:
libwhatever.so -> foo-bar
instead of libwhatever.so -> libwhatever.so.1.2
Why and how to fix this?
#### Edit:
I also tried:
tar -xvf foo-bar-linux-x64.tar.xz --transform "--transform "s:^[^*/]*/:foo-bar/:"
it works, but it curiously creates two folders: foo-bar-linux-x64
which is empty and foo-bar/
which is apparently OK.
$ tar --version
tar (GNU tar) 1.34
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
Asked by s.k
(511 rep)
Oct 3, 2024, 09:30 AM
Last activity: Oct 3, 2024, 10:02 AM
Last activity: Oct 3, 2024, 10:02 AM