| Summary: | Internal method isReadOnly(File) doesn't work as expected on Windows | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Equinox | Reporter: | Meng Xin Zhu <kane.zhu> | ||||
| Component: | p2 | Assignee: | Meng Xin Zhu <kane.zhu> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | henrik.lindberg, kane.mx | ||||
| Version: | 3.7.1 | ||||||
| Target Milestone: | Juno | ||||||
| Hardware: | PC | ||||||
| OS: | Windows All | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 351944 | ||||||
| Attachments: |
|
||||||
|
Description
Meng Xin Zhu
This may be the cause for some of the reported problems relating to the p2 backup/restore functionality as well. (Have not actually scanned that logic to check how it determines what can / can't be done with the files, but would not be surprised if it makes use of File.canRead()/canWrite()). (In reply to comment #1) > be surprised if it makes use of File.canRead()/canWrite()). be surprised if it does *not* make use of .... Created attachment 208477 [details]
a proposed patch
I don't find better way without creating a temporary file for testing. Does everyone have better solution to check whether new files can be created under a specified folder?
No, I think that's the best option. Doing a search returns a couple of other places in our code where we try and create a temp file to determine if a location is readonly. org.eclipse.core.internal.runtime.auth.AuthorizationDatabase#canWrite org.eclipse.osgi.internal.baseadaptor.AdaptorUtil#canWrite Check out the code for the second one, it has special considerations for DLLs on certain Windows-based file systems. Not sure if we need that or not in the p2 code. (In reply to comment #4) > org.eclipse.core.internal.runtime.auth.AuthorizationDatabase#canWrite > org.eclipse.osgi.internal.baseadaptor.AdaptorUtil#canWrite > > Check out the code for the second one, it has special considerations for DLLs on > certain Windows-based file systems. Not sure if we need that or not in the p2 > code. If Eclipse is installed into "Program Files" by user on Windows 7, the instance of this Eclipse always is read-only when user launches it in normal way. The base Eclipse should not be locked and updated when user launches Eclipse without administrative permission. Fixed, http://git.eclipse.org/c/equinox/rt.equinox.p2.git/commit/?id=4174108261eddcb3cd45006d5f1f7631e4a2a2d9 |