| Summary: | Parse error in ash when redirecting value to sysfs | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Henri Bragge <henri.bragge> |
| Component: | Standard Compliance | Assignee: | unassigned |
| Status: | RESOLVED INVALID | ||
| Severity: | minor | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Host: | Target: | ||
| Build: | |||
| Attachments: |
echo 128> ...
echo 128 > ... |
||
|
Description
Henri Bragge
2012-09-19 07:25:10 UTC
Tested with busybox 1.19.4 and 1.20.2 Please strace it: strace -oLOG -s99 ash -c 'echo 128> /sys/class/backlight/pwm-backlight.0/brightness' and post the LOG file Created attachment 4538 [details]
echo 128> ...
Created attachment 4544 [details]
echo 128 > ...
In LOG-error, there is something interesting in line 48:
fcntl64(128, F_DUPFD, 10) = -1 EBADF (Bad file descriptor)
dup2(3, 128) = 128
close(3) = 0
wait4(-1, 0x7e8fa6dc, WNOHANG, NULL) = -1 ECHILD (No child processes)
write(1, "\n", 1) = 1
close(128) = 0
In LOG-ok, this looks like:
fcntl64(1, F_DUPFD, 10) = 10
dup2(3, 1) = 1
close(3) = 0
wait4(-1, 0x7ecc66dc, WNOHANG, NULL) = -1 ECHILD (No child processes)
write(1, "128\n", 4) = 4
dup2(10, 1) = 1
close(10) = 0
Small correction, though you probably noticed it already. Problem actually occurs similarly in normal files and sysfs. Instead, there is something special in the way ash handles numbers that are not separated from ">" character with a whitespace: Both of these do not work as expected: # echo 66> /sys/class/backlight/pwm-backlight.0/brightness # echo 66>/tmp/world # cat /tmp/world # I tested this again with bash on my PC and it seems to behave exactly the same (dealing numbers as file handles?). Nothing strange in it after all. Maybe should have given it a bit more thought before reporting :) |