I think I should comment this patch because of some possible problems.

In code comments and in comments under the bug #2005561 is written,
that : shouldn't be escaped in makefile, because it breaks files with
prefix containing :.
I've been trying hard to make pano with : in it's prefix though I
wasn't successful.

Also I've added escaping of * in quoteStringShell because this one
could cause problems too.

So I think this patch can be applied, because it's more likely that
someone has : in input names (looking at the rate of bug reports it
seems that some camera uses colon in it's names) than in output prefix
(which anyway do not work in current svn). In other words it doesn't
break anything.

If everyone is okay with it I would commit it.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/hugin-ptx
-~----------~----~----~----~------~----~------~--~---

Index: src/hugin_base/hugin_utils/platform.h
===================================================================
--- src/hugin_base/hugin_utils/platform.h	(revision 3594)
+++ src/hugin_base/hugin_utils/platform.h	(working copy)
@@ -117,20 +117,19 @@
 #ifdef WIN32
         // Do not quote backslash and ~ on win32.
         // It seems to be handled well by sh.exe from unixutils
-        return quoteStringInternal(arg, str("\\"), str(" $\"|'`{}[]()"));
+        return quoteStringInternal(arg, str("\\"), str(" $\"|'`{}[]()*"));
 #else
-        return quoteStringInternal(arg, str("\\"), str("\\ ~$\"|'`{}[]()"));
+        return quoteStringInternal(arg, str("\\"), str("\\ ~$\"|'`{}[]()*"));
 #endif
     }
 
     /** Escape dangerous chars in makefile strings/filenames
-     *  (space), should quote : as well, but it does not
-     *  seem to be supported by make.
+     *  (space),#,:
      */
     template <class str>
     str escapeStringMake(const str & arg)
     {
-        return quoteStringInternal(arg, str("\\"), str(" "));
+        return quoteStringInternal(arg, str("\\"), str(" #:"));
     }
 
     /** Quote a filename, so that it is surrounded by ""
Index: src/hugin_base/algorithms/panorama_makefile/PanoramaMakefileExport.cpp
===================================================================
--- src/hugin_base/algorithms/panorama_makefile/PanoramaMakefileExport.cpp	(revision 3594)
+++ src/hugin_base/algorithms/panorama_makefile/PanoramaMakefileExport.cpp	(working copy)
@@ -176,21 +176,21 @@
     o << endl
       << endl
       << "# Tool configuration" << endl
-      << "NONA=" << quoteStringShell(progs.nona) << endl
-      << "PTSTITCHER=" << quoteStringShell(progs.PTStitcher) << endl
-      << "PTMENDER=" << quoteStringShell(progs.PTmender) << endl
-      << "PTBLENDER=" << quoteStringShell(progs.PTblender) << endl
-      << "PTMASKER=" << quoteStringShell(progs.PTmasker) << endl
-      << "PTROLLER=" << quoteStringShell(progs.PTroller) << endl
-      << "ENBLEND=" << quoteStringShell(progs.enblend) << endl
-      << "ENFUSE=" << quoteStringShell(progs.enfuse) << endl
-      << "SMARTBLEND=" << quoteStringShell(progs.smartblend) << endl
-      << "HDRMERGE=" << quoteStringShell(progs.hdrmerge) << endl
+      << "NONA=" << escapeStringMake(quoteStringShell(progs.nona)) << endl
+      << "PTSTITCHER=" << escapeStringMake(quoteStringShell(progs.PTStitcher)) << endl
+      << "PTMENDER=" << escapeStringMake(quoteStringShell(progs.PTmender)) << endl
+      << "PTBLENDER=" << escapeStringMake(quoteStringShell(progs.PTblender)) << endl
+      << "PTMASKER=" << escapeStringMake(quoteStringShell(progs.PTmasker)) << endl
+      << "PTROLLER=" << escapeStringMake(quoteStringShell(progs.PTroller)) << endl
+      << "ENBLEND=" << escapeStringMake(quoteStringShell(progs.enblend)) << endl
+      << "ENFUSE=" << escapeStringMake(quoteStringShell(progs.enfuse)) << endl
+      << "SMARTBLEND=" << escapeStringMake(quoteStringShell(progs.smartblend)) << endl
+      << "HDRMERGE=" << escapeStringMake(quoteStringShell(progs.hdrmerge)) << endl
       << "RM=rm" << endl
 #ifdef COULD_EXECUTE_EXIFTOOL_WITH_PERL
-      << "EXIFTOOL=" << (executeWithPerl? perlCommand+" " : "") << quoteStringShell(progs.exiftool) << endl
+      << "EXIFTOOL=" << (executeWithPerl? perlCommand+" " : "") << escapeStringMake(quoteStringShell(progs.exiftool)) << endl
 #else
-      << "EXIFTOOL=" << quoteStringShell(progs.exiftool) << endl
+      << "EXIFTOOL=" << escapeStringMake(quoteStringShell(progs.exiftool)) << endl
 #endif
       << endl
       << "ifndef ENBLEND" << endl
@@ -284,29 +284,29 @@
 
     o << "# the output panorama" << endl
       << "LDR_REMAPPED_PREFIX=" << escapeStringMake(output) << endl
-      << "LDR_REMAPPED_PREFIX_SHELL=" << quoteStringShell(output) << endl
+      << "LDR_REMAPPED_PREFIX_SHELL=" << escapeStringMake(quoteStringShell(output)) << endl
 
     << "HDR_STACK_REMAPPED_PREFIX=" << escapeStringMake(output + "_hdr_") << endl
-    << "HDR_STACK_REMAPPED_PREFIX_SHELL=" << quoteStringShell(output + "_hdr_") << endl
+    << "HDR_STACK_REMAPPED_PREFIX_SHELL=" << escapeStringMake(quoteStringShell(output + "_hdr_")) << endl
 
     << "LDR_EXPOSURE_REMAPPED_PREFIX=" << escapeStringMake(output + "_exposure_layers_") << endl
-    << "LDR_EXPOSURE_REMAPPED_PREFIX_SHELL=" << quoteStringShell(output + "_exposure_layers_") << endl
+    << "LDR_EXPOSURE_REMAPPED_PREFIX_SHELL=" << escapeStringMake(quoteStringShell(output + "_exposure_layers_")) << endl
 
     << "PROJECT_FILE=" << escapeStringMake(ptofile) << endl
-    << "PROJECT_FILE_SHELL=" << quoteStringShell(ptofile) << endl
+    << "PROJECT_FILE_SHELL=" << escapeStringMake(quoteStringShell(ptofile)) << endl
 
     << "LDR_BLENDED=" << escapeStringMake(sLDR_BLENDED) << endl
-    << "LDR_BLENDED_SHELL=" << quoteStringShell(sLDR_BLENDED) << endl
+    << "LDR_BLENDED_SHELL=" << escapeStringMake(quoteStringShell(sLDR_BLENDED)) << endl
 
     << "LDR_STACKED_BLENDED=" << escapeStringMake(sLDR_STACKED_BLENDED) << endl
-    << "LDR_STACKED_BLENDED_SHELL=" << quoteStringShell(sLDR_STACKED_BLENDED) << endl
+    << "LDR_STACKED_BLENDED_SHELL=" << escapeStringMake(quoteStringShell(sLDR_STACKED_BLENDED)) << endl
 
     << "HDR_BLENDED=" << escapeStringMake(sHDR_BLENDED) << endl
-    << "HDR_BLENDED_SHELL=" << quoteStringShell(sHDR_BLENDED) << endl
+    << "HDR_BLENDED_SHELL=" << escapeStringMake(quoteStringShell(sHDR_BLENDED)) << endl
     << endl
     << "# first input image" << endl
     << "INPUT_IMAGE_1="  << escapeStringMake(pano.getImage(0).getFilename()) << endl
-    << "INPUT_IMAGE_1_SHELL="  << quoteStringShell(pano.getImage(0).getFilename()) << endl
+    << "INPUT_IMAGE_1_SHELL="  << escapeStringMake(quoteStringShell(pano.getImage(0).getFilename())) << endl
 
     << "# all input images" << endl
     << "INPUT_IMAGES=";
@@ -318,7 +318,7 @@
 
     o << "INPUT_IMAGES_SHELL=";
     for (unsigned int i=0; i < pano.getNrOfImages(); i++) {
-        o << quoteStringShell(pano.getImage(i).getFilename());
+        o << escapeStringMake(quoteStringShell(pano.getImage(i).getFilename()));
         if (i+1 != pano.getNrOfImages()) o << "\\" << endl;
     }
 
@@ -339,7 +339,7 @@
     o << endl << endl
       << "LDR_LAYERS_SHELL=";
     for(int i=0; i < (int) remappedImages.size(); i++) {
-        o << quoteStringShell(remappedImages[i]);
+        o << escapeStringMake(quoteStringShell(remappedImages[i]));
         if (i != remappedImages.size() -1) {
             o << "\\" << endl;
         }
@@ -361,7 +361,7 @@
     o << endl << endl
       << "HDR_LAYERS_SHELL=";
     for(int i=0; i < (int) remappedHDRImages.size(); i++) {
-        o << quoteStringShell(remappedHDRImages[i]);
+        o << escapeStringMake(quoteStringShell(remappedHDRImages[i]));
         if (i != remappedHDRImages.size() - 1) {
             o << "\\" << endl;
         }
@@ -383,7 +383,7 @@
     o << endl << endl
       << "HDR_LAYERS_WEIGHTS_SHELL=";
     for(unsigned i=0; i < remappedHDRImagesGray.size(); i++) {
-        o << quoteStringShell(remappedHDRImagesGray[i]);
+        o << escapeStringMake(quoteStringShell(remappedHDRImagesGray[i]));
         if (i != remappedHDRImagesGray.size() - 1) {
             o << "\\" << endl;
         }
@@ -406,7 +406,7 @@
         std::ostringstream stackedImgVar;
         stackedImgVar << "HDR_STACK_" << i;
         o << stackedImgVar.str() << " = " << escapeStringMake(fns.str()) << endl;
-        o << stackedImgVar.str() << "_SHELL = " << quoteStringShell(fns.str()) << endl;
+        o << stackedImgVar.str() << "_SHELL = " << escapeStringMake(quoteStringShell(fns.str())) << endl;
         o << stackedImgVar.str() << "_INPUT = ";
         for (UIntSet::iterator it = stacks[i].begin(); it != stacks[i].end();) {
             std::ostringstream fns;
@@ -420,7 +420,7 @@
         for (UIntSet::iterator it = stacks[i].begin(); it != stacks[i].end();) {
             std::ostringstream fns;
             fns << output << "_hdr_" << std::setfill('0') << std::setw(4) << *it << hdrRemappedExt;
-            o << quoteStringShell(fns.str());
+            o << escapeStringMake(quoteStringShell(fns.str()));
             ++it;
             if (it != stacks[i].end()) o << "\\" << endl;
         }
@@ -456,7 +456,7 @@
         std::ostringstream expImgVar;
         expImgVar << "LDR_EXPOSURE_LAYER_" << i;
         o << expImgVar.str() << " = " << escapeStringMake(destImg) << endl;
-        o << expImgVar.str() << "_SHELL = " << quoteStringShell(destImg) << endl;
+        o << expImgVar.str() << "_SHELL = " << escapeStringMake(quoteStringShell(destImg)) << endl;
         o << expImgVar.str() << "_INPUT = ";
         double exposure=0;
         for (UIntSet::iterator it = similarExposures[i].begin(); it != similarExposures[i].end();) {
@@ -474,7 +474,7 @@
             exposure += pano.getSrcImage(*it).getExposureValue();
             std::ostringstream fns;
             fns << output << "_exposure_layers_" << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
-            o << quoteStringShell(fns.str());
+            o << escapeStringMake(quoteStringShell(fns.str()));
             ++it;
             if (it != similarExposures[i].end()) o << "\\" << endl;
         }
@@ -492,7 +492,7 @@
         for (UIntSet::iterator it = similarExposures[i].begin(); it != similarExposures[i].end();) {
             std::ostringstream fns;
             fns << output << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
-            o << quoteStringShell(fns.str());
+            o << escapeStringMake(quoteStringShell(fns.str()));
             ++it;
             if (it != similarExposures[i].end()) o << "\\" << endl;
         }
@@ -520,7 +520,7 @@
     o << "LDR_EXPOSURE_LAYERS_REMAPPED_SHELL = ";
     for (unsigned i=0; i < similarExposureRemappedImages.size(); i++)
     {
-        o << quoteStringShell(similarExposureRemappedImages[i]);
+        o << escapeStringMake(quoteStringShell(similarExposureRemappedImages[i]));
         if (i+1 != similarExposureRemappedImages.size()) o << "\\" << endl;
     }
     o << endl << endl;
@@ -540,7 +540,7 @@
         std::ostringstream stackedImgVar;
         stackedImgVar << "LDR_STACK_" << i;
         o << stackedImgVar.str() << " = " << escapeStringMake(fns.str()) << endl;
-        o << stackedImgVar.str() << "_SHELL = " << quoteStringShell(fns.str()) << endl;
+        o << stackedImgVar.str() << "_SHELL = " << escapeStringMake(quoteStringShell(fns.str())) << endl;
         o << stackedImgVar.str() << "_INPUT = ";
         for (UIntSet::iterator it = stacks[i].begin(); it != stacks[i].end();) {
             std::ostringstream fns;
@@ -554,7 +554,7 @@
         for (UIntSet::iterator it = stacks[i].begin(); it != stacks[i].end();) {
             std::ostringstream fns;
             fns << output << "_exposure_layers_" << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
-            o << quoteStringShell(fns.str());
+            o << escapeStringMake(quoteStringShell(fns.str()));
             ++it;
             if (it != stacks[i].end()) o << "\\" << endl;
         }

Reply via email to