Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
piro-pp opened this issue Nov 15, 2024 · 0 comments
Open

Comments

@piro-pp
Copy link

piro-pp commented Nov 15, 2024

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.

@piro-pp piro-pp changed the title fw_printenv: debug output enabled by default breaks -n flag ins some cases fw_printenv: debug output enabled by default breaks -n flag in some cases Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant