[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] transform with add-file seems broken
From: |
Sergey Poznyakoff |
Subject: |
Re: [Bug-tar] transform with add-file seems broken |
Date: |
Wed, 26 Jul 2017 21:28:59 +0300 |
Stas Sergeev <address@hidden> ha escrit:
> $ tar cf a.tar a.txt
> $ tar rf a.tar --add-file=`pwd`/b.txt --transform=s,`pwd`/,aaa/,
> tar: Removing leading `/' from member names
Dominique has explained why that happens. Let me explain the rest.
> tar complains to leading slash.
In fact, it doesn't. I merely warns you that it is removing the leading
slash from pathnames being stored. You don't want it to do so. So what
you need is the -P (--absolute-names) option:
tar -Prf a.tar --add-file=`pwd`/b.txt --transform=s,`pwd`/,aaa/,
For details, please see section 6.10.2 "Absolute File Names" of GNU tar
manual.
> Why wouldn't tar do its sanity checks and
> leading slash removal after the transform,
Because it provides a simpler way to do what you need.
Regards,
Sergey