Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=79118 --- shadow/79118 2006-08-20 06:12:36.000000000 -0400 +++ shadow/79118.tmp.1168 2006-08-20 06:12:36.000000000 -0400 @@ -0,0 +1,65 @@ +Bug#: 79118 +Product: Mono: Class Libraries +Version: 1.1 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Minor +Component: System.Security +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: FileIOPermission.UnionKeys only considers first entry of list + +Description of Problem: + +I noticed a compiler warning whilst building mcs: + +System.Security.Permissions/FileIOPermission.cs(531,30): warning CS0162: +Unreachable code detected + +This is an issue in the FileIOPermission.UnionKeys method. + +Looking at the code, I noticed that the logic was a bit buggy, the inner +loop will never look at more than one of the list entries. + +Here is a short test program that reveals the issue: + +-------------------- +using System; +using System.Security.Permissions; + +public class Program { + static public int Main (string[] args) + { + FileIOPermission fiopA = new FileIOPermission( + FileIOPermissionAccess.Read, + new string[] { "/tmp/one", "/tmp/two" }); + + FileIOPermission fiopB = new FileIOPermission( + FileIOPermissionAccess.Read, + new string[] { "/tmp/two" }); + + FileIOPermission fiopC = (FileIOPermission) fiopA.Union(fiopB); + string[] paths = fiopC.GetPathList(FileIOPermissionAccess.Read); + + if (paths.Length > 2) { + Console.WriteLine("Union didn't remove duplicate"); + foreach (string path in paths) { + Console.WriteLine(path); + } + return 1; + } + + Console.WriteLine ("OK"); + return 0; + } +} +-------------------- + +A patch to fix follows. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
