Hello, I stumbled on the following output when attempting to delete a file from a GNU tar produced archive, using GNU tar 1.34 on Guix:
--8<---------------cut here---------------start------------->8--- $ tar -f tar-pack.tar --delete './var/guix/db/db.sqlite' tar: tar-pack.tar: Cannot read: Bad file descriptor tar: At beginning of tape, quitting now tar: Error is not recoverable: exiting now $ echo $? 2 $ tar -tf tar-pack.tar.gz ./ ./gnu/ ./gnu/store/ ./gnu/store/3yrfg1pzl4a0nl3qdgppb6dgmygw83f2-directory-with-utf8-file-names/ ./gnu/store/3yrfg1pzl4a0nl3qdgppb6dgmygw83f2-directory-with-utf8-file-names/α ./gnu/store/3yrfg1pzl4a0nl3qdgppb6dgmygw83f2-directory-with-utf8-file-names/λ ./var/ ./var/guix/ ./var/guix/db/ ./var/guix/db/db.sqlite ./var/guix/gcroots/ ./var/guix/gcroots/profiles ./var/guix/profiles/ ./var/guix/profiles/per-user/ ./var/guix/profiles/per-user/root/ ./var/guix/profiles/per-user/root/guix-profile ./var/guix/profiles/per-user/root/guix-profile-1-link --8<---------------cut here---------------end--------------->8--- The problem seems to be with the files ownership; they are owned by root. Proceeding with 'sudo', it works normally: --8<---------------cut here---------------start------------->8--- $ sudo tar -f tar-pack.tar --delete './var/guix/db/db.sqlite' $ echo $? 0 --8<---------------cut here---------------end--------------->8--- So this bug report is about improving the error output so that it hints at the insufficient privilege rather than the confusing "Bad file descriptor" message. I've attached the test tarball, in case it's useful (72 KiB).
tar-pack.tar
Description: archive/tar
-- Thanks, Maxim