small bugfixes

Claudio Piciarelli <[email protected]> Mon, 27 Oct 2003 00:57:22 +0100
Newsgroups gmane.comp.web.cthumb.devel
Message-ID <[email protected]>
Hello cthumb developers,
I've found two small bugs in the current cvs version of cthumb
(cthumb.in 1.22):

* Creating an album using the default album file (generated by cthumb -c)
gives a cp warning, since we try to copy the theme over itself:

$ cthumb ljubljanskata.album
cthumb 4.3.1, running in /var/home/piccia/tmp/c
cp: /usr/local/share/images/cthumb/neat-round.theme' and
/usr/local/share/images/cthumb/neat-round.theme' are the same file 

* Due to an incorrect regular expression, the trailing spaces in the
config values are not stripped.


Here it is a patch addressing the two problems. The cp patch is
actually suboptimal, since we can easily be fooled by a symlink,
but this is better than nothing.


--- cthumb.in.old	Sun Oct 26 23:59:55 2003
+++ cthumb.in	Mon Oct 27 00:26:23 2003
@@ -405,7 +405,7 @@
         }
 
         if ($options[$i][1] eq "string" &&
-            /^$pattern:\s*(.*)\s*?$/i) { # string w/o comment
+            /^$pattern:\s*(.*?)\s*$/i) { # string w/o comment
             eval "\$$pattern = '$1'";
             #print "#    Source=$type $pattern='$1'\n";
             #   If we just set a new theme, read it in now
@@ -415,7 +415,7 @@
             }
         }
         if ($options[$i][1] eq "array" &&
-            /^$pattern:\s*(.*)\s*?$/i) { # array w/o comment
+            /^$pattern:\s*(.*?)\s*$/i) { # array w/o comment
             eval "\@$pattern = qw($1)";
             #print "#    Source=$type $pattern=qw($1)\n";
             #   If Languages was set, assign NLanguages
@@ -451,8 +451,10 @@
     # if the originals exist, update or create the local copy
     if ((-e ($newthemedir . $newtheme)) || (-e ($ImageDir . "/" . $newtheme . "/"))) {
 	$Theme = $newtheme;
-	# print "DEBUG: $RecursiveCP $ImageDir/$newtheme $newthemedir\n";
-	system("$RecursiveCP $ImageDir/$newtheme $newthemedir");
+	if($ImageDir . "/" ne $newthemedir){
+		# print "DEBUG: $RecursiveCP $ImageDir/$newtheme $newthemedir\n";
+		system("$RecursiveCP $ImageDir/$newtheme $newthemedir");
+	}
     } else {
 	print "WARNING: cannot find theme \"$newtheme\" in current directory or in $ImageDir.\n";
 	print "proceeding with defaults in \"$Theme\" ...\n";



-- 
`cat ~/.mutt/signature`


-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/