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:to:from:subject:date:message-id:references :mime-version:content-type; q=dns; s=default; b=fZ1S9jvI/GqoB8gb alaejabIHNv2/sykyPCSLXOl/YtFxCzvGipEyN+zhQpeREjBlYvKvx3rTizXfurd 7rQc/gcVBjAX6jIU+igw4u8eR1VP06Oyv1Uj20ziHcHTcYG4rUsGFAQ7slTLDfxp pZyd6jykoeuPnzBe7UNn3rqgfXc= 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:to:from:subject:date:message-id:references :mime-version:content-type; s=default; bh=hGy5/Pb9UStqz2q7seMeRB l7EHE=; b=cvqvmO5YVjbZOKv3y2ugp+ZN/yyHE2qsO1JtcRjRqg45wAWMGymouL c6wZ7DqXitP5H/WE5nohQKRcwGx++42bRf9K4AEV86GHpmvNWXXrzddA9ZoZvFJ1 ENBUxP9W6aSMjZ2mv8GWIAyplhqIl6nED985OLTenVt7aYBVXMNKA= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-4.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 To: cygwin AT cygwin DOT com From: Achim Gratz Subject: Re: bash ignoring set -f on windows Date: Mon, 12 Aug 2013 20:23:04 +0200 Lines: 125 Message-ID: <871u5yvkdz.fsf@Rainer.invalid> References: Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Craig Ryan writes: >> I think putting the blame on bash is premature. Try replacing the call to >> java with a script of your own to see what arguments it get called with, > > How so? This works on un*x platforms so what am I missing? You are missing that Windows is not Un*x. On Windows, each application is expected to do their own globbing (if it cares to do it at all), since cmd doesn't do that. > The script IS my own, if you execute the script as suggested what > results did you get with cygwin/windows? I can't run your script since you didn't say how you call it or what the version of Java is that you were using. I did point out that while you were looking at bash, you ignored the fact that Java itself would attempt to expand glob characters. But you can make a new empty directory, put these two files in there: --8<---------------cut here---------------start------------->8--- #!/bin/bash # this is t1.sh set -f ARGS=$@ ARGQ="$@" echo "noglob/unquoted/unquoted:" $ARGS ./t2.sh "-->" $ARGS "<--" echo "noglob/quoted/unquoted: " $ARGQ ./t2.sh "-->" $ARGQ "<--" echo "noglob/unquoted/quoted: $ARGS" ./t2.sh "-->" "$ARGS" "<--" echo "noglob/quoted/quoted: $ARGQ" ./t2.sh "-->" "$ARGQ" "<--" set +f echo " glob/unquoted/unquoted:" $ARGS ./t2.sh "-->" $ARGS "<--" echo " glob/quoted/unquoted: " $ARGQ ./t2.sh "-->" $ARGQ "<--" echo " glob/unquoted/quoted: $ARGS" ./t2.sh "-->" "$ARGS" "<--" echo " glob/quoted/quoted: $ARGQ" ./t2.sh "-->" "$ARGQ" "<--" --8<---------------cut here---------------end--------------->8--- --8<---------------cut here---------------start------------->8--- #!/bin/bash # this is t2.sh set -f echo " ==> noglob/unquoted: " $@ echo " ==> noglob/quoted: $@" set +f echo " ==> glob/unquoted: " $@ echo " ==> glob/quoted: $@" --8<---------------cut here---------------end--------------->8--- make them both executable and then run t1.sh. This should produce the following output: --8<---------------cut here---------------start------------->8--- $ ./t1.sh "*" noglob/unquoted/unquoted: * ==> noglob/unquoted: --> * <-- ==> noglob/quoted: --> * <-- ==> glob/unquoted: --> t1.sh t2.sh <-- ==> glob/quoted: --> * <-- noglob/quoted/unquoted: * ==> noglob/unquoted: --> * <-- ==> noglob/quoted: --> * <-- ==> glob/unquoted: --> t1.sh t2.sh <-- ==> glob/quoted: --> * <-- noglob/unquoted/quoted: * ==> noglob/unquoted: --> * <-- ==> noglob/quoted: --> * <-- ==> glob/unquoted: --> t1.sh t2.sh <-- ==> glob/quoted: --> * <-- noglob/quoted/quoted: * ==> noglob/unquoted: --> * <-- ==> noglob/quoted: --> * <-- ==> glob/unquoted: --> t1.sh t2.sh <-- ==> glob/quoted: --> * <-- glob/unquoted/unquoted: t1.sh t2.sh ==> noglob/unquoted: --> t1.sh t2.sh <-- ==> noglob/quoted: --> t1.sh t2.sh <-- ==> glob/unquoted: --> t1.sh t2.sh <-- ==> glob/quoted: --> t1.sh t2.sh <-- glob/quoted/unquoted: t1.sh t2.sh ==> noglob/unquoted: --> t1.sh t2.sh <-- ==> noglob/quoted: --> t1.sh t2.sh <-- ==> glob/unquoted: --> t1.sh t2.sh <-- ==> glob/quoted: --> t1.sh t2.sh <-- glob/unquoted/quoted: * ==> noglob/unquoted: --> * <-- ==> noglob/quoted: --> * <-- ==> glob/unquoted: --> t1.sh t2.sh <-- ==> glob/quoted: --> * <-- glob/quoted/quoted: * ==> noglob/unquoted: --> * <-- ==> noglob/quoted: --> * <-- ==> glob/unquoted: --> t1.sh t2.sh <-- ==> glob/quoted: --> * <-- --8<---------------cut here---------------end--------------->8--- > I read this, I'm not sure what it provides as a solution? Apart from > the fact that I dont require java 7, what is the expected cygwin bash > glob behaviour? Maybe the above example convinces you that bash does respect the noglob switch, even on Cygwin. What Java does when it gets a command line with a globbing character is a different matter. It seems that it expects the glob character inside quotes or even quoted quotes, depending on version. Note that the outermost quotes will be removed by bash before Java gets to see it, so you will have to do something like "\"$@\"" or even "\\\"$@\\\"" to get this construct onto the commandline of Java unharmed. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Waldorf MIDI Implementation & additional documentation: http://Synth.Stromeko.net/Downloads.html#WaldorfDocs -- 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