Is `#!/bin/sh' configurable?

Started by Alexander Klimovover 24 years ago6 messages
#1Alexander Klimov
ask@wisdom.weizmann.ac.il

Hi.

On some systems /bin/sh is not Burne Shell, e.g. /bin/sh is tcsh, but
there is /bin/sh5. 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'. (This is
really unrelated, because `src/bin/initdb/initdb.sh' has `#! /bin/sh'
hardcoded in it)

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 '('.

BTW: After hand substitution I reach the point of
IpcSemaphoreCreate: semget(key=4, num=17, 03600) failed: No space left on
device
The problem is that I have no idea how to enlarge the parameters on
`ULTRIX black 4.3 1 RISC', and it is looks like PG has no FAQ for
it. Anybody knows how to do it?

Regards,
ASK

#2Doug McNaught
doug@wireboard.com
In reply to: Alexander Klimov (#1)
Re: Is `#!/bin/sh' configurable?

Alexander Klimov <ask@wisdom.weizmann.ac.il> writes:

Hi.

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

*violent retching sounds*

IMHO, any system where /bin/sh doesn't point to an at-least-somewhat
Bourne-compatible shell is broken by definition... Who perpetrated
this atrocity?

-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time... --Dylan

#3Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Alexander Klimov (#1)
1 attachment(s)
Re: Is `#!/bin/sh' configurable?

Hi.

On some systems /bin/sh is not Burne Shell, e.g. /bin/sh is tcsh, but
there is /bin/sh5. 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'. (This is
really unrelated, because `src/bin/initdb/initdb.sh' has `#! /bin/sh'
hardcoded in it)

Actually, Makefile.ultrix will override what is in config.status, so
that part is OK.

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 '('.

It is hard to feel sorry for OS's that have /bin/sh as something that is
not at least moderately compatible with the Bourne sh.

However, I am applying the following patch to allow SHELL set in
Makefile.* to control what is used by initdb. I have not changed any
other commands because I don't want to start making this change all over
when it is not necessary.

BTW: After hand substitution I reach the point of
IpcSemaphoreCreate: semget(key=4, num=17, 03600) failed: No space left on
device
The problem is that I have no idea how to enlarge the parameters on
`ULTRIX black 4.3 1 RISC', and it is looks like PG has no FAQ for
it. Anybody knows how to do it?

Sorry, I don't know.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Attachments:

/bjm/difftext/plainDownload
Index: src/bin/initdb/Makefile
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/bin/initdb/Makefile,v
retrieving revision 1.25
diff -c -r1.25 Makefile
*** src/bin/initdb/Makefile	2001/02/18 18:33:59	1.25
--- src/bin/initdb/Makefile	2001/05/08 16:16:54
***************
*** 18,23 ****
--- 18,24 ----
  initdb: initdb.sh $(top_builddir)/src/Makefile.global
  	sed -e 's/@MULTIBYTE@/$(MULTIBYTE)/g' \
  	    -e 's/@VERSION@/$(VERSION)/g' \
+ 	    -e 's,@SHELL@,$(SHELL),g' \
  	    -e 's,@bindir@,$(bindir),g' \
  	    -e 's,@datadir@,$(datadir),g' \
  	  $< >$@
Index: src/bin/initdb/initdb.sh
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/bin/initdb/initdb.sh,v
retrieving revision 1.123
diff -c -r1.123 initdb.sh
*** src/bin/initdb/initdb.sh	2001/03/27 05:45:50	1.123
--- src/bin/initdb/initdb.sh	2001/05/08 16:16:54
***************
*** 1,4 ****
! #! /bin/sh
  #-------------------------------------------------------------------------
  #
  # initdb creates (initializes) a PostgreSQL database cluster (site,
--- 1,4 ----
! #!@SHELL@
  #-------------------------------------------------------------------------
  #
  # initdb creates (initializes) a PostgreSQL database cluster (site,
#4Peter Eisentraut
peter_e@gmx.net
In reply to: Alexander Klimov (#1)
Re: Is `#!/bin/sh' configurable?

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

#5Alexander Klimov
ask@wisdom.weizmann.ac.il
In reply to: Doug McNaught (#2)
Re: Is `#!/bin/sh' configurable?

On 8 May 2001, Doug McNaught wrote:

Alexander Klimov <ask@wisdom.weizmann.ac.il> writes:

Hi.

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

*violent retching sounds*

IMHO, any system where /bin/sh doesn't point to an at-least-somewhat
Bourne-compatible shell is broken by definition... Who perpetrated
this atrocity?

Sorry, I was misleaded by

sh -c 'echo $SHELL'

/bin/tcsh

The /bin/sh is sh, but not SysV compatible -- there is /bin/sh5 for that.

Regards,
ASK

#6Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Alexander Klimov (#5)
Re: Re: Is `#!/bin/sh' configurable?

We worked around the Ultrix /bin/sh problem for initdb. If that is the
only place there is a problem, we can keep the fix for 7.2.

On 8 May 2001, Doug McNaught wrote:

Alexander Klimov <ask@wisdom.weizmann.ac.il> writes:

Hi.

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

*violent retching sounds*

IMHO, any system where /bin/sh doesn't point to an at-least-somewhat
Bourne-compatible shell is broken by definition... Who perpetrated
this atrocity?

Sorry, I was misleaded by

sh -c 'echo $SHELL'

/bin/tcsh

The /bin/sh is sh, but not SysV compatible -- there is /bin/sh5 for that.

Regards,
ASK

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026