nasa / EdsLib

CCSDS SOIS Electronic Data Sheet Tool and Library
Apache License 2.0
31 stars 12 forks source link

Comparison filehandles not closed #75

Closed jphickey closed 6 months ago

jphickey commented 7 months ago

Describe the bug The file comparison routine in seds_verify_final_file() is missing the call to fclose() and thus leaving stale filehandles open.

To Reproduce Check the number of open file handles as the EDS tool executes (by e.g. checking /proc)

Expected behavior Should not leave filehandles open after the script runs

System observed on: Debian

Additional context At some point, the code was changed to write output to a temp file first, then rename it to the intended name. Also, a quick "compare" is done - if the file is the same, the rename is skipped. This avoids updating the timestamp, which in turn avoids unnecessarily rebuilding all the other code that depended on the file.

It is specifically the file comparison that is missing the fclose(), and thus leaving files open.

Reporter Info Joseph Hickey, Vantage Systems, Inc.