[cmake-developers] [CMake 0015898]: CMake must provide a magic method to do right escaping of commands being executed in shell
The following issue has been SUBMITTED. == https://cmake.org/Bug/view.php?id=15898 == Reported By:Ilya Assigned To: == Project:CMake Issue ID: 15898 Category: CMake Reproducibility:N/A Severity: feature Priority: normal Status: new == Date Submitted: 2016-01-02 05:18 EST Last Modified: 2016-01-02 05:18 EST == Summary:CMake must provide a magic method to do right escaping of commands being executed in shell Description: Right now it's very hard to write a command that should be executed in shell and will work on various platforms. Here is the notable example we came across recently: https://gist.github.com/Kentzo/00198d5cfc03ebdedddf CMake should provide a function or some way to specify a literal that will be correctly escaped according to the rules of the shell where the command will be executed. Additional Information: https://gist.github.com/Kentzo/00198d5cfc03ebdedddf == Issue History Date ModifiedUsername FieldChange == 2016-01-02 05:18 Ilya New Issue == -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [CMake 0015899]: The DragNDrop CPack generator has an off-by-one in its code line-wrapping LICENSE files configured in CPack
The following issue has been SUBMITTED. == https://cmake.org/Bug/view.php?id=15899 == Reported By:Andrey M. Mishchenko Assigned To: == Project:CMake Issue ID: 15899 Category: CPack Reproducibility:always Severity: minor Priority: normal Status: new == Date Submitted: 2016-01-02 14:14 EST Last Modified: 2016-01-02 14:14 EST == Summary:The DragNDrop CPack generator has an off-by-one in its code line-wrapping LICENSE files configured in CPack Description: The package target fails to build given the simple CMakeLists.txt and license.txt attached. == Issue History Date ModifiedUsername FieldChange == 2016-01-02 14:14 Andrey M. MishchenkoNew Issue 2016-01-02 14:14 Andrey M. MishchenkoFile Added: CMakeLists.txt == -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [PATCH] Fix some bugs in CPack's DragNDrop generator's handling of LICENSE files
There were issues in the special-character-escaping and line-wrapping code which caused DragNDrop packaging to fail mysteriously at a later step with parsing errors in the sla.r file generated by the following code. --- Source/CPack/cmCPackDragNDropGenerator.cxx | 89 +++--- Source/CPack/cmCPackDragNDropGenerator.h | 12 ++-- 2 files changed, 76 insertions(+), 25 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 1a694ea..2413b7f 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -693,27 +693,48 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, ofs << std::dec << std::nouppercase << std::setfill(' '); } +bool have_write_license_error = false; +std::string error; + if(oldStyle) { - WriteLicense(ofs, 0, "", cpack_license_file); + if(!this->WriteLicense(ofs, 0, "", cpack_license_file, &error)) +{ +have_write_license_error = true; +} } else { - for(size_t i = 0; i < languages.size(); ++i) + for(size_t i = 0; i < languages.size() && !have_write_license_error; ++i) { if(singleLicense) { - WriteLicense(ofs, i + 5000, languages[i], cpack_license_file); + if(!this->WriteLicense(ofs, i + 5000, languages[i], cpack_license_file, &error)) +{ +have_write_license_error = true; +} } else { - WriteLicense(ofs, i + 5000, languages[i]); + if(!this->WriteLicense(ofs, i + 5000, languages[i], "", &error)) +{ +have_write_license_error = true; +} } } } ofs.Close(); +if(have_write_license_error) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, +"Error writing license file to SLA." << std::endl +<< error +<< std::endl); + return 0; + } + // convert to UDCO std::string temp_udco = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); temp_udco += "/temp-udco.dmg"; @@ -724,7 +745,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, udco_image_command << " -format UDCO"; udco_image_command << " -ov -o \"" << temp_udco << "\""; -std::string error; if(!this->RunCommand(udco_image_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -855,9 +875,10 @@ cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( return GetComponentPackageFileName(package_file_name, componentName, false); } -void +bool cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, - int licenseNumber, std::string licenseLanguage, std::string licenseFile) + int licenseNumber, std::string licenseLanguage, std::string licenseFile, + std::string *error) { if(!licenseFile.empty() && !singleLicense) { @@ -881,9 +902,12 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, std::getline(license_ifs, line); if(!line.empty()) { -EscapeQuotes(line); +EscapeQuotesAndBackslashes(line); std::vector lines; -BreakLongLine(line, lines); +if(!this->BreakLongLine(line, lines, error)) + { + return false; + } for(size_t i = 0; i < lines.size(); ++i) { outputStream << "\"" << lines[i] << "\"\n"; @@ -920,9 +944,12 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, std::getline(menu_ifs, line); if(!line.empty()) { - EscapeQuotes(line); + EscapeQuotesAndBackslashes(line); std::vector lines; - BreakLongLine(line, lines); + if(!this->BreakLongLine(line, lines, error)) +{ +return false; +} for(size_t i = 0; i < lines.size(); ++i) { std::string comma; @@ -949,31 +976,53 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, outputStream << "};\n"; outputStream << "\n"; } + + return true; } -void +bool cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, - std::vector& lines) + std::vector& lines, std::string *error) { const size_t max_line_length = 512; for(size_t i = 0; i < line.size(); i += max_line_length) { -int line_length = max_line_length; -if(i + max_line_length > line.size()) +size_t line_length = max_line_length; +if(i + line_length > line.size()) { line_length = line.size() - i; } +else while(line_length > 0 && line[i + line_length - 1] != ' ') + { + line_length = line_length - 1; + } + +if(line_length == 0) + { + *error = "Please make sure there are no words " + "(or character sequences
Re: [cmake-developers] [PATCH] Fix some bugs in CPack's DragNDrop generator's handling of LICENSE files
I forgot to note that this patch "addresses" https://cmake.org/Bug/view.php?id=15899. On Sat, Jan 2, 2016 at 4:11 PM, Andrey Mishchenko wrote: > There were issues in the special-character-escaping and line-wrapping code > which caused DragNDrop packaging to fail mysteriously at a later step with > parsing errors in the sla.r file generated by the following code. > > --- > Source/CPack/cmCPackDragNDropGenerator.cxx | 89 > +++--- > Source/CPack/cmCPackDragNDropGenerator.h | 12 ++-- > 2 files changed, 76 insertions(+), 25 deletions(-) > > diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx > b/Source/CPack/cmCPackDragNDropGenerator.cxx > index 1a694ea..2413b7f 100644 > --- a/Source/CPack/cmCPackDragNDropGenerator.cxx > +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx > @@ -693,27 +693,48 @@ int cmCPackDragNDropGenerator::CreateDMG(const > std::string& src_dir, >ofs << std::dec << std::nouppercase << std::setfill(' '); >} > > +bool have_write_license_error = false; > +std::string error; > + > if(oldStyle) >{ > - WriteLicense(ofs, 0, "", cpack_license_file); > + if(!this->WriteLicense(ofs, 0, "", cpack_license_file, &error)) > +{ > +have_write_license_error = true; > +} >} > else >{ > - for(size_t i = 0; i < languages.size(); ++i) > + for(size_t i = 0; i < languages.size() && > !have_write_license_error; ++i) > { > if(singleLicense) >{ > - WriteLicense(ofs, i + 5000, languages[i], cpack_license_file); > + if(!this->WriteLicense(ofs, i + 5000, languages[i], > cpack_license_file, &error)) > +{ > +have_write_license_error = true; > +} >} > else >{ > - WriteLicense(ofs, i + 5000, languages[i]); > + if(!this->WriteLicense(ofs, i + 5000, languages[i], "", &error)) > +{ > +have_write_license_error = true; > +} >} > } >} > > ofs.Close(); > > +if(have_write_license_error) > + { > + cmCPackLogger(cmCPackLog::LOG_ERROR, > +"Error writing license file to SLA." << std::endl > +<< error > +<< std::endl); > + return 0; > + } > + > // convert to UDCO > std::string temp_udco = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); > temp_udco += "/temp-udco.dmg"; > @@ -724,7 +745,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const > std::string& src_dir, > udco_image_command << " -format UDCO"; > udco_image_command << " -ov -o \"" << temp_udco << "\""; > > -std::string error; > if(!this->RunCommand(udco_image_command, &error)) >{ >cmCPackLogger(cmCPackLog::LOG_ERROR, > @@ -855,9 +875,10 @@ > cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( >return GetComponentPackageFileName(package_file_name, componentName, > false); > } > > -void > +bool > cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& > outputStream, > - int licenseNumber, std::string licenseLanguage, std::string licenseFile) > + int licenseNumber, std::string licenseLanguage, std::string licenseFile, > + std::string *error) > { >if(!licenseFile.empty() && !singleLicense) > { > @@ -881,9 +902,12 @@ > cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, >std::getline(license_ifs, line); >if(!line.empty()) > { > -EscapeQuotes(line); > +EscapeQuotesAndBackslashes(line); > std::vector lines; > -BreakLongLine(line, lines); > +if(!this->BreakLongLine(line, lines, error)) > + { > + return false; > + } > for(size_t i = 0; i < lines.size(); ++i) >{ >outputStream << "\"" << lines[i] << "\"\n"; > @@ -920,9 +944,12 @@ > cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, > std::getline(menu_ifs, line); > if(!line.empty()) >{ > - EscapeQuotes(line); > + EscapeQuotesAndBackslashes(line); >std::vector lines; > - BreakLongLine(line, lines); > + if(!this->BreakLongLine(line, lines, error)) > +{ > +return false; > +} >for(size_t i = 0; i < lines.size(); ++i) > { > std::string comma; > @@ -949,31 +976,53 @@ > cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, > outputStream << "};\n"; > outputStream << "\n"; > } > + > + return true; > } > > -void > +bool > cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, > - std::vector& lines) > + std::vector& lines, std::string *error) > { >const size_t max_line_length = 512; >for(size_t i = 0; i < line.size(); i += max_line_length) > { > -int line_length = max_line_length; > -
[cmake-developers] [CMake 0015900]: Problem with Cmake and VStudio 2013 in windows 7/64 plaform
The following issue has been SUBMITTED. == https://public.kitware.com/Bug/view.php?id=15900 == Reported By:Taher Assigned To: == Project:CMake Issue ID: 15900 Category: (No Category) Reproducibility:have not tried Severity: crash Priority: normal Status: new == Date Submitted: 2016-01-02 19:20 EST Last Modified: 2016-01-02 19:20 EST == Summary:Problem with Cmake and VStudio 2013 in windows 7/64 plaform Description: CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_world" which requires target "zlib" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_world" which requires target "libjpeg" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_world" which requires target "libpng" that is not in the export set. Steps to Reproduce: How to solve these. Additional Information: I am badly in such problem == Issue History Date ModifiedUsername FieldChange == 2016-01-02 19:20 Taher New Issue == -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers