Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Fix loading of multi-line history entires from disk



Fixes the issue I posted about yesterday with
history-incremental-search-backward. I have no idea as to the
correctness of the fix, but my history file is written out in a way
that matches 4.3.x with this patch applied, and the behavior matches
again.

(Not subscribed to zsh-workers, so if you want me to see replies
promptly please keep me on the CC line. Thanks!)

commit 4b2e7d1047419648291701d80268629f63ad6208
Author: Augie Fackler <raf@xxxxxxxxxxx>
Date:   Wed Jul 16 09:35:22 2014 -0400

    hist.c: fix regression around parsing multi-line history entries

    History files touched by an afflicted zsh with EXTENDED_HISTORY set
    will be slightly corrupt: when zsh rewrites the mis-parsed history
    with the extended metadata at the start of each line, since it
    (wrongly) thought each line was a separate command.

diff --git a/Src/hist.c b/Src/hist.c
index 64f88f5..359e89d 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2308,8 +2308,7 @@ readhistline(int start, char **bufp, int *bufsiz, FILE *in)
        }
        else {
            buf[len - 1] = '\0';
-           if (len > 1 && buf[len - 2] == '\\' &&
-               (len < 3 || buf[len - 3] != '\\')) {
+           if (len > 1 && buf[len - 2] == '\\') {
                buf[--len - 1] = '\n';
                if (!feof(in))
                    return readhistline(len, bufp, bufsiz, in);



Messages sorted by: Reverse Date, Date, Thread, Author