Bug 31174 - xbuild doesn't allow backslashes to be escaped/encoded
Summary: xbuild doesn't allow backslashes to be escaped/encoded
Status: NEW
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-06-16 17:37 UTC by Matt Z
Modified: 2015-12-29 22:48 UTC (History)
4 users (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 31174 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 Matt Z 2015-06-16 17:37:14 UTC
I have an xbuild file which uses the Exec task to invoke a command line tool. The tool takes a regular expression as a parameter, which in my case contains a backslash (\) character. It seems that xbuild converts all backslashes into forward slashes, as they usually represent a directory separation character, but in this specific case I need it passed without conversion. I have tried escaping (\\) and encoding () but neither worked.

Looking at the relevant code, it seems like conversion is done unconditionally:
https://github.com/mono/mono/blob/88d2b9da2a87b4e5c82abaea4e5110188d49601d/mcs/class/Microsoft.Build/Microsoft.Build.Internal/WindowsCompatibilityExtensions.cs#L36

Encoding would be the preferred solution for XML, but it seems that is broken. That issues has already be reported:
https://bugzilla.xamarin.com/show_bug.cgi?id=6759

Using Mono 4.0.2 on CentOS 6
Comment 1 Martin Costello 2015-06-23 17:45:30 UTC
XML entity escapting was working in Mono 4.0.1 but the currently nightly build of Mono 4.3.0 (as of 23/06/15) is no longer working as described in this bug (and bug 6759).

In my case %22 is no longer being converted to a double quote, which is being used to escape the possibility of spaces in paths.

Correct interpretation with Mono 4.0.1: https://travis-ci.org/experiandataquality/electronicupdates/builds/68014174#L2094

Incorrect interpretation with Mono 4.3.0: https://travis-ci.org/experiandataquality/electronicupdates/builds/68027929#L1004