Zsh Mailing List Archive
Messages sorted by:
Re: Possible bug in zargs
- X-seq: zsh-workers 30770
- From: Dima Kogan <zsh@xxxxxxxxxxxxxxxxxxxx>
- Subject: Re: Possible bug in zargs
- Date: Tue, 30 Oct 2012 10:53:47 -0700
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:cc:subject:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding; s=smtpout; bh=i/EvKxmp43KKXN4CfAEOCE 1vGKU=; b=Nj4C3uvDeLGo40ehkDIDaSVBkuWi6kvK1i//5q/aQ/IHd1Bu2hIEEA W2bVsIZV4//MelYCMb3LUBB3Q3UbZYWHyy4T8S34f0kU961n0GwaieHkOYw2cnxN hnMnGjtcgt+EpAaWUVeCym9/nZz/0STczr47WCVMg+7Ww5a5OwH9U=
- In-reply-to: <121030090909.ZM7599@torch.brasslantern.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <firstname.lastname@example.org> <email@example.com> <121030090909.ZM7599@torch.brasslantern.com>
> On Tue, 30 Oct 2012 09:09:09 -0700
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Oct 30, 12:05am, Dima Kogan wrote:
> } Attached is a patch that fixes this. There was some misbehaving logic
> } in the script. I don't understand why that logic was ever necessary.
> } Does anybody know why the value of $n was connected to the value of $c
> } at all?
> Sorry, meant to reply to this thread earlier but I had an unusually busy
> weekend. Short answer: The previous behavior was the intended behavior
> and I'm going to recommend against accepting this patch.
> $n represents the maximum number of arguments that may be passed to the
> called command. NOT the maximum number of arguments that may be taken
> from the input list and added to the other arguments of the command, but
> the maximum that may be passed to the command, period.
> $c is the number of arguments of the command that appear outside of the
> input list, that is, the number of arguments that trail the end of the
> whole zargs construct. In your example:
> } > dima@shorty:/tmp$ zargs -n1 -- * -- ls -l
> } > zargs: argument list too long
> You've said that "ls" should be passed at most one argument (-n1). That
> one argument is "-l". Therefore there is no room to pass any of the
> arguments from the input list (expansion of "*") without passing too
> many arguments, so you get the error.
> This may seem silly your example above, but it could be very important
> if for example you're using a larger value of -n with some sort of
> $(command) substitution generating the command for zargs to execute.
> What you actually want in your example is this:
> zargs -l1 -- * -- ls -l
> The manual page explains this:
> The options -i, -I, -l, -L, and -n differ slightly from their
> usage in xargs. There are no input lines for zargs to count, so
> -l and -L count through the INPUT list, and -n counts the number
> of arguments passed to each execution of COMMAND, _including_ any
> ARG list. Also, any time -i or -I is used, each INPUT is
> processed separately as if by `-L 1'.
Thanks, Bart. I indeed missed that part of the doc. Sorry for the false alarm.
Messages sorted by: