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

debugfs: dump: add rdump -p and handle attrs better #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IgorEisberg
Copy link

This change is part of a contribution I made to erofs-utils on the fsck.erofs --extract=X option.
Timestamps should always be preserved as they are safe to preserve, regardless of user type.
This isn't the case for chmod/chown, which is only allowed to be used by root.

debugfs is used by different kinds of users (e.g. AOSP build system) since rdump is the only official way to dump the contents of an ext2/3/4 image.
The dump command already has the -p option, which lets non-root users omit to avoid an "operation not permitted" vomit all over the terminal, but rdump still pukes all the way.
AOSP knows this, they use rdump in their "deapexer" Python utility, and their way of handling this is just swallowing all output to both stdout and stderr, and only printing it out if the execution failed. This change brings the -p flag to rdump, and root users who actually need it can use it. Normal users simply can't avoid it, as it stands now.

The other change was making sure access/mod timestamps are preserved properly, since "utime" and "chown" try to dereference symlinks and thus not acting on the symlinks themselves. Using "utimensat" when available, and "lchown" instead of "chown" will avoid this error.

All this is already used in erofs-utils. I think we should sync this to e2fsprogs.
Feel free to change what you feel necessary.

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 this pull request may close these issues.

1 participant