Bug 41056 - isReadOnly doesn't look at the user flags of a file
Summary: isReadOnly doesn't look at the user flags of a file
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.0   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.0 M3   Edit
Assignee: Andre Weinand CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-01 11:38 EDT by Pieter Verhaeghe CLA
Modified: 2003-08-06 18:24 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pieter Verhaeghe CLA 2003-08-01 11:38:08 EDT
On Mac OS/X (and maybe other unices), a file with with write permissions, but with the 
immutable flag set is reported as Writable, although the file can not be changed.
(On OS/X the perforce versioning control system uses this flag to allow/disallow a user
to edit a file)

I tested the following patch (source distribution of eclipse 3.0 build M2) of the file plugins/
org.eclipse.core.resources.macosx/src/core.c

99,100d98
<         else if ((info.st_flags & (UF_IMMUTABLE | SF_IMMUTABLE)) != 0)
<                 result |= STAT_READ_ONLY;
138,140c136
<         else if ((info.st_flags & (UF_IMMUTABLE | SF_IMMUTABLE)) != 0)
<                 result |= STAT_READ_ONLY;
<                 
---
>
Comment 1 Andre Weinand CLA 2003-08-04 08:33:38 EDT
Yes, if you "lock" a file in the Finder, this sets the IMMUTABLE bit and not the write permission bits.
And if you set the immutable bit via cmd line:
  chflags uchg <filename>
the file is locked in the Finder.

So I will apply the patch to the MacOS X implementation of core.c.
However, I'm not really sure what to do in CoreFileSystemLibrary.internalSetReadOnly &Co.

platform-core please advise.
Comment 2 Andre Weinand CLA 2003-08-06 18:24:10 EDT
fixed for N20030807

- applied patch (for internalGetStat) 
- internalSetReadOnly sets/clears usr immutable flag
- internalCopyAttributes copies usr immutable flag