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

Chocolately can permanently corrupt the config file if an operation is interrupted #355

Closed
alexchandel opened this issue Jul 16, 2015 · 8 comments
Assignees
Milestone

Comments

@alexchandel
Copy link

If the choco process ends, the following error can occur whenever any choco command is run:

Error deserializing response of type chocolatey.infrastructure.app.configuration.ConfigFileSettings:
 Root element is missing.
Root element is missing.

And the file chocolatey.config is blank. It should not be possible for either of these to occur, unless the user manually clears the file.

@ferventcoder
Copy link
Member

I'm thinking that the file should only be written to if it has changed - someone filed that as #364.

@ferventcoder
Copy link
Member

And the write should be tighter, like a backup made and then a write. If the write is not successful, rename the backup.

@ferventcoder ferventcoder changed the title Chocolately can permanently corrupt itself if an operation is interrupted Chocolately can permanently corrupt the config file if an operation is interrupted Jul 16, 2015
@pyhedgehog
Copy link

Atomic write (aka write to config.new and then move to config.xml) will help.

@GuillaumeSmaha
Copy link

I don't know why this happened. The file C:\ProgramData\chocolatey\config\chocolatey.config was empty.
Just delete the file to fix the issue.

@benh57
Copy link

benh57 commented Aug 19, 2015

+1, also encountered this

@ferventcoder ferventcoder added this to the 0.9.9.9 milestone Aug 19, 2015
@alexchandel
Copy link
Author

@GuillaumeSmaha deleting chocolatey.config indeed fixes this, but the point is that that shouldn't be necessary in the first place.

ferventcoder added a commit that referenced this issue Sep 18, 2015
If someone interrupts a write out for the config file, it can
permanently corrupt the config file and requires one to delete it and
let choco recreate it on the next run. Instead write the updates to the
config file to a new file and then copy it over the existing file. This
makes for a more atomic change that has very little chance of being
interrupted.
ferventcoder added a commit that referenced this issue Sep 18, 2015
* stable:
  (GH-355) Write config to temp path first
  (maint) formatting
@ferventcoder ferventcoder self-assigned this Sep 18, 2015
@malibeg
Copy link

malibeg commented Sep 21, 2015

  • 1

@ferventcoder
Copy link
Member

@BeezUPJohnny I think you are looking for #364 to plus one.

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

7 participants