svn commit: r358265 - head/usr.sbin/config

Warner Losh imp at FreeBSD.org
Sun Feb 23 23:36:58 UTC 2020


Author: imp
Date: Sun Feb 23 23:36:56 2020
New Revision: 358265
URL: https://svnweb.freebsd.org/changeset/base/358265

Log:
  Relax machine directives a little.
  
  Currently, you can have multiple machine directives if they are otherwise
  identical. Relax this so that only the machinename part is the same. This allows
  one to change the machine arch in a different config file you've included easily.

Modified:
  head/usr.sbin/config/config.5
  head/usr.sbin/config/config.y

Modified: head/usr.sbin/config/config.5
==============================================================================
--- head/usr.sbin/config/config.5	Sun Feb 23 23:29:53 2020	(r358264)
+++ head/usr.sbin/config/config.5	Sun Feb 23 23:36:56 2020	(r358265)
@@ -283,7 +283,8 @@ corresponds to MACHINE_ARCH.
 .Pp
 A kernel configuration file may have only one
 .Ic machine
-directive.
+directive, unless the second one matches the
+machine argument in the first one exactly.
 .\" -------- MAKEOPTION --------
 .Pp
 .It Ic makeoption Ar options

Modified: head/usr.sbin/config/config.y
==============================================================================
--- head/usr.sbin/config/config.y	Sun Feb 23 23:29:53 2020	(r358264)
+++ head/usr.sbin/config/config.y	Sun Feb 23 23:36:56 2020	(r358265)
@@ -155,8 +155,11 @@ Config_spec:
 		machinearch = $2;
 	      } |
 	ARCH Save_id Save_id {
-		if (machinename != NULL &&
-		    !(eq($2, machinename) && eq($3, machinearch)))
+		/*
+		 * Allow the machinearch to change with a second machine directive,
+		 * but still enforce no changes to the machinename.
+		 */
+		if (machinename != NULL && !eq($2, machinename))
 		    errx(1, "%s:%d: only one machine directive is allowed",
 			yyfile, yyline);
 		machinename = $2;


More information about the svn-src-head mailing list