bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OSTYPE (etc.) is clobbered


From: Aric Blumer
Subject: OSTYPE (etc.) is clobbered
Date: Thu, 11 Jan 2001 09:30:08 -0500
User-agent: Mutt/1.2i

We have a system-wide standard for the environment variable OSTYPE
that has been in place for years. Whenever bash is run, it clobbers
this variable.  On my platform, it always sets it to linux-gnu. The
older versions of Bash set this to "linux" so this problem has not
popped up until now. This messes up Makefiles because make runs
subshells all the time, and the OSTYPE is being clobbered all the
time.

First, I can understand wanting to set this variable, but bash should
not set the variable if it is already set. This is a design decision
with which some may disagree, but you cannot disagree with the second
problem here:

Second, when bash is run as sh (e.g., /bin/sh) it is supposed to
behave as much as possible like the old Bourne Shell, yet bash2 still
clobbers OSTYPE. Does POSIX define how OSTYPE is handled?

It does the same thing, BTW, with MACHTYPE, etc.

Here's how to reproduce the problem:

% help | grep version
GNU bash, version 2.04.11(1)-release (i386-redhat-linux-gnu)
% export OSTYPE=vxworks-target
% echo $OSTYPE
vxworks-target
% /bin/sh -c 'echo $OSTYPE'
linux-gnu
% (/bin/sh -c 'echo $OSTYPE')
linux-gnu

Here is the same thing run on Solaris:
$ OSTYPE=vxworks-target
$ export OSTYPE
$ echo $OSTYPE
vxworks-target
$ /bin/sh -c 'echo $OSTYPE'
vxworks-target
$ (/bin/sh -c 'echo $OSTYPE')
vxworks-target

-- 
Aric D. Blumer
Marconi Communications
http://www.marconi.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]