MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0013760 | CMake | CMake | public | 2012-11-29 16:13 | 2016-06-10 14:31 |
Reporter | Andreas Mohr | ||||
Assigned To | Kitware Robot | ||||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | moved | ||
Platform | PC 32bit | OS | Linux | OS Version | Debian stable |
Product Version | CMake 2.8.9 | ||||
Target Version | Fixed in Version | ||||
Summary | 0013760: file(STRINGS): very questionable (sufficiently certainly buggy?) behaviour for square brackets | ||||
Description | I just tried parsing a section that resembles an IDL file part (the format spec of which has sections enclosed in '[',']'). I was rather very astonished about the result of file(STRINGS) on this (after already having spent a sizeable chunk of the day about various other file(STRINGS) specifics, to add insult to injury). Why in h*ll would file(STRINGS) take such specific care about the format of the text file? Don't tell me that it's because of (quoting docs) "Intel Hex and Motorola S-record files", which could possibly happen to have certain '['-enclosed sections. That would be a sad result for an otherwise (in the case of non-Intel/Motorola files) supposedly(?) sufficiently generic file(STRINGS) functionality. Needless to say having any []-enclosed yet originally *multi-line* content end up delivered as a *single* line within foreach() processing is very problematic when contrasted against my expectations. If it actually is correct handling (for certain aspects of "correct") and there's no quite standard CMake mechanism explanation for this that I managed to miss, then docs should definitely be corrected to mention this possibly '['-specific handling. Any ideas or comments about this? Severity major since it's data corrupting (e.g. going line-by-line over a regex with start-of-line/end-of-line constraints - ^$ - *will* cause headache or worse). Thank you! | ||||
Steps To Reproduce | cmake_minimum_required(VERSION 2.8) project(file_strings_bug_test NONE) macro(write_file _file _content) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_file}" "${_content}") endmacro(write_file _file _content) macro(read_file _file) file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/${_file}" _content_list) foreach(line_ ${_content_list}) message("line ${_file}: ${line_}") endforeach(line_ ${_content_list}) endmacro(read_file _file) set("content_ok" "Hello World My Worrying Test") set(content_ko "[${content_ok}]") set(content_ko2 "Hi There [${content_ok}] ") write_file(file_ok "${content_ok}") write_file(file_ko "${content_ko}") write_file(file_ko2 "${content_ko2}") read_file(file_ok) read_file(file_ko) read_file(file_ko2) | ||||
Additional Information | $ cmake .. line file_ok: Hello line file_ok: World line file_ok: My Worrying line file_ok: Test line file_ko: [Hello;World;My Worrying;Test] line file_ko2: Hi line file_ko2: There line file_ko2: [Hello;World;My Worrying;Test] -- Configuring done -- Generating done -- Build files have been written to: /home/andi/prg/cmake_tests/file_strings_bug_test/build | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2012-11-29 16:13 | Andreas Mohr | New Issue | |||
2012-11-29 16:52 | David Cole | Note Added: 0031770 | |||
2012-11-29 17:27 | Andreas Mohr | Note Added: 0031771 | |||
2012-11-29 17:37 | Andreas Mohr | Note Added: 0031772 | |||
2012-11-30 06:51 | David Cole | Note Added: 0031778 | |||
2012-11-30 06:55 | David Cole | Note Added: 0031779 | |||
2012-11-30 08:26 | Brad King | Note Added: 0031781 | |||
2016-06-10 14:28 | Kitware Robot | Note Added: 0042162 | |||
2016-06-10 14:28 | Kitware Robot | Status | new => 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 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|