bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] readline and long command lines copy/paste


From: HF/EBC
Subject: [Bug-readline] readline and long command lines copy/paste
Date: Mon, 23 Apr 2007 15:09:13 +0200

Hi, 

We have an application with a command interpreter using the 
readline library. If the application runs in a window (in 
Linux X Windows, or in a terminal window in the MS-Windows 
environment) and a long command line (more than 1000 
characters) is fed using copy/paste we loose character number
510. The same error of loosing character 510 can also be 
demonstrated by echoing the command line to a unix pipe 
to our command interpreter. If the command line is typed
all characters are handled properly.

I have found that this is due to some overflow of the 
buffer named ibuffer of size 512 in input.c in readline.
Changing the size of ibuffer changes what character is lost.

As our temporary workaround we have done the following 
change to input.c (readline version 5.2):

238,239c238,239
<   if (chars_avail > tem)
<     chars_avail = tem;
---
>   if (chars_avail > tem / 2)
>     chars_avail = tem / 2;

This causes the number of bytes to be read in one "chunk"
to be half the available buffer space, instead of the 
available buffer space. With this workaround the problem
has disappeared for us.

We have tried to use the readline library according to
the manual. It is possible that our problem is caused 
by our misunderstanding of the interface.
If that is the case an improvement to the manual might
be useful.

If this is really a bug in the readline library, 
I hope that someone more familiar with the readline
source code could find and correct the real bug.
Our change is just something that hides the bug and 
makes the code work for us.

readline versions tested: 5.0, 5.1 and 5.2
Operating systems tested: SuSE Linux 10, SuSE Linux Enterprise Server 10.
Processsors: Intel Pentium-based, 32-bit

Best Regards,
/Tom





reply via email to

[Prev in Thread] Current Thread [Next in Thread]