Canonical path for /ssss/../../ ?

Weijun Wang weijun.wang at oracle.com
Fri Nov 23 04:20:03 UTC 2012


I've seen something weird on Linux:

   new File("/ssss/../").getCanonicalFile()' = /
   new File("/ssss/../../").getCanonicalFile()' = /..
   new File("/ssss/../../../").getCanonicalFile()' = /
   new File("/ssss/../../../../").getCanonicalFile()' = /..

and

   new File("/ssss/../..").getCanonicalFile().getCanonicalFile() = /

Is "/.." canonical? Shouldn't getCanonicalFile() be idempotent?

Thanks
Max



More information about the core-libs-dev mailing list