[Vm-dev] Unix VM alias resolving bug

Henrik Johansen henrik.s.johansen at veloxit.no
Thu Jun 24 17:30:52 UTC 2010


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.

Cheers,
Henry


More information about the Vm-dev mailing list