-
Notifications
You must be signed in to change notification settings - Fork 3
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
ttar cannot remove existing directory #3
Comments
@knweiss I refactored the code. It still passes the testcase you helpfully supplied. But it may no longer suit your needs, because it will fail if the directory is not empty. We may have to change the "rmdir" back to "rm -r" after all. I need to think about this. |
@ideaship I had the same worries regarding security implications yesterday after sending the pull request. Unfortunately, it now really no longer suits my needs in |
@knweiss GNU tar does the same thing as ttar. It removes empty directories, but aborts with "Cannot open: File exists" if a directory is not empty. I do not want ttar to deviate from user expectations in a potentially dangerous way. While not the default, GNU tar does have an option "--recursive-unlink" which does what you are looking for. Would such an option work for you? |
@ideaship I think we can leave it as-is (rmdir) because clearing the directory tree before extraction is the better solution anyway. |
Okay. I am closing the issue then. |
I've created a small
ttar
testcase for a problem I ran into while working on this PR: prometheus/node_exporter#871:Let's run it:
I.e.
ttar
is unable to remove an existing directory. Therm
fails here:The text was updated successfully, but these errors were encountered: