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

Lance Andersen lance.andersen at oracle.com
Wed Feb 13 22:53:15 UTC 2019


Hi Christoph
> On Feb 13, 2019, at 5:30 PM, Langer, Christoph <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: 
 <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>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/20190213/1bc8e9e4/attachment.html>


More information about the security-dev mailing list