Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15859

Readline history bug

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From A <auroralanes@protonmail.ch>
Newsgroups gnu.bash.bug
Subject Readline history bug
Date Fri, 31 Jan 2020 20:32:35 +0000
Lines 105
Approved bug-bash@gnu.org
Message-ID <mailman.88.1580515675.2412.bug-bash@gnu.org> (permalink)
References <GEBO_8wY5MXQyA9XaPplJPssz-_VaRYuLUZ4I3ITmA_1ZbiZQ6pWAQ9PyMYC70ZLlbKxP-ne7QSKXq8Bd6Cy6SzfQksyGwP7ykYgeIrJ-5Y=@protonmail.ch>
Reply-To A <auroralanes@protonmail.ch>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha256; boundary="---------------------f2e7e4c6f2bfae16cca0b833c7154859"; charset=UTF-8
X-Trace usenet.stanford.edu 1580515676 16813 209.51.188.17 (1 Feb 2020 00:07:56 GMT)
X-Complaints-To action@cs.stanford.edu
To "bug-bash@gnu.org" <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.ch; s=default; t=1580502758; bh=gSTbGgm6HiJXBbl06qcdYGf+SrZpcOE+6rJtOx0Mahk=; h=Date:To:From:Reply-To:Subject:Feedback-ID:From; b=KVKfgEk9ZZC+3GreVv8WDV5vKvqdtCtyiNWFw4eko8Czq+0dJp57SZHA0ghjLMfdN 7gHbplogpK2e8rKtUvABm580TZ2Z5t7uoiEOPvg5JdkblkTX9qK1S0aLpkYniM7RrL 1JoGgndGrzguRvVfOhR3aU/PR0Wj/OIR/MQad/4Q=
Feedback-ID zjvAP0A3DnpSWPx2ehr76hlhi2ujpQK0tbouJBQsJQbgGdv2-K21TwEUVf_QCQRSbFs3SP78iUHvZolVEEKo9w==:Ext:ProtonMail
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 185.70.40.132
X-Mailman-Approved-At Fri, 31 Jan 2020 19:07:54 -0500
X-Content-Filtered-By Mailman/MimeDel 2.1.23
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <GEBO_8wY5MXQyA9XaPplJPssz-_VaRYuLUZ4I3ITmA_1ZbiZQ6pWAQ9PyMYC70ZLlbKxP-ne7QSKXq8Bd6Cy6SzfQksyGwP7ykYgeIrJ-5Y=@protonmail.ch>
Xref csiph.com gnu.bash.bug:15859

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

The readline package doesn't return the errno for some errors in write_history, append_history, and history_truncate_file.
This caused an error in the CPython interpreter(at exit time) when the .python_history file was not writable.

In particular these calls return -1 when the internal`histfile_restore`call fails because`rename`fails. It's fine for`histfile_restore`to return the result from`rename`, but this should be checked for failure (e.g. -1) and handled appropriately by the caller in`history_do_write`and`history_truncate_file`. For example, in`history_do_write`they do the following:

if (rv == 0 && histname && tempname)
    rv = histfile_restore (tempname, histname);

if (rv != 0)
    {
      if (tempname)
	unlink (tempname);
      history_lines_written_to_file = 0;
    }

This needs a simple fix to update the value of`rv`when`histfile_restore`fails:

if (rv == 0 && histname && tempname)
    rv = histfile_restore (tempname, histname);

if (rv != 0) {
    rv = errno;
    if (tempname)
        unlink(tempname);
    history_lines_written_to_file = 0;
}

Code snippet taken from https://github.com/python/cpython/pull/18299#issuecomment-580883515

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Readline history bug A <auroralanes@protonmail.ch> - 2020-01-31 20:32 +0000

csiph-web