-
Notifications
You must be signed in to change notification settings - Fork 0
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
introduce a preserve command line switch in debugfs 'rdump' command #8
Conversation
We should decide if we want to reformat the code or not. If there are ever new upstream changes in this tool, it will be hell to rebase to. If we are to take the risk, we should first reformat the code, and implement the new functionality on top, so that functional changes are not mixed with formatting ones on the same base. |
@vlaci this is an excellent point, I'll rework the MR without formatting stuff so we're safe if we have to rebase on upstream in the future. |
ba671f1
to
5da34a8
Compare
This MR now only contains changes to the code itself and no reformatting. Code changes stick to tabs rather than spaces since it's what was used originally. |
rdump assumed the user wanted to preserve permissions and ownership when dumping a filesystem directory recursively with 'rdump'. This is in opposition with the way the 'dump' or 'dump_inode' command has been designed, since it expose a '-p' command line switch to allow the end users to explicitly opt-in for permission and ownership preservation. The inability to explicitly ask for permission and ownership preservation would get rdump to default to preservation, which is a problem when faced with filesystems having directories with the read flag but not the execute flag, since it would only allow to enumerate the directory content, but not see the inode details. Therefore getting debugfs in all kinds of issues trying to set ownership and permissions of files it can't see. This fix introduce a 'preserve' ('-p') flag in rdump command so that users can explicitly opt-in for it, and debugfs will default to a safer way of operation (no preserve).
Unused variable ext_written was reported by -Wunused-but-set-variable, so it's now guarded by the same preprocessor guards that protects its actual usage. Function without prototypes are note allowed in C23.
debugfs
assumed the user wanted to preserve permissions and ownership when dumping a filesystem directory recursively withrdump
. This is in opposition with the way thedump/dump_inode
command has been designed, since it expose a-p
command line switch to allow the end users to explicitly opt-in for permission and ownership preservation.The inability to explicitly ask for permission and ownership preservation would get rdump to default to preservation, which is a problem when faced with filesystems having directories with the read flag set but not the execute flag set, since it would only allow to enumerate the directory content, but not see the inode details. Therefore getting debugfs in all kinds of issues trying to set ownership and permissions of files it can't see.
This fix introduce a 'preserve' (
-p
) flag in rdump command so that users can explicitly opt-in for it, and debugfs will default to a safer way of operation (no preserve).Note: I also fixed some code to get it to build with modern clang, and formatted the code with
clang-format
because the code is unreadable otherwise.