RFR 8213031: (zipfs) Add support for POSIX file permissions

Langer, Christoph christoph.langer at sap.com
Thu Feb 14 07:54:16 UTC 2019


Hi Lance,

thanks for the detailed explanation, sounds great. I’ll work that in in my next edition ��

Best regards
Christoph


From: Lance Andersen <lance.andersen at oracle.com>
Sent: Mittwoch, 13. Februar 2019 23:53
To: Langer, Christoph <christoph.langer at sap.com>
Cc: Alan Bateman <Alan.Bateman at oracle.com>; nio-dev <nio-dev at openjdk.java.net>; Java Core Libs <core-libs-dev at openjdk.java.net>; OpenJDK Dev list <security-dev at openjdk.java.net>; Volker Simonis <volker.simonis at gmail.com>
Subject: Re: RFR 8213031: (zipfs) Add support for POSIX file permissions

Hi Christoph
On Feb 13, 2019, at 5:30 PM, Langer, Christoph <christoph.langer at sap.com<mailto:christoph.langer at sap.com>> wrote:

Hi Lance,

thanks for looking.


Just starting to take a peek at this and noticed one quick thing in your test:
------------
Paths.get(System.getProperty("test.dir", "."), "testPosix.zip")
——————

You do not need the test.dir property  or the permission added to test.policy
to access it,  just reference the jar and it will be created in user.dir which is
also writable.

Hm, I thought I didn't want to mess around in "user.dir" as it can be some more global directory where you wouldn't want to leave artefacts... To me "test.dir" feels cleaner. Are there other opinions about that?

user.dir points to the scratch directory that test uses, so it is where you want to create the tests.  Workspaces can sometimes be read only:

For example:
——————

    @Test
    public void test000() throws IOException {
        System.out.println("test.dir = " +
                System.getProperty("test.dir", "."));
        System.out.println("user.dir = " +
                System.getProperty("user.dir", "."));
        System.out.println(
                Paths.get(System.getProperty("test.dir", "."), "basic.jar").toAbsolutePath()
        );
    }

-----------------

Results in:
--------------------
test.dir = .
user.dir = /Users/ljanders/Documents/hg-workspaces/openjdk-jdk/jdk-zip-api/build/macosx-x64/JTwork/scratch
/Users/ljanders/Documents/hg-workspaces/openjdk-jdk/jdk-zip-api/build/macosx-x64/JTwork/scratch/./basic.jar

Please see http://openjdk.java.net/jtreg/tag-spec.html for the system properties.  I do not see test.dir there.
—————————

I would just do:

—————————

Path foo = Path.of("test.zip");
System.out.println("test.zip path=" + foo.toAbsolutePath());

--------------------------

which results in the output:
test.zip path=/Users/ljanders/Documents/hg-workspaces/openjdk-jdk/jdk-zip-api/build/macosx-x64/JTwork/scratch/test.zip

Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com<mailto:Lance.Andersen at oracle.com>




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/security-dev/attachments/20190214/70812ffb/attachment-0001.html>


More information about the security-dev mailing list