View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Case Final Project Summer 2007

Bert on Linux Bookmorphs

Resent-Date: 20 Jan 2000 15:32:42 -0000
Resent-Cc: recipient list not shown: ;
X-Authentication-Warning: balloon.cs.uni-magdeburg.de: bert owned process doing -bs
Date: Thu, 20 Jan 2000 18:32:43 +0100 (CET)
From: Bert Freudenberg 
X-Sender: bert@balloon.cs.uni-magdeburg.de
To: squeak@cs.uiuc.edu
Subject: [FIX] Re: [BUG] Re: Bookmorphs not working in Linux?
Resent-From: squeak@cs.uiuc.edu
Reply-To: squeak@cs.uiuc.edu
X-Mailing-List:  archive/latest/14588
X-Loop: squeak@cs.uiuc.edu
Resent-Sender: squeak-request@cs.uiuc.edu

On Wed, 19 Jan 2000, Mark Guzdial wrote:

> I'm producing BookMorphs for my lectures this term, and my 
> Linux-using students say that they can't read them. They say that 
> they try to load the book from the FileList, and they do get the 
> control buttons across the top, but no page.  When they click "next 
> page" they get told that the file does not exist.  Are any other 
> Linux-users having similar problems with BookMorphs?
> 
> The bookmorphs are zipped at http://coweb.cc.gatech.edu/cs2340/7  if 
> you're looking for some examples to try.

Hi Mark,

that's a serious bug, though it seems unrelated to the operating system. I
just looked into this and when debugging I managed to hang my Squeak which
never happens otherwise.

The root of the problem are file urls. The book loads fine, but the page
looks for an url "file://var/Squeak/2.7/markbook/ch2-p1-tour1.sp", which
is wrong, it should be file:/var/ ... Anyway, the resulting file path is
"var/Squeak/2.7/markbook/ch2-p1-tour1.sp" which is wrong since the leading
slash is missing. The default directory is "/var/Squeak/2.7". This leads
to the absolute file
"/var/Squeak/2.7/var/Squeak/2.7/markbook/ch2-p1-tour1.sp" since it is
treated as relative path.


  It is a a popular fallacy to take "something://" as the beginning
  (uninteresting) part of an URL. "something:" specifies a scheme, 
  "//something" specifies an authority, and "/something" the path.

	see http://www.faqs.org/rfcs/rfc2396.html

  For file urls, this means that file:/path is okay as is
  file://localhost/path. Netscape does accept both as well as except
  file:///path, but in file://something  "something" is looked up as host.
  A relative file would be file:relpath.


Okay, I digged a little deeper into this.

The bug is in FileUrl>>pathForDirectory which ignores the isAbsolute inst
var. The reason why it still works on a Mac seems to be
MacFileDir>>fullPathFor: aPath - it simply does not check if aPath is
absolute or relative, whereas the Win / Unix variants do. I'd consider the
Mac behaviour a kludge that covers other inconsistencies.

Anyway, here's a FIX. I'm not sure if this works on Mac/Windows. There
should be a way to generate an absolute filepath from its components.

------------------------- 
!FileUrl methodsFor: 'access' stamp: 'bf 1/20/2000 18:17'!
pathForDirectory
  "Path using local file system's delimiter.  $\ or $:"

  ^ String streamContents: [ :s |
    isAbsolute ifTrue:[ s nextPut: FileDirectory pathNameDelimiter].
    1 to: self path size - 1 do: [ :ii |
      s nextPutAll: (path at: ii); nextPut: FileDirectory pathNameDelimiter
       ] ]! !
-------------------------

But still, several methods wrongly generate file:// urls (like
FileDirectory>>url, FileStream>>url, FileUrl>>totext). These should be
corrected.

  -Bert-


Links to this Page