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

Augeas leaves temporary files when the destination is not writable #479

Closed
seanmil opened this issue Jul 18, 2017 · 2 comments
Closed

Augeas leaves temporary files when the destination is not writable #479

seanmil opened this issue Jul 18, 2017 · 2 comments

Comments

@seanmil
Copy link
Contributor

seanmil commented Jul 18, 2017

When an Augeas save is done and the destination file is not writable, the temporary file that Augeas uses is left behind and not cleaned up.

If run from a regularly executing job it can lead to accumulation of a great many temporary files.

The error returned in Augeas is "rename_augtemp" and I believe that the place to fix it would be in transform.c:clone_file but it isn't quite clear to me what the proper implementation of fix would be.

@lutter
Copy link
Member

lutter commented Sep 8, 2017

I think the way to fix this would be to call unlink(augtemp) in the error handling in transform_save on line transform.c:1265. clone_file makes sure that from doesn't exist when it is successful (either through rename or explicit unlink)

In all other uses of clone_file, it seems we would want to leave the from file untouched when clone_file fails, and only when we fail to clone the temporary file should we also unlink it.

lutter added a commit to lutter/augeas that referenced this issue Sep 11, 2017
When the file we are trying to save to is not writable, we left the
temporary file we wriote to behind. Now, we make sure we remove it.

Fixes hercules-team#479
@lutter
Copy link
Member

lutter commented Sep 11, 2017

@seanmil could you have a look and see if PR #493 fixes the situation that gave you trouble ?

lutter added a commit to lutter/augeas that referenced this issue Sep 15, 2017
When the file we are trying to save to is not writable, we left the
temporary file we wriote to behind. Now, we make sure we remove it.

Fixes hercules-team#479
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants