Page MenuHomeFreeBSD

patch(1): Add -Vnone option to disable backup files
ClosedPublic

Authored by cem on Jul 21 2015, 9:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 12, 2:02 PM
Unknown Object (File)
Sun, Oct 5, 9:37 PM
Unknown Object (File)
Sat, Oct 4, 12:40 AM
Unknown Object (File)
Fri, Oct 3, 7:40 PM
Unknown Object (File)
Fri, Oct 3, 3:24 PM
Unknown Object (File)
Fri, Oct 3, 2:56 PM
Unknown Object (File)
Fri, Oct 3, 5:57 AM
Unknown Object (File)
Thu, Oct 2, 12:38 AM
Tokens
"Like" token, awarded by accornehl_fastmail.fm.

Details

Test Plan

Manually applied patches with -Vnone, observed that .orig files were not
spammed throughout my tree.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

cem retitled this revision from to patch(1): Add -Vnone option to disable backup files.
cem updated this object.
cem edited the test plan for this revision. (Show Details)
cem added reviewers: markj, pfg.

Thank you.

FWIW, NetBSD added the same option 15 months ago:

http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/patch/

Perhaps we can reduce the differences? It helps to be able to merge changes from elsewhere.

In D3146#62739, @pfg wrote:

Thank you.

FWIW, NetBSD added the same option 15 months ago:

http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/patch/

Perhaps we can reduce the differences? It helps to be able to merge changes from elsewhere.

Hah, and we even spelled it mostly the same. Sure, I can try and make the diff smaller.

I think -Vnone is broken in NetBSD. In particular, they override none in main() after parsing the switch:

	/* parse switches */
	Argc = argc;
	Argv = argv;
	get_some_switches();

	if (backup_type == none) {
		if ((v = getenv("PATCH_VERSION_CONTROL")) == NULL)
			v = getenv("VERSION_CONTROL");
		if (v != NULL || !posix)
			backup_type = get_version(v);	/* OK to pass NULL. */
	}

And they are missing -Vnone in usage().

cem edited edge metadata.

Reorder backup_args / backup_types to diff-reduce vs NetBSD

pfg edited edge metadata.
In D3146#62741, @cem wrote:

I think -Vnone is broken in NetBSD. In particular, they override none in main() after parsing the switch:

Heh .. now I recall I was going to merge their change but something looked broken :-P.
It's alright though, I just wanted to see some diff reduction. Our patch(1) is already a fork on it's own but it also has changes from all the other BSDs.

This revision is now accepted and ready to land.Jul 21 2015, 10:46 PM
markj edited edge metadata.
This revision was automatically updated to reflect the committed changes.
In D3146#62748, @pfg wrote:

Heh .. now I recall I was going to merge their change but something looked broken :-P.
It's alright though, I just wanted to see some diff reduction. Our patch(1) is already a fork on it's own but it also has changes from all the other BSDs.

Sure, no problem. Thanks for the quick review!