Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
To: cygwin@cygwin.com
X-Injected-Via-Gmane: http://gmane.org/
Path: not-for-mail
From: Joe Buehler <jbuehler@hekimian.com>
Newsgroups: gmane.os.cygwin
Subject: Re: RE : bash question, perhaps problem
Date: Thu, 27 Jun 2002 11:18:44 -0400
Lines: 28
Message-ID: <3D1B2CD4.4060207@hekimian.com>
References: <5.1.0.14.2.20020626062010.01b43240@pop3.cris.com> <000001c21d5e$661d9020$022b01c0@patin>
NNTP-Posting-Host: hekimian.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: main.gmane.org 1025191103 12630 206.205.138.10 (27 Jun 2002 15:18:23 GMT)
X-Complaints-To: usenet@main.gmane.org
NNTP-Posting-Date: Thu, 27 Jun 2002 15:18:23 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.0.0) Gecko/20020530
X-Accept-Language: en-us, en

bruno patin wrote:

> The problem we have is that we use a root value obtained by pwd and
> append to it what is given to us by the $0 variable.

I may misremember, but I think that at least one older UNIX version
did not use to provide the name of the script in $0.  I believe it
was a version of System V that would actually give you something like
/dev/fd/7 for $0.

A Google search for "argv /dev/fd" in fact yielded the following from
what appears to be an IRIX man page for the exec() system call:

Set-user-ID, set-group-ID interpreter files and those with	attached
capabilities are handled in a special manner.  If execution of an
interpreter file will change either the user or group ID or the file has
attached capabilities, IRIX will open the interpreter file	for reading
(subject to the read permissions of the interpreter file and the user and
group ID of the new process).   A pathname	corresponding to the
interpreter file descriptor will be substituted for the pathname of the
interpreter file in the argument list passed to the intepreter.  This
pathname will be of the form /dev/fd/N where N is the number of the
interpreter file descriptor.

It may work on the systems you usually use, but it's not portable.

Joe Buehler




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

