stages/shell.init: add pattern for env var names

Pattern for valid environment variable names as defined in
The Open Group Base Specifications Issue 7, 2018 edition
IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008)

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html

Updated tests to match UPPERCASE ONLY var names.
This commit is contained in:
Achilleas Koutsou 2023-02-14 16:44:41 +01:00
parent 291726a83b
commit b848e5d9df
3 changed files with 10 additions and 7 deletions

View file

@ -27,7 +27,10 @@ SCHEMA_2 = r"""
"additionalProperties": false, "additionalProperties": false,
"required": ["key", "value"], "required": ["key", "value"],
"properties": { "properties": {
"key": "string", "key": {
"type": "string",
"pattern": "^[A-Z_][A-Z0-9_]*$"
},
"value": "string" "value": "string"
} }
} }

View file

@ -397,7 +397,7 @@
"test_env": { "test_env": {
"env": [ "env": [
{ {
"key": "var", "key": "VAR",
"value": "val" "value": "val"
} }
] ]
@ -405,11 +405,11 @@
"test_env.2": { "test_env.2": {
"env": [ "env": [
{ {
"key": "one", "key": "ONE",
"value": "1" "value": "1"
}, },
{ {
"key": "two", "key": "TWO",
"value": "2" "value": "2"
} }
] ]

View file

@ -54,7 +54,7 @@
"test_env": { "test_env": {
"env": [ "env": [
{ {
"key": "var", "key": "VAR",
"value": "val" "value": "val"
} }
] ]
@ -62,11 +62,11 @@
"test_env.2": { "test_env.2": {
"env": [ "env": [
{ {
"key": "one", "key": "ONE",
"value": "1" "value": "1"
}, },
{ {
"key": "two", "key": "TWO",
"value": "2" "value": "2"
} }
] ]