Skip to content

Instantly share code, notes, and snippets.

@tcely
Last active June 26, 2019 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcely/8ef31809f04a494a27ad79d49afdf167 to your computer and use it in GitHub Desktop.
Save tcely/8ef31809f04a494a27ad79d49afdf167 to your computer and use it in GitHub Desktop.
AlpineLinux aports style decisions
  1. Shell (ash from busybox) variables are always quoted and use curly braces.

    "Optimize for the inexperience newcomers rather than the experience gurus." As explained in this post there are a few quirks when dealing with shell variables that do not use the curly braces. For example: $pkgver

    Instead of expecting new contributors to already know about all of the pitfalls involved with using that syntactic sugar, it is better to just always use the braces. Shell variables are quoted when assigned and used, when accessed they are quoted and surrounded by curly braces. For example: pkgname='bind' or pkgdesc="${pkgname} tools" and "${pkgname}"

    The characters that do and do not extend the name of the variable are not a concern when the intention of what the variable name should be is made clear by using this explicit syntax. Users don't need to remember which of _, -, or . will change the variable name and lead to an empty value being used instead of the value they were expecting.

    It is easiest to explain to beginners that you should always quote variables and use the curly braces. When following this rule there are only a few exceptions around quoting for word lists that need to be explained. This minimizes unexpected outcomes.

  2. Empty variables are not removed.

    A template was created. Dicing up this template serves very little good purpose. It is optimizing for the gurus rather than the newcomers. I am against this. Anything that discourages newcomers from contributing should be avoided. The less impenetrable the existing things are the more attractive it is for new contributors to make the changes they want to see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment