delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/02/15/00:29:33

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=+GBQ5LWzAyVYO5KWln9E0ZHDkCz0mAZMIXl1Be/59DQ=; b=I7b52QgRgbtr+zjfTa6e5PKguoovF/ZWLgxPIVO8o5EEelCvoxFgVAX749WgiC520l udR+WzK2xOIPJZfRM0HdING1grU6h0ipdOBCykbZAnMhwVOSffQ/SrQtlFKeP5TTOoPs Zton4Caz0jRXBy5YKW610e6iLxLRnnommLRkdLEgaim9swsXGb4hrOGcJENzIri3dBMo L3fNQIVnNToHe1pS+VPBNxRNYYoD3iuYsXvJAy5fN57Wn0TSG4V8agYmiKLJy9WTf8GO gpsJRjmRQiYfrCVovbLi/cQbvjDoVeZduhX/IL48TEoshlZSUkx2JZhKrp1jxYyfboeI fpAw==
X-Received: by 10.58.213.37 with SMTP id np5mr1511132vec.54.1360906151143; Thu, 14 Feb 2013 21:29:11 -0800 (PST)
Message-ID: <511DC7A4.80701@centrych.org>
Date: Fri, 15 Feb 2013 00:29:08 -0500
From: Centrych Administrator <admin AT centrych DOT org>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Is this a bug or a behavior?
References: <511BBBD4 DOT 8090902 AT fastmail DOT fm> <CE9C056E12502146A72FD81290379E9A608E7C64 AT ENFIRHMBX1 DOT datcon DOT co DOT uk>
In-Reply-To: <CE9C056E12502146A72FD81290379E9A608E7C64@ENFIRHMBX1.datcon.co.uk>
X-Gm-Message-State: ALoCoQmO6a7qThPLCbnnb9Ywh01oKPLjfN29m5tmy7qV/YX9oXMlwCRDvsmsRqxU8SH8Ibd7Muh2
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

On 02/13/2013 11:55 AM, Adam Dinwoodie wrote:
> Yes. If you ask for a file, the file doesn't exist, but the file with 
> a .exe extension exists, Cygwin will refer you to the .exe version of 
> the file. See 
> <http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-exe>. 

Thanks, already aware of that, and it's why I raised this question.

> From that point of view it is; Cygwin is self-consistent, but the very 
> nature of attempting to write a Linux-like interface on a 
> fundamentally non-Linux like OS means such issues can't be avoided.

I'm not clear on what your standard for "self-consistent" is, or why 
filenames are an interface issue.

Those aside, consider these two lines:

     $ rm -rf * && mkdir a && touch grep && cp grep /bin/grep a
     $ rm -rf * && mkdir a && touch grep && cp /bin/grep grep a

The first line executes as expected while the second, which reverses the 
order of files, fails after copying the .exe with the following:

     cp: cannot create regular file `a/grep': File exists

Now, take these two sets:

     $ rm -rf * && touch foo grep && cp /bin/grep.exe .
     $ mv foo grep && ls -i

     $ rm -rf * && touch foo && cp /bin/grep.exe .
     $ mv -n foo grep

The first set works as expected while the second deletes grep.exe during 
the rename even though no-clobber is explicitly passed to mv.

> Nobody has yet suggested a more consistent alternative that still 
> allows, for example, a Linux shell script that calls unadorned "grep" 
> to work on Cygwin.

How can it ever be consistent while 'filename' and filename.exe' are 
allowed to exist in the same directory?

Is there some way to differentiate between a Windows .exe and a Cygwin 
binary, like grep.exe, that's intended to execute within the Cygwin 
environment?

> For your (I really hope) contrived example... 

Unfortunately, it wasn't contrived.  It was an actual question in a BASH 
scripting module that I unnecessarily have to slog through.



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