Uh oh!
There was an error while loading. Please reload this page.
validate/env: add env name begins with digit check - #80
Conversation
liangchenye
commented
May 26, 2016
LGTM! |
wking
commented
May 26, 2016
On Thu, May 26, 2016 at 03:56:10AM -0700, 梁辰晔 (Liang Chenye) wrote:
In the in-flight opencontainers/runtime-spec#427, I'm suggesting we Other applications may have difficulty dealing with environment So it's legal but not recommended. I think we want to land |
@wking I think you just past half sentence in POSIX 1, the charset and leading-digit restrictions are for “Environment variable names used by the utilities in the Shell and Utilities volume of IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the '_' (underscore) from the characters defined in Portable Character Set and do not begin with a digit.” |
liangchenye
commented
May 27, 2016
@wking sorry, I did not elaborate clearly. I mean runtime spec misses |
wking
commented
May 27, 2016
On Thu, May 26, 2016 at 06:21:53PM -0700, Ma Shimiao wrote:
No, it says “Environment variable names used by the utilities in the The “Other applications may have difficulty…” line I quoted earlier |
@wking yes, runc is not in a utility list. But most configed processes in runc may call or just be utilities in the list. And "Other applications may have difficulty dealing with environment variable names that start with a digit. For this reason, use of such names is not recommended anywhere." I think |
wking
commented
May 27, 2016
On Thu, May 26, 2016 at 11:09:33PM -0700, Ma Shimiao wrote:
The POSIX spec is about the environment variables used by those $ env - 123=5 HOME=$HOME env works fine (at least with GNU coreutils 8.23 running on glibc 2.21).
This is the distinction between MUST 1 and SHOULD 2. We can And the wording in opencontainers/runtime-spec#427 is just formal for |
This seems OK. But I'm not sure this is the right way to use environment variables. |
wking
commented
May 27, 2016
On Fri, May 27, 2016 at 12:07:15AM -0700, Ma Shimiao wrote:
I have one here 1.
That's one way to set an environment variable in a child process, but
I checked BusyBox v1.24.1 and dash 0.5.7 and neither of them liked $ python3 -c "import subprocess as s; s.Popen(['env'], env={'1test': '43'})" I expect the general pattern is “parsing shell commands is complicated |
Mashimiao
commented
May 27, 2016
@wking Yes, some programs accept environment variable name begin with digit. But there still some programs can't handle it as POSIX says. |
wking
commented
May 27, 2016
On Fri, May 27, 2016 at 12:51:35AM -0700, Ma Shimiao wrote:
I think a linter that warns folks about this sort of thing is fine, |
Mashimiao
commented
May 28, 2016
ping @liangchenye@mrunalp How do you think? |
liangchenye
commented
Jun 2, 2016
As @wking pointed out, IEEE std 1003.1-2001 says clearly that begin with a digit is not a MUST restriction: Also I think we need to clarify it in runtime spec. There is no 'MUST/SHOULD' restriction in the above paragraph. My understanding is: no matter what kind of restriction it has, literally the restriction of |
wking
commented
Jun 2, 2016
@liangchenye, how does the language in opencontainers/runtime-spec#427 look to you? |
liangchenye
commented
Jun 3, 2016
@wking I like that :) |
Mashimiao
commented
Jun 3, 2016
As you both think adding warning is better, I agree to updating the PR. |
b9bd253 to
e53991cCompare| return false | ||
| } | ||
| if i == 0 && unicode.IsDigit(ch) { | ||
| logrus.Warnf("Env %v: variable name begin with digit is not recommended.", env) |
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
e53991c to
5a03d31Comparemrunalp
commented
Jun 7, 2016
LGTM |
Mashimiao
commented
Jun 8, 2016
ping @liangchenye |
liangchenye
commented
Jun 17, 2016
LGTM |
Signed-off-by: Ma Shimiao mashimiao.fnst@cn.fujitsu.com
env name should not begin with a digit