For Digital UNIX 4.0D, shared libraries are created by:
	$ ld -shared -expect_unresolved "*" -o foo.so [objects]

This presents a problem for mkMakefile.tcldefs.sh.in. In tclConfig.sh:
	TCL_SHLIB_LD='ld -shared -expect_unresolved "*"'

In mkMakefile.tcldefs.sh.in:
	cat @TCL_CONFIG_SH@ |
	egrep '^TCL_|^TK_' |
	while read inp
	do
		eval eval echo $inp
	done >Makefile.tcldefs

Because of this, we wind up with the following in Makefile.tcldefs to
created shared libraries on Digital UNIX because of the eval:
	TCL_SHLIB_LD=ld -shared -expect_unresolved *

The "*" needs to be quoted to avoid shell expansion. How about the
following:
	cat @TCL_CONFIG_SH@ |
	egrep '^TCL_|^TK_' |
	sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/"

-- 
albert chin (china@thewrittenword.com)

Sat, 10 Jul 1999 00:42:46 -0500 (CDT)
pgsql-hackers@thewrittenword.com
Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in 6.5
I didn't understand this the first time you sent it either.

Send me a patch to review, please.


> For Digital UNIX 4.0D, shared libraries are created by:
> 	$ ld -shared -expect_unresolved "*" -o foo.so [objects]
> 
> This presents a problem for mkMakefile.tcldefs.sh.in. In tclConfig.sh:
> 	TCL_SHLIB_LD='ld -shared -expect_unresolved "*"'
> 
> In mkMakefile.tcldefs.sh.in:
> 	cat @TCL_CONFIG_SH@ |
> 	egrep '^TCL_|^TK_' |
> 	while read inp
> 	do
> 		eval eval echo $inp
> 	done >Makefile.tcldefs
> 
> Because of this, we wind up with the following in Makefile.tcldefs to
> created shared libraries on Digital UNIX because of the eval:
> 	TCL_SHLIB_LD=ld -shared -expect_unresolved *
> 
> The "*" needs to be quoted to avoid shell expansion. How about the
> following:
> 	cat @TCL_CONFIG_SH@ |
> 	egrep '^TCL_|^TK_' |
> 	sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/"
> 
> -- 
> albert chin (china@thewrittenword.com)
> 
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Sat, 10 Jul 1999 02:45:47 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in
 6.5
On Sat, Jul 10, 1999 at 02:45:47AM -0400, Bruce Momjian wrote:
> I didn't understand this the first time you sent it either.
> 
> Send me a patch to review, please.

--- src/pl/tcl/mkMakefile.tcldefs.sh.in.orig	Fri Jul  9 08:29:09 1999
+++ src/pl/tcl/mkMakefile.tcldefs.sh.in	Fri Jul  9 08:29:49 1999
@@ -8,9 +8,6 @@
 
 cat @TCL_CONFIG_SH@ |
     egrep '^TCL_|^TK_' |
-    while read inp
-    do
-	    eval eval echo $inp
-    done >Makefile.tcldefs
+    sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/" >Makefile.tcldefs
 
 exit 0

> 
> > For Digital UNIX 4.0D, shared libraries are created by:
> > 	$ ld -shared -expect_unresolved "*" -o foo.so [objects]
> > 
> > This presents a problem for mkMakefile.tcldefs.sh.in. In tclConfig.sh:
> > 	TCL_SHLIB_LD='ld -shared -expect_unresolved "*"'
> > 
> > In mkMakefile.tcldefs.sh.in:
> > 	cat @TCL_CONFIG_SH@ |
> > 	egrep '^TCL_|^TK_' |
> > 	while read inp
> > 	do
> > 		eval eval echo $inp
> > 	done >Makefile.tcldefs
> > 
> > Because of this, we wind up with the following in Makefile.tcldefs to
> > created shared libraries on Digital UNIX because of the eval:
> > 	TCL_SHLIB_LD=ld -shared -expect_unresolved *
> > 
> > The "*" needs to be quoted to avoid shell expansion. How about the
> > following:
> > 	cat @TCL_CONFIG_SH@ |
> > 	egrep '^TCL_|^TK_' |
> > 	sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/"
> > 
> > -- 
> > albert chin (china@thewrittenword.com)
> 
> -- 
>   Bruce Momjian                        |  http://www.op.net/~candle

