Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 329836 - EFS.ATTRIBUTE_IMMUTABLE is not set along with EFS.ATTRIBUTE_READ_ONLY any more
Summary: EFS.ATTRIBUTE_IMMUTABLE is not set along with EFS.ATTRIBUTE_READ_ONLY any more
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 major (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Malgorzata Janczarska CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-09 12:53 EST by Szymon Brandys CLA
Modified: 2011-01-26 04:21 EST (History)
0 users

See Also:
Szymon.Brandys: review+


Attachments
Test suites update (1.79 KB, patch)
2010-11-10 03:47 EST, Szymon Brandys CLA
no flags Details | Diff
Patch switching SF_IMMUTABLE to UF_IMMUTABLE (890 bytes, patch)
2011-01-04 07:35 EST, Malgorzata Janczarska CLA
no flags Details | Diff
mylyn/context/zip (7.48 KB, application/octet-stream)
2011-01-04 07:35 EST, Malgorzata Janczarska CLA
no flags Details
Combined patches. (5.10 KB, patch)
2011-01-04 11:13 EST, Malgorzata Janczarska CLA
Szymon.Brandys: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Szymon Brandys CLA 2010-11-09 12:53:03 EST
Pawel, it seems that your latest fix caused a problem. I'm attaching a test illustrating it.
Comment 1 Szymon Brandys CLA 2010-11-09 12:56:26 EST
You can also see it, when you run the test attached to Bug 323833, see 'Fixed patch'.
Comment 2 Szymon Brandys CLA 2010-11-09 13:11:28 EST
I committed Bug_329836.java to core.tests.resources. It illustrates the problem. When you have the fix, please add the test to the suite.
Comment 3 Szymon Brandys CLA 2010-11-10 03:31:44 EST
Please also add TestBug323833.java to the suite, when you fix the bug.
Comment 4 Szymon Brandys CLA 2010-11-10 03:47:20 EST
Created attachment 182791 [details]
Test suites update
Comment 5 Szymon Brandys CLA 2010-12-03 05:27:53 EST
Gosia, please investigate during M5.
Comment 6 Malgorzata Janczarska CLA 2011-01-04 07:35:38 EST
Created attachment 185997 [details]
Patch switching SF_IMMUTABLE to UF_IMMUTABLE

I think I?ve discovered where the problem lies. Look at UnixFileNatives.puFileInfo(String, IFileInfo, int), is sets/unsets immutable flag by using system chflags command. There are two system flags that may mean that file is immutable: SF_IMMUTABLE and UF_IMMUTABLE. When we want to set immutable to FALSE we are trying to switch both flags off, when we want to set immutable to TRUE we are only switching the SF_IMMUTABLE flag on.
This is what chflags manual says about flags:
______
The ``UF_IMMUTABLE'', ``UF_APPEND'', ``UF_OPAQUE'', and ``UF_HIDDEN'' flags may be set or unset by either the owner of a file or the super-user.

     The ``SF_ARCHIVED'', ``SF_IMMUTABLE'' and ``SF_APPEND'' flags may only be set or unset by the super-user.  They may be set at any time, but normally may only be unset when the system is in single-user mode.  (See init(8) for details.)
______

We are not running our tests as super-user, so setting the SF_IMMUTABLE flag on fails. When I?ve changed flag to UF_IMMUTABLE everything works fine, so this would be probably a solution to this defect.

As for setting both flags off for immutable=false I think it was done on purpose, because if the SF_IMMUTABLE flag is already off this command will only change UF_IMMUTABLE and changing SF_IMMUTABLE is added only for rare situations where the flag is on and we are a super-user.
Comment 7 Malgorzata Janczarska CLA 2011-01-04 07:35:40 EST
Created attachment 185998 [details]
mylyn/context/zip
Comment 8 Malgorzata Janczarska CLA 2011-01-04 11:13:35 EST
Created attachment 186019 [details]
Combined patches.

Combined all the patches and modified Bug_329836 test to check if it's unsetting immutable flag as well.
Comment 9 Szymon Brandys CLA 2011-01-05 10:09:01 EST
In HEAD. Thanks Gosia.
Comment 10 Malgorzata Janczarska CLA 2011-01-26 04:21:07 EST
Verified by code inspection.