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 |
On 24.06.2010, at 19:30, Henrik Johansen wrote: > > 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 Yeah I've been bitten by that too. Do you have a patch? Actually, Ian prefers to be sent a fully patched file ... - Bert - |
On Thu, Jun 24, 2010 at 10:33 AM, Bert Freudenberg <[hidden email]> wrote:
You'll find its fixed in the Cog sources. Alas there are other changes there-in, but at least that function is not affected by other changes.
|
On Jun 24, 2010, at 7:49 46PM, Eliot Miranda wrote: Thanks! Attached is the sqUnixMain.c from 2202 release, with the function modified as has been done in Cog. I built using it, and verified the expression in previous mail now returns true. Cheers, Henry sqUnixMain.c (42K) Download Attachment |
Free forum by Nabble | Edit this page |