Re: sys/conf/DEFAULT[S]

From: Bruce Evans (bde_at_zeta.org.au)
Date: 10/08/03

  • Next message: Adam C. Migus: "Re: sys/conf/DEFAULT[S]"
    Date: Wed, 8 Oct 2003 21:45:47 +1000 (EST)
    To: "Adam C. Migus" <adam@migus.org>
    
    

    On Thu, 2 Oct 2003, Adam C. Migus wrote:

    > > On Fri, 26 Sep 2003, Adam C. Migus wrote:
    >
    > This patch works for me, please let me know if there's any problems
    > with it or you'd like a PR.

    % ==== //depot/user/amigus/freebsd-amigus/src/usr.sbin/config/config.y#1 - /src/p4/user/amigus/perforce.freebsd.org/freebsd-amigus/usr.sbin/config/config.y ====
    % @@ -118,6 +118,8 @@
    % |
    % Config_spec SEMICOLON
    % |
    % + Include
    % + |
    % SEMICOLON
    % |
    % error SEMICOLON
    % @@ -164,9 +166,7 @@
    % = {
    % hints = $2;
    % hintmode = 1;
    % - } |
    % - INCLUDE ID
    % - = { include($2, 0); };
    % + };
    %
    % System_spec:
    % CONFIG System_id System_parameter_list
    % @@ -265,6 +265,11 @@
    % rmdev($2);
    % } ;
    %
    % +Include:
    % + INCLUDE ID
    % + = { include($2, 0); };
    % +
    % +
    % %%
    %
    % void

    I found 1 problem with this: it doesn't require SEMICOLON after
    "INCLUDE ID", so parsing resumes after "ID" when the input stream
    is switched back to the includer. You can say things like

            include FOO device foo

    and then the "device foo" directive actually works. This can be
    considered a feature, but the following is not:

            include GENERIC.local

    at the end of GENERIC should be a syntax error, but it actually
    matches ID = GENERIC and includes GENERIC recursively, which gives
    a confusing error message. There would be a syntax error on switching
    back but config aborts before then. (Filenames other than single
    identifiers must be quoted to avoid problems like this. This is not
    very obvious since config was changed to not require quotes in most
    contexts.)

    Stefan's version requires SEMICOLON:

    % Index: src/usr.sbin/config/config.y
    % ===================================================================
    % RCS file: /usr/home/ncvs/src/usr.sbin/config/config.y,v
    % retrieving revision 1.61
    % diff -u -r1.61 config.y
    % --- src/usr.sbin/config/config.y 6 Jul 2003 02:00:52 -0000 1.61
    % +++ src/usr.sbin/config/config.y 27 Sep 2003 10:39:13 -0000
    % @@ -118,6 +118,9 @@
    % |
    % Config_spec SEMICOLON
    % |
    % + INCLUDE ID SEMICOLON
    % + = { include($2, 0); };
    % + |
    % SEMICOLON
    % |
    % error SEMICOLON
    % @@ -164,9 +167,7 @@
    % = {
    % hints = $2;
    % hintmode = 1;
    % - } |
    % - INCLUDE ID
    % - = { include($2, 0); };
    % + }
    %
    % System_spec:
    % CONFIG System_id System_parameter_list

    I lost your examples showing that this doesn't quite work. What is the
    problem with it?

    Another old bug is that using "include" defeats the point of the
    INCLUDE_CONFIG_FILE option (since included files aren't expanded).

    Bruce
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: Adam C. Migus: "Re: sys/conf/DEFAULT[S]"

    Relevant Pages

    • Re: Removing text from strings
      ... is left off then it causes a syntax error but adding fixes that error. ... I gave examples in the thread you are replying to where adding the semicolon changes the meaning of the code. ... And I would be totally shocked if it made that much difference in a real world application where having them there made any noticable difference in speed of execution. ... "Hey Louie, I just shaved 60 ms off the 218 seconds it takes this script to execute by adding 380,000 semicolons to this script but it added 180 ...
      (comp.lang.javascript)
    • Re: Ot: opinions vs facts
      ... Always use for all your logical block ... Always end a command with semicolon; ... ASP pages ('mixin' of server-side VBScript and client-side JScript) ... a semicolon is a syntax error, ...
      (comp.lang.javascript)
    • Re: c2143 syntax errors.
      ... Right - because you are missing a semicolon at the end of the previous ... overhead. ... -- RFC 1925 ...
      (microsoft.public.vc.language)
    • Re: c2143 syntax errors.
      ... class there but forgot to add a semicolon after the closing brace. ... overhead. ... -- RFC 1925 ...
      (microsoft.public.vc.language)