zsh-workers
 help / color / mirror / code / Atom feed
* Error in zshaddhistory() should not prevent command from running
@ 2016-12-31  6:13 Bart Schaefer
  2017-01-01  3:10 ` Daniel Shahaf
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2016-12-31  6:13 UTC (permalink / raw)
  To: zsh-workers

[Fourth attempt sending this, primenet is blocking gmail again.]

Should this actually be in callhookfunc() itself?  I note that the doc
warns about errors in precmd killing off periodic, or else I'd say it
ought to be.

Possibly more controversial, why run this hook at all when nothing is
being added?

diff --git a/Src/hist.c b/Src/hist.c
index 97fd340..350688d 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1418,7 +1418,7 @@ hend(Eprog prog)
   DPUTS(hptr < chline, "History end pointer off start of line");
   *hptr = '\0';
     }
-    {
+    if (*chline) {
     LinkList hookargs = newlinklist();
     int save_errflag = errflag;
     errflag = 0;
@@ -1427,6 +1427,7 @@ hend(Eprog prog)
   addlinknode(hookargs, chline);
   callhookfunc("zshaddhistory", hookargs, 1, &hookret);

+	errflag &= ~ERRFLAG_ERROR;
	errflag |= save_errflag;
     }
     /* For history sharing, lock history file once for both read and write */


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Error in zshaddhistory() should not prevent command from running
@ 2016-12-29  0:41 Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2016-12-29  0:41 UTC (permalink / raw)
  To: zsh-workers

Should this actually be in callhookfunc() itself?  I note that the doc
warns about errors in precmd killing off periodic, or else I'd say it
ought to be.

Possibly more controversial, why run this hook at all when nothing is
being added?

diff --git a/Src/hist.c b/Src/hist.c
index 97fd340..350688d 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1418,7 +1418,7 @@ hend(Eprog prog)
 	DPUTS(hptr < chline, "History end pointer off start of line");
 	*hptr = '\0';
     }
-    {
+    if (*chline) {
 	LinkList hookargs = newlinklist();
 	int save_errflag = errflag;
 	errflag = 0;
@@ -1427,6 +1427,7 @@ hend(Eprog prog)
 	addlinknode(hookargs, chline);
 	callhookfunc("zshaddhistory", hookargs, 1, &hookret);
 
+	errflag &= ~ERRFLAG_ERROR;
 	errflag |= save_errflag;
     }
     /* For history sharing, lock history file once for both read and write */


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-02  3:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-31  6:13 Error in zshaddhistory() should not prevent command from running Bart Schaefer
2017-01-01  3:10 ` Daniel Shahaf
2017-01-01 19:20   ` Bart Schaefer
2017-01-02  2:48     ` Daniel Shahaf
  -- strict thread matches above, loose matches on Subject: below --
2016-12-29  0:41 Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).