delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/12/05/20:17:41

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
Date: Tue, 5 Dec 2000 20:15:13 -0500
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Possible bug in exec with symlink.
Message-ID: <20001205201513.A25484@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20001205193715 DOT A16956 AT redhat DOT com> <Pine DOT SOL DOT 3 DOT 91 DOT 1001205165758 DOT 26082E-100000 AT cse DOT cygnus DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.3.11i
In-Reply-To: <Pine.SOL.3.91.1001205165758.26082E-100000@cse.cygnus.com>; from mdejong@cygnus.com on Tue, Dec 05, 2000 at 05:02:15PM -0800

On Tue, Dec 05, 2000 at 05:02:15PM -0800, Mo DeJong wrote:
>On Tue, 5 Dec 2000, Christopher Faylor wrote:
>
>> Cygwin sets the argv[0] to be the name of the file which
>> invoked the script.
>> 
>> In this case, that's 'mygcc'.  'mygcc' is a symbolic link to a script
>> which is running a non-cygwin program.  The program is apparently
>> looking at argv[0] for some kind of inspiration but is unable to
>> decipher cygwin's symlink.
>
>Ahh, yes that is the problem. The Tcl shell is not a Cygwin
>app so it does not know how to follow the symlink.
>
>$ ./itcl_sh
>% set fd [open ip2k-elf-gcc r]
>file204
>% read $fd
>!<symlink>fake_toolchain
>
>It tries to run "<symlink>fake_toolchain" and puked on that.
>
>> So, I think that Cygwin is behaving appropriately.
>> 
>> cgf
>
>Thanks, I guess I will have to find some other way
>to implement this.

I thought that most modern shells had some kind of command to dereference
symbolic links like 'truename' or 'realname' or something like that.
I thought I'd used this kind of functionality for this kind of problem
in the past but apparently I was hallucinating since I can't figure out
how to do this now.

You could do something like a 'ls -l $0' and parse the output from that
but that's sort of ugly.

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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