Bugzilla – Bug 325431
gmcs/mcs/AssemblyBuilder: native resource file must be writeable
Last modified: 2007-09-17 08:29:23 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".
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.