Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary Directory remains on disk #435

Open
BajanMarian opened this issue Jun 11, 2024 · 2 comments
Open

Temporary Directory remains on disk #435

BajanMarian opened this issue Jun 11, 2024 · 2 comments

Comments

@BajanMarian
Copy link

Issue Description

When you import govips, a temporary folder is always created, but not always removed.

Replication Steps:

  1. Import govips library
  2. Execute a simple command, such as print(vips.Version) (without invoking vips.Startup()).
  3. Allow the program to terminate.

In this scenario, the temporary directory persists on disk, which it should not. The only way to ensure its removal currently is to explicitly call vips.Startup() and then defer vips.Shutdown()

Real-world Scenario:

  • Package A imports govips because it uses some govips functions
  • Package main imports Package A
  • Pacakge main only uses some constants from Package A (not related to govips)
  • After performing its tasks, the main package completes execution, but the temporary govips folder remains on disk

Proposed Solutions:

After reviewing the code, I suggest two potential solutions to address this issue:

  1. Create the Temporary Directory During vips.Startup(): This would ensure that the temporary folder is only created when vips.Startup() is explicitly called. It is important to note that in the current implementation, the folder is deleted only if the ### running variable is set to TRUE (as managed in vips.Shutdown()).
  2. Expose a Method to Delete the Temporary Folder: Provide a method within the govips library that can be called to remove the temporary directory explicitly. This would allow users to clean up the directory without relying on vips.Startup() and vips.Shutdown() if they are not using the full capabilities of the library.
@tonimelisma
Copy link
Collaborator

Thank you!! This is a great bug report. I agree that management of the temporary Director should be more explicit. I think the first solution would make more sense.

Would you have interest in developing a PR?

@BajanMarian
Copy link
Author

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants