Mantis - Squeak
Viewing Issue Advanced Details
7550 VM minor always 07-08-10 10:36 07-09-10 09:44
henriksp  
lewis  
normal  
acknowledged 4.1  
open  
none    
none  
0007550: Relative symbolic links do not resolve correctly in Unix 4.0.3.2202
There's a bug in the alias resolution sqGetFilenameFromString in sqUnixMain.c.
In the line
filenameLength = readLink(aCharBuffer, aCharBuffer, MAXPATHLEN)
it replaces the old link path with the resolved link path, however links may be relative, eg. /bin/sh linking to bash rather than /bin/bash.

 Thus, file opening, and other operations using this function will fail if encountering a relative link.

 F.ex. print (on Ubuntu, where sh -> dash):

 |openedRelative|
 openedRelative := nil.
[FileStream readOnlyFileNamed: '/bin/sh' do: [:fs | openedRelative := true]] on: FileDoesNotExistException do: [openedRelative := false].
openedRelative

and you get false.
Created issue as the patched file posted on VM-Dev may have gone unnoticed.
New method merged from Cog sources, where Eliot had fixed it already.
 sqUnixMain.c [^] (41,473 bytes) 07-08-10 10:36

Notes
(0013825)
henriksp   
07-08-10 10:37   
Discussion on VM-dev:
http://forum.world.st/Unix-VM-alias-resolving-bug-tp2267360p2267360.html [^]
(0013826)
lewis   
07-09-10 09:44   
Forwarded file to Ian for inclusion in platforms/unix