Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

env: cannot handle empty-string envvar #6175

Copy link
Copy link
Closed
@BenWiederhake

Description

@BenWiederhake
Issue body actions

The empty string is apparently a valid name for an environment variable, even though I strongly expect that it is used only for malicious purposes:

$ env =a env | grep -Fv PATH # GNU with GNU
PWD=/home/nattiff/Bilder/xperia/Kamera
LS_COLORS=
SHLVL=1
PATH=/bin:/usr/local/bin:/usr/bin:/bin
_=/bin/env
=a
$ ./target/debug/coreutils env =a env | grep -Fv PATH # uutils calling GNU
env: warning: no name specified for value 'a'
PWD=/home/nattiff/workspace/coreutils-rs
LS_COLORS=
SHLVL=1
_=./target/debug/coreutils
$ env =a foo=x ./target/debug/coreutils env | grep -Fv PATH # GNU calling uutils, demonstrating that the envvar was dropped, not skipped
PWD=/home/nattiff/workspace/coreutils-rs
LS_COLORS=
SHLVL=1
_=/bin/env
foo=x
$ env =a ./target/debug/coreutils env | grep -Fv PATH # GNU calling uutils
PWD=/home/nattiff/workspace/coreutils-rs
LS_COLORS=
SHLVL=1
_=/bin/env
$ ./target/debug/coreutils env =a ./target/debug/coreutils env | grep -Fv PATH # uutils calling uutils
env: warning: no name specified for value 'a'
PWD=/home/nattiff/workspace/coreutils-rs
LS_COLORS=
SHLVL=1
_=./target/debug/coreutils

This means two issues:

  • uutils does not set the envvar, and instead writes something to stderr
  • uutils does not parse the envvar, and instead skips it

Found while reviewing #6167.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.