Skip to content

env parsing quirks #142

@mcandre

Description

@mcandre

Fedora dumps multiline string data directly onto stdout for env with plain LF's:

$ env
FEDORA_CHANGELOG=* Sun Feb 1 2026 Bob <bob@bobsautoparts.test>
- Prototype
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/.venv/bin
VERBOSE=1
...

There is probably no safe, distro independent way to safely parse data piped in from env. Because the value may itself begin a line with <VAR>=.

Frankly, requiring the user to pipe env in, is needlessly laborious. And breaks native Windows.

Fortunately, there is a safer, better UX way:

  1. Query an environment variable JINJA_ENV.
  2. When JINJA_ENV is present, then use the standard library to loop over environment variables and build up the data dictionary.

https://www.geeksforgeeks.org/python/python-os-getenv-method/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions