HomePhorge

Switch from using freopen() to fclose()+fopen() for reopening PST files

Description

Switch from using freopen() to fclose()+fopen() for reopening PST files

This fixes a data loss problem in the readpst parallel jobs support.

glibc since 2.29 and musl both seek before closing the file descriptor.
Since the file descriptor is still linked to the file description created
and still used by the parent process, the seek changes the file position
of the file description of the file descriptor of the parent process,
which means the parent process reads data from the wrong location and
soon encounters errors, stops processing the data and misses out on
processing the messages that occur later in the PST file.

Since sharing a file description between parent and child processes is
inherently unsafe and there may be other C libraries that seek even before
fclose(), this is only a workaround and a different design is required.

Workaround-for: https://github.com/pst-format/libpst/issues/7

Details

Provenance
Paul Wise <pabs3@bonedaddy.net>Authored on Aug 14 2023, 3:35 AM
mollekopfPushed on Sep 3 2024, 2:20 PM
Parents
rLIBPST252e919b095e: Use PYTHON_SITE_PKG instead of manually constructing the Python module dir
Branches
Unknown
Tags
Unknown
Build Status
Buildable 50112