delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/27/11:19:50

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
To: cygwin AT cygwin DOT com
X-Injected-Via-Gmane: http://gmane.org/
Path: not-for-mail
From: Joe Buehler <jbuehler AT hekimian DOT 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 DOT 1 DOT 0 DOT 14 DOT 2 DOT 20020626062010 DOT 01b43240 AT pop3 DOT cris DOT com> <000001c21d5e$661d9020$022b01c0 AT patin>
NNTP-Posting-Host: hekimian.com
Mime-Version: 1.0
X-Trace: main.gmane.org 1025191103 12630 206.205.138.10 (27 Jun 2002 15:18:23 GMT)
X-Complaints-To: usenet AT main DOT gmane DOT 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/

- Raw text -


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