{"thread":{"id":"21340","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","startedAt":"2009-10-23T20:25:24Z","lastAt":"2009-10-24T23:32:04Z","messageCount":13,"participants":["Bernhard Reutner-Fischer","Junio C Hamano","Andreas Schwab","Jakub Narebski","Denys Vlasenko"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"125807","messageId":"20091023202524.GE4615@mx.loc","threadId":"21340","inReplyTo":"1256328943-22136-1-git-send-email-rep.dot.nop@gmail.com","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Bernhard Reutner-Fischer","fromEmail":"rep.dot.nop@gmail.com","sentAt":"2009-10-23T20:25:24Z","receivedAt":"2009-10-23T20:25:24Z","isPatch":true,"sender":{"key":"rep.dot.nop@gmail.com","avatar":null},"body":"On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:\n>GNU tar-1.22 handles 'o' as no-same-owner only on extract,\n>on create, 'o' would be --old-archive.\n\nFYI this was prompted by:\n\nSigned-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>\n\ndiff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile\n--- git-1.6.5.oorig/templates/Makefile\t2009-10-11 03:42:04.000000000 +0200\n+++ git-1.6.5/templates/Makefile\t2009-10-23 21:43:06.000000000 +0200\n@@ -50,4 +50,4 @@ clean:\n install: all\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n \t(cd blt && $(TAR) cf - .) | \\\n-\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)\n+\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)\n\nSomeone should try to ask the git people not to rely on getopt\npermuting options.. xof would be gentle to folks who don't want\nto turn on getopt_long though.\n\ncheers,\n"},{"id":"125814","messageId":"20091023210648.GA23122@mx.loc","threadId":"21340","inReplyTo":"20091023202524.GE4615@mx.loc","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Bernhard Reutner-Fischer","fromEmail":"rep.dot.nop@gmail.com","sentAt":"2009-10-23T21:06:48Z","receivedAt":"2009-10-23T21:06:48Z","isPatch":true,"sender":{"key":"rep.dot.nop@gmail.com","avatar":null},"body":"On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:\n>On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:\n>>GNU tar-1.22 handles 'o' as no-same-owner only on extract,\n>>on create, 'o' would be --old-archive.\n>\n>FYI this was prompted by:\n>\n>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>\n>\n>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile\n>--- git-1.6.5.oorig/templates/Makefile\t2009-10-11 03:42:04.000000000 +0200\n>+++ git-1.6.5/templates/Makefile\t2009-10-23 21:43:06.000000000 +0200\n>@@ -50,4 +50,4 @@ clean:\n> install: all\n> \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n> \t(cd blt && $(TAR) cf - .) | \\\n>-\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)\n>+\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)\n\nargh, sorry! --no-same-owner of course.\n\n>Someone should try to ask the git people not to rely on getopt\n>permuting options.. xof would be gentle to folks who don't want\n>to turn on getopt_long though.\n"},{"id":"125816","messageId":"7vocnxajj6.fsf@alter.siamese.dyndns.org","threadId":"21340","inReplyTo":"20091023210648.GA23122@mx.loc","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-23T21:26:53Z","receivedAt":"2009-10-23T21:26:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n\n> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:\n>>On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:\n>>>GNU tar-1.22 handles 'o' as no-same-owner only on extract,\n>>>on create, 'o' would be --old-archive.\n>>\n>>FYI this was prompted by:\n>>\n>>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>\n>>\n>>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile\n>>--- git-1.6.5.oorig/templates/Makefile\t2009-10-11 03:42:04.000000000 +0200\n>>+++ git-1.6.5/templates/Makefile\t2009-10-23 21:43:06.000000000 +0200\n>>@@ -50,4 +50,4 @@ clean:\n>> install: all\n>> \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n>> \t(cd blt && $(TAR) cf - .) | \\\n>>-\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)\n>>+\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)\n>\n> argh, sorry! --no-same-owner of course.\n\nEither way, your change would break non-GNU tar implementations that are\nproperly POSIX.1, isn't it?\n"},{"id":"125830","messageId":"20091024091758.GF4615@mx.loc","threadId":"21340","inReplyTo":"7vocnxajj6.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Bernhard Reutner-Fischer","fromEmail":"rep.dot.nop@gmail.com","sentAt":"2009-10-24T09:17:58Z","receivedAt":"2009-10-24T09:17:58Z","isPatch":true,"sender":{"key":"rep.dot.nop@gmail.com","avatar":null},"body":"On Fri, Oct 23, 2009 at 02:26:53PM -0700, Junio C Hamano wrote:\n>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>\n>> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:\n>>>On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:\n>>>>GNU tar-1.22 handles 'o' as no-same-owner only on extract,\n>>>>on create, 'o' would be --old-archive.\n>>>\n>>>FYI this was prompted by:\n>>>\n>>>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>\n>>>\n>>>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile\n>>>--- git-1.6.5.oorig/templates/Makefile\t2009-10-11 03:42:04.000000000 +0200\n>>>+++ git-1.6.5/templates/Makefile\t2009-10-23 21:43:06.000000000 +0200\n>>>@@ -50,4 +50,4 @@ clean:\n>>> install: all\n>>> \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n>>> \t(cd blt && $(TAR) cf - .) | \\\n>>>-\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)\n>>>+\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)\n>>\n>> argh, sorry! --no-same-owner of course.\n>\n>Either way, your change would break non-GNU tar implementations that are\n>properly POSIX.1, isn't it?\n\nI suppose xf - -o would work?\n"},{"id":"125835","messageId":"m28wf1unop.fsf@whitebox.home","threadId":"21340","inReplyTo":"20091024091758.GF4615@mx.loc","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2009-10-24T09:49:10Z","receivedAt":"2009-10-24T09:49:10Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n\n> On Fri, Oct 23, 2009 at 02:26:53PM -0700, Junio C Hamano wrote:\n>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>>\n>>> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:\n>>>>On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:\n>>>>>GNU tar-1.22 handles 'o' as no-same-owner only on extract,\n>>>>>on create, 'o' would be --old-archive.\n>>>>\n>>>>FYI this was prompted by:\n>>>>\n>>>>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>\n>>>>\n>>>>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile\n>>>>--- git-1.6.5.oorig/templates/Makefile\t2009-10-11 03:42:04.000000000 +0200\n>>>>+++ git-1.6.5/templates/Makefile\t2009-10-23 21:43:06.000000000 +0200\n>>>>@@ -50,4 +50,4 @@ clean:\n>>>> install: all\n>>>> \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n>>>> \t(cd blt && $(TAR) cf - .) | \\\n>>>>-\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)\n>>>>+\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)\n>>>\n>>> argh, sorry! --no-same-owner of course.\n>>\n>>Either way, your change would break non-GNU tar implementations that are\n>>properly POSIX.1, isn't it?\n>\n> I suppose xf - -o would work?\n\nIsn't that the same as 'xfo -'?\n\n(tar isn't specified by POSIX, btw.)\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"125836","messageId":"m38wf1dsjf.fsf@localhost.localdomain","threadId":"21340","inReplyTo":"m28wf1unop.fsf@whitebox.home","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-10-24T09:56:33Z","receivedAt":"2009-10-24T09:56:33Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Andreas Schwab <schwab@linux-m68k.org> writes:\n> Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>> On Fri, Oct 23, 2009 at 02:26:53PM -0700, Junio C Hamano wrote:\n>>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>>>> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:\n>>>>> On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:\n>>>>>>\n>>>>>> GNU tar-1.22 handles 'o' as no-same-owner only on extract,\n>>>>>> on create, 'o' would be --old-archive.\n\n>>>>>  \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n>>>>>  \t(cd blt && $(TAR) cf - .) | \\\n>>>>> -\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)\n>>>>> +\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)\n>>>>\n>>>> argh, sorry! --no-same-owner of course.\n>>>\n>>> Either way, your change would break non-GNU tar implementations that are\n>>> properly POSIX.1, isn't it?\n>>\n>> I suppose xf - -o would work?\n> \n> Isn't that the same as 'xfo -'?\n> \n> (tar isn't specified by POSIX, btw.)\n\nI don't quite understand why 'o' has to be spelled using long name\n--no-same-owner, instead of just correcting the ordering of \"old style\"\nshort options to have 'f' last, i.e.\n\n  $(TAR) xof -\n\nand not (current)\n\n  $(TAR) xfo -\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"125837","messageId":"20091024100502.GG4615@mx.loc","threadId":"21340","inReplyTo":"m28wf1unop.fsf@whitebox.home","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Bernhard Reutner-Fischer","fromEmail":"rep.dot.nop@gmail.com","sentAt":"2009-10-24T10:05:02Z","receivedAt":"2009-10-24T10:05:02Z","isPatch":true,"sender":{"key":"rep.dot.nop@gmail.com","avatar":null},"body":"On Sat, Oct 24, 2009 at 11:49:10AM +0200, Andreas Schwab wrote:\n>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>\n>> On Fri, Oct 23, 2009 at 02:26:53PM -0700, Junio C Hamano wrote:\n>>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>>>\n>>>> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:\n>>>>>On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:\n>>>>>>GNU tar-1.22 handles 'o' as no-same-owner only on extract,\n>>>>>>on create, 'o' would be --old-archive.\n>>>>>\n>>>>>FYI this was prompted by:\n>>>>>\n>>>>>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>\n>>>>>\n>>>>>diff -rdup git-1.6.5.oorig/templates/Makefile git-1.6.5/templates/Makefile\n>>>>>--- git-1.6.5.oorig/templates/Makefile\t2009-10-11 03:42:04.000000000 +0200\n>>>>>+++ git-1.6.5/templates/Makefile\t2009-10-23 21:43:06.000000000 +0200\n>>>>>@@ -50,4 +50,4 @@ clean:\n>>>>> install: all\n>>>>> \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n>>>>> \t(cd blt && $(TAR) cf - .) | \\\n>>>>>-\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)\n>>>>>+\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)\n>>>>\n>>>> argh, sorry! --no-same-owner of course.\n>>>\n>>>Either way, your change would break non-GNU tar implementations that are\n>>>properly POSIX.1, isn't it?\n>>\n>> I suppose xf - -o would work?\n>\n>Isn't that the same as 'xfo -'?\n\nNot really (if you do not permute the arguments which we don't in\nbusybox, for size reasons).\nf specifies the file so \"fo\" acts on file \"o\".\n\"xof -\" would work for me as well as \"xf - -o\", it's just that\n\"xfo -\" does not work.\n"},{"id":"125838","messageId":"20091024100621.GH4615@mx.loc","threadId":"21340","inReplyTo":"m38wf1dsjf.fsf@localhost.localdomain","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Bernhard Reutner-Fischer","fromEmail":"rep.dot.nop@gmail.com","sentAt":"2009-10-24T10:06:21Z","receivedAt":"2009-10-24T10:06:21Z","isPatch":true,"sender":{"key":"rep.dot.nop@gmail.com","avatar":null},"body":"On Sat, Oct 24, 2009 at 02:56:33AM -0700, Jakub Narebski wrote:\n>Andreas Schwab <schwab@linux-m68k.org> writes:\n>> Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>>> On Fri, Oct 23, 2009 at 02:26:53PM -0700, Junio C Hamano wrote:\n>>>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>>>>> On Fri, Oct 23, 2009 at 10:25:24PM +0200, Bernhard Reutner-Fischer wrote:\n>>>>>> On Fri, Oct 23, 2009 at 10:15:43PM +0200, Bernhard Reutner-Fischer wrote:\n>>>>>>>\n>>>>>>> GNU tar-1.22 handles 'o' as no-same-owner only on extract,\n>>>>>>> on create, 'o' would be --old-archive.\n>\n>>>>>>  \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n>>>>>>  \t(cd blt && $(TAR) cf - .) | \\\n>>>>>> -\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)\n>>>>>> +\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) x --no-numeric-owner -f -)\n>>>>>\n>>>>> argh, sorry! --no-same-owner of course.\n>>>>\n>>>> Either way, your change would break non-GNU tar implementations that are\n>>>> properly POSIX.1, isn't it?\n>>>\n>>> I suppose xf - -o would work?\n>> \n>> Isn't that the same as 'xfo -'?\n>> \n>> (tar isn't specified by POSIX, btw.)\n>\n>I don't quite understand why 'o' has to be spelled using long name\n>--no-same-owner, instead of just correcting the ordering of \"old style\"\n\nIt doesn't have to be, right.\n\n>short options to have 'f' last, i.e.\n>\n>  $(TAR) xof -\n>\n>and not (current)\n>\n>  $(TAR) xfo -\n\nany of \"xf - -o\" or \"xof -\" would work for me.\n"},{"id":"125839","messageId":"m2ws2lt8ba.fsf@whitebox.home","threadId":"21340","inReplyTo":"m38wf1dsjf.fsf@localhost.localdomain","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2009-10-24T10:06:33Z","receivedAt":"2009-10-24T10:06:33Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> I don't quite understand why 'o' has to be spelled using long name\n> --no-same-owner, instead of just correcting the ordering of \"old style\"\n> short options to have 'f' last, i.e.\n>\n>   $(TAR) xof -\n>\n> and not (current)\n>\n>   $(TAR) xfo -\n\nBoth do exactly the same, traditionally.  Note the lack of '-' preceding\n'xfo', which does not use getopt-style option parsing.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"125840","messageId":"m2ocnxt6jl.fsf@whitebox.home","threadId":"21340","inReplyTo":"20091024100502.GG4615@mx.loc","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2009-10-24T10:44:46Z","receivedAt":"2009-10-24T10:44:46Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n\n> On Sat, Oct 24, 2009 at 11:49:10AM +0200, Andreas Schwab wrote:\n>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>>\n>>> I suppose xf - -o would work?\n>>\n>>Isn't that the same as 'xfo -'?\n>\n> Not really (if you do not permute the arguments which we don't in\n> busybox, for size reasons).\n\nThere is no argument permutation.  The traditional argument parsing of\ntar does not cluster option letters with option arguments.\n\nOf course, just using 'xof -' will work around this busybox bug.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"125842","messageId":"m2ocnxuej2.fsf@igel.home","threadId":"21340","inReplyTo":"m2ocnxt6jl.fsf@whitebox.home","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2009-10-24T13:06:57Z","receivedAt":"2009-10-24T13:06:57Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Andreas Schwab <schwab@linux-m68k.org> writes:\n\n> Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>\n>> On Sat, Oct 24, 2009 at 11:49:10AM +0200, Andreas Schwab wrote:\n>>>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n>>>\n>>>> I suppose xf - -o would work?\n>>>\n>>>Isn't that the same as 'xfo -'?\n>>\n>> Not really (if you do not permute the arguments which we don't in\n>> busybox, for size reasons).\n>\n> There is no argument permutation.  The traditional argument parsing of\n> tar does not cluster option letters with option arguments.\n>\n> Of course, just using 'xof -' will work around this busybox bug.\n\nLike this.\n\nAndreas.\n\n>From ebadb41b346c305b94f27e3bb787bf0ba6bb8a5b Mon Sep 17 00:00:00 2001\nFrom: Andreas Schwab <schwab@linux-m68k.org>\nDate: Sat, 24 Oct 2009 15:01:03 +0200\nSubject: [PATCH] Work around option parsing bug in the busybox tar implementation\n\nTraditionally the first argument of the tar command was interpreted a\nbundle of letters specifying the mode of operation and additional options,\nwith any option arguments taken from subsequent words on the command line\nas needed.  The implementation of tar in busybox apparently treats this\nbundle as if preceded by a dash and then parses it by getopt rules, which\nmishandles 'tar xfo -'.  Use 'tar xof -' instead which is parsed the same\nway by both traditional tar implementations and busybox.\n\nSigned-off-by: Andreas Schwab <schwab@linux-m68k.org>\n---\n templates/Makefile |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/templates/Makefile b/templates/Makefile\nindex a12c6e2..408f013 100644\n--- a/templates/Makefile\n+++ b/templates/Makefile\n@@ -50,4 +50,4 @@ clean:\n install: all\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n \t(cd blt && $(TAR) cf - .) | \\\n-\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)\n+\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)\n-- \n1.6.5.1\n\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"125853","messageId":"7vd44c61cb.fsf@alter.siamese.dyndns.org","threadId":"21340","inReplyTo":"m2ocnxuej2.fsf@igel.home","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-24T19:25:40Z","receivedAt":"2009-10-24T19:25:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Schwab <schwab@linux-m68k.org> writes:\n\n> Like this.\n\nYeah, correct and it beautifly explains the issue.  Thanks.\n\n>>From ebadb41b346c305b94f27e3bb787bf0ba6bb8a5b Mon Sep 17 00:00:00 2001\n> From: Andreas Schwab <schwab@linux-m68k.org>\n> Date: Sat, 24 Oct 2009 15:01:03 +0200\n> Subject: [PATCH] Work around option parsing bug in the busybox tar implementation\n>\n> Traditionally the first argument of the tar command was interpreted a\n> bundle of letters specifying the mode of operation and additional options,\n> with any option arguments taken from subsequent words on the command line\n> as needed.  The implementation of tar in busybox apparently treats this\n> bundle as if preceded by a dash and then parses it by getopt rules, which\n> mishandles 'tar xfo -'.  Use 'tar xof -' instead which is parsed the same\n> way by both traditional tar implementations and busybox.\n>\n> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>\n> ---\n>  templates/Makefile |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/templates/Makefile b/templates/Makefile\n> index a12c6e2..408f013 100644\n> --- a/templates/Makefile\n> +++ b/templates/Makefile\n> @@ -50,4 +50,4 @@ clean:\n>  install: all\n>  \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n>  \t(cd blt && $(TAR) cf - .) | \\\n> -\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)\n> +\t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)\n> -- \n> 1.6.5.1\n>\n>\n> -- \n> Andreas Schwab, schwab@linux-m68k.org\n> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n> \"And now for something completely different.\"\n"},{"id":"125864","messageId":"200910250132.04187.vda.linux@googlemail.com","threadId":"21340","inReplyTo":"m2ocnxt6jl.fsf@whitebox.home","subject":"Re: [PATCH] tar: on extract, -o is --no-same-owner","fromName":"Denys Vlasenko","fromEmail":"vda.linux@googlemail.com","sentAt":"2009-10-24T23:32:04Z","receivedAt":"2009-10-24T23:32:04Z","isPatch":true,"sender":{"key":"vda.linux@googlemail.com","avatar":null},"body":"On Saturday 24 October 2009 12:44, Andreas Schwab wrote:\n> Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n> \n> > On Sat, Oct 24, 2009 at 11:49:10AM +0200, Andreas Schwab wrote:\n> >>Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:\n> >>\n> >>> I suppose xf - -o would work?\n> >>\n> >>Isn't that the same as 'xfo -'?\n> >\n> > Not really (if you do not permute the arguments which we don't in\n> > busybox, for size reasons).\n> \n> There is no argument permutation.  The traditional argument parsing of\n> tar does not cluster option letters with option arguments.\n> \n> Of course, just using 'xof -' will work around this busybox bug.\n\nFrom my side, I prefer to squash that busybox bug.\nThis is the second time people complain about it,\nso it is a reoccurring problem.\n\nThe attached patch has been pushed to busybox git.\n\nfunction                                             old     new   delta\ntar_main                                             702     751     +49\n\n--\nvda\n\n\ndiff -d -urpN busybox.0/archival/tar.c busybox.1/archival/tar.c\n--- busybox.0/archival/tar.c\t2009-10-20 22:11:09.000000000 +0200\n+++ busybox.1/archival/tar.c\t2009-10-25 01:27:38.000000000 +0200\n@@ -841,6 +841,33 @@ int tar_main(int argc UNUSED_PARAM, char\n #if ENABLE_FEATURE_TAR_LONG_OPTIONS\n \tapplet_long_options = tar_longopts;\n #endif\n+#if ENABLE_DESKTOP\n+\tif (argv[1][0] != '-') {\n+\t\t/* Compat:\n+\t\t * 1st argument without dash handles options with parameters\n+\t\t * differently from dashed one: it takes *next argv[i]*\n+\t\t * as paramenter even if there are more chars in 1st argument:\n+\t\t *  \"tar fx TARFILE\" - \"x\" is not taken as f's param\n+\t\t *  but is interpreted as -x option\n+\t\t *  \"tar -xf TARFILE\" - dashed equivalent of the above\n+\t\t *  \"tar -fx ...\" - \"x\" is taken as f's param\n+\t\t * getopt32 wouldn't handle 1st command correctly.\n+\t\t * Unfortunately, people do use such commands.\n+\t\t * We massage argv[1] to work around it by moving 'f'\n+\t\t * to the end of the string.\n+\t\t * More contrived \"tar fCx TARFILE DIR\" still fails,\n+\t\t * but such commands are much less likely to be used.\n+\t\t */\n+\t\tchar *f = strchr(argv[1], 'f');\n+\t\tif (f) {\n+\t\t\twhile (f[1] != '\\0') {\n+\t\t\t\t*f = f[1];\n+\t\t\t\tf++;\n+\t\t\t}\n+\t\t\t*f = 'f';\n+\t\t}\n+\t}\n+#endif\n \topt = getopt32(argv,\n \t\t\"txC:f:Opvk\"\n \t\tIF_FEATURE_TAR_CREATE(   \"ch\"  )\n"}]}