Skip to content

fw_printenv: debug output enabled by default breaks -n flag in some cases #34

@piro-pp

Description

@piro-pp

As the title says. You would use the "-n" flag to read the value of a variable and assign it to a shell variable
xy=$(fw_printenv -n xz)

But in the case that the U-Boot environment is empty and the value is fetched from default environment. The output is:

Environment WRONG, copy 0
Cannot read environment, using default
<value of xy>

where i only wanted the part.

While the second line goes to stdout and can be filtered by "2>/dev/null" the first one goes to stdout and breaks my script.

So my suggestion is to print debug and non-critical messages to stderr by default or handle the "-n" flag as quiet flag that suppresses such these messages.

I know that one of these messages can be disabled, when compiling with a defined NDEBUG, but this is not always doable and doesn't resolve the basic problem.

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