This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/1427: C's stdlib getenv("PWD") with wrong return value inside GDB
- From: lucaslm at dep dot fem dot unicamp dot br
- To: gdb-gnats at sources dot redhat dot com
- Cc: lucas dot martini at ic dot unicamp dot br
- Date: 23 Oct 2003 19:12:39 -0000
- Subject: gdb/1427: C's stdlib getenv("PWD") with wrong return value inside GDB
- Reply-to: lucaslm at dep dot fem dot unicamp dot br
>Number: 1427
>Category: gdb
>Synopsis: C's stdlib getenv("PWD") with wrong return value inside GDB
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 23 19:18:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: lucaslm@dep.fem.unicamp.br
>Release: GNU gdb 6.0 (LINUX)
>Organization:
>Environment:
Linux guinness 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux
gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
This GDB was configured as "i686-pc-linux-gnu"...
>Description:
Calls to getenv("PWD") to get the current directory from the
environment variables inside GDB return "pwd" instead of
NULL or the correct working directory.
Calls to getenv("PATH") for example, or any other
environment variable I tested work just fine.
"Show env PWD" inside GDB DOES show the correct working
directory.
The call works fine outside GDB.
Problem also occurs on GNU gdb 5.1 in SUN4SOL systems
Problem does NOT occur in GNU gdb 2003-09-20-cvs (cygwin-special)
>How-To-Repeat:
The following test program reproduces the problem in my
systems. Note the PATH should print ok, while PWD would
print only "pwd".
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
char* pwd[255];
char* path[5000];
*pwd = getenv("PWD");
printf("PWD is: %s\n", *pwd);
*path = getenv("PATH");
printf("PATH is: %s\n", *path);
return 0;
}
>Fix:
Good luck, I have no idea. =)
>Release-Note:
>Audit-Trail:
>Unformatted: