Bug with Advanced formatting @ option

Started by StarGeek, April 04, 2019, 05:29:35 PM

Previous topic - Next topic

StarGeek

I'm trying to remove keywords based upon the @ feature mentioned in the advanced formatting, but I don't seem to be getting the expected results.  I'm getting a single entries with all the remaining entries joined as one.
C:\>exiftool -P -overwrite_original -subject=Test1 -subject=Test2 -Subject=Test3 y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1##Test2##Test3
[ExifTool]      ExifToolVersion                 : 11.33

C:\>exiftool -P -overwrite_original -sep ## "-subject<${Subject@;$_=undef if m/Test2/}" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1, Test3
[ExifTool]      ExifToolVersion                 : 11.33


If I go back to the version where you first mention it (ver 10.87), I still get the wrong results, but it seems to work correctly in ver 10.86

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.86.exe" -P -overwrite_original -subject=Test1 -subject=Test2 -Subject=Test3 y:\!temp\Test4.jpg
    1 image files updated

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.86.exe" -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1##Test2##Test3
[ExifTool]      ExifToolVersion                 : 10.86

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.86.exe" -P -overwrite_original -sep ## "-subject<${Subject@;$_=undef if m/Test2/}" y:\!temp\Test4.jpg
    1 image files updated

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.86.exe" -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1##Test3
[ExifTool]      ExifToolVersion                 : 10.86

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.87.exe" -P -overwrite_original -subject=Test1 -subject=Test2 -Subject=Test3 y:\!temp\Test4.jpg
    1 image files updated

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.87.exe" -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1##Test2##Test3
[ExifTool]      ExifToolVersion                 : 10.87

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.87.exe" -P -overwrite_original -sep ## "-subject<${Subject@;$_=undef if m/Test2/}" y:\!temp\Test4.jpg
    1 image files updated

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.87.exe" -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1, Test3
[ExifTool]      ExifToolVersion                 : 10.87


Am I in error in my understanding of what it's supposed to do?
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

I'll look into this first thing tomorrow.

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

Phil Harvey

#2
Thanks for this report and for all the details to make this otherwise sort-of-tricky-bug-to-find much easier!

This will be fixed in 11.35.

- Phil

Edit: The problem was that in version 10.54 I had simplified the API List and ListSep options by combining them into a single ListJoin option.  Although I provided for backward compatibility of software using the old options, I didn't think about what would happen if software used a mix of old a new options.  This came back to bite me when I added some new code in 10.87 to use the ListJoin option in the advanced formatting "@" feature, while the rest of the code still used the older options.

BTW, Your command will work for versions 10.87 to 11.34 if you use -sep ", " instead of -sep ##.
...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 ($).

StarGeek

Quote from: Phil Harvey on April 05, 2019, 07:23:54 AM
BTW, Your command will work for versions 10.87 to 11.34 if you use -sep ", " instead of -sep ##.[/i]

Good to know.  The problem is that sometimes I have commas in my keywords. 
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).