rawtoaces main at 868a571, Ubuntu 24.04, gcc 13.3, exiftool 12.76.
perform_exiftool_call (src/rawtoaces_util/exiftool.cpp) builds the exiftool command line by string concatenation and hands it to popen(), with neither the exiftool path nor the image path quoted:
std::string command = exiftool_path + " -S";
...
command += " " + image_path;
So a space or a shell character in either path breaks the call. I tried four cases with BatteryPark.NEF copied around (small program calling fetch_metadata with cameraMake / cameraModel):
image path without space -> OK make='NIKON CORPORATION'
image path with spaces -> OK make=''
exiftool path with a space -> FAIL Failed to execute exiftool. Please make sure that its locati
image name with $ and () -> FAIL Failed to execute exiftool. Please make sure that its locati
with exiftool complaining on stderr for the second one:
Error: File not found - /tmp/dir
Error: File not found - with
Error: File not found - space/Battery
Error: File not found - Park.NEF
The second case is the bad one: the shell splits the path into four file names, exiftool prints "File not found" for each, but the call still counts as successful because stdout is not empty (FileName is printed for the fragments), so fetch_metadata returns true with no metadata and the lens correction later reports the camera make as missing. Nothing points at the space in the path.
On Windows the same applies to C:\Program Files\... for the binary, and (1) in a file name is what every browser download produces.
I'll send a PR that quotes both paths (single quotes for sh, double quotes for cmd.exe with the extra outer pair cmd needs) and adds a test with a dir with spaces/Battery Park (1).NEF copy of the fixture.
rawtoaces main at 868a571, Ubuntu 24.04, gcc 13.3, exiftool 12.76.
perform_exiftool_call(src/rawtoaces_util/exiftool.cpp) builds the exiftool command line by string concatenation and hands it to popen(), with neither the exiftool path nor the image path quoted:So a space or a shell character in either path breaks the call. I tried four cases with BatteryPark.NEF copied around (small program calling
fetch_metadatawithcameraMake/cameraModel):with exiftool complaining on stderr for the second one:
The second case is the bad one: the shell splits the path into four file names, exiftool prints "File not found" for each, but the call still counts as successful because stdout is not empty (
FileNameis printed for the fragments), sofetch_metadatareturns true with no metadata and the lens correction later reports the camera make as missing. Nothing points at the space in the path.On Windows the same applies to
C:\Program Files\...for the binary, and(1)in a file name is what every browser download produces.I'll send a PR that quotes both paths (single quotes for sh, double quotes for cmd.exe with the extra outer pair cmd needs) and adds a test with a
dir with spaces/Battery Park (1).NEFcopy of the fixture.