*BSD News Article 12945


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!saimiri.primate.wisc.edu!sdd.hp.com!caen!nic.umass.edu!news.mtholyoke.edu!news.byu.edu!ns.novell.com!gateway.univel.com!fcom.cc.utah.edu!cs.weber.edu!terry
From: terry@cs.weber.edu (A Wizard of Earth C)
Subject: Re: VM problems w/unlimited memory?
Message-ID: <1993Mar18.175426.5433@fcom.cc.utah.edu>
Sender: news@fcom.cc.utah.edu
Organization: Weber State University  (Ogden, UT)
References: <1o4spvINNl1v@usenet.INS.CWRU.Edu> <1993Mar16.221837.10302@fcom.cc.utah.edu> <C41BtF.3vB@sugar.neosoft.com>
Date: Thu, 18 Mar 93 17:54:26 GMT
Lines: 42

In article <C41BtF.3vB@sugar.neosoft.com> peter@NeoSoft.com (Peter da Silva) writes:
>In article <1993Mar16.221837.10302@fcom.cc.utah.edu> terry@cs.weber.edu (A Wizard of Earth C) writes:
>> >Since Posix.2 allows multidigit file descriptor specs in redirections,
>> >there are no `safe' file descriptors for shells to use internally
>
>> I don't understand from the
>> code why it's necessary to get anything other than the next available
>> descriptor; the ones the shell cares about, 0, 1, and 2, are already
>> taken at that point; if nothing else a search starting a 3 would be
>> reasonable.
>
>What happens if some script then tries to use that FD with
>
>	foo 3>&1 &

The same that would happen if the script programmer were being "clever"
and tried to use the largest fd available and that were in use too,
except in your example, the problems wouldn't result in a machine panic.

I have to argue that a failure of "foo 3>&1 &" will be reassigning fd 3
for the child, not the parent process; otherwise, "foo 2>&1 &" would
fail catastrophically when you tried to redirect stderr to stdout.

Even if this were to result in a failure (I can build a failure case,
even if "foo 3>&1 &" isn't really a failure case itself), the failure
would effect only the user incorrectly using a direct rather than an
indirect reference to an fd instead of crashing the machine.

Crashing the machine is the arguably more severe error.


					Terry Lambert
					terry@icarus.weber.edu
					terry_lambert@novell.com
---
Any opinions in this posting are my own and not those of my present
or previous employers.
-- 
-------------------------------------------------------------------------------
                                        "I have an 8 user poetic license" - me
 Get the 386bsd FAQ from agate.berkeley.edu:/pub/386BSD/386bsd-0.1/unofficial
-------------------------------------------------------------------------------