[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-security-dev
Subject:    RE: RFR 8213031: (zipfs) Add support for POSIX file permissions
From:       "Langer, Christoph" <christoph.langer () sap ! com>
Date:       2019-02-14 7:54:16
Message-ID: fffd5a1521ef426c992dd3c8fa971185 () sap ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

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@oracle.com>
Sent: Mittwoch, 13. Februar 2019 23:53
To: Langer, Christoph <christoph.langer@sap.com>
Cc: Alan Bateman <Alan.Bateman@oracle.com>; nio-dev <nio-dev@openjdk.java.net>; Java \
Core Libs <core-libs-dev@openjdk.java.net>; OpenJDK Dev list \
                <security-dev@openjdk.java.net>; Volker Simonis \
                <volker.simonis@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@sap.com<mailto:christoph.langer@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@oracle.com<mailto:Lance.Andersen@oracle.com>


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Helvetica;
	panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
pre
	{mso-style-priority:99;
	mso-style-link:"HTML Preformatted Char";
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
p.msonormal0, li.msonormal0, div.msonormal0
	{mso-style-name:msonormal;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
	{mso-style-name:"HTML Preformatted Char";
	mso-style-priority:99;
	mso-style-link:"HTML Preformatted";
	font-family:"Consolas",serif;}
span.apple-style-span
	{mso-style-name:apple-style-span;}
span.EmailStyle21
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi \
Lance,<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">thanks for \
the detailed explanation, sounds great. I'll work that in in my next edition \
</span><span lang="EN-US" style="font-family:&quot;Segoe UI \
Emoji&quot;,sans-serif;mso-fareast-language:EN-US">&#128522;</span><span lang="EN-US" \
style="mso-fareast-language:EN-US"><o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Best \
regards<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="mso-fareast-language:EN-US">Christoph<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p> <div \
style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt"> <div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Lance \
Andersen &lt;lance.andersen@oracle.com&gt; <br>
<b>Sent:</b> Mittwoch, 13. Februar 2019 23:53<br>
<b>To:</b> Langer, Christoph &lt;christoph.langer@sap.com&gt;<br>
<b>Cc:</b> Alan Bateman &lt;Alan.Bateman@oracle.com&gt;; nio-dev \
&lt;nio-dev@openjdk.java.net&gt;; Java Core Libs \
&lt;core-libs-dev@openjdk.java.net&gt;; OpenJDK Dev list \
&lt;security-dev@openjdk.java.net&gt;; Volker Simonis \
&lt;volker.simonis@gmail.com&gt;<br> <b>Subject:</b> Re: RFR 8213031: (zipfs) Add \
support for POSIX file permissions<o:p></o:p></span></p> </div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Hi Christoph<o:p></o:p></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Feb 13, 2019, at 5:30 PM, Langer, Christoph &lt;<a \
href="mailto:christoph.langer@sap.com">christoph.langer@sap.com</a>&gt; \
wrote:<o:p></o:p></p> </div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<p class="MsoNormal">Hi Lance,<br>
<br>
thanks for looking.<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Just starting to take a peek at this and noticed one quick thing \
                in your test:<br>
------------<br>
Paths.get(System.getProperty(&quot;test.dir&quot;, &quot;.&quot;), \
&quot;testPosix.zip&quot;)<br> ——————<br>
<br>
You do not need the test.dir property &nbsp;or the permission added to \
test.policy<br> to access it, &nbsp;just reference the jar and it will be created in \
user.dir which is<br> also writable.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><br>
Hm, I thought I didn't want to mess around in &quot;user.dir&quot; as it can be some \
more global directory where you wouldn't want to leave artefacts... To me \
&quot;test.dir&quot; feels cleaner. Are there other opinions about \
that?<o:p></o:p></p> </div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<p class="MsoNormal">user.dir points to the scratch directory that test uses, so it \
is where you want to create the tests. &nbsp;Workspaces can sometimes be read \
only:<o:p></o:p></p> </div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">For example:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">——————<o:p></o:p></p>
</div>
<div>
<pre style="background:white"><span \
style="font-family:&quot;Helvetica&quot;,sans-serif">&nbsp;&nbsp;&nbsp; \
@Test<br>&nbsp;&nbsp;&nbsp; <b><span style="color:navy">public void \
</span></b>test000() <b><span style="color:navy">throws </span></b>IOException \
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.<b><i><span \
style="color:#660E7A">out</span></i></b>.println(<b><span \
style="color:green">&quot;test.dir = &quot; \
</span></b>&#43;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
System.<i>getProperty</i>(<b><span \
style="color:green">&quot;test.dir&quot;</span></b>, <b><span \
style="color:green">&quot;.&quot;</span></b>));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
System.<b><i><span style="color:#660E7A">out</span></i></b>.println(<b><span \
style="color:green">&quot;user.dir = &quot; \
</span></b>&#43;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
System.<i>getProperty</i>(<b><span \
style="color:green">&quot;user.dir&quot;</span></b>, <b><span \
style="color:green">&quot;.&quot;</span></b>));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
System.<b><i><span style="color:#660E7A">out</span></i></b>.println(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Paths.<i>get</i>(System.<i>getProperty</i>(<b><span \
style="color:green">&quot;test.dir&quot;</span></b>, <b><span \
style="color:green">&quot;.&quot;</span></b>), <b><span \
style="color:green">&quot;basic.jar&quot;</span></b>).toAbsolutePath()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
);<br>&nbsp;&nbsp;&nbsp; }</span><o:p></o:p></pre> <div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">-----------------<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Results in:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">--------------------<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">test.dir = .<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">user.dir = \
/Users/ljanders/Documents/hg-workspaces/openjdk-jdk/jdk-zip-api/build/macosx-x64/JTwork/scratch<o:p></o:p></p>
 </div>
<div>
<p class="MsoNormal">/Users/ljanders/Documents/hg-workspaces/openjdk-jdk/jdk-zip-api/build/macosx-x64/JTwork/scratch/./basic.jar<o:p></o:p></p>
 </div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Please see&nbsp;<a \
href="http://openjdk.java.net/jtreg/tag-spec.html">http://openjdk.java.net/jtreg/tag-spec.html</a> \
for the system properties. &nbsp;I do not see test.dir there.<o:p></o:p></p> </div>
<div>
<p class="MsoNormal">—————————<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">I would just do:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">—————————<o:p></o:p></p>
</div>
<div>
<pre style="background:white"><span \
style="font-family:&quot;Helvetica&quot;,sans-serif">Path foo = \
Path.<i>of</i>(<b><span \
style="color:green">&quot;test.zip&quot;</span></b>);<br>System.<b><i><span \
style="color:#660E7A">out</span></i></b>.println(<b><span \
style="color:green">&quot;test.zip path=&quot; </span></b>&#43; \
foo.toAbsolutePath());</span><o:p></o:p></pre> <div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">--------------------------<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">which results in the output:&nbsp;<o:p></o:p></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><u><span style="font-size:12.0pt;color:#0069D9">test.zip \
path=/Users/ljanders/Documents/hg-workspaces/openjdk-jdk/jdk-zip-api/build/macosx-x64/JTwork/scratch/test.zip</span></u><o:p></o:p></p>
 </div>
<div>
<p class="MsoNormal"><span \
style="font-size:13.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:black"><o:p>&nbsp;</o:p></span></p>
 </div>
<p class="MsoNormal"><span \
style="font-size:12.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#666666">Lance \
Andersen| Principal Member of Technical Staff | &#43;1.781.442.2037<br> </span><span \
style="font-size:12.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:black">Oracle</span><span \
style="font-size:12.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#666666">&nbsp;Java \
Engineering&nbsp;<br> 1 Network Drive&nbsp;<br>
Burlington, MA 01803<br>
</span><a href="mailto:Lance.Andersen@oracle.com"><span \
style="font-size:12.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:black">Lance.Andersen@oracle.com</span></a><o:p></o:p></p>
 </div>
<div>
<p class="MsoNormal"><span \
style="font-size:12.0pt;font-family:&quot;Helvetica&quot;,sans-serif;color:black"><o:p>&nbsp;</o:p></span></p>
 </div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic