# Re: [PATCH] tar: on extract, -o is --no-same-owner

13 messages from 2009-10-23 to 2009-10-24. Participants: Bernhard Reutner-Fischer, Junio C Hamano, Andreas Schwab, Jakub Narebski, Denys Vlasenko.
Thread: https://gitlist.dev/t/21340

## Bernhard Reutner-Fischer, 2009-10-23 20:25

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <20091023202524.GE4615@mx.loc>
URL: https://gitlist.dev/e/20091023202524.GE4615%40mx.loc
In-Reply-To: <1256328943-22136-1-git-send-email-rep.dot.nop@gmail.com>

```
On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:
>GNU tar-1.22 handles 'o' as no-same-owner only on extract,
>on create, 'o' would be --old-archive.

FYI this was prompted by:

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>

diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
--- git-1.6.5.oorig/templates/Makefile	2009-10-11 03:42:04.000000000 +0200
+++ git-1.6.5/templates/Makefile	2009-10-23 21:43:06.000000000 +0200
@@ -50,4 +50,4 @@ clean:
 install: all
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
 	(cd blt && $(TAR) cf - .) | \
-	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
+	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)

Someone should try to ask the git people not to rely on getopt
permuting options.. xof would be gentle to folks who don't want
to turn on getopt_long though.

cheers,

```

## Bernhard Reutner-Fischer, 2009-10-23 21:06

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <20091023210648.GA23122@mx.loc>
URL: https://gitlist.dev/e/20091023210648.GA23122%40mx.loc
In-Reply-To: <20091023202524.GE4615@mx.loc>

```
On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:
>On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:
>>GNU tar-1.22 handles 'o' as no-same-owner only on extract,
>>on create, 'o' would be --old-archive.
>
>FYI this was prompted by:
>
>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
>
>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
>--- git-1.6.5.oorig/templates/Makefile	2009-10-11 03:42:04.000000000 +0200
>+++ git-1.6.5/templates/Makefile	2009-10-23 21:43:06.000000000 +0200
>@@ -50,4 +50,4 @@ clean:
> install: all
> 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
> 	(cd blt && $(TAR) cf - .) | \
>-	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
>+	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)

argh, sorry! --no-same-owner of course.

>Someone should try to ask the git people not to rely on getopt
>permuting options.. xof would be gentle to folks who don't want
>to turn on getopt_long though.

```

## Junio C Hamano, 2009-10-23 21:26

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <7vocnxajj6.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vocnxajj6.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20091023210648.GA23122@mx.loc>

```
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:

> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:
>>On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:
>>>GNU tar-1.22 handles 'o' as no-same-owner only on extract,
>>>on create, 'o' would be --old-archive.
>>
>>FYI this was prompted by:
>>
>>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
>>
>>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
>>--- git-1.6.5.oorig/templates/Makefile	2009-10-11 03:42:04.000000000 +0200
>>+++ git-1.6.5/templates/Makefile	2009-10-23 21:43:06.000000000 +0200
>>@@ -50,4 +50,4 @@ clean:
>> install: all
>> 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
>> 	(cd blt && $(TAR) cf - .) | \
>>-	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
>>+	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)
>
> argh, sorry! --no-same-owner of course.

Either way, your change would break non-GNU tar implementations that are
properly POSIX.1, isn't it?

```

## Bernhard Reutner-Fischer, 2009-10-24 09:17

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <20091024091758.GF4615@mx.loc>
URL: https://gitlist.dev/e/20091024091758.GF4615%40mx.loc
In-Reply-To: <7vocnxajj6.fsf@alter.siamese.dyndns.org>

```
On Fri, Oct 23, 2009 at 02:26:53PM -0700, Junio C Hamano wrote:
>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>
>> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:
>>>On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:
>>>>GNU tar-1.22 handles 'o' as no-same-owner only on extract,
>>>>on create, 'o' would be --old-archive.
>>>
>>>FYI this was prompted by:
>>>
>>>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
>>>
>>>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
>>>--- git-1.6.5.oorig/templates/Makefile	2009-10-11 03:42:04.000000000 +0200
>>>+++ git-1.6.5/templates/Makefile	2009-10-23 21:43:06.000000000 +0200
>>>@@ -50,4 +50,4 @@ clean:
>>> install: all
>>> 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
>>> 	(cd blt && $(TAR) cf - .) | \
>>>-	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
>>>+	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)
>>
>> argh, sorry! --no-same-owner of course.
>
>Either way, your change would break non-GNU tar implementations that are
>properly POSIX.1, isn't it?

I suppose xf - -o would work?

```

