You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mark Hindess (JIRA)" <ji...@apache.org> on 2007/09/06 16:12:31 UTC

[jira] Created: (HARMONY-4754) [classlib] FilePermission incorrect canonical path

[classlib] FilePermission incorrect canonical path
--------------------------------------------------

                 Key: HARMONY-4754
                 URL: https://issues.apache.org/jira/browse/HARMONY-4754
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Mark Hindess


If called with a path ending in "-" or "*", java.io.FilePermission calls  File.getCanonicalPath with the "-" or "*" still appended.  This is incorrect (and produces very odd results if "-" or "*" exists - perhaps as a symlink to some completely different tree).

For example, if you do:

  mkdir test
  ln -s /tmp test/-

 then (new FilePermission("test/-", "read")).implies(new FilePermission("/tmp/file", "read")
is true and (new FilePermission("test/-", "read")).implies(new FilePermission("test/file", "read") is false where as on the RI it is the opposite way around since the '-' symlink is (correctly) ignored.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-4754) [classlib] FilePermission incorrect canonical path

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525525 ] 

Tim Ellison commented on HARMONY-4754:
--------------------------------------

> I also notice that the RI doesn't evaluate the canonical
> path in the constructor but only when it is required

Really?  I see it behave differently on Windows, using the Sysinternals tool and simply running 
    new FilePermission("foobartest/-", "read")

produces (apologies for poor formatting) on the RI a file system request

Process         Request    Path                            Result        Other
javaw.exe:2104  DIRECTORY  C:\Eclipse\workspace\Tim test\  NO SUCH FILE  FileBothDirectoryInformation: foobartest	


