git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] tar: on extract, -o is --no-same-owner
       [not found] <1256328943-22136-1-git-send-email-rep.dot.nop@gmail.com>
@ 2009-10-23 20:25 ` Bernhard Reutner-Fischer
  2009-10-23 21:06   ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 13+ messages in thread
From: Bernhard Reutner-Fischer @ 2009-10-23 20:25 UTC (permalink / raw)
  To: vda.linux; +Cc: busybox, git

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,

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-23 20:25 ` [PATCH] tar: on extract, -o is --no-same-owner Bernhard Reutner-Fischer
@ 2009-10-23 21:06   ` Bernhard Reutner-Fischer
  2009-10-23 21:26     ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Bernhard Reutner-Fischer @ 2009-10-23 21:06 UTC (permalink / raw)
  To: vda.linux; +Cc: busybox, git

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-23 21:06   ` Bernhard Reutner-Fischer
@ 2009-10-23 21:26     ` Junio C Hamano
  2009-10-24  9:17       ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2009-10-23 21:26 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer; +Cc: vda.linux, busybox, git

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?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-23 21:26     ` Junio C Hamano
@ 2009-10-24  9:17       ` Bernhard Reutner-Fischer
  2009-10-24  9:49         ` Andreas Schwab
  0 siblings, 1 reply; 13+ messages in thread
From: Bernhard Reutner-Fischer @ 2009-10-24  9:17 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: vda.linux, busybox, git

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?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-24  9:17       ` Bernhard Reutner-Fischer
@ 2009-10-24  9:49         ` Andreas Schwab
  2009-10-24  9:56           ` Jakub Narebski
  2009-10-24 10:05           ` Bernhard Reutner-Fischer
  0 siblings, 2 replies; 13+ messages in thread
From: Andreas Schwab @ 2009-10-24  9:49 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer; +Cc: Junio C Hamano, vda.linux, busybox, git

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."

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-24  9:49         ` Andreas Schwab
@ 2009-10-24  9:56           ` Jakub Narebski
  2009-10-24 10:06             ` Bernhard Reutner-Fischer
  2009-10-24 10:06             ` Andreas Schwab
  2009-10-24 10:05           ` Bernhard Reutner-Fischer
  1 sibling, 2 replies; 13+ messages in thread
From: Jakub Narebski @ 2009-10-24  9:56 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Bernhard Reutner-Fischer, Junio C Hamano, vda.linux, busybox, git

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-24  9:49         ` Andreas Schwab
  2009-10-24  9:56           ` Jakub Narebski
@ 2009-10-24 10:05           ` Bernhard Reutner-Fischer
  2009-10-24 10:44             ` Andreas Schwab
  1 sibling, 1 reply; 13+ messages in thread
From: Bernhard Reutner-Fischer @ 2009-10-24 10:05 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Junio C Hamano, vda.linux, busybox, git

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-24  9:56           ` Jakub Narebski
@ 2009-10-24 10:06             ` Bernhard Reutner-Fischer
  2009-10-24 10:06             ` Andreas Schwab
  1 sibling, 0 replies; 13+ messages in thread
From: Bernhard Reutner-Fischer @ 2009-10-24 10:06 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Andreas Schwab, Junio C Hamano, vda.linux, busybox, git

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-24  9:56           ` Jakub Narebski
  2009-10-24 10:06             ` Bernhard Reutner-Fischer
@ 2009-10-24 10:06             ` Andreas Schwab
  1 sibling, 0 replies; 13+ messages in thread
From: Andreas Schwab @ 2009-10-24 10:06 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Bernhard Reutner-Fischer, Junio C Hamano, vda.linux, busybox, git

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."

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-24 10:05           ` Bernhard Reutner-Fischer
@ 2009-10-24 10:44             ` Andreas Schwab
  2009-10-24 13:06               ` Andreas Schwab
  2009-10-24 23:32               ` Denys Vlasenko
  0 siblings, 2 replies; 13+ messages in thread
From: Andreas Schwab @ 2009-10-24 10:44 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer; +Cc: Junio C Hamano, vda.linux, busybox, git

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."

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-24 10:44             ` Andreas Schwab
@ 2009-10-24 13:06               ` Andreas Schwab
  2009-10-24 19:25                 ` Junio C Hamano
  2009-10-24 23:32               ` Denys Vlasenko
  1 sibling, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2009-10-24 13:06 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer; +Cc: Junio C Hamano, vda.linux, busybox, git

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."

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-24 13:06               ` Andreas Schwab
@ 2009-10-24 19:25                 ` Junio C Hamano
  0 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2009-10-24 19:25 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Bernhard Reutner-Fischer, Junio C Hamano, vda.linux, busybox, git

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."

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tar: on extract, -o is --no-same-owner
  2009-10-24 10:44             ` Andreas Schwab
  2009-10-24 13:06               ` Andreas Schwab
@ 2009-10-24 23:32               ` Denys Vlasenko
  1 sibling, 0 replies; 13+ messages in thread
From: Denys Vlasenko @ 2009-10-24 23:32 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Bernhard Reutner-Fischer, Junio C Hamano, busybox, git

[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]

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

[-- Attachment #2: 1.patch --]
[-- Type: text/x-diff, Size: 1316 bytes --]

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"  )

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-10-24 23:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1256328943-22136-1-git-send-email-rep.dot.nop@gmail.com>
2009-10-23 20:25 ` [PATCH] tar: on extract, -o is --no-same-owner Bernhard Reutner-Fischer
2009-10-23 21:06   ` Bernhard Reutner-Fischer
2009-10-23 21:26     ` Junio C Hamano
2009-10-24  9:17       ` Bernhard Reutner-Fischer
2009-10-24  9:49         ` Andreas Schwab
2009-10-24  9:56           ` Jakub Narebski
2009-10-24 10:06             ` Bernhard Reutner-Fischer
2009-10-24 10:06             ` Andreas Schwab
2009-10-24 10:05           ` Bernhard Reutner-Fischer
2009-10-24 10:44             ` Andreas Schwab
2009-10-24 13:06               ` Andreas Schwab
2009-10-24 19:25                 ` Junio C Hamano
2009-10-24 23:32               ` Denys Vlasenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).