[PATCH] patch: ignore a few more flags for compatibility with gnu diff
Matheus Izvekov
mizvekov at gmail.com
Fri Jan 22 03:54:49 UTC 2010
On 04:18 Fri 22 Jan , Denys Vlasenko wrote:
> On Wednesday 20 January 2010 03:47, Matheus Izvekov wrote:
> > Signed-off-by: Matheus Izvekov <mizvekov at gmail.com>
> > - OPT_R = (1 << 2),
> > - OPT_N = (1 << 3),
> > - OPT_dry_run = (1 << 4) * ENABLE_LONG_OPTS,
> > + OPT_R = (1 << 3),
> > + OPT_N = (1 << 4),
> > + OPT_E = (1 << 5), /* ignored, this is the default */
> > + OPT_f = (1 << 6), /* ignored */
> > + OPT_backup_if_mismatch = (1 << 7) * ENABLE_LONG_OPTS,
> > + OPT_no_backup_if_mismatch = (1 << 8) * ENABLE_LONG_OPTS,
> > + OPT_dry_run = (1 << 9) * ENABLE_LONG_OPTS,
>
> This change makes it more confusing which options are
> supported and which are merely ignored.
>
> It also makes OPT_dry_run value larger. Larger values
> for these flags sometimes result in larger AND / OR
> instructions. In this case, the growth is +5 bytes.
> By rearranging options so that it equals 0x80 instead of 0x200,
> it can be improved.
>
> > + "get\0" Required_argument "g"
>
> ??
>
> -g num or --get=num
> This option controls patch's actions when a file is under RCS
> or SCCS control, and does not exist or is read-only and matches
> the default version, or when a file is under ClearCase control
> and does not exist.
>
> Did you really see use of this obscure option in the wild?
>
> > + "remove-empty-files\0" No_argument "E"
>
> Who would in their right mind use the option which is
> the default anyway?...
>
> > + "backup-if-mismatch\0" No_argument "\xfd"
> > + "no-backup-if-mismatch\0" No_argument "\xfe"
>
> ...I think maybe it makes sense to swipe them under ENABLE_DESKTOP
>
> > - opt = getopt32(argv, "p:i:RNg:", &p, &i, NULL);
> > + opt = getopt32(argv, "p:i:g:RNEf", &p, &i, NULL);
>
> It is better to not mix impelemented and ignored options.
> If possible, put ignored ones at the end.
>
> I committed a bit different change.
>
> Please let me know whether you personally need -g to be accepted
> but ignored.
> --
> vda
Well, the history is that gentoo's portage calls patch with all these
options, but just using default values. Ie patch -g0 -E etc..
I figure it's better to just ignore it, than to start a war on who's
right or wrong...
Anyway, it's not really urgent right now because for any usability in
that system, patch needs to deal with wrong offsets etc. I want to work
on optional support for that sometime soon.
More information about the busybox
mailing list