From: Denys Vlasenko <vda.linux@googlemail.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
busybox@busybox.net, git@vger.kernel.org
Subject: Re: [PATCH] tar: on extract, -o is --no-same-owner
Date: Sun, 25 Oct 2009 01:32:04 +0200 [thread overview]
Message-ID: <200910250132.04187.vda.linux@googlemail.com> (raw)
In-Reply-To: <m2ocnxt6jl.fsf@whitebox.home>
[-- 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" )
prev parent reply other threads:[~2009-10-24 23:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200910250132.04187.vda.linux@googlemail.com \
--to=vda.linux@googlemail.com \
--cc=busybox@busybox.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rep.dot.nop@gmail.com \
--cc=schwab@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.