W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2008

Re: Of base URIs and the current working directory

From: David A. Lee <dlee@calldei.com>
Date: Wed, 19 Nov 2008 10:30:35 -0500
Message-ID: <1601FBB3F47143B1A3AC8F818A2010AD@calldei.com>
To: "Norman Walsh" <ndw@nwalsh.com>, "XProc Dev" <xproc-dev@w3.org>

The "current working directory" is a tricky thing portably ...

Examples:

On *nix there is a cwd per process.  Since most (but not all) XML processors 
are single threaded they can use the process cwd and "typical" XML 
processors dont change the cwd ...
so one can often infer that the "real cwd" is the OS concept of the cwd for 
that process.


In Java, there is the cwd at the time the process started and this is only 
exposed
by the System "user.dir" property which is populated at startup from the OS 
cwd.
MOST but not all XML processors use this if they can, but I've found that 
sometimes depending on how you get the "File" object created it can defer 
down to native code which uses the real OS system CWD instead of the java 
property.   This is a problem if you try to change the directory within a 
java program by setting the system property (no other supported way). 
Particularly a problem if you run multiple threads and each has its own 
concept of a "current directory".
xmlsh for example, simulates a multi threaded cwd by overriding the system 
properties per thread.  This works sometimes, but other times does not due 
to the above issues.

Why I mention all this, is that it may not be a portable supportable concept 
to expose the "current directory" if you assume that all XML processors will 
respect it.
If you expose the "current directory" then I belive this bleeds into the 
spec into every place a file URI is accepted you need to guarentee or assert 
that relative paths will use the "current directory" exposed by the extended 
API and implementations will have to respect this in all cases, which may be 
very tricky.


-----------------------------------------------------------
David A. Lee
dlee@calldei.com
http://www.calldei.com






----- Original Message ----- 
From: "Norman Walsh" <ndw@nwalsh.com>
To: "XProc Dev" <xproc-dev@w3.org>
Sent: Wednesday, November 19, 2008 9:50 AM
Subject: Re: Of base URIs and the current working directory
Received on Wednesday, 19 November 2008 15:43:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 19 November 2008 15:43:54 GMT