-- 
albert chin (china@thewrittenword.com)


Sat, 10 Jul 1999 02:07:47 -0500 (CDT)
pgsql-hackers@thewrittenword.com
Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in
 6.5
On Sat, Jul 10, 1999 at 02:45:47AM -0400, Bruce Momjian wrote:
> I didn't understand this the first time you sent it either.
> 
> Send me a patch to review, please.

--- src/pl/tcl/mkMakefile.tcldefs.sh.in.orig	Fri Jul  9 08:29:09 1999
+++ src/pl/tcl/mkMakefile.tcldefs.sh.in	Fri Jul  9 08:29:49 1999
@@ -8,9 +8,6 @@
 
 cat @TCL_CONFIG_SH@ |
     egrep '^TCL_|^TK_' |
-    while read inp
-    do
-	    eval eval echo $inp
-    done >Makefile.tcldefs
+    sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/" >Makefile.tcldefs
 
 exit 0

> 
> > For Digital UNIX 4.0D, shared libraries are created by:
> > 	$ ld -shared -expect_unresolved "*" -o foo.so [objects]
> > 
> > This presents a problem for mkMakefile.tcldefs.sh.in. In tclConfig.sh:
> > 	TCL_SHLIB_LD='ld -shared -expect_unresolved "*"'
> > 
> > In mkMakefile.tcldefs.sh.in:
> > 	cat @TCL_CONFIG_SH@ |
> > 	egrep '^TCL_|^TK_' |
> > 	while read inp
> > 	do
> > 		eval eval echo $inp
> > 	done >Makefile.tcldefs
> > 
> > Because of this, we wind up with the following in Makefile.tcldefs to
> > created shared libraries on Digital UNIX because of the eval:
> > 	TCL_SHLIB_LD=ld -shared -expect_unresolved *
> > 
> > The "*" needs to be quoted to avoid shell expansion. How about the
> > following:
> > 	cat @TCL_CONFIG_SH@ |
> > 	egrep '^TCL_|^TK_' |
> > 	sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/"
> > 
> > -- 
> > albert chin (china@thewrittenword.com)
> 
> -- 
>   Bruce Momjian                        |  http://www.op.net/~candle

-- 
albert chin (china@thewrittenword.com)

Sat, 10 Jul 1999 02:07:47 -0500 (CDT)
pgsql-hackers@thewrittenword.com
Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in
 6.5
> On Sat, Jul 10, 1999 at 02:45:47AM -0400, Bruce Momjian wrote:
> > I didn't understand this the first time you sent it either.
> > 
> > Send me a patch to review, please.
> 
> --- src/pl/tcl/mkMakefile.tcldefs.sh.in.orig	Fri Jul  9 08:29:09 1999
> +++ src/pl/tcl/mkMakefile.tcldefs.sh.in	Fri Jul  9 08:29:49 1999
> @@ -8,9 +8,6 @@
>  
>  cat @TCL_CONFIG_SH@ |
>      egrep '^TCL_|^TK_' |
> -    while read inp
> -    do
> -	    eval eval echo $inp
> -    done >Makefile.tcldefs
> +    sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/" >Makefile.tcldefs
>  

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 can apply this to
6.6.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Sat, 10 Jul 1999 10:36:25 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in
 6.5
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

Sat, 10 Jul 1999 11:37:24 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in
	6.5
Bruce Momjian wrote:

>
> > On Sat, Jul 10, 1999 at 02:45:47AM -0400, Bruce Momjian wrote:
> > > I didn't understand this the first time you sent it either.
> > >
> > > Send me a patch to review, please.
> >
> > --- src/pl/tcl/mkMakefile.tcldefs.sh.in.orig  Fri Jul  9 08:29:09 1999
> > +++ src/pl/tcl/mkMakefile.tcldefs.sh.in  Fri Jul  9 08:29:49 1999
> > @@ -8,9 +8,6 @@
> >
> >  cat @TCL_CONFIG_SH@ |
> >      egrep '^TCL_|^TK_' |
> > -    while read inp
> > -    do
> > -         eval eval echo $inp
> > -    done >Makefile.tcldefs
> > +    sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/" >Makefile.tcldefs
> >
>
> 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 can apply this to
> 6.6.

    As  far  as  I  can  recall,  the  first of all versions I've
    created did it mainly that way (with a simple  sed(1)  call).
    But  since  tclConfig.sh  is a shell script, there have to be
    shell variable expansions done on  some  platforms  and  that
    resulted  finally in the double eval. So I would consider the
    above a little step for a man, but a big  leap  backward  for
    mankind.

    Instead,  the  result  of  the  double  eval must get special
    characters quoted in some way.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #



