bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] transform with add-file seems broken


From: Dominique Martinet
Subject: Re: [Bug-tar] transform with add-file seems broken
Date: Wed, 26 Jul 2017 16:59:35 +0200

Hi,

Stas Sergeev wrote on Wed, Jul 26, 2017 at 05:22:56PM +0300:
> I am doing the following:
> 
> $ 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
> 
> The transform is completely ignored, and
> tar complains to leading slash.
> But the following case works fine:
> 
> $ tar cf a.tar a.txt
> $ tar rf a.tar --add-file=b.txt --transform=s,^,aaa/,
> 
> Am I doing something wrong, or is it a bug?

The problem is as tar says, due to the leading /.

Say you're in /tmp, the added file will be tmp/b.txt but you are
matching /tmp/b.txt

This will work, even if it's not pretty (replace the first / of `pwd` by
a ^ anchor):
$ tar rf a.tar --add-file=$(pwd)/b.txt --transform=s,$(pwd | sed -e 
's:^/:^:')/,aaa/,

-- 
Dominique Martinet



reply via email to

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