Skip site navigation (1) Skip section navigation (2)

Re: src/backend/Makefile CDPATH Patch

From: Jason Tishler <Jason(dot)Tishler(at)dothill(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Pgsql-Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: src/backend/Makefile CDPATH Patch
Date: 2001-04-23 20:05:54
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches

On Mon, Apr 23, 2001 at 03:25:38PM -0400, Bruce Momjian wrote:
> > The above is due to the following:
> > 
> >     $ export CDPATH=.:/home/jt:/home/jt/src:/home/jt/lib
> >     $ echo `cd parser/ && pwd`
> >     /home/jt/src/pgsql/src/backend/parser /home/jt/src/pgsql/src/backend/parser
> Basically, you are telling me that if there are two matching parser
> directories, pwd gets set to _both_ of them.  Sorry, I don't think we
> want to work around a bug like that, should we?

I guess that I was not explicit enough, so I will try again...

The extra directory name comes from bash's builtin cd echoing the
directory name when a match is found in the user's CDPATH.  It is *not*
coming from pwd.

So, I still content that this is a bug in the Makefile.  The construct
that is suspect is the following:

    prereqdir=`cd $(dir $<) && pwd`

The above implicitly assumes that the "cd $(dir $<)" part does *not*
write to stdout.  If it does then, prereqdir will end up as the
concatenation of "cd $(dir $<)" and "pwd".

Under bash, I get the following:

    $ prereqdir=`cd parser/ && pwd`
    $ echo "$prereqdir" 

Under sh, I get the following:

    $ prereqdir=`cd parser/ && pwd`
    $ echo "$prereqdir"

Hence, when the PostgreSQL build is run (where sh == bash), the ln
command generated by the Makefile:

    ln -s $prereqdir/parse.h .

becomes the following:

    ln -s /home/jt/src/pgsql/src/backend/parser # *** new line here ***
    /home/jt/src/pgsql/src/backend/parser/parse.h .

which confuses ln and causes the make to fail.

Note this problem only occurs on our Red Hat Linux boxes because /bin/sh
is a symlink to /bin/bash.  We do not have this problem under Cygwin or


Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason(dot)Tishler(at)dothill(dot)com
Hazlet, NJ 07730 USA                 WWW:

In response to


pgsql-patches by date

Next:From: Bruce MomjianDate: 2001-04-23 20:10:17
Subject: Re: src/backend/Makefile CDPATH Patch
Previous:From: Bruce MomjianDate: 2001-04-23 19:25:38
Subject: Re: src/backend/Makefile CDPATH Patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group