Meaning of exit code 150
Added by Romain D. about 8 years ago
Hello,
I want to extract thumbnail from an image, so I ran:
$ exiv2 -v -e t DSC00639.JPG File 1/1: DSC00639.JPG Writing thumbnail (image/jpeg, 10646 Bytes) to file ./DSC00639-thumb.jpg
Thumbnail is correctly extracted and I can open it, but the exit code of exiv2 is 150.
I didn't find any doc about exit codes for exiv2. What does 150 mean, and why exit code isn't 0?
Thanks.
Replies (4)
RE: Meaning of exit code 150 - Added by Robin Mills about 8 years ago
I can explain this. The return value is the length of the thumbnail % 256 (% is the integer modulus operator)
$ del ~/temp/img*thumb.jpg ; exiv2 -v -e t ~/temp/img_4697.jpg ; echo $? ; ls -alt ~/temp/img*thumb.jpg File 1/1: /Users/rmills/temp/img_4697.jpg 47 -rw-r--r--+ 1 rmills staff 6191 24 Aug 20:45 /Users/rmills/temp/img_4697-thumb.jpg $ perl -e 'print( eval("6191 % 256") . "\n")' 47 $
I didn't write Exiv2, so I cannot explain why the code has been constructed to return this value. However this is the explanation. In your case, you get a return value of 150 because the length of your preview is different from my image.
Robin
RE: Meaning of exit code 150 - Added by Romain D. about 8 years ago
Ok, thanks Robin for your explanation.
But I think passing this information via exit code is not a good idea, since some tools (make in my case) break if exit code isn't 0. I have to do a dirty thing like
exiv2 -v -e t $? || exit 0to workaround this.
RE: Meaning of exit code 150 - Added by Robin Mills about 8 years ago
Romain
My aim in life is to make and keep everybody happy. So, here's what I suggest. Please raise a bug on this matter and mention this topic (1602). Andreas, whom I believe wrote this code, can do one of the following:
1) Reject the bug with a justification for the current behaviour
2) Fix it
3) Assign to me to be fixed
4) Nothing
The fix could be as simple as a tiny change in preview.cpp lin3 1082: function PreviewImage::writeFile()
Change
return Exiv2::writeFile(buf, name);
to
return Exiv2::writeFile(but,name)?0:EOF;
If Andreas does nothing, I will fix this for our 0.25 release which is expected around December 2013. It's OK for you to ping me in a month if you see no progress.
Robin