-
Notifications
You must be signed in to change notification settings - Fork 5.9k
code-server deletes olds version when updating #1483
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
Comments
Huge problem. Could you elaborate on your directory structure? |
@dmratcliffe Were you placing your files in the directory code-server was unpacked into? Regardless, we'll change code-server asap to move the files instead of deleting. |
To give more information, my code-server was setup like so: /home/coder/code-server - the binary of code server It had been setup like this forever, and updates previously had never destroyed my files. It seems insane that an update could even do this. I don't mean to nitpick, but why was it set to delete files that it didn't create? Did it just run rm * on its folder? Why was there no warning? Why did it happen now and not before? |
Does this mean you were on V2? |
Yes it's insane and unexpected so we're gonna try to fix whatever it is asap. |
No, I had recently updated it to v3, with all the node folders and such. Sorry for the delay, trying to recover the files. |
Hey, I did some looking and I believe the reason it was overwritten is because the move command will overwrite the entire directory if a directory is given as the destination. I think that's why, which means the current patch will defeat this by moving the files out before updating?* Not sure, baseing this stuff of the documentation of fs.move found here: and the implentation that made this happen (I think this is the spot maybe I'm wrong?): I think the proper fix would be to fs.move each file indivually? *small edit cause I misspoke |
You're right, that's exactly what caused this issue. When the new code-server directory was moved on top of the old one it overwrote the old one entirely. The commit I just made renames the current code-server directory with a timestamp suffix so it won't get overridden. I also removed the We could move each file individually but then we might encounter unexpected side effects, such as what might happen if code-server crashed or was killed partway through the update. There's also no guarantee that we wouldn't accidentally overwrite a file the user modified or created if it happens to share the same name. I think renaming the directory is the safest (and fastest) option when considering all the potential edge cases. |
@dmratcliffe Really sorry about this whole situation, hope you can recover your files! |
@nhooyr Thanks, filetree was gone, photorec is promising but theres 40gbs of random scambled files :/ |
@dmratcliffe Just as a heads up, we're going to release 3.1.0 today. It has the update fixes but 3.0.2 still has the old code so an automatic update from 3.0.2 to 3.1.0 will delete the old version again. I hope you've had some luck in the recovery process, sorry again! |
@code-asher For sure. Thanks for the headsup. |
Coder server just updated, and deleted my projects folder.
Is there anyway to retrieve it? I don't have a backup.
Infact, it delted all configs. It wiped the folder that coder was in an replaced it all.
The text was updated successfully, but these errors were encountered: