Path bug list
Torsten Anders
torstenanders at gmx.de
Wed Feb 28 08:39:02 CET 2007
Dear Hackers,
On 26.02.2007, at 14:08, Boriss Mejias wrote:
> +Decide about patch for Path.oz
> - I haven't assigned anybody here. Denys, do you want to take care of
> this? In that case, please feel free to change the ending date and the
> estimated time.
It seems nobody had time so far to look into my patch for the Path
std-lib, which I posted here on Mon Feb 12. In order to demonstrate the
urgency that something is done about Path, following is a (rather
long!) list of bugs in Path (see below). All these bugs are fixed in my
patch. In addition, I refactored the Path functor, added definitions
for consistency, and also added comments plus test cases in order to
simplify the job for the next guy doing fixes.
Thank you!
Best,
Torsten
--
Torsten Anders
Sonic Arts Research Centre • Queen's University Belfast
Frankstr. 49 • D-50996 Köln
Tel: +49-221-3980750
http://strasheela.sourceforge.net
http://www.torsten-anders.de
------------------------------------------------
%% orig Path
declare [Path]={Module.link ['x-oz://system/os/Path.ozf']}
%% [1: init] On MacOS, this call results in an error: every path object
must end with a slash, even a plain file like '/home/test/tmp.txt/'
%% NB: This problem pops up with every definition in the functional
Path API, because all rely on Path.make.
{Path.make '/home/test/tmp.txt'}
%******************** Error: conditional failed *****************
%**
%** Missing else clause
%**
/*
%% some kludge to avoid the problem, but this is not the expected way
to do things
{New Path.'class' init('/home/test/tmp.txt' exact:true)}
*/
%% All the following tests were run on Linux:
%% [2: init]
{{Path.make '/'} toString($)}
%% -> nil
{{Path.make '/'} toAtom($)}
%% -> ''
%% [3]
{{Path.make '/'} isAbsolute($)}
%% -> false
%% NB: several other Path methods fail on "/" as well.
%% [4: basename] .. neither correct path, nor does it cut of the dirname
{{{Path.make '/home/test.txt'} basename($)} toString($)}
%% -> "/homehome/test.txt"
%% [5: dirname] ... neither correct path, nor does it cut of the
basename
{{{Path.make '/home/test/tmp.txt'} dirname($)} toString($)}
%% -> "/homehome/testhomehomte/test/tmp.txt"
%% [6: basenameString] .. outputs string in list
{{Path.make '/home/test/tmp.txt'} basenameString($)}
%% ["tmp.txt"]
%% [7: resolve] .. garbles the first path and ignores the second
instead of appending it
{{{Path.make '/home/test/'} resolve('testDir/myFile.txt' $)}
toString($)}
%% "/homehome/test/"
%% [8: isRoot] .. isRoot can not distinguish between empty path and root
{{Path.make nil} isRoot($)}
%% -> true
%% [9: extension] .. extension never returns the extension, always unit
for a non-existing extension. BTW:
{{Path.make '/home/test/tmp.txt'} extension($)}
%% -> unit
%% [10: dropExtension] .. dropExtension drops more than the extension
{{{Path.make '/home/test/tmp.txt'} dropExtension($)} toString($)}
%% -> "/homehome/test"
%% [11: addExtension] .. addExtension drops stuff instead
{{{Path.make '/home/test/tmp'} addExtension('txt' $)} toString($)}
%% -> "/homehome/test"
%% [12: readdir] .. garbles pathes
{Map {{Path.getcwd} readdir($)} fun {$ P} {P toString($)} end}
More information about the mozart-hackers
mailing list