help-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tar stripping leading / in paths in options in file list


From: Antonin Décimo
Subject: tar stripping leading / in paths in options in file list
Date: Wed, 30 Jun 2021 18:42:02 +0200

Dear maintainer, dear list,

I'm using tar 1.34 on Arch Linux and I'm hitting something I don't
understand. I'm generating a list of files to include in an archive.
Each file path is relative to a root directory, where tar is asked to
chdir to. When the root directory is the root of the filesystem, I
get errors.

    mkdir /dir
    touch /dir/file

    cd somewhere
    cat <<EOF > manifest
    -P
    --directory=/
    dir
    dir/file
    EOF

The following are failing:

    tar cvf archive.tar -T manifest
    tar cvf archive.tar -P -T manifest

My understanding is that the error is that the / has been stripped,
leaving the --directory option empty without an argument.

    tar: : Cannot open: No such file or directory
    tar: Error is not recoverable: exiting now

The following works and should correspond to the manifest file being
inlined as parameters:

    tar cvf archive.tar -C/ dir dir/file

If I use absolute paths, it works too

    tar cvf archive.tar /dir /dir/file
    tar cvf archive.tar -P /dir /dir/file

The fact that the behavior in the command line and in the file list is
different lets me think that this is a bug and paths given in options
in the file list shouldn't be stripped of leading / characters.

What do you think?

Best regards,

-- Antonin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]