Re: [fltk.bugs] [MOD] STR #2784: Relative paths should always be computed from getcwd, not PWD

2011-12-04 Thread Ben Stott

[STR Closed w/Resolution]

Link: http://www.fltk.org/str.php?L2784
Version: 2.0-current
Fix Version: 2.0-current (r9194)


So I did a bit of research and it turns out you're right -- this was
probably a holdover from someone's machine where they couldn't use
getcwd() for whatever reason.
I committed a slightly modified version of your patch; one that falls back
on PWD iff getcwd() returns NULL (which it only does under 3 (relatively
rare) conditions).

Thanks!


Link: http://www.fltk.org/str.php?L2784
Version: 2.0-current
Fix Version: 2.0-current (r9194)

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


[fltk.bugs] [MOD] STR #2784: Relative paths should always be computed from getcwd, not PWD

2011-12-01 Thread jmb
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2784
Version: 2.0-current


In src/filename_absolute.cxx, the functions to convert between relative and
absolute paths try to take the current path from the PWD environment
variable and fall back to getcwd if PWD is not set. Unfortunately, the PWD
environment variable may be incorrect for a variety of reasons including:
- A faulty shell;
- A faulty IDE (I was bitten by this issue because Eclipse will launch a
project from its own folder without updating PWD);
- Or more importantly if the application itself calls chdir without
updating PWD...

The attached patch disables the PWD lookup in favour of the call to
getcwd.


Link: http://www.fltk.org/str.php?L2784
Version: 2.0-currentIndex: src/filename_absolute.cxx
===
--- src/filename_absolute.cxx   (revision 9038)
+++ src/filename_absolute.cxx   (working copy)
@@ -102,8 +102,7 @@
 // current directory
 if (pwd) prefix = pwd;
 else {
-  prefix = getenv(PWD);
-  if (!prefix) prefix = getcwd(output, length);
+  prefix = getcwd(output, length);
 }
 prefixlen = strlen(prefix);
   }
@@ -144,8 +143,7 @@
   }
 
   if (!cwd) {
-cwd = getenv(PWD);
-if (!cwd) cwd = getcwd(to, tolen);
+cwd = getcwd(to, tolen);
   }
 
   const char* slash = from;
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs