ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: pedzsan on August 29, 2022, 10:31:54 AM

Title: Warning message on stdout and exit of 0 but no desired output
Post by: pedzsan on August 29, 2022, 10:31:54 AM
I'm on an M1 Mac running 12.5.1.  exiftool -ver says 12.30.  I can also run this on a Free BSD system 12.2-RELEASE-p14 with exiftool -ver 12.44.

exiftool -XMP:DateTimeOriginal $j
(where $j is the path to the attached image) reports:

"Warning: XMP format error (no closing tag for \xE4\xE9) - /mnt/pedz..../HP9B9163.jpg

with an exit code of 0.

I'm actually calling exiftool from inside a Ruby script separating the stdout, stderr, and exit status.  There is no "mechanical" indication that a problem has occurred.  Now that I know this, I can deal with it but it seems like this should exit with a non-zero code since none of the desired output is printed.  Also, if I add -m, it doesn't change anything so it seems this isn't "minor".

If the upload isn't usable, let me know and we'll figure out another way to get a copy to you if you need it.
Title: Re: Warning message on stdout and exit of 0 but no desired output
Post by: StarGeek on September 01, 2022, 12:49:33 PM
Quote from: pedzsan on August 29, 2022, 10:31:54 AM"Warning: XMP format error (no closing tag for \xE4\xE9) - /mnt/pedz..../HP9B9163.jpg

The XMP in that file is badly formed or corrupted.  Exiftool will still extract what it can.  This is only a warning, not an error that prevents processing.

Quotebut it seems like this should exit with a non-zero code since none of the desired output is printed.  Also, if I add -m, it doesn't change anything so it seems this isn't "minor".

See Exit Status (https://exiftool.org/exiftool_pod.html#EXIT-STATUS).  Exiftool will return a 1 only when an actual error occurred.  If the data you are looking for isn't in the file, it's not an error in processing.  You could check for the existence of the data first with -if 'defined $XMP:DateTimeOriginal', which will return a code of 2 if the data doesn't exist.  Or you could use the -f (-ForcePrint) option (https://exiftool.org/exiftool_pod.html#f--forcePrint) to force an output you could then parse.

QuoteIf the upload isn't usable, let me know and we'll figure out another way to get a copy to you if you need it.

That file is questionable.  It's an XML file with trailing binary data that's not enclosed by the XML.  I don't see a jpeg header in the first few lines of the binary data either.

I'm going to remove the file since it appears that it might have personal data (email addresses at least) in it.