[386sx@my-deja.com: Re: Building gdb 5.0]

Eli Zaretskii eliz@is.elta.co.il
Fri Jun 29 02:32:00 GMT 2001


The attached message summarizes a long thread that was going on
comp.os.msdos.djgpp, which started when this user reported that he
couldn't build the DJGPP port of GDB on his machine, because the
configure script said it couldn't chdir to the `intl' directory.

It turns out that CDPATH was set, and it didn't include ".".  It also
turns out that Bash will append "." to CDPATH, but only if it isn't
called as "sh", in which case it gets Posix.  Which is what was
happening in this case (you will see that gdb/config/djgpp/djconfig.sh
invokes "sh ./configure").

Now, I agree that it's not very wise, to say the least, to have CDPATH
without ".", but given that some people do (evidently relying on
Bash's non-Posix behavior), should the configure script perhaps
nullify CDPATH, just to be on the safe side?  

In any case, this doesn't seem to be a DJGPP-specific issue (the user
who reported that originally understood the cause of the problem when
he tried to build GDB on GNU/Linux with a similar CDPATH setup, and
got the same failure).

------- Start of forwarded message -------
From: 386sx <386sx@my-deja.com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Building gdb 5.0
Date: 29 Jun 2001 08:15:39 GMT
Organization: not a chance
X-Trace: fu-berlin.de 993802539 14387778 166.102.93.63 (16 [33304])
User-Agent: Xnews/4.06.22
X-Hobbies: X-Pickup-Sticks,  X-Polo-Wrestling
To: djgpp@delorie.com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp@delorie.com
X-Mailing-List: djgpp@delorie.com
X-Unsubscribes-To: listserv@delorie.com
Precedence: bulk
Content-Type: text
Content-Length: 2295

Eli Zaretskii <eliz@is.elta.co.il> wrote:

> On 27 Jun 2001, 386sx wrote:
> 
>> > I can't imagine people could do that in their CDPATH, since if they
>> > do, "cd foo" cannot chdir into a subdirectory `foo' of the current
>> > directory. 
>> 
>> True only if there is a "foo'' subdirectory within a directory in
>> CDPATH. If "." isn't included in CDPATH cd acts as if "." were the
>> last entry. 
> 
> Then why did "cd intl" fail in the GDB build procedure?
> 
> It sounds like I didn't really understand the reason for this problem,
> so please tell some more about this.  Since this issue is not specific
> to DJGPP, it will probably require some changes in the GDB configure
> scripts, and I'd like to be able to explain this to the GDB
> maintainers.

I think the answer is not the interactive bash, but bash's POSIX 
non-interactive alter-ego (SHELL=/bin/sh) :

**********
**********

File: bashref.info,  Node: Bash Startup Files,  Next: Interactive Shells,  
Prev: Invoking Bash,  Up: Bash Features

Bash Startup Files

[...]

Invoked with name `sh'
......................

[...]

   If Bash is invoked with the name `sh', it tries to mimic the startup
behavior of historical versions of `sh' as closely as possible, while
conforming to the POSIX standard as well.

[...]

   When invoked as `sh', Bash enters POSIX mode after the startup files
are read.

[...]

**********
**********

File: bashref.info,  Node: Bash POSIX Mode,  Prev: The Restricted Shell,  
Up: Bash Features

Bash POSIX Mode
===============

   Starting Bash with the `--posix' command-line option or executing
`set -o posix' while Bash is running will cause Bash to conform more
closely to the POSIX 1003.2 standard by changing the behavior to match
that specified by POSIX in areas where the Bash default differs.

   The following list is what's changed when `POSIX mode' is in effect:

[...]

 19. If `CDPATH' is set, the `cd' builtin will not implicitly append
     the current directory to it.  This means that `cd' will fail if no
     valid directory name can be constructed from any of the entries in
     `$CDPATH', even if the a directory with the same name as the name
     given as an argument to `cd' exists in the current directory.

[...]

- -- 
386

clc FAQ:
http://www.eskimo.com/~scs/C-faq/top.html
------- End of forwarded message -------



More information about the Gdb mailing list