## Andreas Schwab, 2009-10-24 09:49

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <m28wf1unop.fsf@whitebox.home>
URL: https://gitlist.dev/e/m28wf1unop.fsf%40whitebox.home
In-Reply-To: <20091024091758.GF4615@mx.loc>

```
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:

> On Fri, Oct 23, 2009 at 02:26:53PM -0700, Junio C Hamano wrote:
>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>>
>>> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:
>>>>On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:
>>>>>GNU tar-1.22 handles 'o' as no-same-owner only on extract,
>>>>>on create, 'o' would be --old-archive.
>>>>
>>>>FYI this was prompted by:
>>>>
>>>>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
>>>>
>>>>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
>>>>--- git-1.6.5.oorig/templates/Makefile	2009-10-11 03:42:04.000000000 +0200
>>>>+++ git-1.6.5/templates/Makefile	2009-10-23 21:43:06.000000000 +0200
>>>>@@ -50,4 +50,4 @@ clean:
>>>> install: all
>>>> 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
>>>> 	(cd blt && $(TAR) cf - .) | \
>>>>-	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
>>>>+	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)
>>>
>>> argh, sorry! --no-same-owner of course.
>>
>>Either way, your change would break non-GNU tar implementations that are
>>properly POSIX.1, isn't it?
>
> I suppose xf - -o would work?

Isn't that the same as 'xfo -'?

(tar isn't specified by POSIX, btw.)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

## Jakub Narebski, 2009-10-24 09:56

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <m38wf1dsjf.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m38wf1dsjf.fsf%40localhost.localdomain
In-Reply-To: <m28wf1unop.fsf@whitebox.home>

```
Andreas Schwab <schwab@linux-m68k.org> writes:
> Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>> On Fri, Oct 23, 2009 at 02:26:53PM -0700, Junio C Hamano wrote:
>>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>>>> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:
>>>>> On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:
>>>>>>
>>>>>> GNU tar-1.22 handles 'o' as no-same-owner only on extract,
>>>>>> on create, 'o' would be --old-archive.

