bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/5215] New: [regression] ld/genscripts.sh rev 1.24 breaks on Free


From: j at uriah dot heep dot sax dot de
Subject: [Bug ld/5215] New: [regression] ld/genscripts.sh rev 1.24 breaks on FreeBSD's /bin/sh
Date: 24 Oct 2007 07:54:41 -0000

Revision 1.24 of ld/genscripts.sh introduced the following code:

if test -n "${BASH+set}"; then
  source_em()
  {
    local current_script="$em_script"
    em_script=$1
    . $em_script
    em_script=$current_script
  }
  fragment()
  {
    local lineno=$[${BASH_LINENO[0]} + 1]  ###### <---
    echo >> e${EMULATION_NAME}.c "#line $lineno \"$em_script\""
    cat >> e${EMULATION_NAME}.c
  }

This breaks on FreeBSD's /bin/sh with the following message:

.././ld/genscripts.sh: 403: Syntax error: Bad substitution

(Line 403 is marked with ###### <--- above.)

The issue here is that FreeBSD's /bin/sh simply does not recognize the
*syntax* of the array substitution, so the test for ${BASH} above
doesn't matter at all -- the shell aborts parsing the script at that
point.

So somehow, the test for using a bash should either be moved into a
configure-time substitution, or the array (and math, too?) substitution
should be replaced by something else that can be handled by any flavor
of /bin/sh.

FreeBSD's /bin/sh doesn't choke on the $[] math invoked (it simply doesn't
sustitute anything), yet I figure some other /bin/sh might also consider
that a syntax error.  IMHO it's just riding on the safe side to use plain
old expr(1).

-- 
           Summary: [regression] ld/genscripts.sh rev 1.24 breaks on
                    FreeBSD's /bin/sh
           Product: binutils
           Version: 2.18
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: j at uriah dot heep dot sax dot de
                CC: bug-binutils at gnu dot org
  GCC host triplet: freebsd-*-*


http://sourceware.org/bugzilla/show_bug.cgi?id=5215

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]