delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/09/08:37:56

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <17B78BDF120BD411B70100500422FC6309E269@IIS000>
From: Bernard Dautrevaux <Dautrevaux AT microprocess DOT com>
To: "'DJ Delorie'" <dj AT redhat DOT com>, cygwin AT cygwin DOT com
Subject: RE: Trailing Periods on File Names
Date: Mon, 9 Apr 2001 13:54:29 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

> -----Original Message-----
> From: DJ Delorie [mailto:dj AT redhat DOT com]
> Sent: Friday, April 06, 2001 8:35 PM
> To: cygwin AT cygwin DOT com
> Subject: Re: Trailing Periods on File Names
> 
> 
> 
> Bernard Dautrevaux <Dautrevaux AT microprocess DOT com> writes:
> > In fact Windows not exactly ignores periods at the end of 
> file names:
> > writing a filename as "foo." asks windows NOT to search for 
> "foo.exe" or
> > "foo.bat" IF it needs to execute the file... This is allows 
> to execute "foo"
> > instead of "foo.exe" if both exist, just to add some more fun :-)
> 
> That's not windows, that's command.com or cmd.exe.  If you put "." at
> the end, it [wrongly] thinks there's and extension, and only searches
> for that extension, which in this case is blank.

I'm afraid I have to disagree: taken from the documentation of
'CreateProcess':

	If the filename does not contain an extension, .EXE is assumed. 
	If the filename ends in a period (.) with no extension, or the 
	filename contains a path, .EXE is not appended. 

That is not specifically command.com or cmd.exe that do this; that's WIN32
that specifies this behaviour (and implement it itself if you don't search
the PATH by yourself and provide a full path name).

Even under cygwin (at least 1.1.8(0.34/3/2)) I can get the following:

$ cp /usr/bin/ls.exe test1.exe
$ cp /usr/bin/cp.exe test1
$ ls -l test1*
-rwxr-xr-x   1 administ Aucun       63488 Apr  9 12:01 test1
-rwxr-xr-x   1 administ Aucun       62464 Apr  9 12:01 test1.exe
$ PATH=".:$PATH"
$ test1 --help
<skipped the help for ls>
$ test1. --help
<skipped the help for cp>
$ if [ -x test1 ]; then echo "test1 executable"; else echo "test1 not
executable"; fi
test1 executable
$ if [ -x test1. ]; then echo "test1. executable"; else echo "test1 not
executable"; fi
test1. executable
$ rm test1
$ ls -l test1*
-rwxr-xr-x   1 administ Aucun       62464 Apr  9 12:01 test1.exe
$ if [ -x test1. ]; then echo "test1. executable"; else echo "test1. not
executable"; fi
test1. not executable
$ if [ -x test1 ]; then echo "test1 executable"; else echo "test1 not
executable"; fi
test1 executable
$ mv test1.exe test1
mv: `test1.exe' and `test1' are the same file
$ mv test1.exe test1.
$ ls -l test1*
-rwxr-xr-x   1 administ Aucun       62464 Apr  9 12:01 test1
$ if [ -x test1 ]; then echo "test1 executable"; else echo "test1 not
executable"; fi
test1 executable
$ if [ -x test1. ]; then echo "test1. executable"; else echo "test1. not
executable"; fi
test1. executable

It then seems that for cygwin also a trailing "." means "no extension"; what
I don't know is if that is by design (of cygwin) or just an inherited WIN32
"peculiarity" :-)

Regards,

	Bernard

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux AT microprocess DOT com
		b DOT dautrevaux AT usa DOT net
-------------------------------------------- 

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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