> [classlib] FilePermission incorrect canonical path
> --------------------------------------------------
>
>                 Key: HARMONY-4754
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4754
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Mark Hindess
>            Assignee: Tim Ellison
>
> If called with a path ending in "-" or "*", java.io.FilePermission calls  File.getCanonicalPath with the "-" or "*" still appended.  This is incorrect (and produces very odd results if "-" or "*" exists - perhaps as a symlink to some completely different tree).
> For example, if you do:
>   mkdir test
>   ln -s /tmp test/-
>  then (new FilePermission("test/-", "read")).implies(new FilePermission("/tmp/file", "read")
> is true and (new FilePermission("test/-", "read")).implies(new FilePermission("test/file", "read") is false where as on the RI it is the opposite way around since the '-' symlink is (correctly) ignored.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-4754) [classlib] FilePermission incorrect canonical path

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4754?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Ellison reassigned HARMONY-4754:
------------------------------------

    Assignee: Tim Ellison

> [classlib] FilePermission incorrect canonical path
> --------------------------------------------------
>
>                 Key: HARMONY-4754
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4754
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Mark Hindess
>            Assignee: Tim Ellison
>
> If called with a path ending in "-" or "*", java.io.FilePermission calls  File.getCanonicalPath with the "-" or "*" still appended.  This is incorrect (and produces very odd results if "-" or "*" exists - perhaps as a symlink to some completely different tree).
> For example, if you do:
>   mkdir test
>   ln -s /tmp test/-
>  then (new FilePermission("test/-", "read")).implies(new FilePermission("/tmp/file", "read")
> is true and (new FilePermission("test/-", "read")).implies(new FilePermission("test/file", "read") is false where as on the RI it is the opposite way around since the '-' symlink is (correctly) ignored.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-4754) [classlib] FilePermission incorrect canonical path

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525808 ] 

Tim Ellison commented on HARMONY-4754:
--------------------------------------

Ok, now if I create the directory "foobartest/" in the cwd, and then touch the file "-" in that directory, when I run the same snippet 

    new FilePermission("foobartest/-", "read") 

on RI / Harmony I see (edited for brevity) :

DIRECTORY ...\Tim test\            SUCCESS FileBothDirectoryInformation: foobartest
OPEN      ...\Tim test\foobartest\ SUCCESS Options: Open Directory Access: 00100001
DIRECTORY ...\Tim test\foobartest\ SUCCESS FileBothDirectoryInformation: -
CLOSE     ...\Tim test\foobartest\ SUCCESS

i.e. the RI and harmony both stat the file called "-", even though it is not intended to represent an actual file, just the foobartest directory recursively.

Are you saying that you don't see that stat?  I'm just trying to figure out where the difference lies, whether it is in fact in the constructor or in the implementation of #implies.

Thanks

> [classlib] FilePermission incorrect canonical path
> --------------------------------------------------
>
>                 Key: HARMONY-4754
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4754
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Mark Hindess
>            Assignee: Tim Ellison
>
> If called with a path ending in "-" or "*", java.io.FilePermission calls  File.getCanonicalPath with the "-" or "*" still appended.  This is incorrect (and produces very odd results if "-" or "*" exists - perhaps as a symlink to some completely different tree).
> For example, if you do:
>   mkdir test
>   ln -s /tmp test/-
>  then (new FilePermission("test/-", "read")).implies(new FilePermission("/tmp/file", "read")
> is true and (new FilePermission("test/-", "read")).implies(new FilePermission("test/file", "read") is false where as on the RI it is the opposite way around since the '-' symlink is (correctly) ignored.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-4754) [classlib] FilePermission incorrect canonical path

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525771 ] 

Mark Hindess commented on HARMONY-4754:
---------------------------------------

Oops.  Ignore that comment.  Doing something silly (the RI forks (or clones a new thread) and I had omitted the -f option on strace.)



> [classlib] FilePermission incorrect canonical path
> --------------------------------------------------
>
>                 Key: HARMONY-4754
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4754
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Mark Hindess
>            Assignee: Tim Ellison
>
> If called with a path ending in "-" or "*", java.io.FilePermission calls  File.getCanonicalPath with the "-" or "*" still appended.  This is incorrect (and produces very odd results if "-" or "*" exists - perhaps as a symlink to some completely different tree).
> For example, if you do:
>   mkdir test
>   ln -s /tmp test/-
>  then (new FilePermission("test/-", "read")).implies(new FilePermission("/tmp/file", "read")
> is true and (new FilePermission("test/-", "read")).implies(new FilePermission("test/file", "read") is false where as on the RI it is the opposite way around since the '-' symlink is (correctly) ignored.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-4754) [classlib] FilePermission incorrect canonical path

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525492 ] 

Mark Hindess commented on HARMONY-4754:
---------------------------------------

I also notice that the RI doesn't evaluate the canonical path in the constructor but only when it is required ... for example when the implies method is called.  This might result in different behaviour if the filesystem changes between the call to new and the call to implies.  We should probably try to behave more like the RI.



> [classlib] FilePermission incorrect canonical path
> --------------------------------------------------
>
>                 Key: HARMONY-4754
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4754
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Mark Hindess
>
> If called with a path ending in "-" or "*", java.io.FilePermission calls  File.getCanonicalPath with the "-" or "*" still appended.  This is incorrect (and produces very odd results if "-" or "*" exists - perhaps as a symlink to some completely different tree).
> For example, if you do:
>   mkdir test
>   ln -s /tmp test/-
>  then (new FilePermission("test/-", "read")).implies(new FilePermission("/tmp/file", "read")
> is true and (new FilePermission("test/-", "read")).implies(new FilePermission("test/file", "read") is false where as on the RI it is the opposite way around since the '-' symlink is (correctly) ignored.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-4754) [classlib] FilePermission incorrect canonical path

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525841 ] 

Mark Hindess commented on HARMONY-4754:
---------------------------------------

On sun 50 I see:

  lstat64("/path/to/foobartest", ...);

on Harmony I see:

  readlink("/path/to/foobartest/-", ...);

(Incidentally, on J9 I see neither and what I originally suggested about the canonical path being found at implies time stands.  And at implies time it only stats foobartest and not foobartest/-.  At least that tells use that lazy evaluation is okay in order to pass the TCK.)

I think it is the constructor that is incorrect.



> [classlib] FilePermission incorrect canonical path
> --------------------------------------------------
>
>                 Key: HARMONY-4754
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4754
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Mark Hindess
>            Assignee: Tim Ellison
>
> If called with a path ending in "-" or "*", java.io.FilePermission calls  File.getCanonicalPath with the "-" or "*" still appended.  This is incorrect (and produces very odd results if "-" or "*" exists - perhaps as a symlink to some completely different tree).
> For example, if you do:
>   mkdir test
>   ln -s /tmp test/-
>  then (new FilePermission("test/-", "read")).implies(new FilePermission("/tmp/file", "read")
> is true and (new FilePermission("test/-", "read")).implies(new FilePermission("test/file", "read") is false where as on the RI it is the opposite way around since the '-' symlink is (correctly) ignored.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.