I want to create an archive file that preserves the absolute path information of the originals, but I have not been able to find a way to do this that does not result in a tarbomb?
For concreteness, suppose that I want to make a (compressed) archive file (*.zip or *.tgz or anything else) that includes the files
/usr/share/foo/bsd/config.yaml
/usr/share/foo/linux/config.yaml
/usr/share/foo/windows/config.yaml
...and I want to preserve the information encoded in the full path of the original files.
Ideally, when the archive is extracted, it should produce the following files
./<BASENAME>/usr/share/foo/bsd/config.yaml
./<BASENAME>/usr/share/foo/linux/config.yaml
./<BASENAME>/usr/share/foo/windows/config.yaml
...where <BASENAME> stands for the archive file's basename (EXcluding its extension).
One way I could do this would be to create ./<BASENAME>/usr/share/foo/{bsd,linux,windows} directories, create symlinks in these directories to the corresponding files, create an archive of the ./<BASENAME> directory (including whatever flag may be needed to ensure that the symlinks get dereferenced at the time of adding items to the archive), and run rm -rf ./<BASENAME> once the archive file is ready.
Is there a less labored approach?