Sun, 11 Jul 1999 15:46:26 +0200 (MET DST)
wieck@debis.com (Jan Wieck)
Re: [ADMIN] Re: [HACKERS] Problems with
	src/pl/tcl/mkMakefile.tcldefs.sh.in in 6.5
On Sun, Jul 11, 1999 at 03:46:26PM +0200, Jan Wieck wrote:
> Bruce Momjian wrote:
> 
> >
> > > On Sat, Jul 10, 1999 at 02:45:47AM -0400, Bruce Momjian wrote:
> > > > I didn't understand this the first time you sent it either.
> > > >
> > > > Send me a patch to review, please.
> > >
> > > --- src/pl/tcl/mkMakefile.tcldefs.sh.in.orig  Fri Jul  9 08:29:09 1999
> > > +++ src/pl/tcl/mkMakefile.tcldefs.sh.in  Fri Jul  9 08:29:49 1999
> > > @@ -8,9 +8,6 @@
> > >
> > >  cat @TCL_CONFIG_SH@ |
> > >      egrep '^TCL_|^TK_' |
> > > -    while read inp
> > > -    do
> > > -         eval eval echo $inp
> > > -    done >Makefile.tcldefs
> > > +    sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/" >Makefile.tcldefs
> > >
> >
> > 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 can apply this to
> > 6.6.
> 
>     As  far  as  I  can  recall,  the  first of all versions I've
>     created did it mainly that way (with a simple  sed(1)  call).
>     But  since  tclConfig.sh  is a shell script, there have to be
>     shell variable expansions done on  some  platforms  and  that
>     resulted  finally in the double eval. So I would consider the
>     above a little step for a man, but a big  leap  backward  for
>     mankind.
> 
>     Instead,  the  result  of  the  double  eval must get special
>     characters quoted in some way.

I just looked at the man for make on Solaris, Digital UNIX, HP-UX, and
IRIX and all support $() and ${} for variable expansion. BTW, I also
looked at the Makefile generated by Tk and it assumes make can handle
${}. It basically does one eval of tclConfig.sh and uses the result in
make variables. As Tk assumes make can handle ${}, can we safely
assume the same? With this, we'd do one eval rather than two before.
This is the same as the sed line I posted because everything in
tclConfig.sh is VAR='VAL' so the one eval would just strip the single
quotes (which sed did). But, if tclConfig.sh changes to some use of
double quotes in the future, we won't break.

> Jan

-- 
albert chin (china@thewrittenword.com)


Sun, 11 Jul 1999 13:54:06 -0500 (CDT)
pgsql-hackers@thewrittenword.com
Re: [ADMIN] Re: [HACKERS] Problems with
	src/pl/tcl/mkMakefile.tcldefs.sh.in in 6.5
I believe this is fixed.

> For Digital UNIX 4.0D, shared libraries are created by:
> 	$ ld -shared -expect_unresolved "*" -o foo.so [objects]
> 
> This presents a problem for mkMakefile.tcldefs.sh.in. In tclConfig.sh:
> 	TCL_SHLIB_LD='ld -shared -expect_unresolved "*"'
> 
> In mkMakefile.tcldefs.sh.in:
> 	cat @TCL_CONFIG_SH@ |
> 	egrep '^TCL_|^TK_' |
> 	while read inp
> 	do
> 		eval eval echo $inp
> 	done >Makefile.tcldefs
> 
> Because of this, we wind up with the following in Makefile.tcldefs to
> created shared libraries on Digital UNIX because of the eval:
> 	TCL_SHLIB_LD=ld -shared -expect_unresolved *
> 
> The "*" needs to be quoted to avoid shell expansion. How about the
> following:
> 	cat @TCL_CONFIG_SH@ |
> 	egrep '^TCL_|^TK_' |
> 	sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/"
> 
> -- 
> albert chin (china@thewrittenword.com)
> 
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Tue, 21 Sep 1999 17:39:54 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in
 6.5
