Command line editing give a wrong result for me on hush shell 1.9.1
Denys Vlasenko
vda.linux at googlemail.com
Tue Feb 19 01:02:45 UTC 2008
On Tuesday 19 February 2008 01:58, Martinb_ARM_NOMMU_KISSDVD wrote:
> Its hard to believe but that's just the point
> if I leave your comments its working
>
> if I do "./hush 2>/dev/null" it ok
>
> but if I remove the comments and recompile its NOT ok
> I don't get this ?
> the code is:
>
> if (cmdedit_x >= num) {
> const char *bbbb = "\b\b\b\b";
> //bb_error_msg("\n initial bbbb=%02x %02x %02x %02x (%p)", bbbb[0], bbbb[1],
> bbbb[2], bbbb[3], bbbb);
> cmdedit_x -= num;
> bbbb += 4;
> if (num <= 4) {
> bbbb -= num;
> //asm volatile("# HERE");
> //bb_error_msg("\n bbbb=%02x %02x %02x %02x (%p)", bbbb[0], bbbb[1],
> bbbb[2], bbbb[3], bbbb);
> printf(bbbb);
> return;
> }
> printf("\033[%uD", num);
> return;
> }
>
> so if I compile with the // its NOT ok
> if I compile with the // removed its ok (if I redirect the comment to null)
> ??
"??" indeed.
It leaves me only with two teories which explain these symptoms:
1. Memory corruption
2. Miscompilation (gcc bug).
Second one is less likely as I looked at assembly and it seems to be ok.
Anyway, I plan to apply this to 1.9.2:
http://busybox.net/downloads/fixes-1.9.1/busybox-1.9.1-lineedit.patch
--
vda
More information about the busybox
mailing list