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

Corinna Vinschen corinna-cygwin@cygwin.com
Thu May 20 20:40:24 GMT 2021


On May 20 12:01, Christian Franke wrote:
> Corinna Vinschen wrote:
> > Hi Christian,
> > 
> > On May 19 17:46, Christian Franke wrote:
> > > ...
> > > $ 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...
> > ...
> > >  From 865a5a50501f3fd0cf5ed28500d3e6e45a6456de Mon Sep 17 00:00:00 2001
> > > From: Christian Franke<...>
> > > 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.
> 
> New patch attached.
> 
> Note that there is now the possibly unexpected (& hidden) behavior that
> 'chattr -h' without file argument clears the hidden attribute of cwd.
> 
> Regards,
> Christian
> 

> From b838125f797c123d4a6d2f0ef30cccee8face50c Mon Sep 17 00:00:00 2001
> From: Christian Franke <christian.franke@t-online.de>
> Date: Thu, 20 May 2021 11:05:29 +0200
> Subject: [PATCH] Cygwin: utils: chattr: Improve option parsing, fix some
>  messages.
> 
> Allow multiple characters also in first '-mode' argument.
> Use '-H' instead of '-h' for '--help' to fix ambiguity with
> hidden attribute.  Fix help and usage texts and documentation.
> 
> Signed-off-by: Christian Franke <christian.franke@t-online.de>
> ---
>  winsup/doc/utils.xml  | 10 +++++-----
>  winsup/utils/chattr.c | 32 ++++++++++++++------------------
>  2 files changed, 19 insertions(+), 23 deletions(-)

Pushed.


Thanks,
Corinna



More information about the Cygwin-patches mailing list