Re: small bugfixes
Claudio Piciarelli <[email protected]> Sun, 2 Nov 2003 19:36:25 +0100
| Newsgroups | gmane.comp.web.cthumb.devel |
|---|---|
| Message-ID | <[email protected]> |
[email protected] ha scritto: > > 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 > i think this can be solved by uring rsync -avq as the copying > method. what do you have as "RecursiveCP" ? > i assume it is cp -a or cp -r? Yes, I don't have rsync installed, so the configure script selected "cp -r" as preferred method. I'll try the patch with rsync too. > > * Due to an incorrect regular expression, the trailing spaces in the > > config values are not stripped. > i am not sure about the context. can you put an example? Of course. Let's create a simple album: $ ls dscn0911.jpg $ cthumb -c * > test.album now let's set the CthumbDir parameter in the album file. In test.album put this line: CthumbDir: thumb ^^^ with 3 spaces here, at the end! do the hard work: $ cthumb test.album [...] Created subdirectory './thumb ' Creating page: ./thumb /dscn0911-1-0.html generating thumb /dscn0911-thumb.jpg ... done. [...] The directory has the trailing spaces: $ perl -e 'opendir(D,".");while($i=readdir(D)){print "-$i-\n";}' -.- -..- -dscn0911.jpg- -test.album- -thumb - -page.html- -index.html- The problem is in the greedyness of the regular expression used to parse the config file: /^$pattern:\s*(.*)\s*?$/i *? stands for "match the minimum number of times possible", and the minimum number possible is zero. All the spaces are eaten by the .* expression. To avoid the problem we must let the \s match the maximum number of spaces possible, while .* should match only the remaining characters. Examples: $ perl -e '$_=" hello world "; /^\s*(.*)\s*?$/; print "-$1-\n";' -hello world - $ perl -e '$_=" hello world "; /^\s*(.*?)\s*$/; print "-$1-\n";' -hello world- > in any case, please check in your changes after some testing > you think it is appropriate. i added your sf account to the > project, so you should be able to check stuff in. Thank you. -- `cat ~/.mutt/signature` ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/