Bug 325431 (MONO82764) - gmcs/mcs/AssemblyBuilder: native resource file must be writeable
Summary: gmcs/mcs/AssemblyBuilder: native resource file must be writeable
Status: RESOLVED FIXED
Alias: MONO82764
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Minor
Target Milestone: ---
Assignee: Raja R Harinath
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-09 18:03 UTC by Andy Hume
Modified: 2007-09-17 08:29 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:52:53 UTC


---- Reported by andyhume32@yahoo.co.uk 2007-09-09 11:03:56 MST ----

Similar to https://bugzilla.novell.com/show_bug.cgi?id=MONO82617 "Wrong file permissions used for the '-
win32icon:foo.ico' command line parameter" (and to https://bugzilla.novell.com/show_bug.cgi?id=MONO81669 "Icon..ctor
(String filename) needs Write access to the file").

Repro: compile any program with /win32res:Icon.ico where Icon.ico is read-
only.  See:

[[
$ gmcs HelloWorld.cs -pkg:dotnet /win32res:Icon1.ico

Unhandled Exception: System.UnauthorizedAccessException: Access to the 
path "d:\Temp\Icon1.ico" is denied.
  at System.IO.FileStream..ctor (System.String path, FileMode mode, 
FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, 
FileOptions options) [0x00000]
  at System.IO.FileStream..ctor (System.String path, FileMode mode) 
[0x00000]
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor 
(string,System.IO.FileMode)
  at System.Reflection.Emit.AssemblyBuilder.DefineUnmanagedResource 
(System.String resourceFileName) [0x00000]
  at Mono.CSharp.Driver.MainDriver (System.String[] args) [0x00000]
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000]
]]

Note the stack trace is (as expected) different from the issue in 82617 --
 it is 11 levels deep, and the fault there is in method 
AssemblyBuilder.DefineIconResource.

The fix to this one is the same as there, but this time in method 
System.Reflection.Emit.AssemblyBuilder.DefineUnmanagedResource.


(After this, of the five issues listed in my comment to 82617, only 
mcs/class/ByteFX.Data/mysqlclient/Driver.cs remains unmodified).



---- Additional Comments From vargaz@gmail.com 2007-09-09 17:25:26 MST ----

Hopefully fixed in SVN.



Unknown operating system unknown. Setting to default OS "Other".

Comment 1 Andy Hume 2007-09-17 08:29:23 UTC
Yup, the fix is good.

However the test I gave is not so good: a .ico file is not a .res file, and it causes gmcs to hang forever...  I guess that's worthy of a bug -- when I get some time I'll try to do some investigation of whether other options cause the same behaviour first.