[
https://issues.apache.org/jira/browse/HDDS-11590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17911640#comment-17911640
]
Attila Doroszlai commented on HDDS-11590:
-----------------------------------------
[~izlenko], I think the quotation from POSIX is misunderstood:
# "Environment variable names used by the utilities in the Shell and Utilities
volume of IEEE Std 1003.1-2001 consist solely of ..." -- This statement about
the _utilities_ defined in POSIX, not environment variables in general. It
places a restriction on those utilities (which are to be implemented by
POSIX-compliant operating systems), not user applications (like Docker Compose).
# "Other characters may be permitted by an implementation; applications shall
tolerate the presence of such names." -- This explicitly says that applications
are required to allow variable names that contain other characters. ["shall" =
"is required
to"|https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap01.html#tag_01_02]
So we are not "incorrectly using environment variables".
We may still want to workaround the bug that affects some versions of Docker
Compose.
However, I would prefer not to wrap all variables in JSON strings.
# It adds unnecessary complexity. The Docker Compose bug only affects files
references by {{env_file}}. We can include the same variables in the
{{docker-compose.yaml}} file itself.
# It is error-prone. E.g. we have to come up with unique name in each config
file.
# It also leads to unpredictable variable overriding behavior. With individual
variables, any previous definitions are overridden by new ones, in the order
they are defined, when Docker Compose reads the files. With wrapped variables,
overriding happens in {{envtoconf}}, where order is not guaranteed to be the
same.
# It is hard to debug (see sample SCM startup failure below -- which config
file does it refer to, and which config variable?)
{code}
Traceback (most recent call last):
File "/opt/hadoop/libexec/envtoconf.py", line 130, in <module>
Simple(sys.argv[1:]).main()
File "/opt/hadoop/libexec/envtoconf.py", line 117, in main
self.process_envs()
File "/opt/hadoop/libexec/envtoconf.py", line 56, in process_envs
conf_variables=json.loads(os.environ[key])
File "/usr/lib64/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.9/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 7 column 1 (char
215)
{code}
> Unexpected character "-" in Docker Compose env_file variable names
> ------------------------------------------------------------------
>
> Key: HDDS-11590
> URL: https://issues.apache.org/jira/browse/HDDS-11590
> Project: Apache Ozone
> Issue Type: Bug
> Components: docker-compose
> Affects Versions: 2.0.0
> Reporter: Ivan Zlenko
> Assignee: Ivan Zlenko
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> We are incorrectly using environment variables in our docker compose files.
> We can't use variables with names containing anything other than alphanumeric
> characters and underscore:
> {quote}
> 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. Other characters may be permitted by an
> implementation; applications shall tolerate the presence of such names.
> {quote}
> On the latest version of docker we can't run docker compose because of that.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]