Bug 10061

Summary: The binutils suite will not compile on systems without a bash shell
Product: binutils Reporter: Mark Hobley <markhobley>
Component: binutilsAssignee: Alan Modra <amodra>
Status: RESOLVED FIXED    
Severity: normal CC: bug-binutils, Ralf.Wildenhues
Priority: P2    
Version: 2.19   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed: 2009-04-24 15:08:52

Description Mark Hobley 2009-04-11 12:29:13 UTC
The binutils suite will not compile on systems using a traditional Bourne
compatible shell. During build, the scripts will fail will errors as follows:

../../binutils-2.19.1/ld/genscripts.sh: /tmp/sh119278: cannot open
make[4]: *** [ei386linux.c] Error 1
make[4]: *** Waiting for unfinished jobs....
../../binutils-2.19.1/ld/genscripts.sh: /tmp/sh11884180: cannot open
make[4]: *** [eelf_i386.c] Error 1
make[4]: Leaving directory `/local/home/lfs/binutils-build/ld'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/local/home/lfs/binutils-build/ld'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/local/home/lfs/binutils-build/ld'
make[1]: *** [all-ld] Error 2
make[1]: Leaving directory `/local/home/lfs/binutils-build'
make: *** [all] Error 2

The cause appears to be due to the absence of a bash shell.

Running grep on the unpackaged source, it appears that the scripts contain some
bashisms as follows:

genscrba.sh:#!/bin/bash

The above error occurs on systems using either an ash shell or a heirloom shell.
Comment 1 Andreas Schwab 2009-04-11 15:21:13 UTC
Most likely the shell has a problem with the handing of here-documents.
Comment 2 Alan Modra 2009-04-12 05:38:03 UTC
Use of genscrba.sh is protected by a test of a bash specific variable, so that
should not be causing a problem.
Comment 3 Mark Hobley 2009-04-15 18:48:37 UTC
(In reply to comment #2)
> Use of genscrba.sh is protected by a test of a bash specific variable, so that
> should not be causing a problem.

These build scripts are big, messy and difficult to debug IMHO. It might be
better to have different directories of scripts for the different platforms,
rather than having massive scripts with hundreds of different branches, an then
trying to work out where these go wrong. (The KISS principle). Also, the
subdirectories seem to rely on the parent directory scripts, and the scripts are
tied to specific versions of autotools. (I would like to a libbinutils library,
and the components separated into separate packages, but I am strange like that.)

The problem might be to do with genscripts.sh:

checkbashisms genscripts.sh
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
possible bashism in genscripts.sh line 292 (sourced script with arguments):
(there is a whole series of these).

The first one appeared to be calling ld/emulparams/elf_i386.sh elf_i386.
I am not sure what the passed arguments do here.

Comment 4 Sourceware Commits 2009-04-24 15:06:44 UTC
Subject: Bug 10061

CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2009-04-24 15:06:17

Modified files:
	ld             : ChangeLog genscripts.sh 

Log message:
	PR 10061
	* genscripts.sh: Don't pass $EMULATION_NAME as $CUSTOMIZER_SCRIPT
	param.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.1972&r2=1.1973
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/ld/genscripts.sh.diff?cvsroot=src&r1=1.29&r2=1.30

Comment 5 Alan Modra 2009-04-24 15:11:22 UTC
Please let me know if the patch I've just committed fixes it for you.
Comment 6 Ralf Wildenhues 2009-06-04 06:00:52 UTC
Which system and shell is this on exactly?  Including version, please. Thanks.
Comment 7 Mark Hobley 2009-06-06 08:08:38 UTC
Subject: Re:  The binutils suite will not compile on systems without a bash shell



--- On Thu, 4/6/09, Ralf dot Wildenhues at gmx dot de <sourceware-bugzilla@sourceware.org> wrote:

> From: Ralf dot Wildenhues at gmx dot de <sourceware-bugzilla@sourceware.org>
> Subject: [Bug binutils/10061] The binutils suite will not compile on systems without a bash shell
> Which system and shell is this on exactly?  Including
> version, please. Thanks.

Hi Ralf. This is an experimental system currently in build. Unfortunately the broken toolchain has prevented completion of an an operational build.

The system currently has two shells:

hsh - The Heirloom Shell
ash - Kenneth Almquist's Shell

The ash shell has some bug fixes applied to the build scripts in order to make it compatible with Linux based systems.

Shell scripts are initially tested with the Heirloom shell for syntax portability, and are expected to run on a Bourne compatible shell (which will probably be ash), in a live environment.

The heirloom shell is version 050706:
http://heirloom.sourceforge.net/sh.html

The ash shell is ash386-0.2a:
ftp://markhobley.yi.org/packages/ash/ash386-0.2a.tar.bz2

I can give you specific system related information on request, if you require additional information. (Basically, this is currently a broken Debian, which will be butchered to remove Debian specifics, a new kernel will be build. The system will be more like Slackware when it becomes built. My systems currently run Debian for legacy reasons. I do not like this distribution.

Regards,

Mark.




Comment 8 Alan Modra 2009-06-06 11:20:01 UTC
Fixed