[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-tar] compress list of files, when root folder is a symlink
From: |
Sergey Poznyakoff |
Subject: |
Re: [Help-tar] compress list of files, when root folder is a symlink |
Date: |
Sat, 25 May 2019 22:35:04 +0300 |
Reuti <address@hidden> ha escrit:
> > [...] First of
> > all, it does not contain the entry for the directory subfolder-symlink
>
> In my opinion it does have this entry:
I was talking about "the directory subfolder-symlink points to". You
have omitted "points to", hence the confusion. Tar never tries to
archive directories (or files) symlinks point to, unless these files
are explicitly given in the file list. That's why my proposed solution
resolved the symlink and added the resulting directory to the file list.
> But the behavior I found is still puzzeling: why does a two-stage
> extraction work?
I'm not quite sure what you mean by "two-stage extraction"
> `tar` seems to remember, that the subfolder-symlink
> is a symlink also for later files in the archive
It has no means of "remembering" anything, except what is stored in the
archive. And what the archive contained in this particular case was a
symlink to a directory that was not present in the archive. That's
enough to cause further troubles.
When extracting symlink to a directory, tar first replaces it with a
regular file (called "placeholder"). Upon encountering in the archive
the directory that symlink points to, it extracts the directory, removes
the placeholder and replaces it with the symlink. In this case tar never
extracted the actual directory entry, so attempting to extract
subfolder-symlink/dummyfile failed, because first component was not a
directory.
Regards,
Sergey