Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in 6.5 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in 6.5
Date
Msg-id 3705.931621044@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in 6.5  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> I understand what your patch does, and it looks OK, but any idea why the
> 'eval eval' was there, and is it safe to skip it?

I think the idea is to expand any shell variable references that appear
in tclConfig.sh.  If so, the code is wrong anyway, since the expansion
will occur in a subshell that hasn't actually executed tclConfig.sh,
and therefore does not have definitions for the referenced variables.
We'll always get empty strings substituted for the references, and that
may be the wrong thing.

Taking an example that actually appears in my system's tclConfig.sh:
TCL_LIB_FILE='libtcl8.0${TCL_DBGX}.a'

I stick this into shell variable inp:

$ read inp
TCL_LIB_FILE='libtcl8.0${TCL_DBGX}.a'        --- typed by me
$ echo $inp
TCL_LIB_FILE='libtcl8.0${TCL_DBGX}.a'

Now one eval gets rid of the outer single quotes:

$ eval echo $inp
TCL_LIB_FILE=libtcl8.0${TCL_DBGX}.a

and another one will perform a round of shell interpretation on what's
inside the quotes:

$ eval eval echo $inp
TCL_LIB_FILE=libtcl8.0.a

which is not what we want.  In this particular case it's harmless
because TCL_DBGX should be empty, but if I had a debugging build
of Tcl installed here then the makefile would fail because it would
have the wrong value of TCL_LIB_FILE.

If we do something like what Albert is proposing, the sed script
will need to convert ${...} to $(...) so that shell variable references
become make variable references.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] 6.5.1
Next
From: Bruce Momjian
Date:
Subject: 6.5.1 release