[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/6854] New: Use of BASH_LINENO[0] in ld/genscripts.sh prevents us
From: |
martinwguy at yahoo dot it |
Subject: |
[Bug ld/6854] New: Use of BASH_LINENO[0] in ld/genscripts.sh prevents use of dash |
Date: |
25 Aug 2008 16:05:14 -0000 |
Hi!
In building a complete cross-toolchain with CONFIG_SHELL=/bin/ash (-> dash) is
frustrated by a single line in ld/genscripts.sh:
...
if test -n "${BASH+set}"; then
printenv | grep BASH
source_em()
{
local current_script="$em_script"
em_script=$1
. $em_script
em_script=$current_script
}
fragment()
{
local lineno=$[${BASH_LINENO[0]} + 1] # <==== dash dies here
echo >> e${EMULATION_NAME}.c "#line $lineno \"$em_script\""
cat >> e${EMULATION_NAME}.c
}
else
...
Although dash doesn't execute the BASH_ code, it still dies parsing it, saying:
binutils-2.18/ld/genscripts.sh: 403: Syntax error: Bad substitution
Using dash knocks 35% off the elapsed build time for the toolchain compared to
bash - is this line-number-reporting code really worth it?
One fix is to drop the complex "then" clause leaving the body of the simple
"else" clause.
Another, keeping the exact same line-number bash functionality in a
non-dash-poisonous way is to achieve the same effect, substituting for the
fragment() function the following code:
alias fragment='em_lineno=$LINENO; fragment_em'
fragment_em()
{
local lineno=$[$em_lineno + 1]
echo >> e${EMULATION_NAME}.c "#line $lineno \"$em_script\""
cat >> e${EMULATION_NAME}.c
}
I've tested this; with bash the files generated by genscripts.sh are identical
to those made with the original version, while using CONFIG_SHELL=/bin/dash the
binutils build finishes in
--
Summary: Use of BASH_LINENO[0] in ld/genscripts.sh prevents use
of dash
Product: binutils
Version: 2.18
Status: NEW
Severity: minor
Priority: P2
Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: martinwguy at yahoo dot it
CC: bug-binutils at gnu dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=6854
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
- [Bug ld/6854] New: Use of BASH_LINENO[0] in ld/genscripts.sh prevents use of dash,
martinwguy at yahoo dot it <=