delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/06/15:54:09

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 6 Nov 2009 21:53:47 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: src/winsup/cygwin ChangeLog syscalls.cc
Message-ID: <20091106205347.GT26344@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20091105144413 DOT 31963 DOT qmail AT sourceware DOT org> <4AF30801 DOT 7090508 AT users DOT sourceforge DOT net> <20091105173450 DOT GQ26344 AT calimero DOT vinschen DOT de> <20091105180847 DOT GA1918 AT ednor DOT casa DOT cgf DOT cx> <20091105181732 DOT GB1918 AT ednor DOT casa DOT cgf DOT cx> <20091105182225 DOT GT26344 AT calimero DOT vinschen DOT de> <20091105183135 DOT GC1918 AT ednor DOT casa DOT cgf DOT cx> <20091106122925 DOT GE26344 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20091106122925.GE26344@calimero.vinschen.de>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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 Nov  6 13:29, Corinna Vinschen wrote:
> On Nov  5 13:31, Christopher Faylor wrote:
> > On Thu, Nov 05, 2009 at 07:22:25PM +0100, Corinna Vinschen wrote:
> > >On Nov  5 13:17, Christopher Faylor wrote:
> > >> On Thu, Nov 05, 2009 at 01:08:47PM -0500, Christopher Faylor wrote:
> > >> >On Thu, Nov 05, 2009 at 06:34:50PM +0100, Corinna Vinschen wrote:
> > >> >>Let's see:
> > >> >>
> > >> >>  rename ("foo.exe", "perl5.10.0.exe")  result: perl5.10.0.exe
> > >> >>  rename ("foo.exe", "perl5.10.0")      result: perl5.10.0
> > >> >>  rename ("foo", "perl5.10.0.exe")      result: perl5.10.0.exe
> > >> >>  rename ("foo", "perl5.10.0")          result: perl5.10.0
> > >> >>
> > >> >>The latter one is a problem, because that's what happens when calling
> > >> >>
> > >> >>  strip perl5.10.0
> > >> >>
> > >> >>so after strip the binary is missing a .exe suffix.
> > >> >>
> > >> >>Sigh.
> > >> >>
> > >> >>Is there any *reliable* solution to this problem, other than never to
> > >> >>add a .exe suffix?
> > >> >
> > >> >Isn't the reliable-but-slow method to check the magic at the beginning
> > >> >of the file to see if it actually is a .exe?  I'm not sure we want to do
> > >> >that though.
> > >> 
> > >> Which is, of course, what we're doing.  Duh.
> > >> 
> > >> I see why the strip case is problematic but I can't think of a way to
> > >> fix it since the "state" of the temporary file is lost between stripping
> > >> and renaming.
> > >
> > >Right.  That's why I thought that any suffix given in the target file
> > >name should be sufficient to avoid appending the .exe suffix, but
> > >apparently it isn't.  Probably we would need to check for any kind
> > >of Windows executable suffix like .exe, .sys, .com.  I have to admit,
> > >though, that I never saw a .src suffix for a Windows binary...
> > 
> > Well, in this case we could just look for alphabetic suffixes.  But that's
> > probably too kludgy.
> 
> Worth a try, at least.

I implemented an explicit test for .exe, .com, .sys, and .scr.  This
test can be easily extended with more suffixes as we go along.  Probably
a bit of optimization is also possible if necessary.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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