aboutsummaryrefslogtreecommitdiff
path: root/toys/other/lsattr.c
AgeCommit message (Collapse)Author
2020-02-27chattr: allow `chattr =`.Elliott Hughes
Also fix another bug where we were testing `set` twice. Fixes https://github.com/landley/toybox/issues/172.
2020-02-11chattr: fix exit status, redo the tests.Elliott Hughes
The e2fsprogs chattr(1) returns failure when it fails to do what was asked of it, and so should we. Fixing this then reveals a lot of issues with the tests that were being accidentally swept under the carpet. The bulk of this patch is going through all the tests, removing the duplicates and making the remaining tests more thorough. I've tested this on ext4 and f2fs on a variety of 4.x and 5.x kernel versions (but nothing older). We might need to reduce the list of attribtues we try to toggle, but the more thorough tests use well-supported attributes. I've also fixed the -R test to actually involve a directory hierarchy.
2020-02-06chattr: improve error messages.Elliott Hughes
When chattr fails in production, it helps to see what it was trying to do. Reuse the lsattr format but without the '-'s. Only read the flags if we have any intention of changing them: `chattr -p 123` has no reason to read the flags. Only write the flags back if they actually change: `chattr +a` shouldn't do anything if that flag is already set, for example. Switch -p and -v to perror_msg() instead of perror_exit() in case they're used with -R. (I suspect that the uses of DIRTREE_ABORT are mistakes given -R, but I'll leave them until I actually hit this.)
2020-02-05chattr: reuse toybox argument parsing.Elliott Hughes
Rewrite -v and -p to not use ad hoc argument parsing.
2020-02-01lsattr/chattr: improve help text.Elliott Hughes
Document all the attributes, and take less space doing so. Switch to CAPITALS for user input in the synopses. Don't imply that this is only for ext2 (but also don't try to list the subset of file systems that do support which subset of attributes).
2020-01-22lsattr/chattr: -p support.Elliott Hughes
Add support for setting projid in chattr, and dumping it in lsattr. Also fix the lsattr output formatting, and undo my well-intentioned sorting of the flags because that broke the ordering in the lsattr terse output.
2020-01-20lsattr/chattr: add missing flags.Elliott Hughes
Also update help to include flags that were already added. Remove useless duplicative comments. Swich to FLAG macros.
2019-08-19Tiny cleanup, net two lines shorter.Rob Landley
2017-05-27Replace two space indents with tab indents in help text (for consistency).Rob Landley
2017-05-26Be more consistent about periods in help text.Elliott Hughes
2016-10-22Tweak help text.Rob Landley
2015-09-11Replace toys.exithelp with help_exit() in lib.Rob Landley
2014-07-26Move DIRTREE_COMEAGAIN second callback up to when the filehandle is still ↵Rob Landley
open, and add dir->again variable to distinguish second call instead of checking for -1 filehandle.
2014-05-02Attached is the patch for lsattr and chattr implementation.Ashwini Sharma
This is the modified and better version from the last one I sent. It is having the both the mains (lsattr_main() and chattr_main() ) in single file. Also removed the dependency of additional file in lib, as common code is in the same .c file.