Re: Is `#!/bin/sh' configurable? - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Is `#!/bin/sh' configurable?
Date
Msg-id Pine.LNX.4.30.0105081845490.759-100000@peter.localdomain
Whole thread Raw
In response to Is `#!/bin/sh' configurable?  (Alexander Klimov <ask@wisdom.weizmann.ac.il>)
List pgsql-hackers
Alexander Klimov writes:

> On some systems /bin/sh is not Burne Shell, e.g. /bin/sh is tcsh, but
> there is /bin/sh5.

/bin/sh is a Bourne shell on Ultrix, just a particularly old and wacky
one.

> It is looks like there is already knowledge about it in
> the system: Makefile.ultrix4 has `SHELL=/bin/sh5' in it, but configure
> thinks something else: config.status has `s%@SHELL@%/bin/sh%g'.

Autoconf inserts this automatically because some makes inherit the value
of SHELL from the environment, which is a silly thing to do.  We don't use
this because we use GNU make.

> The result of the mess is that scripts like initdb are installed with
> `#!/bin/sh', but they has function definition and tcsh complain about
> usage of '('.

No, the Ultrix shell simply doesn't support shell functions.  AFAIK it's
the only Bourne shell still on the planet that does that.  The short
answer might be not to use shell functions.  The one in initdb could
probably be replaced by a trap.  But the Ultrix /bin/sh is broken in
subtle and weird ways beyond that and it's too much effort to work around
this.  Even the autoconf guys think so these days.

A better answer would probably be making the #! /bin/sh substitutable.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: UserLock oddity with Limit
Next
From: Bruce Momjian
Date:
Subject: Re: Is `#!/bin/sh' configurable?