Bruce Momjian wrote:

>
> I believe this is fixed.

    Again  one of the frequently appearing items. So I would call
    it more "hacked quiet - for now" instead of "fixed".

    The  script  is  only  called  if  PostgreSQL  is  configured
    --with_tcl.  In  that  case,  missing  the  Tcl(/Tk) includes
    and/or libs would cause errors and a compilation abort. Can't
    we  assume that if the user configured with Tcl, she would at
    least have a working tclsh(1)? I think we can. I  don't  know
    of  any  "normal" Tcl-installation where the libs are present
    but no working tclsh(1).

    Since Tcl itself has much better capabilities than a sh(1) or
    sed(1),  it might be reasonable to source in the tclConfig.sh
    into mkMakefile.tclsh.sh and pipe a "set" trough a tcl script
    that  does the real conversion into proper Makefile escaping.

    An advantage would be that the Tcl script could check if  the
    version  of  the  systems default tclsh(1) is the same as the
    one in the choosen tclConfig.sh file and notice the  user  if
    not.  Using  different  Tcl versions in the libs and includes
    than  in  the  tclsh(1)  executable  could   cause   horrible
    problems.   I'm  unhappy with the current libpgtcl for a long
    time,  but  the  changes  I  have  in  mind  would  make   it
    incompatible  with  pre-8.0  Tcl. So the changes will cause a
    bunch of #if...#else...#endif that MUST match the later  used
    tclsh(1)  at  compile time or the dynamic loader of Tcl would
    fail.


Jan

BTW: Is it only me or do others  too  wonder  why  their  private
     wish-list is sometimes longer than our official TODO?

>
> > For Digital UNIX 4.0D, shared libraries are created by:
> >  $ ld -shared -expect_unresolved "*" -o foo.so [objects]
> >
> > This presents a problem for mkMakefile.tcldefs.sh.in. In tclConfig.sh:
> >  TCL_SHLIB_LD='ld -shared -expect_unresolved "*"'
> >
> > In mkMakefile.tcldefs.sh.in:
> >  cat @TCL_CONFIG_SH@ |
> >  egrep '^TCL_|^TK_' |
> >  while read inp
> >  do
> >       eval eval echo $inp
> >  done >Makefile.tcldefs
> >
> > Because of this, we wind up with the following in Makefile.tcldefs to
> > created shared libraries on Digital UNIX because of the eval:
> >  TCL_SHLIB_LD=ld -shared -expect_unresolved *
> >
> > The "*" needs to be quoted to avoid shell expansion. How about the
> > following:
> >  cat @TCL_CONFIG_SH@ |
> >  egrep '^TCL_|^TK_' |
> >  sed -e "s/^\([^=]*\)='\(.*\)'$/\1=\2/"
> >
> > --
> > albert chin (china@thewrittenword.com)

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #



Wed, 22 Sep 1999 00:55:35 +0200 (MET DST)
wieck@debis.com (Jan Wieck)
Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in
 6.5
> Jan
> 
> BTW: Is it only me or do others  too  wonder  why  their  private
>      wish-list is sometimes longer than our official TODO?

That's bad.  Our official TODO is very large.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Tue, 21 Sep 1999 19:38:42 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in
 6.5
wieck@debis.com (Jan Wieck) writes:
> Bruce Momjian wrote:
>> I believe this is fixed.

>     Again  one of the frequently appearing items. So I would call
>     it more "hacked quiet - for now" instead of "fixed".

No, it's really fixed, or anyway Albert's complaint is fixed
(there was at least one other related complaint recently, too).

The problem was not whether we could find tclConfig.sh, it was
whether we were coping correctly with shell metacharacters in
the variable values.  We were not, but I fixed that with a redesign
of the way the script read the file...

			regards, tom lane

Tue, 21 Sep 1999 21:27:34 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in
	6.5