View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012350CMakeCMakepublic2011-07-19 06:472016-06-10 14:31
ReporterFlávio J. Saraiva 
Assigned ToKitware Robot 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0012350: add STRING(ESCAPE) to produce the original string in a CONFIGURE_FILE substitution
Descriptionstring(ESCAPE <string to escape> <output variable>)

It would escape the string, adding surrounding quotes if necessary so that using the escaped string in a CONFIGURE_FILE substitution would produce the original string.
Steps To Reproducesee attached file TestEscapeHell.cmake for a test showcasing the problem and a test with the proposed solution
Additional InformationI'm doing CONFIGURE_FILE on the script file CopyIfNotExists.cmake.in to run at install time.
I have a regex SVN_FOLDER_PATTERN=[\\.]svn that contains a backslash and is passed on to a variable in the file.

Configuring the file turns: set( SVN_FOLDER_PATTERN @SVN_FOLDER_PATTERN@ )
into: set( SVN_FOLDER_PATTERN [\.]svn )

This obviously generates a parse error: Invalid escape sequence \.
I'm forced to use string(REPLACE) to add escapes and avoid the issue.
TagsNo tags attached.
Attached Files? file icon TestEscapeHell.cmake [^] (1,125 bytes) 2011-07-19 06:47
patch file icon 0014-added-STRING-ESCAPE-command.patch [^] (3,702 bytes) 2011-07-20 05:34 [Show Content]

 Relationships

  Notes
(0027054)
Flávio J. Saraiva (reporter)
2011-07-19 15:52

Adding surrounding quotes isn't necessary since this can be done: set( SVN_FOLDER_PATTERN "@SVN_FOLDER_PATTERN@" )

Sidenote:
CMakeCache.txt doesn't support storing multi-line values (truncated to 1st line on load, cache can get poisoned with the other lines) or strings that start and end with a single quote (quote pair removed on load).
Properly escaping the value would be a good idea and allow for any value to be stored.
(0027056)
Flávio J. Saraiva (reporter)
2011-07-20 05:42

Added an implementation of the command. 0014-added-STRING-ESCAPE-command.patch

Only compiling was tested.
Escapes quotes, backslash, new line, carriage return, horizontal tab, vertical tab, $ and @.
Replaces new line, carriage return, horizontal tab, vertical tab in a 'quick-and-dirty' way.

Dunno what escapes it should handle, but these seem reasonable.
(0030279)
David Cole (manager)
2012-08-11 11:38

Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0041865)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2011-07-19 06:47 Flávio J. Saraiva New Issue
2011-07-19 06:47 Flávio J. Saraiva File Added: TestEscapeHell.cmake
2011-07-19 15:52 Flávio J. Saraiva Note Added: 0027054
2011-07-20 05:34 Flávio J. Saraiva File Added: 0014-added-STRING-ESCAPE-command.patch
2011-07-20 05:42 Flávio J. Saraiva Note Added: 0027056
2012-08-11 11:38 David Cole Status new => backlog
2012-08-11 11:38 David Cole Note Added: 0030279
2016-06-10 14:28 Kitware Robot Note Added: 0041865
2016-06-10 14:28 Kitware Robot Status backlog => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team