editline truncates at 64 characters in batch mode

Bug #307652 reported by Mark O'Donohue on 2008-12-13
Affects Status Importance Assigned to Milestone
editline (Debian)
Fix Released
editline (Ubuntu)

Bug Description

In batch mode, if the input line is greater than 64 characters, the first 64 characters are lost.

In my case:

$isql-fb < test.sql

the input file of:

  Table_10 t10
  XXXXJOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);


  Table_10 t10
N (1 = 1);

In the above the line :
  XXXXJOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);

N (1 = 1);

This does not happen in interactive mode, nor does it happen with the version of editline that is included in the firebird source distribution.

This also seems to have been reported and fixed for minix-editline here:


I am still investigating, but this first came to our notice with trying to run the python QMTest tests on the Firebird package distributed with Ubuntu.

Editline version is the latest: 1.12-5 and a quick look on the Debian package, didnt show any latter changes or bug reports.

General info:

$ lsb_release -rd
Description: Ubuntu 7.10
Release: 7.10

$ apt-cache policy libeditline0
  Installed: 1.12-5
  Candidate: 1.12-5
  Version table:
 *** 1.12-5 0
        500 http://au.archive.ubuntu.com gutsy/universe Packages
        100 /var/lib/dpkg/status

Cheers - Mark

Mark O'Donohue (mark-odonohue) wrote :

Ok here is a simple program showing the problem.

It is actually the testit.c program distributed with libeditline,


essentiallty it does

$./testit < test.txt

Where test.txt has lines over 64 character long.

Cheers - Mark

Mark O'Donohue (mark-odonohue) wrote :

The buffer in editline.c
      STATIC char* read_redirected()

is 64 characters long, when it get to the end of 64 characters it does:

        if (p == end) {
            size += MEM_INC;
            p = line = realloc(line, size);
            end = p + size;

So 'p' which is where it is writing the next character is set back to the start of the line, not left at the end. The attached patch, bumps p to next write position correctly.

        if (p == end) {
            int lengthSoFar = p - line;
            size += MEM_INC;
            line = realloc(line, size);
            p = line + lengthSoFar;
            end = line + size;

Cheers - Mark

Brian Murray (brian-murray) wrote :

Looking at the attachments in this bug report, I noticed that "fix for bug, based on debian editline 1.12 base" was not flagged as a patch. A patch contains changes to an Ubuntu package that will resolve a bug and this attachment is one! Subsequently, I've checked the patch flag for it. In the future when submitting patches please use the patch checkbox as there are some Launchpad searches that use this feature. Thanks for your contribution Mark O'Donohue!

Changed in editline:
status: Unknown → New
Changed in editline (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.