delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/09/14/23:54:39

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=1.0 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE,TW_YG,TW_ZY
X-Spam-Check-By: sourceware.org
X-Authority-Analysis: v=1.1 cv=nDD+kvg7J3j5g4cdWNAGMjYWcuyaa40dw2N2reZutTs= c=1 sm=0 a=YPJmYKBAnK4A:10 a=kj9zAlcOel0A:10 a=0lsEwaAtgUHmJBbDowIRqQ==:17 a=nY2GoafvAAAA:8 a=nyGt8KavAAAA:8 a=sETyO-lgviKXnwg922QA:9 a=kExu1EjrONcJTnt74o54Fhvl96EA:4 a=CjuIK1q_8ugA:10 a=SwYLqWKyoV8A:10 a=0lsEwaAtgUHmJBbDowIRqQ==:117
Date: Tue, 14 Sep 2010 20:54:24 -0700
From: Keith Thompson <kst AT mib DOT org>
To: cygwin AT cygwin DOT com
Cc: Keith Thompson <kst AT mib DOT org>
Subject: tcsh filename substitution bug
Message-ID: <20100915035424.GA9001@nuthaus.mib.org>
MIME-Version: 1.0
User-Agent: Mutt/1.5.19 (2009-01-05)
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
Note-from-DJ: This may be spam

% cygcheck -c cygwin tcsh
Cygwin Package Information
Package              Version         Status
cygwin               1.7.5-1         OK
tcsh                 6.17.00.1-1     OK

I've noticed that certain file matching patterns in tcsh under Cygwin
are matching more files than they should.  In the cases I've noticed,
a pattern like *__* or *xx* matches files containing only a single
trailing '_' or 'x' character, respectively.

I do not see this problem with tcsh 6.17.00 under Ubuntu 9.04, nor do
I see it with tcsh 6.17.00 compiled from source under Cygwin on the
same system where I see the problem with the Cygwin-provided tcsh.

setup.exe says I have the latest tcsh.

Here's a script that demonstrates the problem:
========== CUT HERE ==========
#!/bin/tcsh -f

set nonomatch

set tmpdir = /tmp/$$
mkdir $tmpdir || exit 1
cd $tmpdir || exit 1

set ok

touch xyz zyx
echo Directory contents: *

set match = ( *x* ) ; set expected = ( xyz zyx )
if ("$match" == "$expected") then
    echo "*x* matched ( $match ), ok"
else
    echo "*x*, matched ( $match ), expected ( $expected )"
    unset ok
endif

set match = ( *xx* ) ; set expected = ( "*xx*" )
if ("$match" == "$expected") then
    echo "*xx* matched ( $match ), ok"
else
    echo "*xx*, matched ( $match ), expected ( $expected )"
    unset ok
endif

set match = ( *xxx* ) ; set expected = ( "*xxx*" )
if ("$match" == "$expected") then
    echo "*xxx* matched ( $match ), ok"
else
    echo "*xxx*, matched ( $match ), expected ( $expected )"
    unset ok
endif

echo ''
touch abcx
echo Directory contents: *

set match = ( *x* ) ; set expected = ( abcx xyz zyx )
if ("$match" == "$expected") then
    echo "*x* matched ( $match ), ok"
else
    echo "*x*, matched ( $match ), expected ( $expected )"
    unset ok
endif

set match = ( *xx* ) ; set expected = ( "*xx*" )
if ("$match" == "$expected") then
    echo "*xx* matched ( $match ), ok"
else
    echo "*xx*, matched ( $match ), expected ( $expected )"
    unset ok
endif

set match = ( *xxx* ) ; set expected = ( "*xxx*" )
if ("$match" == "$expected") then
    echo "*xxx* matched ( $match ), ok"
else
    echo "*xxx*, matched ( $match ), expected ( $expected )"
    unset ok
endif

cd
rm -rf $tmpdir

echo ''

if ($?ok) then
    echo "Passed"
    exit 0
else
    echo "Failed"
    exit 1
endif
========== AND HERE ==========

Here's the output I get with the Cygwin-provided tcsh:
========== CUT HERE ==========
Directory contents: xyz zyx
*x* matched ( xyz zyx ), ok
*xx*, matched ( zyx ), expected ( *xx* )
*xxx* matched ( *xxx* ), ok

Directory contents: abcx xyz zyx
*x* matched ( abcx xyz zyx ), ok
*xx*, matched ( abcx zyx ), expected ( *xx* )
*xxx*, matched ( zyx ), expected ( *xxx* )

Failed
========== AND HERE ==========

And here's the output I get with tcsh compiled from source
on the same system:
========== CUT HERE ==========
Directory contents: xyz zyx
*x* matched ( xyz zyx ), ok
*xx* matched ( *xx* ), ok
*xxx* matched ( *xxx* ), ok

Directory contents: abcx xyz zyx
*x* matched ( abcx xyz zyx ), ok
*xx* matched ( *xx* ), ok
*xxx* matched ( *xxx* ), ok

Passed
========== AND HERE ==========

-- 
Keith Thompson (The_Other_Keith) kst AT mib DOT org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

--
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

- Raw text -


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