| delorie.com/archives/browse.cgi | search |
| 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:mime-version:date:message-id:subject:from:to | |
| :content-type:content-transfer-encoding; q=dns; s=default; b=I2s | |
| J1weSDoz3wGYMIbxOjoQovlgxoGgwvXNfa+zZBgqKPiUFQRojCQpIJxFjLZh2Zfu | |
| w0tTpyL6gwl3xoUcB+QEXpwbEmM+CrI4RA0lBEGwevzIF8f9p2ComFja7pPSkD9z | |
| k0owZUBPtIAtOjKDLNAH23xuSeFVYvnrxsbKsMk8= | |
| 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:mime-version:date:message-id:subject:from:to | |
| :content-type:content-transfer-encoding; s=default; bh=7sleWpjd9 | |
| puZkwWJ94tXW84q8hI=; b=v/T8gPIB6jw+z3ybkbncaXgU81I4wmilW5pwPs7/H | |
| sruES6CRREkmSYhZn7edyGU36MTQzZ3vnbpbAs8hkCIhuQv2LaFGqtiMSfdTnUwA | |
| bY9dURIZeTPsTwkrU/cqow4fX/l4D3YZVHFVD6WSyeMfzhQTHV7gCoGyOwvLfEpO | |
| Gc= | |
| 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 |
| X-Spam-SWARE-Status: | No, score=3.2 required=5.0 tests=AWL,BAYES_05,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.2 |
| MIME-Version: | 1.0 |
| X-Received: | by 10.68.164.1 with SMTP id ym1mr13220799pbb.33.1376305602718; Mon, 12 Aug 2013 04:06:42 -0700 (PDT) |
| Date: | Mon, 12 Aug 2013 21:06:42 +1000 |
| Message-ID: | <CA+t=3-91S0PSp3nYZgrNg9ymzx+9gB=HSTvT6EZznZX2Q=Jrgg@mail.gmail.com> |
| Subject: | bash ignoring set -f on windows |
| From: | Craig Ryan <cryan DOT dublin AT gmail DOT com> |
| To: | cygwin AT cygwin DOT com |
| X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id r7CB6vfZ016897 |
The cygwin bash is ignoring noglob on windows 7 and XP. Cygwin
details: CYGWIN_NT-6.1 1.7.17(0.262/5/3) 2012-10-19 14:39
To illustrate, here is a script which calls a java application
which I expect to have wildcards passed through as-is to the java
main String[ ]args. Source to both as follows.
----------------------------
#!/bin/bash
set -f
ARGS=$@
ARGSQ="$@"
# Try both quoted/unquoted ARGS
echo unquoted call to TestApp
$JAVA_HOME/bin/java TestApp $ARGS
echo quoted call to TestApp
$JAVA_HOME/bin/java TestApp $ARGSQ
-----------------------------
The java app is simply:
public class TestApp {
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("WRONG!! NO ARGS AT ALL - should be '*'");
return;
}
if (args[0].equals("*")) {
System.out.println("GOT '*'!!");
} else {
System.out.println("WRONG!! got '" + args[0] + "' - should be '*'");
}
}
}
From a cygwin terminal, cd to the directory containing the java
source and script. Compile the app and run as follows
$ javac TestApp.java
$ ./bash.sh ‘*’
That’s asterix in single quotes. I expect to see
GOT '*'!!
But I get
WRONG!! got 'bash.sh’ – should be ‘*’
The ‘set –f’ in the script is ignored and therefore wildcard
expansion is enabled for the java invocation. If I comment out
‘set –f’ the result is the same.
If I run the same test on a Mac the result is that with ‘set –f’
uncommented no wildcard expansion occurs and with ‘set –f’ active
expansion does occur as expected.
I am shipping a similar script with my open source app so I need
to instruct users the easiest way to fix this just for cygwin.
Is this a known problem? Can you please outline what the
issue/bug/limitation is, and the least impact fix a user can be
expected to cope with please?
The following isn't reasonable to expect from users:
- Full scale cygwin version upgrades (a few file updates are OK)
- Any requirement to build any cygwin or other software from source
- Having to set a global or environment setting which affects
software other than my app
I can live with workarounds within my own script (bash.sh above)
so long as it works in non-cygwin shells.
I’d really appreciate help on this.
thanks,
Craig
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |