zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: BUG: failure in "vcs_info prompt" aborts precmd function
Date: Sun, 23 Nov 2014 10:13:45 -0800	[thread overview]
Message-ID: <141123101345.ZM10525@torch.brasslantern.com> (raw)
In-Reply-To: <5472040F.8020803@thequod.de>

On Nov 23,  4:58pm, Daniel Hahler wrote:
} Subject: Re: BUG: failure in "vcs_info prompt" aborts precmd function
}
} On 22.11.2014 23:20, Mikael Magnusson wrote:
} 
} >> Apart from that, I am still wondering why the error in vcs_info causes abortion of the precmd function?!
} > 
} > Passing a non-existing file to $(< is a fatal error, or whichever term
} > is correct here.
} 
} I got that, but e.g. `false` does not abort the precmd function.

"false" is just a normal command that returns nonzero.

$(<notafile) is treated similarly to a syntax error, it kills the whole
surrounding context.

It's pretty easy to make it behave like a failed external command; can
anyone recall why it wasn't, other than to avoid allocating an empty
linked list?  It has been a fatal error since before revision control
was in use.  It is possible something really depends on being stopped
by this error?


diff --git a/Src/exec.c b/Src/exec.c
index 042215d..02a8fe3 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3840,8 +3840,8 @@ getoutput(char *cmd, int qt)
 	    return NULL;
 	untokenize(s);
 	if ((stream = open(unmeta(s), O_RDONLY | O_NOCTTY)) == -1) {
-	    zerr("%e: %s", errno, s);
-	    return NULL;
+	    zwarn("%e: %s", errno, s);
+	    return newlinklist();
 	}
 	return readoutput(stream, qt);
     }


  parent reply	other threads:[~2014-11-23 18:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-22 17:13 Daniel Hahler
2014-11-22 17:20 ` [PATCH] vcs_info: test -f .git/rebase-merge/done before reading it Daniel Hahler
2014-11-22 17:51 ` BUG: failure in "vcs_info prompt" aborts precmd function Mikael Magnusson
2014-11-22 18:01   ` Daniel Hahler
2014-11-22 22:20     ` Mikael Magnusson
2014-11-22 22:44       ` Bart Schaefer
2014-11-23 19:02         ` Peter Stephenson
2014-11-23 19:38           ` Bart Schaefer
2014-11-23 20:04             ` Peter Stephenson
2014-11-23 15:58       ` Daniel Hahler
2014-11-23 18:08         ` Mikael Magnusson
2014-11-23 19:57           ` TRY_BLOCK_ERROR and exit status Bart Schaefer
2014-11-24 10:11             ` Peter Stephenson
2014-11-25  8:01               ` Bart Schaefer
2014-11-25  9:18                 ` Peter Stephenson
2014-11-23 18:13         ` Bart Schaefer [this message]
2014-11-23 18:52           ` BUG: failure in "vcs_info prompt" aborts precmd function Mikael Magnusson
2014-11-23 19:47             ` Bart Schaefer
2014-11-23 22:03           ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=141123101345.ZM10525@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).