Hi,

I'm trying to learn how the last version of Go that is bootstrapped from C 
works and as a learning exercise, maybe try porting to a new OS (on x86 for 
now)...   

So I'm trying to get my head around the xrealdwd() function  in 
/src/cmd/dist/unix.c - I just can't grok why it is needed. 

A quick search indicates that xrealdwd() is only ever used by build.c, and 
the comment in build.c says:

// xgetwd might return a path with symlinks fully resolved, and if
// there happens to be symlinks in goroot, then the hasprefix test
// will never succeed. Instead, we use xrealwd to get a canonical
// goroot/src before the comparison to avoid this problem.

I guess my understanding and knowledge of symlinks is lacking, but I guess 
i just don't understand why hasprefix() will never succeed if there happens 
to be symlinks in goroot...

The windows.c file also has a similar (at least similar in logic but not in 
OS calls) approach to xrealdwd() so I must assume that hasprefix() does not 
like symlinks on Windows either?

I think if this were ported to an OS that doesnt have symlinks, I might be 
able to get away with making xrealwd() always just return the current 
directory without trying to get a canonical path to goroot/src...  

Cheers,
Chris


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/935f7f80-beb2-4206-839e-68ca17950e38n%40googlegroups.com.

Reply via email to