From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: utils: chattr: Improve option parsing.
Date: Thu, 20 May 2021 22:19:52 +0200 [thread overview]
Message-ID: <YKbEaE8jPiIBbt7c@calimero.vinschen.de> (raw)
In-Reply-To: <f4bff7ef-17c1-357e-0630-0d7d587e467f@t-online.de>
On May 20 21:48, Christian Franke wrote:
> Hi Corinna,
>
> Corinna Vinschen wrote:
> > Hi Christian,
> >
> > On May 20 12:01, Christian Franke wrote:
> > > Corinna Vinschen wrote:
> > > > 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.
> > Uhm... why?
>
> Because chattr uses '.' as default if no FILE argument is specified. The
> same applies to all other '+-=MODE' arguments. The patch does not change
> this behavior but of course enables it for '-h'.
Oh, right. I can't reproduce this behaviour with the most recent chattr
from e2fsprogs in F33. Sorry, I'm not sure anymore why I did that. But
given the entire behaviour is rather unexpected, and it's not even
documented, maybe we should drop it, too? Not sure if backward compat
counts in this case...
> Another behavior (possibly inherited from lsattr) is also not very useful:
> 'chattr +-=MODE DIRECTORY' also changes the attributes of all elements in
> the directory (not recursively). It is not possible to solely change the
> attributes of a directory except if it is the current directory and no FILE
> argument is passed. Fixing this would again break backward compatibility.
Ouch, no! That's a bug. The expression in line 354 should have been
if (S_ISDIR (st.st_mode) && Ropt && chattr_dir (argv[optind]))
ret = 1;
the Ropt check is just missing.
Corinna
next prev parent reply other threads:[~2021-05-20 20:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 15:46 Christian Franke
2021-05-19 17:47 ` Corinna Vinschen
2021-05-20 10:01 ` Christian Franke
2021-05-20 17:57 ` Corinna Vinschen
2021-05-20 19:48 ` Christian Franke
2021-05-20 20:19 ` Corinna Vinschen [this message]
2021-05-20 20:40 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YKbEaE8jPiIBbt7c@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin-patches@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).