ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: den on April 30, 2013, 09:51:52 AM

Title: Error message when using whit -p "<newline>"
Post by: den on April 30, 2013, 09:51:52 AM
Hi

I run in to the error message "Unsuccessful stat on filename containing newline at /usr/bin/exiftool line 3100." but the command was successfully executed. I tested this whit version 9.28 on a kubuntu box. A test command (note the new line character in format string) and its output to see the error is:

exiftool  -m -n -p "aa
bb" 1366888029711.jpg
Unsuccessful stat on filename containing newline at /usr/bin/exiftool line 3100.
aa
bb


I'm not really familiar whit perl, but replacing line 3100 whit the following line seams to do the trick and works well for me...
    } elsif ($arg !~ /\n/ and -f $arg and Open(\*FMT_FILE, $arg)) {
Title: Re: Error message when using whit -p "<newline>"
Post by: Phil Harvey on April 30, 2013, 08:20:00 PM
Thanks for this report, but I don't think there is any reasonable way to avoid this warning.  I only get the warning if the file doesn't exist, which is reasonable I suppose, but I would prefer not having it.  Patching this one case only touches the surface... there are many other places in the code where I stat a file, and patching them all would be painful.

- Phil
Title: Re: Error message when using whit -p "<newline>"
Post by: den on May 01, 2013, 04:44:35 AM
There is two ways to use the -p option: Giving it a file which contains the format or a string which is a format for the output. In the first case, it is unlikely to have a newline in it and easy avoidable. But when giving the format directly (in my case it is generated by a script), it is very likely to have a new line in it. And exiftool only differs between the two cases be try and error if the given string can be opened as a file or not. I think at this point, it should not generate a error when giving a string whit new line (which just confuses because it works as intended).
Title: Re: Error message when using whit -p "<newline>"
Post by: Phil Harvey on May 01, 2013, 07:40:25 AM
Ah, sorry.  I wasn't paying close enough attention and missed that this was an argument to -p.  You get the same warning for a regular file argument.

I understand now, and will apply your patch.

Thanks.

- Phil
Title: Re: Error message when using whit -p "<newline>"
Post by: den on May 04, 2013, 01:34:39 AM
No problem. Thanks for adding it (and for the great tool as well)!