Re: logic error
[email protected] Fri, 19 Aug 2011 16:13:30 +0000
| Newsgroups | gmane.comp.video.graphicsmagick.apis |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Aug 19, 2011 at 09:04:10AM -0500, Bob Friesenhahn wrote: > On Fri, 19 Aug 2011, [email protected] wrote: >> >> The code that performs this begins at line ~5408 in >> magick/display.c. Unfortunately, it appears the renaming of the file >> is carried out in a separate function, in a clone of the ImageInfo, >> and this work will never get back to the scope that emits the error msg. >> >> Without a larger overhaul, do you think skipping the politeness of >> returning the (potentially incorrect) filename could be skipped from >> the error msg? > > I will take a look at what can be done. Obviously any error message > should reflect the path which was (attempted to be) written to and the > reason for the falure, rather than the source source image name. As you > say, it make take some exploring to find the best way to retrieve the > correct error. It seems likely that the ExceptionInfo struct accessed > like (*image)->exception_info contains the best information. Ah... My first thought was with (*image)->image_info... (which isn't "obviously easy" to make work, given the scoping I described previously). I think we both realize it's got to be something other than just (*image)->filename, though. I'll take a look at your suggestion too and see if some solution presents itself. > Running the software with the MAGICK_DEBUG variable set to 'exception' > will reveal the actual underlying exceptions which are thrown: Good tip. You've mentioned this in other contexts, and it's not yet baked into my habbits; that'll come ;) > % MAGICK_DEBUG=exception gm display seaworld.jpg& > [1] 26085 > freddy:~% 08:53:35 0:27 0.210u 26085 blob.c/OpenBlob/3485/FileOpen: > Unable to open file (/blah/seaworld.jpg) > 08:53:35 0:27 0.210u 26085 jpeg.c/WriteJPEGImage/1738/FileOpen: > Unable to open file (/blah/seaworld.jpg) > > % MAGICK_DEBUG=exception gm display seaworld.pbm& > [1] 26092 > % 08:55:13 0:26 0.180u 26092 blob.c/OpenBlob/3485/FileOpen: > Unable to open file (/blah/seaworld.pbm) > 08:55:13 0:26 0.180u 26092 pnm.c/WritePNMImage/1293/FileOpen: > Unable to open file (/blah/seaworld.pbm) > > Would you be happier if the notification window said "Unable to open > file (/blah/seaworld.pbm)" rather than the file name? My scenario was this: kamloops$ pwd /home/bch/nowrite kamloops$ ls -ld . dr-xr-xr-x 2 root wheel 512 Aug 19 09:08 . kamloops$ ls -ld * -rw-r--r-- 1 root users 56716 Aug 19 09:08 bird.jpg kamloops$ env MAGICK_DEBUG=exception gm display bird.jpg 09:10:05 0:17 0.030u 557 jpeg.c/WriteJPEGImage/1737/FileOpen: Unable to open file (bird2.jpg) The above was generated by trying to save the "bird.jpg" image as "bird2.jpg". I guess an error of "Unable to open file (bird2.jpg)" would be better error, yes. > Bob > -- > Bob Friesenhahn > [email protected], http://www.simplesystems.org/users/bfriesen/ > GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ -- Brad Harder Method Logic Digital Consulting http://methodlogic.net/ http://twitter.com/bcharder ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2