tar: on extract, -o is --no-same-owner
Quoted 2 lines · Bernhard Reutner-Fischer
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:
templates/Makefile +1 -1
@@ -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,
Quoted 15 lines · Bernhard Reutner-Fischer
Quoted 2 lines · Bernhard Reutner-Fischer
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 <[email protected]>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
templates/Makefile +0
-0@@ -50,4 +50,4 @@ clean:install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)' (cd blt && $(TAR) cf - .) | \
templates/Makefile clean: · line 53
Quoted 2 lines
templates/Makefile +1
-1- (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.
Quoted 3 lines
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_longthough.
Quoted 9 lines · Bernhard Reutner-Fischer
Quoted 8 lines · Bernhard Reutner-Fischer
Quoted 2 lines · Bernhard Reutner-Fischer
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 <[email protected]>
Quoted 11 lines
templates/Makefile clean: · line 53
Quoted 9 lines
diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
templates/Makefile +0
-0@@ -50,4 +50,4 @@ clean:install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)' (cd blt && $(TAR) cf - .) | \templates/Makefile +1
-1- (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?
Quoted 23 lines · Junio C Hamano
Quoted 9 lines · Bernhard Reutner-Fischer
Quoted 8 lines · Bernhard Reutner-Fischer
Quoted 2 lines · Bernhard Reutner-Fischer
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 <[email protected]>Quoted 11 lines
templates/Makefile clean: · line 53
Quoted 9 lines
diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
templates/Makefile +0
-0@@ -50,4 +50,4 @@ clean:install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)' (cd blt && $(TAR) cf - .) | \templates/Makefile +1
-1- (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.
Quoted 2 lines
Either way, your change would break non-GNU tar implementations that are properly POSIX.1, isn't it?
I suppose xf - -o would work?
Quoted 24 lines · Bernhard Reutner-Fischer
Quoted 23 lines · Junio C Hamano
Quoted 20 lines · Bernhard Reutner-Fischer
Quoted 15 lines · Bernhard Reutner-Fischer
Quoted 2 lines · Bernhard Reutner-Fischer
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 <[email protected]>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
templates/Makefile +0
-0@@ -50,4 +50,4 @@ clean:install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)' (cd blt && $(TAR) cf - .) | \templates/Makefile clean: · line 53
Quoted 2 lines
templates/Makefile +1
-1- (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.
Quoted 4 lines
Quoted 2 lines
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.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 26 lines · Andreas Schwab
Quoted 24 lines · Bernhard Reutner-Fischer
Quoted 23 lines · Junio C Hamano
Quoted 20 lines · Bernhard Reutner-Fischer
Quoted 15 lines · Bernhard Reutner-Fischer
Quoted 2 lines · Bernhard Reutner-Fischer
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 <[email protected]>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile
templates/Makefile +0
-0@@ -50,4 +50,4 @@ clean:install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)' (cd blt && $(TAR) cf - .) | \templates/Makefile clean: · line 53
Quoted 2 lines
templates/Makefile +1
-1- (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.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
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.
Quoted 9 lines · Bernhard Reutner-Fischer
Quoted 5 lines · Andreas Schwab
Quoted 1 line · Bernhard Reutner-Fischer
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.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 9 lines · Andreas Schwab
Quoted 7 lines · Bernhard Reutner-Fischer
Quoted 5 lines · Andreas Schwab
Quoted 1 line · Bernhard Reutner-Fischer
I suppose xf - -o would work?
Isn't that the same as 'xfo -'?
Quoted 7 lines
Quoted 2 lines
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
archival/tar.c +27 -0
@@ -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" )
Quoted 9 lines · Andreas Schwab
Quoted 7 lines · Bernhard Reutner-Fischer
Quoted 5 lines · Andreas Schwab
Quoted 1 line · Bernhard Reutner-Fischer
I suppose xf - -o would work?
Isn't that the same as 'xfo -'?
Quoted 7 lines
Quoted 2 lines
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.
Quoted 1 line
From
ebadb41b346c305b94f27e3bb787bf0ba6bb8a5bMon Sep 17 00:00:00 2001
From: Andreas Schwab <[email protected]>
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.
--- templates/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
templates/Makefile +1 -1
@@ -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 -)
Signature · 7 lines
1.6.5.1 -- Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 1 line · Andreas Schwab
Like this.
Yeah, correct and it beautifly explains the issue. Thanks.
Quoted 36 lines
Quoted 1 line
From
ebadb41b346c305b94f27e3bb787bf0ba6bb8a5bMon Sep 17 00:00:00 2001From: Andreas Schwab <[email protected]>
Date: Sat, 24 Oct 2009 15:01:03 +0200
Subject: [PATCH] Work around option parsing bug in the busybox tar implementationTraditionally 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 <[email protected]>--- templates/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)templates/Makefile +1
-1@@ -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 -)Signature · 7 lines
1.6.5.1 -- Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 16 lines · Andreas Schwab
Quoted 15 lines · Bernhard Reutner-Fischer
Quoted 14 lines · Junio C Hamano
Quoted 12 lines · Bernhard Reutner-Fischer
templates/Makefile clean: · line 53
Quoted 9 lines · Bernhard Reutner-Fischer
Quoted 3 lines · Bernhard Reutner-Fischer
GNU tar-1.22 handles 'o' as no-same-owner only on extract, on create, 'o' would be --old-archive.
templates/Makefile +1
-1$(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.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
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 -
Signature · 3 lines
Jakub Narebski Poland ShadeHawk on #git
Quoted 20 lines · Jakub Narebski
Quoted 19 lines · Andreas Schwab
Quoted 18 lines · Bernhard Reutner-Fischer
Quoted 16 lines · Junio C Hamano
Quoted 6 lines · Bernhard Reutner-Fischer
Quoted 4 lines · Bernhard Reutner-Fischer
Quoted 3 lines · Bernhard Reutner-Fischer
GNU tar-1.22 handles 'o' as no-same-owner only on extract, on create, 'o' would be --old-archive.
Quoted 6 lines
templates/Makefile clean: · line 53
Quoted 4 lines
templates/Makefile +1
-1$(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?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
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.
Quoted 7 lines
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.
Quoted 9 lines · Jakub Narebski
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.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."