bug in tr ?
Denys Vlasenko
vda.linux at googlemail.com
Sun Mar 1 04:48:47 UTC 2009
On Friday 20 February 2009 04:06:30 pm walter harms wrote:
> Hi List,
> i was traceing a bug and found that tr (bb 13.0) seems to have a bug:
>
>
> echo "19AFH" |./tr -cd "[0-9]"
> 19
>
> echo "19AFH" |./tr -cd "[0-9A-F]"
> bash: echo: write error: Datenübergabe unterbrochen (broken pipe)
You do not show that tr complains about bad command format
(by showing usage screen). Is it a test in telepathy,
or do you compigured out help text? (that't why
attaching your .config isn't such a bad idea).
> ./tr -cd "[0-9A-F]" <xx
> echo $?
> 1
> reading from a file seems to indicate an error ?
I see this:
# ./busybox tr -cd "[0-9A-F]" <AUTHORS; echo $?
BusyBox v1.14.0.svn (2009-03-01 04:13:26 CET) multi-call binary
Usage: tr [-cds] STRING1 [STRING2]
Translate, squeeze, and/or delete characters from
standard input, writing to standard output
Options:
-c Take complement of STRING1
-d Delete input characters coded STRING1
-s Squeeze multiple output characters of STRING2 into one character
1
So, no, reading from a file does not indicate the error,
the error here is that tr misinterprets "[0-9A-F]"
> (echo "19AFH" |./tr -cd "[0-9A-F]" works fine with gnu tr)
>
> btw: my first version was echo "19AFH" |./tr -cd "[:xdigit:]" what simply eats anything.
Try attached patch, it fixes all these problems in my testing.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.patch
Type: text/x-diff
Size: 6379 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090301/4c7c64e3/attachment.bin>
More information about the busybox
mailing list