Bug 5910
| Summary: | expr length function fails if argument is single ( or ) | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | almquipf |
| Component: | sh-utils | Assignee: | bero |
| Status: | CLOSED NOTABUG | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.1 | ||
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 1999-10-13 17:28:08 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
According to the base maintainer, this is the expected behavior (and compatible with pretty much all other unixes). |
the gnu utility expr fails in the follow 2 cases: expr length "(" and expr length ")" escaping the ( and ) as '(' ')' or \( \) has no effect expr reports these 2 cases as: expr: syntax error readily reproducible from command line all other single character strings containing all letters of alphabet in both cases and all other special characters on standard US keyboard are evaluated correctly by expr returning correctly a length of 1. The addition of another character with either ( or ) correctly returns a length of 2 so it does not appear to be a case of expr requiring balanced parentheses. Problem first detected on RH6.0 with sh-utils-1.16.23 while using expr in a bash script. I then upgraded sh-utils-2.0-1 from a rh6.1 distribution on my rh6.0 machine (upgrade successful, no warning or errors). exactly the same results. here is a test script I wrote to check special characters. for l in "~" "!" "@" "#" '$' "%" "^" "&" '*' "(" ")" "_" "+" "\`" "-" "=" "\\" "|" "," "." "/" "<" ">" "?" "{" "}" "[" "]" do echo -n "$l " expr length "$l" done For what it is worth HP-UX 10.20 expr exhibits the same behavior. paul almquist, instructor & sys admin almquipf.tec.wi.us