On 2020/7/24 6:15, Eric Sandeen wrote:
On 7/22/20 11:39 PM, Xiao Yang wrote:
On 2020/7/23 14:08, Christoph Hellwig wrote:
On Thu, Jul 23, 2020 at 01:27:23PM +0800, Xiao Yang wrote:
-D and -R options are mutually exclusive actually but chattr command
doesn't check it so that always applies -D option when both of them
are specified. For example:
Looks good,
Reviewed-by: Christoph Hellwig<hch@xxxxxx>
Hi,
Ah, I have a question after sending the patch:
Other commands(e.g. cowextsize) including the same options seem to avoid the issue by accepting the last option, as below:
--------------------------------------------------------
io/cowextsize.c
141 while ((c = getopt(argc, argv, "DR")) != EOF) {
142 switch (c) {
143 case 'D':
144 recurse_all = 0;
145 recurse_dir = 1;
146 break;
147 case 'R':
148 recurse_all = 1;
149 recurse_dir = 0;
150 break;
Yep, I meant to look at this but hadn't gotten to it yet. These should all
be consistent, and I tend to agree with Dave that explicitly conflicting
incompatible options and erroring out is better than silently accepting
the last one specified.
And indeed help specifies that they are exclusive:
cowextsize_cmd.args = _("[-D | -R] [cowextsize]");
It'd be great if you want to send a V2 that makes the behavior (and
documentation) of any/all commands that accept [-D | -R] consistent.
Hi Eric, Dave
Thanks for your suggestions.
I will send v2 patch to make the behavior consistent.
Thanks,
Xiao Yang
Thanks,
-Eric
.