News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Error message when using whit -p "<newline>"

Started by den, April 30, 2013, 09:51:52 AM

Previous topic - Next topic

den

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)) {

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

den

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).

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

den

No problem. Thanks for adding it (and for the great tool as well)!