[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #36677] canonicalize_file_name: inconsistent b
From: |
Philip Nienhuis |
Subject: |
[Octave-bug-tracker] [bug #36677] canonicalize_file_name: inconsistent behavior for non-existing files |
Date: |
Mon, 18 Jun 2012 17:27:39 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6 |
URL:
<http://savannah.gnu.org/bugs/?36677>
Summary: canonicalize_file_name: inconsistent behavior for
non-existing files
Project: GNU Octave
Submitted by: philipnienhuis
Submitted on: Mon Jun 18 19:27:39 2012
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Philip Nienhuis
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
canonicalize_file_name behaves differently under Linux than under Windows
(file 'notfound.fil' doesn't exist):
Windows (both MSVC & MinGW) Octave-3.6.2_MSVC
octave-3.6.2.exe:1> filename = 'notfound.fil'
filename = notfound.fil
octave-3.6.2.exe:2> canonicalize_file_name (filename)
ans = c:\home\philip\mydocs\octave\notfound.fil
octave-3.6.2.exe:3> filename = '..\notfound.fil'
filename = ..\notfound.fil
octave-3.6.2.exe:4> canonicalize_file_name (filename)
ans = c:\home\philip\mydocs\notfound.fil
octave-3.6.2.exe:5> pwd
ans = c:\home\philip\mydocs\octave
Linux: (Octave-3.6.1 (Mandriva) & tip d.d. June 17, 2012)
octave-3.6.1:1> filename = 'notfound.fil'
filename = notfound.fil
octave-3.6.1:2> ls filename
ls: cannot access filename: No such file or directory
error: ls: command exited abnormally with status 2
octave-3.6.1:2> canonicalize_file_name (filename)
ans =
octave-3.6.1:3> filename = './notfound.fil'
filename = ./notfound.fil
octave-3.6.1:4> canonicalize_file_name (filename)
ans =
octave-3.6.1:5>
Another example (on Linux:)
octave-3.6.1:1> filename = '/tmp/notfound.fil'
filename = /tmp/notfound.fil
octave-3.6.1:2> canonicalize_file_name (filename)
ans =
octave-3.6.1:3>
Some more background:
I wouldn't be able to tell for sure on which of the two platforms
canonicalize_file_name behaves faulty (plus, I can't test on Mac OSX).
But the behavior is inconsistent across platforms.
As for me, I would prefer that on Linux, like on Windows,
canonicalize_file_name assumes that a non-existing file would reside in the
current directory.
This is a.o., needed in the UNO (OpenOffice.org) sections of the io package,
where to be able to open or create a file, OOo needs the fully qualified file
name.
On Windows the same seems to be needed for COM/ActiveX.
A clumsy workaround would be to first test for existence, and if nonexistent,
prepend the filename with
['pwd' filesep]
but this would break for nonexistent files with fully qualified pathnames in
another directory, as the third example shows.
Obviously, more involved workarounds can be imagined; but IMO that
functionality should rather be contained in the canonicalize_file_name
function.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?36677>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #36677] canonicalize_file_name: inconsistent behavior for non-existing files,
Philip Nienhuis <=