[llvm-commits] [llvm] r136459 - /llvm/trunk/lib/Support/Unix/Path.inc

Chris Lattner clattner at apple.com
Fri Jul 29 14:08:03 PDT 2011


>>> Reverted in r136477. I honestly don't see how it's any more or less correct than using getcwd, since $PWD is the current directory per definition.
>> 
>> If it's the current directory by definition, why doesn't getcwd return it?
>> 
>> POSIX specs that the value returned by getcwd may not contain symbolic links. PWD may contain symbolic links because of how it's required to be set by "cd". In either case it needs to be the current directory, but they can be different strings.
> 
> What if clang is not being run by a shell?  PWD is a shell thing, not a unix syscall thing.
> 
> Mm, you're right. I misremembered PWD as being a required environment variable across all process invocations, but it's only defined in the shell execution environment, which applies only to things run by the shell. The answer is that if PWD were unset it would fall back to getcwd. Of course, PWD could also be just plain wrong if not invoked by a shell.
> 
> I didn't really want to have two get current directory methods in Support, and I don't think I want to hard-code "PWD" in clang. Does getShellCurrentDirectory in Support sound reasonable?

I don't understand what problem you're trying to solve here.  What are you trying to do?

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110729/56d81352/attachment.html>


More information about the llvm-commits mailing list