ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: karlgustavv on May 01, 2023, 04:44:06 AM

Title: Bug? introduced in 12.60: If clause combined with "-m"
Post by: karlgustavv on May 01, 2023, 04:44:06 AM
OS: Windows 10

If you got a folder containing 3 jpg files and want to get those that don't have an ISO tag you might use:
exiftool_12.59.exe -if "not defined $ISO" -m *.jpg

Output will be:
======== no_iso.jpg
ExifTool Version Number         : 12.59
File Name                       : no_iso.jpg
Directory                       : .
...
Image Size                      : 4500x2532
Megapixels                      : 11.4
    2 files failed condition
    1 image files read

If you use the same command with 12.60 (or 12.61):
exiftool_12.60.exe -if "not defined $ISO" -m *.jpg

Output will be:
    3 files failed condition
    0 image files read

If you omit "-m" it will work as expected:
exiftool_12.60.exe -if "not defined $ISO" *.jpg

Output will be:
======== no_iso.jpg
ExifTool Version Number         : 12.60
File Name                       : no_iso.jpg
Directory                       : .
...
Image Size                      : 4500x2532
Megapixels                      : 11.4
    2 files failed condition
    1 image files read

I usually use that if clause in combination with "-tagsfromfile" within a batch file. Omitting "-m" is not an option in that case.
Title: Re: Bug? introduced in 12.60: If clause combined with "-m"
Post by: Phil Harvey on May 01, 2023, 08:29:26 AM
The behaviour of 12.59 was contrary to the documentation.  This was fixed in 12.60:

Apr. 5, 2023 - Version 12.60 (production release)
  - Fixed handling of undefined tags in -if conditions to conform with
    documentation and match -p and -tagsFromFile behaviour when -m or -f option
    is used

Undefined tags are set to an empty string when the -m option is used.

I would suggest changing the condition to -if "not $iso" to handle both cases (with and without -m).

- Phil
Title: Re: Bug? introduced in 12.60: If clause combined with "-m"
Post by: karlgustavv on May 01, 2023, 09:41:14 AM
Thank you very much for the explanation and the easy solution.