| Summary: | Ash -ne test does not fail correctly | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Jake Magee <busybox> |
| Component: | Standard Compliance | Assignee: | unassigned |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
Fix:
--- busybox.3/coreutils/test.c 2010-05-31 02:14:36.000000000 +0200
+++ busybox.4/coreutils/test.c 2010-06-03 01:45:59.000000000 +0200
@@ -393,7 +393,7 @@ static number_t getn(const char *s)
if (errno != 0)
syntax(s, "out of range");
- if (*(skip_whitespace(p)))
+ if (p == s || *(skip_whitespace(p)))
syntax(s, "bad number");
return r;
I am committing it to git.
|
OVERVIEW: When using the "-ne" test with an empty variable and a number, the test fails (reports that "" is equal to "0"). On an Ubuntu system running Bash, the following error is produced: "-bash: [: : integer expression expected" STEPS TO REPRODUCE: The following code is an example: #!/bin/sh test="" if [ "$test" -ne "0" ] then echo "An error or this should be printed out." fi ACTUAL RESULTS: nothing (the -ne test fails with "" equal to "0") EXPECTED RESULTS: an Ash error like "[: : integer expression expected" PLATFORM: Using BusyBox 1.11.2 on a PowerPC Linux (OpenWRT 8.01) system.