Page 1 of 1
'Compare' hanging on filenames with asterisks
Posted: 2012-07-09T14:01:34-07:00
by Sean Colombo
I've run compare on about 6 million files, but I've run into a stumbling-block where it hangs indefinitely on a file which contains a bunch of asterisks in the name.
Here is the exact command I'm using:
Code: Select all
compare -metric MEPP "/raid/compressed_images/by_id/b/bakugan-world/images/9/9c/************************_jpegoptim.jpg" "/raid/images/by_id/b/bakugan-world/images/9/9c/************************.jpg" /dev/null 2>&1
Things I've checked so far:
- Changing from double-quotes to single-quotes didn't help it
- The files themselves are both valid (and appear to be identical... almost all of the images in our collection that we compare ARE identical).
- That I was just being impatient (I let the compare command run for DAYS and it didn't finish... these are fairly small files too... like 400x400 or something).
Any ideas what is wrong or why compare would hang on these files?
Re: 'Compare' hanging on filenames with asterisks
Posted: 2012-07-09T14:15:11-07:00
by fmw42
To help the IM developers, you should provide your IM version and platform.
Re: 'Compare' hanging on filenames with asterisks
Posted: 2012-07-09T14:20:12-07:00
by Sean Colombo
fmw42 wrote:To help the IM developers, you should provide your IM version and platform.
Good call:
$> compare --version
Version: ImageMagick 6.5.7-8 2010-12-02 Q16
http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP
$> cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.2 LTS"
Re: 'Compare' hanging on filenames with asterisks
Posted: 2012-07-09T14:41:36-07:00
by fmw42
see
viewtopic.php?f=3&t=19215&p=75037&hilit ... ers#p75037
Anthony will have to help here if this does not answer your question.
Also you have a very old version of IM. I cannot say if this has been corrected since then, given the reference.
Re: 'Compare' hanging on filenames with asterisks
Posted: 2012-07-09T16:38:18-07:00
by Sean Colombo
Thanks! That page was just what I needed. Escaping the asterisks didn't work, but replacing them with question marks will work for my use-case.
Re: 'Compare' hanging on filenames with asterisks
Posted: 2012-07-09T20:07:54-07:00
by anthony
IM is trying to handling the '*' as a GLOB filename expandsion expression.
see IM Examples Filename Handling, Meta-characters
http://www.imagemagick.org/Usage/files/#read_meta
When escaping you need to not only escape the shell, but also within the quotes for IM
EG: for the literal filename ***.jpg you will need to use '\*\*\*.jpg' Note both quotes AND backslashes.
For IMv7 I will be looking at some settings to control and disable the internal filename GLOB expansion and other 'read modifiers' (actually for as a security control option).
Re: 'Compare' hanging on filenames with asterisks
Posted: 2012-07-09T22:18:37-07:00
by Sean Colombo
anthony wrote:
EG: for the literal filename ***.jpg you will need to use '\*\*\*.jpg' Note both quotes AND backslashes.
I tried with all permutations of both single and double-quotes and single and double backslashes. None of them worked in my case. I don't have the results in front of me, but as I recall it, when I used backslashes the error message was that "the file \*\*\*[etc.]" could not be found. Both single and double backslashes lead to an error-message which indicated it was looking for the single-slashed version.
Hopefully this has something to do with our servers having an old version of IM... but it doesn't sound like this has surfaced terribly often, so it's possible the bug is still lingering. I'm happy to provide the exact image files if you guys wish to debug it. I have a rough workaround for my needs though.
anthony wrote:
For IMv7 I will be looking at some settings to control and disable the internal filename GLOB expansion and other 'read modifiers' (actually for as a security control option).
Such a setting seems quite useful