On 10/02/2025 21:15, Sertonix wrote:
On Mon Feb 10, 2025 at 10:08 PM CET, Harald van Dijk wrote:
Hi,
On 10/02/2025 19:14, Sertonix wrote:
The test-test example in the comment wasn't actually fixed before as
one can see by running
env -i "test-test=test" busybox ash -c 'export -p'
This previously incorrectly resulted in
export test
You're right that that output is incorrect. However...
But now it correctly results in
export 'test-test=test'
...this is not the correct result either. As the comment in the code
says, the output is meant to be usable for 'eval'. This output is not
usable for 'eval' and would result in a "bad variable name" error.
This is not the case. I changed the variable name checking to be more
relaxed for export so it works as expected. You can try this to verify:
env -i "test-test=test" busybox ash -c 'eval "$(export -p)"'
Oh, apologies, I missed that, I tested the output in an unpatched
busybox instead. I did not see in your message that you changed that as
well.
That change still looks wrong: unless there is some special permission
that I am not seeing, 'export test-test=test' is supposed to either
result in an error, or in the specified variable being assigned in the
way that POSIX specifies variable assignments work. The way POSIX
specifies variable assignments work mean the variable behaves like any
other variable. The syntax might not always allow that variable to be
referenced, but consider
env -i ./busybox ash -c 'export foo=bar baz-=quux; export -p; set'
*If* the assignment of baz- succeeds, then the requirements for 'export'
say that it becomes a shell variable, and the requirements for 'set' say
it gets printed there as well. That does not happen with your patch.
I believe my below comment still applies, the variable needs to be
skipped when printing instead.
The variable needs to be skipped when printing instead.
Cheers,
Harald van Dijk
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox