git: babfcc0aa662 - stable/13 - stand: lua: module names should permit more

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Mon, 11 Sep 2023 22:02:55 UTC
The branch stable/13 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=babfcc0aa66256ffa5142a621ee9eba67d564efb

commit babfcc0aa66256ffa5142a621ee9eba67d564efb
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2023-09-05 02:21:34 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2023-09-11 22:02:38 +0000

    stand: lua: module names should permit more
    
    The module entries should generally allow whatever is allowed as an
    env_var in the pattern table.  Notably, we're missing periods which
    would allow proper entries for .dtb files in loader.conf that don't need
    to specify a module_name entry for it.
    
    %d in this expression is actually redundant as %w is actually
    "all alphanumerics," but I've included it for now to match the env_var
    entry.  We should really remove it from both.
    
    Reported by:    "aribi" on the forums via allanjude@
    
    (cherry picked from commit 5bc1e0c2285e73fe8455bb6c72b2b40e33f5477e)
---
 stand/lua/config.lua | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/stand/lua/config.lua b/stand/lua/config.lua
index 2f66d715016e..2f22056efde2 100644
--- a/stand/lua/config.lua
+++ b/stand/lua/config.lua
@@ -60,7 +60,10 @@ local MSG_FAILSYN_EOLESC = "Stray escape at end of line"
 local MSG_FAILSYN_EOLVAR = "Unescaped $ at end of line"
 local MSG_FAILSYN_BADVAR = "Malformed variable expression at position '%d'"
 
-local MODULEEXPR = '([-%w_]+)'
+-- MODULEEXPR should more or less allow the exact same set of characters as the
+-- env_var entries in the pattern table.  This is perhaps a good target for a
+-- little refactoring.
+local MODULEEXPR = '([%w%d-_.]+)'
 local QVALEXPR = '"(.*)"'
 local QVALREPL = QVALEXPR:gsub('%%', '%%%%')
 local WORDEXPR = "([-%w%d][-%w%d_.]*)"