-
Notifications
You must be signed in to change notification settings - Fork 842
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
stack clean --full
deletes personal ssh keys when using docker
#2000
Comments
Ouch! Sorry about that. |
Yeah, I think this is the worst stack bug to date. I'm impressed with the lack of expletives in this bug report ;) |
I have a patch
|
I moved .stack-work/docker to .stack-docker. It no longer is included in the mass-delete that is Additionally $HOME is now mounted in the container so we can just symlink it to the right place for the stack user. |
to $PROJECTROOT/.stack-docker because `stack clean --full` tries to delete .stack-work/docker and it can't because .stack-work/docker/_home is mounted by docker while it's trying to delete it resolves #2000
so do you mean that if one were to delete shouldn't all stack stuff stay in |
there's two problems here
I solved #1 by moving .stack-work/docker to .stack-docker out of the way so that's not deleted. #1 solves #2 but we don't need to mount $HOME/.ssh explicitly if we just mount $HOME and symlink $HOME/.ssh to the |
In any case we should never ever ever delete things from the host users .ssh dir. That's nasty. |
If we don't like moving .stack-work/docker to .stack-docker then we'll have to re-write |
cool ok; i understand a bit better; but am i right in understanding that if i were to look inside |
if you look at .stack-docker on the host, it'll have some misc files & symlinks in it. if you just recursively delete you'll delete a symlink (wrt .ssh). if you delete ~/.ssh inside the container it'll just delete the symlink. if you go crazy and delete everything out of ~/.ssh/ then yes, you just deleted your hosts .ssh content. so don't do that :) |
This is just a proposal at this point. I want more people to like or dislike the change/move to .stack-docker for docker container working files/mounts. |
thank you @tonyd256 for such an awesome bug report |
Thanks @dysinger and others! And thanks for all your great work on this amazing tool! I'm curious why the |
@borsboom would know the answer to those two |
Sorry about this! It's the unintended consequence of a bad interaction between two requested features we implemented: that stack.yaml can reference private git repositories when using Docker, and that |
IMO the moving I tried removing that commit from the PR, and the fix still works ( |
I've pushed my version to #2003 |
We should also put the fix on master! |
This is awesome! When will I be able to do |
@tonyd256 Not yet, it needs to be uploaded to hackage first. |
I'm the process of building the binaries and running the integration tests on every supported platform. Once that's done, I'll upload to Hackage. |
v1.0.4.3 is released, and all official binaries and packages uploaded. |
Awesome! Thanks everyone!! |
It appears that stack is linking one's home directory
.ssh
folder into the.stack-work/docker/_home/.ssh
directory. This means if you remove your.stack-work
folder or runstack clean --full
it will try to delete your.ssh
directory. It is failing to delete that directory because of this error:removeDirectoryRecursive: resource busy (Device or resource busy)
, but it is still deleting the contents which are the private and public keys. If you look at the output of the verbose command below you will see this part of thedocker create
command:-v /Users/tony/.ssh:/Users/tony/dev/thoughtbot/Doorbell/.stack-work/docker/_home/.ssh
. This seems like the issue that will cause astack clean --full
to delete one's personal ssh keys. Could this instead mount the ssh directory to the linux equivalent to~/.ssh
?Steps to reproduce:
stack exec bash
on a stack project using docker.ls .stack-work/docker/_home/.ssh
.exit
to back out of the container.stack clean --full
.ls -la ~/.ssh
.Expected:
My ssh keys should still be there.
Actual:
My ssh keys have been deleted.
Here is the stack --version output:
Here is the command I ran with --verbose:
The text was updated successfully, but these errors were encountered: