delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/07/02:39:14

From: M DOT A DOT Bukin AT inp DOT nsk DOT su
To: djgpp AT delorie DOT com
Subject: Re: /dev/null problems with bash when rebuild from sources
References: <Pine DOT SUN DOT 3 DOT 91 DOT 981006142949 DOT 17118T-100000 AT is>
Date: 07 Oct 1998 12:31:50 +0700
In-Reply-To: Eli Zaretskii's message of "Tue, 6 Oct 1998 14:30:10 +0300 (IDT)"
Message-ID: <204sthx7i1.fsf@Sky.inp.nsk.su>
Lines: 64
X-Mailer: Gnus v5.5/Emacs 19.34
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> writes:

> On 4 Oct 1998 M DOT A DOT Bukin AT inp DOT nsk DOT su wrote:
> 
> > djgpp 20:30:51> SYSROOT=$DJDIR
> >  20:31:01> echo $SYSROOT
> > d:/comp/djgpp
> >  20:31:07> echo test > /dev/null
> > bash: /dev/null: No such file or directory (ENOENT)
> 
> You are NOT supposed to set SYSROOT to anything but a root of a
> certain drive.  That is, SYSROOT=c: is okay (and /dev/null will work
> then).  DJGPP only supports /dev/null if /dev is at the top level,
> either as /dev/null or X:/dev/null (where X: is any drive letter).  In
> the case above, the library sees d:/comp/djgpp/dev/null, since Bash
> prepends $SYSROOT before it calls any library functions, and that name
> does not get mapped into NUL.

  Let me quote from bash's readme.dos:

...
SPECIAL VARIABLES:

  o SYSROOT (optional)
      Fixed root system directory (default = invalid)
      This variable requires absolute path (need not last slash)
      Can be included double slashed drive name
      (e.g.)
        SYSROOT=e:
	SYSROOT=e:/root
        SYSROOT=//e
...

> I don't think it is right for the library to handle such cases, since
> that would make `dev' special and will essentially preclude any
> directory to have such name.  Right now, you can have `dev' anywhere
> but at the top level, which is already bad enough, IMHO (several
> people got burnt by that, and it is now in the FAQ).

IMHO, replacing `/dev/something' with `something' is not good.  It
does not add much for portability.  Those devices that are present on
all or most Unix systems can be treated specially, e.g.
'/dev/null' => 'NUL', '/dev/tty' => 'CON' and maybe '/dev/lp' => 'PRN'.
Other devices either don't have standard names across different OSes,
or have no matching DOS device with the same functionality or have no
IOCTL support in DJGPP.

IMHO, bash should handle `/dev' specially itself.  AFAIK, the most
common assumptions made by Unix programmers are:

/dev/null (and maybe /dev/tty)
/tmp
/bin/{cp|rm...} (mostly in shell scripts and Makefiles).

Current implementation of SYSROOT support makes it easier to have
`/tmp' and `/bin' on one drive and access them from any other drive.
But if one has plenty of room on this drive, why not build packages
there and then `/bin' and `/tmp' will work just fine.  Or SYSROOT can
be pointed to $DJDIR, but then `/dev/null' will be broken.  That's why
I think that current implementation of SYSROOT support is either
broken or useless (the same applies to `//drive/path' notation).

-- 
Michael Bukin

- Raw text -


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