>>>>>  	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
>>>>>  	(cd blt && $(TAR) cf - .) | \
>>>>> -	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
>>>>> +	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)
>>>>
>>>> argh, sorry! --no-same-owner of course.
>>>
>>> Either way, your change would break non-GNU tar implementations that are
>>> properly POSIX.1, isn't it?
>>
>> I suppose xf - -o would work?
> 
> Isn't that the same as 'xfo -'?
> 
> (tar isn't specified by POSIX, btw.)

I don't quite understand why 'o' has to be spelled using long name
--no-same-owner, instead of just correcting the ordering of "old style"
short options to have 'f' last, i.e.

  $(TAR) xof -

and not (current)

  $(TAR) xfo -

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Bernhard Reutner-Fischer, 2009-10-24 10:05

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <20091024100502.GG4615@mx.loc>
URL: https://gitlist.dev/e/20091024100502.GG4615%40mx.loc
In-Reply-To: <m28wf1unop.fsf@whitebox.home>

```
On Sat, Oct 24, 2009 at 11:49:10AM +0200, Andreas Schwab wrote:
>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>
>> On Fri, Oct 23, 2009 at 02:26:53PM -0700, Junio C Hamano wrote:
>>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>>>
>>>> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:
>>>>>On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:
>>>>>>GNU tar-1.22 handles 'o' as no-same-owner only on extract,
>>>>>>on create, 'o' would be --old-archive.
>>>>>
>>>>>FYI this was prompted by:
>>>>>
>>>>>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
>>>>>
>>>>>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
>>>>>--- git-1.6.5.oorig/templates/Makefile	2009-10-11 03:42:04.000000000 +0200
>>>>>+++ git-1.6.5/templates/Makefile	2009-10-23 21:43:06.000000000 +0200
>>>>>@@ -50,4 +50,4 @@ clean:
>>>>> install: all
>>>>> 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
>>>>> 	(cd blt && $(TAR) cf - .) | \
>>>>>-	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
>>>>>+	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)
>>>>
>>>> argh, sorry! --no-same-owner of course.
>>>
>>>Either way, your change would break non-GNU tar implementations that are
>>>properly POSIX.1, isn't it?
>>
>> I suppose xf - -o would work?
>
>Isn't that the same as 'xfo -'?

Not really (if you do not permute the arguments which we don't in
busybox, for size reasons).
f specifies the file so "fo" acts on file "o".
"xof -" would work for me as well as "xf - -o", it's just that
"xfo -" does not work.

```

## Bernhard Reutner-Fischer, 2009-10-24 10:06

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <20091024100621.GH4615@mx.loc>
URL: https://gitlist.dev/e/20091024100621.GH4615%40mx.loc
In-Reply-To: <m38wf1dsjf.fsf@localhost.localdomain>

```
On Sat, Oct 24, 2009 at 02:56:33AM -0700, Jakub Narebski wrote:
>Andreas Schwab <schwab@linux-m68k.org> writes:
>> Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>>> On Fri, Oct 23, 2009 at 02:26:53PM -0700, Junio C Hamano wrote:
>>>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>>>>> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:
>>>>>> On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:
>>>>>>>
>>>>>>> GNU tar-1.22 handles 'o' as no-same-owner only on extract,
>>>>>>> on create, 'o' would be --old-archive.
>
>>>>>>  	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
>>>>>>  	(cd blt && $(TAR) cf - .) | \
>>>>>> -	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
>>>>>> +	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)
>>>>>
>>>>> argh, sorry! --no-same-owner of course.
>>>>
>>>> Either way, your change would break non-GNU tar implementations that are
>>>> properly POSIX.1, isn't it?
>>>
>>> I suppose xf - -o would work?
>> 
>> Isn't that the same as 'xfo -'?
>> 
>> (tar isn't specified by POSIX, btw.)
>
>I don't quite understand why 'o' has to be spelled using long name
>--no-same-owner, instead of just correcting the ordering of "old style"

It doesn't have to be, right.

>short options to have 'f' last, i.e.
>
>  $(TAR) xof -
>
>and not (current)
>
>  $(TAR) xfo -

any of "xf - -o" or "xof -" would work for me.

```

## Andreas Schwab, 2009-10-24 10:06

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <m2ws2lt8ba.fsf@whitebox.home>
URL: https://gitlist.dev/e/m2ws2lt8ba.fsf%40whitebox.home
In-Reply-To: <m38wf1dsjf.fsf@localhost.localdomain>

```
Jakub Narebski <jnareb@gmail.com> writes:

> I don't quite understand why 'o' has to be spelled using long name
> --no-same-owner, instead of just correcting the ordering of "old style"
> short options to have 'f' last, i.e.
>
>   $(TAR) xof -
>
> and not (current)
>
>   $(TAR) xfo -

Both do exactly the same, traditionally.  Note the lack of '-' preceding
'xfo', which does not use getopt-style option parsing.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

## Andreas Schwab, 2009-10-24 10:44

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <m2ocnxt6jl.fsf@whitebox.home>
URL: https://gitlist.dev/e/m2ocnxt6jl.fsf%40whitebox.home
In-Reply-To: <20091024100502.GG4615@mx.loc>

```
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:

> On Sat, Oct 24, 2009 at 11:49:10AM +0200, Andreas Schwab wrote:
>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>>
>>> I suppose xf - -o would work?
>>
>>Isn't that the same as 'xfo -'?
>
> Not really (if you do not permute the arguments which we don't in
> busybox, for size reasons).

There is no argument permutation.  The traditional argument parsing of
tar does not cluster option letters with option arguments.

Of course, just using 'xof -' will work around this busybox bug.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

## Andreas Schwab, 2009-10-24 13:06

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <m2ocnxuej2.fsf@igel.home>
URL: https://gitlist.dev/e/m2ocnxuej2.fsf%40igel.home
In-Reply-To: <m2ocnxt6jl.fsf@whitebox.home>

```
Andreas Schwab <schwab@linux-m68k.org> writes:

> Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>
>> On Sat, Oct 24, 2009 at 11:49:10AM +0200, Andreas Schwab wrote:
>>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>>>
>>>> I suppose xf - -o would work?
>>>
>>>Isn't that the same as 'xfo -'?
>>
>> Not really (if you do not permute the arguments which we don't in
>> busybox, for size reasons).
>
> There is no argument permutation.  The traditional argument parsing of
> tar does not cluster option letters with option arguments.
>
> Of course, just using 'xof -' will work around this busybox bug.

Like this.

Andreas.

>From ebadb41b346c305b94f27e3bb787bf0ba6bb8a5b Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@linux-m68k.org>
Date: Sat, 24 Oct 2009 15:01:03 +0200
Subject: [PATCH] Work around option parsing bug in the busybox tar implementation

Traditionally the first argument of the tar command was interpreted a
bundle of letters specifying the mode of operation and additional options,
with any option arguments taken from subsequent words on the command line
as needed.  The implementation of tar in busybox apparently treats this
bundle as if preceded by a dash and then parses it by getopt rules, which
mishandles 'tar xfo -'.  Use 'tar xof -' instead which is parsed the same
way by both traditional tar implementations and busybox.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
 templates/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/templates/Makefile b/templates/Makefile
index a12c6e2..408f013 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -50,4 +50,4 @@ clean:
 install: all
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
 	(cd blt && $(TAR) cf - .) | \
-	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
+	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)
-- 
1.6.5.1


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

## Junio C Hamano, 2009-10-24 19:25

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <7vd44c61cb.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd44c61cb.fsf%40alter.siamese.dyndns.org
In-Reply-To: <m2ocnxuej2.fsf@igel.home>

```
Andreas Schwab <schwab@linux-m68k.org> writes:

> Like this.

Yeah, correct and it beautifly explains the issue.  Thanks.

>>From ebadb41b346c305b94f27e3bb787bf0ba6bb8a5b Mon Sep 17 00:00:00 2001
> From: Andreas Schwab <schwab@linux-m68k.org>
> Date: Sat, 24 Oct 2009 15:01:03 +0200
> Subject: [PATCH] Work around option parsing bug in the busybox tar implementation
>
> Traditionally the first argument of the tar command was interpreted a
> bundle of letters specifying the mode of operation and additional options,
> with any option arguments taken from subsequent words on the command line
> as needed.  The implementation of tar in busybox apparently treats this
> bundle as if preceded by a dash and then parses it by getopt rules, which
> mishandles 'tar xfo -'.  Use 'tar xof -' instead which is parsed the same
> way by both traditional tar implementations and busybox.
>
> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
> ---
>  templates/Makefile |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/templates/Makefile b/templates/Makefile
> index a12c6e2..408f013 100644
> --- a/templates/Makefile
> +++ b/templates/Makefile
> @@ -50,4 +50,4 @@ clean:
>  install: all
>  	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
>  	(cd blt && $(TAR) cf - .) | \
> -	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
> +	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)
> -- 
> 1.6.5.1
>
>
> -- 
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."

