Bug 59026 - File.GetAttributes() returns Normal instead of ReadOnly
Summary: File.GetAttributes() returns Normal instead of ReadOnly
Status: NEW
Alias: None
Product: Installers
Classification: Mono
Component: Linux packages ()
Version: 5.4.0 (2017-06)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Jo Shields
URL:
Depends on:
Blocks:
 
Reported: 2017-08-24 19:25 UTC by Vinay Potluri
Modified: 2017-08-24 19:25 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 59026 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Vinay Potluri 2017-08-24 19:25:48 UTC
Building mono fails at a testsuite CopyTest.cs
Ref: https://github.com/mono/mono/blob/master/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CopyTest.cs

> cd /builddir/build/BUILD/mono/mcs/class/Microsoft.Build.Tasks/
> make run-test FIXTURE=Microsoft.Build.Tasks.Copy_OverwriteReadOnlyTrue

Tracing it down fails at a testcase TestCopy_OverwriteReadOnlyTrue() where it sets the created file (copyro1.txt) attributes to "ReadOnly" but the GetAttributes returns "Normal" always.
Ref: https://github.com/mono/mono/blob/75fd607a5c178dde86a8d382ddf2ffa35d4e111c/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CopyTest.cs#L311

When the created file permissions are in ReadOnly mode; however, GetAttribute always returns as Normal.

> cd mono/mcs/class/Microsoft.Build.Tasks/Test/
> ls -al resources/Target/copyro1.txt
> -r--r--r-- 1 root root 0 Aug 23 23:13 resources/Target/copyro1.txt

> System.Console.WriteLine("Target File:" +target_file+" "+File.GetAttributes (target_file));
> Target File:Test/resources/Target/copyro1.txt Normal

This results in an error at Assert.AreEqual
Ref: https://github.com/mono/mono/blob/75fd607a5c178dde86a8d382ddf2ffa35d4e111c/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CopyTest.cs#L323

//Error
>1) TestCopy_OverwriteReadOnlyTrue (MonoTests.Microsoft.Build.Tasks.CopyTest.TestCopy_OverwriteReadOnlyTrue)
>     A1
>  Expected: ReadOnly
>  But was:  Normal
> at MonoTests.Microsoft.Build.Tasks.CopyTest.TestCopy_OverwriteReadOnlyTrue () [0x0011b] in /builddir/build/BUILD/mono/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CopyTest.cs:334
> at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
> at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /builddir/build/BUILD/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:305


I suspect File.GetAttributes method returning some default value with monolite.


Mono : 5.4.0
Monolite : monolite-linux-1050700000
OS: Clear Linux