Re: Is `#!/bin/sh' configurable?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Alexander Klimov <ask(at)wisdom(dot)weizmann(dot)ac(dot)il>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Is `#!/bin/sh' configurable?
Date: 2001-05-08 16:55:37
Message-ID: Pine.LNX.4.30.0105081845490.759-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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%(at)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(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-05-08 16:57:06 Re: Where `gcc -MMD' puts .d files
Previous Message Bruce Momjian 2001-05-08 16:28:08 Re: Is `#!/bin/sh' configurable?