Your process here is really strange.  You see something, then you
write a diff before answering your own question, then you send a mail
asking a question with the diff already present as an investment.

In OpenBSD, we have a 20 year old repository that explains why a
change was made.  Before the 20 years, there are older repositories to
view.  There are also many other resources which might document why -f
existed in the past.  Without review of those, it is wrong to simply
delete it.

Use 'cvs annnoate' and look at the history for that line in the
file.

   revision 1.26
   date: 2010/01/12 19:30:53;  author: jasper;  state: Exp;  lines: +2 -2;
   sync comment with reality, -f won't be documented.
   
   as discussed with jmc@, otto@ and millert@
   ok otto@ millert@

So at least 4 people discussed it.  You didn't discover that?

Look at -r1.1 of chmod.c

                case 'f':               /* XXX: undocumented. */
                        fflag = 1;

That still does not explain it.  But did you get there?

There are older repositories and documents to review.

But at least now there are two questions and you can dig further
rather than spending the time writing a diff.  Yet you did it first.
How bizzare.

Your diff is pointless, without first know the answers to the questions,
isn't it?

It think it is nice that people are trying to help; but if you are
modifying binaries often used in scripts, the standard of work has to
be very high.

> Digging around the tree (Yes, i want try to contribute if possible),
> i found this small piece of code:
> 
> 
> >case 'f':            /* no longer documented. */
> >     fflag = 1;
> >     break;
> 
> And the usage of this flag in two conditional statement in a logic
> OR:
> 
> >if (ischmod) {
> >     if (!fchmodat(AT_FDCWD, p->fts_accpath, oct ? omode :
> >         getmode(set, p->fts_statp->st_mode), atflags)
> >         || fflag)
> >             continue;
> >} else if (!ischflags) {
> >     if (!fchownat(AT_FDCWD, p->fts_accpath, uid, gid,
> >         atflags) || fflag)
> >             continue;
> 
> I checked the man pages related to chmod(1), chgrp(1), chflags(1) and
> chown(8) and as the comment stated, nowhere the option is mentioned.
> There is a motivation why the unused -f option is still there? As the
> option is not documented anymore, this mean that fflag will be false
> in every documented use case.
> Anyway, attached a diff usable if the option can be removed.
> 
> Regards
> 
> --UT4aJajqd8PRde7T
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename="f_option.diff"
> 
> Index: chmod.c
> ===================================================================
> RCS file: /cvs/src/bin/chmod/chmod.c,v
> retrieving revision 1.38
> diff -u -p -r1.38 chmod.c
> --- chmod.c   9 Oct 2015 01:37:06 -0000       1.38
> +++ chmod.c   12 Nov 2015 20:51:28 -0000
> @@ -62,7 +62,7 @@ main(int argc, char *argv[])
>       unsigned long val;
>       int oct;
>       mode_t omode;
> -     int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval, atflags;
> +     int Hflag, Lflag, Rflag, ch, fts_options, hflag, rval, atflags;
>       uid_t uid;
>       gid_t gid;
>       u_int32_t fclear, fset;
> @@ -79,8 +79,8 @@ main(int argc, char *argv[])
>  
>       uid = (uid_t)-1;
>       gid = (gid_t)-1;
> -     Hflag = Lflag = Rflag = fflag = hflag = 0;
> -     while ((ch = getopt(argc, argv, "HLPRXfghorstuwx")) != -1)
> +     Hflag = Lflag = Rflag = hflag = 0;
> +     while ((ch = getopt(argc, argv, "HLPRXghorstuwx")) != -1)
>               switch (ch) {
>               case 'H':
>                       Hflag = 1;
> @@ -96,9 +96,6 @@ main(int argc, char *argv[])
>               case 'R':
>                       Rflag = 1;
>                       break;
> -             case 'f':               /* no longer documented. */
> -                     fflag = 1;
> -                     break;
>               case 'h':
>                       hflag = 1;
>                       break;
> @@ -261,12 +258,11 @@ done:
>  
>               if (ischmod) {
>                       if (!fchmodat(AT_FDCWD, p->fts_accpath, oct ? omode :
> -                         getmode(set, p->fts_statp->st_mode), atflags)
> -                         || fflag)
> +                         getmode(set, p->fts_statp->st_mode), atflags))
>                               continue;
>               } else if (!ischflags) {
>                       if (!fchownat(AT_FDCWD, p->fts_accpath, uid, gid,
> -                         atflags) || fflag)
> +                         atflags))
>                               continue;
>               } else {
>                       if (!chflagsat(AT_FDCWD, p->fts_accpath, oct ? fset :
> 
> --UT4aJajqd8PRde7T--
> 

Reply via email to