[Bug 473] Chapter 5: Textutils, Findutils, Gawk, Patch, Sed, Textutils Configure Command

Bill's LFS Login lfsbill at wlmcs.com
Fri Jan 17 03:52:22 PST 2003


A valid bug, I think.

On Fri, 17 Jan 2003 bugzilla at linuxfromscratch.org wrote:

> http://bugs.linuxfromscratch.org/show_bug.cgi?id=473
><snip>

> ------- Additional Comments From tush at yahoo.com  2003-01-17 01:04 -------
> Did you cut and paste from the book or did you type out the commands? if you did
> type out, the \ at the end of the line indicates that the command continues in
> the next line.
>
> BTW, for future reference, it would good to post to the lfs-support list/group
> to figure out whether it really is a bug. You will get more responses there.

I think the problem is real - the '&&' equates to a list rather than
a pipeline. This is the same as individual commands terminated with
newlines. Man bash 'Lists'. Variable assignments do *not* propagate
across those boundaries unless exported. So, when executed from the
command line in the current shell, the variable assignement does not
propagate to commands subsequent to the first following the assignment.

To test this, I made a dir in /tmp and created the following.

-rwxrwxrwx    1 lfsbill  lfsbill        41 Jan 17 06:09 configure
Contents:

    echo "doing configure: LDFLAGS=$LDFLAGS"

-rwxrwxrwx    1 lfsbill  lfsbill       112 Jan 17 06:09 make
Contents:

    if [ $# -eq 1 ] ; then
        echo "make: doing $1 and LDFLAGS=$LDFLAGS"
    else
	echo "make: LDFLAGS=$LDFLAGS"
    fi

At the command line I then type

     LDFLAGS="-static" ./configure && ./make && ./make install

Results:

    doing configure: LDFLAGS=-static
    make: LDFLAGS=
    make: doing install and LDFLAGS=

If I make a script,

-rwxrwxrwx    1 lfsbill  lfsbill        40 Jan 17 06:35 testit
Contents:
    ./configure && ./make && ./make install

and then run

    LDFLAGS=-static ./testit

everything works as expected, due to the exporting of the variable into
the subshell. Results:

    doing configure: LDFLAGS=-static
    make: LDFLAGS=-static
    make: doing install and LDFLAGS=-static

As can be seen, doing each command, as stated in the book, from the
command line, will be sensitive to the placement of the variable
assignment. But, if the variable assignment is done prior to invocation
of a script containing all the other commands as detailed in the book,
results will differ.

Conclusion: this is indeed a bug.

-- 
Bill Maltby
lfsbill at wlmcs.com

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-book' in the subject header of the message



More information about the lfs-book mailing list