ExifTool Forum

ExifTool => Developers => Topic started by: Sebastian Fischer on October 04, 2023, 10:49:05 AM

Title: C++ Interface hangs
Post by: Sebastian Fischer on October 04, 2023, 10:49:05 AM
Hi,

The C++ interface for ExifTool hangs with a corrupted JPG image when used on macOS (intel) or Linux.

I had a look into the C++ interface code and it seems like the issue is the unix pipe for stdout that does not receive a response.

I do get a correct response (some warnings and the "ready" token) when I start the exiftool manually on the command line and use the same arguments and options that the interfaces uses.

Is there a know issue like this?

Best regards
Sebastian Fischer
Title: Re: C++ Interface hangs
Post by: Sebastian Fischer on October 06, 2023, 02:28:21 AM
The problem occurs only with one damaged jpg file. I was not able to reproduce it with other images. Unfortunately I am not allowed to share this image.

Furthermore, it only happens, when I specify the metadata fields I want to read (e.g. "-EXIF:all"). Because there is no Exif metadata in the file, the ExifTool output contains no metadata but some warnings.

When I edit the C++ Interface in a way, that let the ExifTool write it's output (STDOUT_FILENO and STDERR_FILENO) to a file instead of the pipe, the file contains the correct output. With the original code, the pipe does not receive anything, wich leads to the hang.

I was able to work around the problem: In addition to the metadata fields I want to read, I also specify "-ExifTool:all" to force the ExifTool to always write some metadata (warnings, if any, and at least it's own version). In this case, the pipe does receive data.
Title: Re: C++ Interface hangs
Post by: Phil Harvey on October 10, 2023, 02:51:49 PM
Thanks.  I'll look into this when I get a chance.

- Phil