src/backend/Makefile CDPATH Patch - Mailing list pgsql-patches

From Jason Tishler
Subject src/backend/Makefile CDPATH Patch
Date
Msg-id 20010423151133.R169@dothill.com
Whole thread Raw
Responses Re: src/backend/Makefile CDPATH Patch
Re: src/backend/Makefile CDPATH Patch
List pgsql-patches
The attached patch solves an annoying build failure when /bin/sh is a
symlink to /bin/bash and CDPATH is set.  The problem manifests itself as
the following error:

    $ cd src/backend
    $ make ../../src/include/parser/parse.h
    prereqdir=`cd parser/ && pwd` && \
      cd ../../src/include/parser/ && rm -f parse.h && \
      ln -s $prereqdir/parse.h .
    ln: ./parser: File exists
    make: *** [../../src/include/parser/parse.h] Error 1
    make: *** Deleting file `../../src/include/parser/parse.h'

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

Hence, prereqdir is actually getting set to two directory names instead
of one which causes ln to fail.

If CDPATH is not set (or set differently) or /bin/sh is not /bin/bash,
then we get the expected behavior:

    $ unset CDPATH
    $ echo `cd parser/ && pwd`
    /home/jt/src/pgsql/src/backend/parser

The the solution used in the patch is as follows:

    $ export CDPATH=.:/home/jt:/home/jt/src:/home/jt/lib
    $ echo `cd parser/ >/dev/null && pwd`
    /home/jt/src/pgsql/src/backend/parser

Note that there are many solutions -- I just chose the one that perturbed
the Makefile the least.

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

Attachment

pgsql-patches by date:

Previous
From: Jason Tishler
Date:
Subject: Re: Cygwin PostgreSQL ESQL Patch
Next
From: Bruce Momjian
Date:
Subject: Re: src/backend/Makefile CDPATH Patch