AgentD / squashfs-tools-ng

A new set of tools and libraries for working with SquashFS images
Other
196 stars 30 forks source link

errror using flag root-becomes #70

Closed hi-ko closed 3 years ago

hi-ko commented 3 years ago

I want to extract the rootfs sudirectory from a lxd export tarball. When I try to use command flag --root-becomes I get input is not a ustar tar archive!

zcat test.tar.gz | tar2sqfs -r ./rootfs/ -f rootfs.squashfs
input is not a ustar tar archive!

I tried different variants without slash etc but none of them seem to work for me. tar reports the paths as rootfs/

tested with version 0.8-1 from ubuntu 20.04

AgentD commented 3 years ago

Hi @hi-ko,

Thanks for reporting!

This issue should be fixed by commit fdefb8d09adf74635ad00883a1389361aa4740dc which currently isn't part of any release yet.

It has been back-ported to the 1.0.0-fixes branch as commit fbe66e384476e4d9d458e51f56a4e7bc38f71b33, also available as a patch here: https://infraroot.at/pub/squashfs/patches-1.0.2/0002-Fix-tar2sqfs-when-skipping-non-prefixed-files-also-s.patch

hi-ko commented 3 years ago

Hi @AgentD, thanks for your hint to the fix. I built the package on Ubuntu 20.04 from master and now get a

tar2sqfs: lib/common/compress.c:40: compressor_get_default: Assertion `0' failed.

Did I miss something? I built/installed as follows on a fresh container:

apt install build-essential autoconf automake autotools-dev libtool pkg-config liblzo2-2 liblzo2-dev

git clone https://github.com/AgentD/squashfs-tools-ng.git
cd squashfs-tools-ng/
./autogen.sh
./configure
make
make install
ldconfig
hi-ko commented 3 years ago

I'm sorry - I installed liblzo2-dev too late. a make clean && make && make install solved the last issue.

btw: It would help to support make uninstall to remove a master build later. Thanks

hi-ko commented 3 years ago

oh - it seams I closed the issue to early: When using -r ./rootfs/ to extract only the root filesystem from a lxd export tarball I get

Resolving hard link '/bin/bzcat' -> 'rootfs/bin/bunzip2': No such file or directory

doing the same without -r works without errors.

AgentD commented 3 years ago

I devised a patch for rewriting the targets of hard & symbolic links if --root-becomes is set:

0001-Fix-tar2sqfs-if-root-becomes-is-used-also-retarget-l.patch.gz

Does this work for you?

AgentD commented 3 years ago

I added a test case and pushed the patch to master & the fixes-1.0.0 branch.

hi-ko commented 3 years ago

That works - thanks a lot!