delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/12/18/09:19:25

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; q=dns; s=default; b=HnZEcABLfPqc1YYsiUQc7G6oWGwSI
L+i102o+CG+c7nDymoSVUxyZct6TuhMu9ZYoWJBWBYAhAdbJ1Q0DbD6oKvZoRZ9+
jukQv7OV95oJLbtXE4CTnygvtavLjA4onBXqU2SsTFc/cBh9AYkOu9vMw/onhj78
75R2GYwQ2a7qWw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; s=default; bh=QzI7JTfldkB87OJAKoAqfMQA7vM=; b=JNy
D/Eb90bV2ZHcxLF9hcj7iCKsjrwL7+IlhJ+PbrnUW4ho7Aa7fPxVpDnhnDe3SXr/
eY1nmXksItOyGaDpr08AxpOqsjNErd/NBEgpnLmOodHRngCAmgCYw+zexRo/z9pj
X0JWhSYR7m2FTSKa5cmPEnNi2BS4Fpx5YbjsoPv8=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,MIME_BASE64_BLANKS,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2
X-HELO: nihxway2out.hub.nih.gov
X-IronPortListener: Outbound_SMTP
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Ag0FAEiusVKcKEet/2dsb2JhbABZgwqBDYMDsliDBxiBAxZ0giUBAQEDARIREVUCAQgNCwICBiACAgIdExUQAQEEGxqHWgimaYodmHIXgSmNOBYigm41gRMEjliQKosogyuCKg
From: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder AT niaid DOT nih DOT gov>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: RE: Change in behavior of bash / if [
Date: Wed, 18 Dec 2013 14:18:27 +0000
Message-ID: <6CF2FC1279D0844C9357664DC5A08BA21F8DF5@MLBXV06.nih.gov>
References: <6CF2FC1279D0844C9357664DC5A08BA21F8C0A AT MLBXV06 DOT nih DOT gov> <52B11F9C DOT 9050100 AT redhat DOT com>
In-Reply-To: <52B11F9C.9050100@redhat.com>
MIME-Version: 1.0
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id rBIEJJuJ011439

Eric Blake sent the following at Tuesday, December 17, 2013 11:08 PM
>On 12/17/2013 08:02 PM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
>> Today, a script that I use every day stated giving me the following
>> error message.  (I grant that it might have started earlier and I
>> didn't notice.)  Note that although it gave the error message, the
>> script seems to still have worked.

In my original post, I should have reported that it is a bash script.

>> ./lddir: line 77: [: too many arguments
>>
>> Line 77 was as follows.  I'm testing whether $1 is "clip".
>>
>> if [ x$1 = xclip ]
>
>What was $1 at the time?

clip

>> I fixed it with this.
>>
>> if [ "x$1" = xclip ]
>
>Yes, this is the correct fix for the improper quotation of the earlier
>example.

But why would it need quoting unless the first argument unless the
command line is quoted and might have a space"?  It wasn't.  It was
called from a script that was being sourced by a bash interactive shell
as follows.

lddir clip

"clip is telling lddir to get its input from the clipboard instead of
the command line.  "clip" is never used with another argument.  The
calling script is being sourced because it is change the working
directory of the interactive shell.  And the path of that directory
is known to not have spaces.

>> 32-bit, everything was up to date.
>>
>> I've solved my problem, but the change was unexpected and, for me,
>> inexplicable, so I thought that I'd report it.
>
>Your quoting error would produce the same message on Linux; it is not
>cygwin-specific.
>>
>> Let me know if you want/need more information.
>
>Without knowing how $1 was set, I can only guess that it contained
>something with characters in $IFS and therefore the word-splitting of
>the unquoted use caused too many arguments to [.

For that, it would have to be called with $1 on the command line in
quotes, which it wasn't.  Something like the following.

lddir "111 one" 222 "three 333" 444

And then there's the fact that I've been using lddir with no changes
for the past year and it just started misbehaving now.

Speculation:  Since cygwin1.dll was updated last week, perhaps
something happened there.  But if no one else reports a similar
problem, it might be something peculiar to my installation and use
and not worth debugging.

Thanks for your response.

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019