[Mono-bugs] [Bug 673109] New: Command line argument quoting lost in mono script wrapper

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 17 13:56:40 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=673109

https://bugzilla.novell.com/show_bug.cgi?id=673109#c0


           Summary: Command line argument quoting lost in mono script
                    wrapper
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.10.x
          Platform: i386
        OS/Version: RHEL 5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: packaging
        AssignedTo: ajorgensen at novell.com
        ReportedBy: tekhedd at byteheaven.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13)
Gecko/20101203 Firefox/3.6.13

Quoted command line arguments lose their quoting and are split on whitespace by
the mono script wrapper installed on CentOS 5 (and probably other linux
platforms.)

Easy Fix:

Modify /opt/novell/mono/bin/mono: line 3:

exec /opt/novell/mono/bin/mono.bin "$@"

^ Adding quotes around the $@ preserves quoting of the command line arguments.
(Common error!)

Reproducible: Always

Steps to Reproduce:
using System;
public class PrintArgs
{
   public static int Main( string [] unused ) 
   {
      Console.WriteLine( "CL: {0}", Environment.CommandLine );
      string [] args = Environment.GetCommandLineArgs();
      foreach (string arg in args)
         Console.WriteLine( "ARG: {0}", arg );

      return 0;
   }
}

Output should be: (WinXP)


S:\>args ONE "TWO THREE"
CL: args ONE "TWO THREE"
ARG: args
ARG: ONE
ARG: TWO THREE

Output is:

[buildman at rh5build tmp]$ mono args.exe ONE "TWO THREE"
CL: /tmp/args.exe ONE TWO THREE
ARG: /tmp/args.exe
ARG: ONE
ARG: TWO
ARG: THREE




(Apologies if this is a duplicate. I searched several different ways!)

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list