delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/31/17:00:25

X-Spam-Check-By: sourceware.org
Date: Tue, 31 Jan 2006 23:00:15 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: 1.5.19-4 exec family of functions find wrong file to execute
Message-ID: <20060131220015.GB15572@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20060123161255 DOT 21937 DOT qmail AT web30611 DOT mail DOT mud DOT yahoo DOT com>
Mime-Version: 1.0
In-Reply-To: <20060123161255.21937.qmail@web30611.mail.mud.yahoo.com>
User-Agent: Mutt/1.4.2i
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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 Jan 23 11:12, Martin wrote:
> I am attempting to invoke a command with
> execvp/execlp.  If a file appears in my PATH before
> the executable desired and has the same name as the
> executable, the first occurrence of the file name is
> used as the executable to invoke.  Even though the
> first file is NOT marked as executable.
> 
> The attached testcase illustrates this.
> Here's a simple shell log:
> 
> bash-3.00$ gcc test2.c -o test2
> bash-3.00$ PATH=/usr/bin:.
> bash-3.00$ test2 nopathnoext
> NoPathNoExt
> bash-3.00$ touch echo
> bash-3.00$ ls -l echo
> -rw-r--r-- 1 test None 0 Jan 21 15:39 echo
> bash-3.00$ test2 nopathnoext
> NoPathNoExt
> bash-3.00$ PATH=.:/usr/bin
> bash-3.00$ test2 nopathnoext
> nopathnoext: No such device or address
> bash-3.00$ rm -f echo
> bash-3.00$ test2 nopathnoext
> NoPathNoExt
> bash-3.00$ echo garbage > echo
> bash-3.00$ test2 nopathnoext
> nopathnoext: Permission denied
> bash-3.00$ ls -l echo
> -rw-r--r-- 1 test None 8 Jan 21 15:40 echo
> bash-3.00$ test2 nopathext
> NoPathExt
> bash-3.00$ test2 path
> Path
> 
> Is this normal behavior for execlp/execvp?
> Shouldn't the execution permission be set in order to
> execute it?

There was a tiny bug in the path evaluation.  I've applied a fix.  Please
give the next developer's snapshot a try.  http://cygwin.com/snapshots/


Thanks for the report and the testcase,
Corinna

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

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

- Raw text -


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