```

## Denys Vlasenko, 2009-10-24 23:32

Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Message-ID: <200910250132.04187.vda.linux@googlemail.com>
URL: https://gitlist.dev/e/200910250132.04187.vda.linux%40googlemail.com
In-Reply-To: <m2ocnxt6jl.fsf@whitebox.home>

```
On Saturday 24 October 2009 12:44, Andreas Schwab wrote:
> Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
> 
> > On Sat, Oct 24, 2009 at 11:49:10AM +0200, Andreas Schwab wrote:
> >>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
> >>
> >>> I suppose xf - -o would work?
> >>
> >>Isn't that the same as 'xfo -'?
> >
> > Not really (if you do not permute the arguments which we don't in
> > busybox, for size reasons).
> 
> There is no argument permutation.  The traditional argument parsing of
> tar does not cluster option letters with option arguments.
> 
> Of course, just using 'xof -' will work around this busybox bug.

From my side, I prefer to squash that busybox bug.
This is the second time people complain about it,
so it is a reoccurring problem.

The attached patch has been pushed to busybox git.

function                                             old     new   delta
tar_main                                             702     751     +49

--
vda


diff -d -urpN busybox.0/archival/tar.c busybox.1/archival/tar.c
--- busybox.0/archival/tar.c	2009-10-20 22:11:09.000000000 +0200
+++ busybox.1/archival/tar.c	2009-10-25 01:27:38.000000000 +0200
@@ -841,6 +841,33 @@ int tar_main(int argc UNUSED_PARAM, char
 #if ENABLE_FEATURE_TAR_LONG_OPTIONS
 	applet_long_options = tar_longopts;
 #endif
+#if ENABLE_DESKTOP
+	if (argv[1][0] != '-') {
+		/* Compat:
+		 * 1st argument without dash handles options with parameters
+		 * differently from dashed one: it takes *next argv[i]*
+		 * as paramenter even if there are more chars in 1st argument:
+		 *  "tar fx TARFILE" - "x" is not taken as f's param
+		 *  but is interpreted as -x option
+		 *  "tar -xf TARFILE" - dashed equivalent of the above
+		 *  "tar -fx ..." - "x" is taken as f's param
+		 * getopt32 wouldn't handle 1st command correctly.
+		 * Unfortunately, people do use such commands.
+		 * We massage argv[1] to work around it by moving 'f'
+		 * to the end of the string.
+		 * More contrived "tar fCx TARFILE DIR" still fails,
+		 * but such commands are much less likely to be used.
+		 */
+		char *f = strchr(argv[1], 'f');
+		if (f) {
+			while (f[1] != '\0') {
+				*f = f[1];
+				f++;
+			}
+			*f = 'f';
+		}
+	}
+#endif
 	opt = getopt32(argv,
 		"txC:f:Opvk"
 		IF_FEATURE_TAR_CREATE(   "ch"  )

```
