[RFE] Control Relative Path Resolution

Florian Weimer fweimer at redhat.com
Thu Feb 14 15:01:57 UTC 2019


* Alan Bateman:

>> However, this introduces a new challenge, in this case regarding the
>> system property 'user.dir', since it has different purposes. Some
>> Maven plugins change this value in some cases as it is the only way
>> to control the resolution of relative paths. Being able to change
>> the "working directory" gives several interesting benefits, which
>> should not impact other usages of user.dir.

> Java SE and the JDK have no support for the equivalent of chdir, it's
> not clear how such a feature could work reliably in a multi-threaded
> environment.

Several file servers on Linux use unshare(CLONE_FS) to obtain a
per-thread current directory (and chroot and umask, but they probably
care less about those).

I plan to expose this in glibc 2.30 at the <pthread.h> level for
clarity, but the unshare hack is extremely reliable today, will not go
away, and could be used by the JVM on Linux.  (Not sure about Solaris or
others.)

That does not address the question of the higher-level Java behavior
regarding file-system-independent pathname resolution, of course.

Thanks,
Florian


More information about the jdk-dev mailing list