Hi,

On Mon, Jul 22, 2013 at 8:53 PM, Margarita Manterola
<[email protected]> wrote:
> that is completely independent of the kernel

I'm sorry for this red-herring yesterday.  As I mentioned before,
there was a change in rlwrap's implementation, which tainted my tests.
 I'm now testing with a simplified version of the program originally
attached to the report.  I'm attaching here the simplified version.

I tested this in a real machines that I had access to:
On Debian Lenny: the program works correctly, kernel version 2.6.26-2-686
On Debian Squeeze: works correctly with 2.6.32-5-amd64, both with
readline5 and readline6.
On Ubuntu Lucid: works correctly with 2.6.38.8 (x86_64) with readline6.1

On another Ubuntu Lucid: fails with 3.0.0-32 (x86_64) with both
readline5 and readline6.1
The program also fails when run on 3.2 (Debian Wheeze), 3.5 (Ubuntu
Quantal), 3.9 (Debian Sid).

I'm thinking of doing a git bisect between 2.6.38 and 3.0, but that
doesn't sound very appealing :-/

Also, regarding what Chet had said, I can confirm that commenting out
one of the calls that set/unset the terminal modes
(rl_prep_term_function or rl_deprep_term_function) "fixes" this (not a
real fix since this breaks the terminal, but it shows that the problem
is in what those calls do; it's interesting that commenting *either*
of them makes this work).

I'm guessing some ioctl call changed its behavior between 2.6.38 and
3.0.  I'm unsure if this is readline's fault for using ioctl in a
wrong way, or the kernel's fault for breaking it.  I guess it depends
on which call it is and how readline is using it.

-- 
Besos,
Marga
/* mini program to demonstrate problem with cut and paste,  Frank Lübeck */
/* Simplified by Margarita Manterola. */
/* Compile:
 *    gcc -Wall -o minirl -O2 minirl.c -lreadline
 *    gcc -Wall -o minirl -O2 minirl.c $CPPFLAGS $LDFLAGS -lreadline -lncurses
 * Run:
 *    ./minirl TESTOUT
 * and paste the content of any text file (say 10kB without long lines),
 * end program with Ctrl-d.
 *
 * Then
 *    diff original-file TESTOUT
 * shows that in some lines trailing characters get lost. Or lines completely
 * lost.
*/

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <readline/readline.h>

int main(int argc, char** argv) {

  char* s;
  FILE *out;

  if (argc == 1) return 1;
  out = fopen(argv[1], "w");
  while (1) {
    s = readline("> ");
    if (!s) break;
    fprintf(out,"%s\n",s);
    free(s);
  }
  fflush(out);
  return 0;
}
_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline

Reply via email to