View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015744CMakeCMakepublic2015-09-15 13:212016-05-02 08:30
ReporterThiago M. 
Assigned ToClinton Stimpson 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSRed Hat Enterprise LinuxOS Version6
Product VersionCMake 3.3.1 
Target VersionFixed in Version 
Summary0015744: Spaces in paths with non-ASCII characters are not escaped when using Ninja
DescriptionWhen using CMake with the Ninja generator to build some source code that is inside a path that contains both spaces and non-ASCII characters, the path is used without escaping the spaces inside the generated Ninja rules files.
Steps To Reproduce1) Create a sources folder in a path which contains both spaces and non-ASCII characters. Ex:
   `make /tmp/CMake Ninja Spaces/Código`
2) Inside the source folder, create a `CMakeLists.txt` with an `add_executable(main main.cpp)`.
3) Run CMake using the Ninja generator.
4) Check the generated `build.ninja` file.
   It should have spaces in paths escaped with `$`, like:
       build CMakeFiles/CMakeNinjaSpaces.dir/main.cpp.o: CXX_COMPILER__CMakeNinjaSpaces /tmp/CMake$ Ninja$ Spaces/Código/main.cpp
   However, it has variables names `identX` with unescaped paths:
       ident0 = /tmp/CMake Ninja Spaces/Código/main.cpp
       build CMakeFiles/CMakeNinjaSpaces.dir/main.cpp.o: CXX_COMPILER__CMakeNinjaSpaces $ident0
Additional InformationThe unescaped paths make Ninja rebuild and relink everything whenever it runs, making incremental builds and the edit-build-test cicle impossible.

Steps to reproduce (cont.):
5) Run Ninja on the generated `build.ninja` file.
   It outputs the progress of files being build:
       [1/2] Building CXX object CMakeFiles/CMakeNinjaSpaces.dir/main.cpp.o
       [2/2] Linking CXX executable CMakeNinjaSpaces
6) Run Ninja again.
   It should do nothing and print:
       `ninja: no work to do.`
   However, it does rebuild and relink everything, showing again the progress messages described in step 5.
Tagsninja, Unicode
Attached Files? file icon build.ninja [^] (7,117 bytes) 2015-09-15 13:21

 Relationships

  Notes
(0040037)
Clinton Stimpson (developer)
2016-01-01 23:26

I'm seeing this output from Ninja.

$ ninja-build -d explain
ninja explain: /tmp/CMake Ninja Spaces/C is dirty
ninja explain: digo/main.cpp is dirty
ninja explain: CMakeFiles/main.dir/main.cpp.o is dirty
ninja explain: main is dirty
[2/2] Linking CXX executable main

Perhaps this is a Ninja bug. For example, here is a currently open bug where non-ascii characters are treated as whitespace, which fits my observation above.
https://github.com/ninja-build/ninja/issues/811 [^]
(0040049)
Thiago M. (reporter)
2016-01-04 07:15

Clinton, it seems you're right: I've tested the same build.ninja file generated by CMake with Ninja master (commit c2e810ca4314f112cb65fabd35583b10136faea2 on their Git) and it indeed worked correctly.
(0040991)
Robert Maynard (manager)
2016-05-02 08:30

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-09-15 13:21 Thiago M. New Issue
2015-09-15 13:21 Thiago M. File Added: build.ninja
2015-09-15 13:31 Thiago M. Tag Attached: ninja
2015-09-15 13:31 Thiago M. Tag Attached: Unicode
2016-01-01 23:26 Clinton Stimpson Note Added: 0040037
2016-01-04 07:15 Thiago M. Note Added: 0040049
2016-01-05 23:31 Clinton Stimpson Status new => resolved
2016-01-05 23:31 Clinton Stimpson Resolution open => no change required
2016-01-05 23:31 Clinton Stimpson Assigned To => Clinton Stimpson
2016-05-02 08:30 Robert Maynard Note Added: 0040991
2016-05-02 08:30 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team