Re: src/backend/Makefile CDPATH Patch

Поиск
Список
Период
Сортировка
От Jason Tishler
Тема Re: src/backend/Makefile CDPATH Patch
Дата
Msg-id 20010423160554.T169@dothill.com
обсуждение исходный текст
Ответ на Re: src/backend/Makefile CDPATH Patch  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: src/backend/Makefile CDPATH Patch  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-patches
Bruce,

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"
    /home/jt/src/pgsql/src/backend/parser
    /home/jt/src/pgsql/src/backend/parser

Under sh, I get the following:

    $ prereqdir=`cd parser/ && pwd`
    $ echo "$prereqdir"
    /home/jt/src/pgsql/src/backend/parser

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
Solaris.

Thanks,
Jason

--
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.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

В списке pgsql-patches по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: src/backend/Makefile CDPATH Patch
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: src/backend/Makefile CDPATH Patch