X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Message-ID: <49EF0C6E.6010808@byu.net> Date: Wed, 22 Apr 2009 06:24:14 -0600 From: Eric Blake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: [1.7] Backslash incorrectly triggers DOS style path warning References: <49EC78A0 DOT 6050602 AT cornell DOT edu> <49EC7A7D DOT 2050706 AT cornell DOT edu> <20090420211453 DOT GB3143 AT ednor DOT casa DOT cgf DOT cx> <20090421235020 DOT GA593 AT ednor DOT casa DOT cgf DOT cx> <49EE7BC1 DOT 1070400 AT gmail DOT com> <49EF0674 DOT 9090605 AT cornell DOT edu> In-Reply-To: <49EF0674.9090605@cornell.edu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Ken Brown on 4/22/2009 5:58 AM: >> It is maybe getting globbed on the command-line because not >> protected by >> quoting and it contains pattern match chars? > > The text in question is in the definition of _known_hosts() in > /etc/bash_completion, in case someone wants to try to sort this out. Which looks like: COMPREPLY=($( awk 'BEGIN {FS=","} /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \ gsub(" .*$", "", $i); \ if ($i ~ /'$cur'/) {print $i} \ }}' "${kh[@]}" 2>/dev/null )); That looks properly quoted to me. Really, the question is why does awk call stat() on its first argument? Here's a simpler test case: $ echo hi > hi $ strace -o trace.txt gawk '{ print }' hi The strace is informative: 110 40766 [main] gawk 2804 build_argv: argv[0] = 'gawk' 453 41219 [main] gawk 2804 lstat64: entering 79 41298 [main] gawk 2804 normalize_posix_path: src { print } ... 37 42339 [main] gawk 2804 stat_worker: -1 = (\??\K:\cygwin-2\tmp\{ print }, 0x1DCB18) 96 42435 [main] gawk 2804 globify: argv[1] = '{ print }' 65 42500 [main] gawk 2804 build_argv: argv[2] = 'hi' 35 42535 [main] gawk 2804 build_argv: argc 3 with no further references to '{ print }' once awk is running. In other words, the problematic stat is occurring prior to main(), and it is not awk's fault, but rather cygwin's, that globify() is trying to dereference a non-file name and triggering the warning. Even the presence of { in a command line argument was enough to trigger globify(). But maybe that is an artifact of strace. Notice the difference between: $ ls '*' ls: cannot access *: No such file or directory $ strace -o trace.txt ls '*' hi trace.txt $ In other words, strace is mistakenly performing glob expansion on the subsidiary arguments to the program being traced, when we really wanted to trace ls with a literal argument of "*". - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9 AT byu DOT net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknvDG0ACgkQ84KuGfSFAYAmwgCeLrHqXzoge9i7hg4YDYoqkLIr 4YoAmwYjq9aYiYXDirAVYkfo93kk3B4Y =fu91 -----END PGP SIGNATURE----- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/