[PATCH] Cygwin: utils: chattr: Improve option parsing.

Corinna Vinschen corinna-cygwin@cygwin.com
Wed May 19 17:47:37 GMT 2021


Hi Christian,

On May 19 17:46, Christian Franke wrote:
> This possibly improves the usability of chattr for some typical use cases:
> 
> Command         : Old  : New behavior
> ================================================
> chattr -h       : help : help
> chattr -h FILE  : help : chattr -- -h -- FILE
> chattr -hs FILE : help : chattr -- -h -s -- FILE
> chattr -sh FILE : fail : chattr -- -s -h -- FILE
> chattr -ar FILE : fail : chattr -- -a -r -- FILE
> 
> Unrelated: there a two trivial block-copied-but-not-changed issues:
> 
> $ egrep 'ACL|--r' chattr.c
>           "Get POSIX ACL information\n"
>       "  -R, --recursive     recursively list attributes of directories and
> their \n"

Oops.  Please patch while you're at it...

> 
> Regards,
> Christian
> 

> From 865a5a50501f3fd0cf5ed28500d3e6e45a6456de Mon Sep 17 00:00:00 2001
> From: Christian Franke <christian.franke@t-online.de>
> Date: Wed, 19 May 2021 16:24:47 +0200
> Subject: [PATCH] Cygwin: utils: chattr: Improve option parsing.
> 
> Interpret '-h' as '--help' only if last argument.

Who was the idiot using -h for help *and* the hidden flag? *blush*

I'd vote for --help to be changed to -H for the single character
option.  The help output is very unlikely to be used in scripts,
so that shouldn't be a backward compat problem.

Would you mind to change the patch accordingly?


Thanks,
Corinna


More information about the Cygwin-patches mailing list