Giter Club home page Giter Club logo

Comments (5)

shusso avatar shusso commented on August 11, 2024

Not sure if this is related or not but digging up from
https://stackoverflow.com/questions/2821043/allowed-characters-in-linux-environment-variable-names
https://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap08.html
we can see

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 so I assume it's then up to each shell implementation. E.g. in Bash

↳  bash --version
GNU bash, version 5.2.2(1)-release (aarch64-apple-darwin22.1.0)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
↳  export MY-VAR="foobar"
-bash: export: `MY-VAR=foobar': not a valid identifier
↳  export MY_VAR="foobar"

from compose-go.

asyarif93 avatar asyarif93 commented on August 11, 2024

then i read the article wrong, i think we can close this. thanks for the effort

from compose-go.

milas avatar milas commented on August 11, 2024

You're both right!

Here's an expanded snippet from IEEE Std 1003.1, 2004 Edition :: 8.1 (emphasis mine):

These strings have the form name=value; names shall not contain the character '='. For values to be portable across systems conforming to IEEE Std 1003.1-2001, the value shall be composed of characters from the portable character set (except NUL and as indicated below). There is no meaning associated with the order of strings in the environment. If more than one string in a process' environment has the same name, the consequences are undefined.

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

Currently, Compose MOSTLY behaves like a Shell - uppercase letters, digits, & _. We do also allow . as a valid character due to its prevalence in many Java frameworks for environment variable overrides.

I don't think we want to open up to all non-NUL but I could see allowing - if a similar argument to . can be made, i.e. there's widespread use of - from popular frameworks/languages.


TL;DR Stick to alphanumeric + _ for compatibility purposes with Shell & other apps

from compose-go.

ndeloof avatar ndeloof commented on August 11, 2024

Agree, let's reopen this one, until there's some technical reason that prevent us to accept - within environment variables

from compose-go.

xzyfer avatar xzyfer commented on August 11, 2024

TL;DR Stick to alphanumeric + _ for compatibility purposes with Shell & other apps

Looks like this rule of thumb has already been broken in #271. The justification being that . was support in v1 which appears to be true for - as the current "work-around" found online is to use v1.

from compose-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.