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

ttar: cannot remove directory #892

Closed
knweiss opened this issue Apr 11, 2018 · 3 comments · Fixed by #894
Closed

ttar: cannot remove directory #892

knweiss opened this issue Apr 11, 2018 · 3 comments · Fixed by #894

Comments

@knweiss
Copy link
Contributor

knweiss commented Apr 11, 2018

There's an issue with my PR #871 as ttar is unable to extract the updated sys.ttar archive contents over the contents from older commits. (Developers will run into it but not TravisCI as it always starts with an empty builddir.)

>> extracting sysfs fixtures
./ttar -C collector/fixtures -x -f collector/fixtures/sys.ttar
/home/knweiss/go/src/github.com/prometheus/node_exporter/collector/fixtures
rm: cannot remove 'sys/bus/cpu/devices/cpu0': Is a directory
make: *** [collector/fixtures/sys/.unpacked] Error 

I've reported the issue in ideaship/ttar#3 with a detailled test case and an suggested fix. It got merged into ttar but the recursive remove was changed into a (safer) rmdir which unfortunately is not good enough for the issue here in node-exporter as the directory is not empty.

Another solution would be to clear the collector/fixtures/sys/ directory before we extract the sys.ttar. Thoughts?

@SuperQ
Copy link
Member

SuperQ commented Apr 11, 2018

Yes, I think it would be a good idea to clear the directory before un-tar. It's the only way to clean out removed files.

@ideaship
Copy link
Contributor

As I mentioned in ideaship/ttar/issues/3, I am open to implementing the equivalent of GNU tar's "--recursive-unlink" option (which enables the desired, potentially dangerous behavior) in ttar. But that would still not clean out removed files.

@knweiss
Copy link
Contributor Author

knweiss commented Apr 11, 2018

@ideaship I agree, cleaning obsolete files is important, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants