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

Re: Is this a bug for zsh 4.2.3?

Bart Schaefer wrote:
> The network mounted part is a red herring; this occurs anytime one uses
> [[ existingfile -nt nonexistentfile ]].
> What's happening is that stat("nonexistentfile") fails, which causes
> [[ ... ]] to return an error condition rather than a simple falsehood.
> This is almost certainly a a bug, because [ ... ] (the test builtin,
> that is) does not cause an error in this situation.

Yes, this wasn't intended.

> It's a pretty
> serious bug, one that probably warrants a 4.2.4.

I don't have the energy, myself...

> This was introduced
> in the patch in zsh-workers/20412, which could probably be entirely
> backed out because the Austin Group has concluded that the extensions to
> "test" are OK after all.

It's probably more useful to leave it looking like a traditional "test"
which is what existing scripts will assume, if they assume anything.

Index: Src/cond.c
RCS file: /cvsroot/zsh/zsh/Src/cond.c,v
retrieving revision 1.6
diff -u -r1.6 cond.c
--- Src/cond.c	5 Oct 2004 10:39:43 -0000	1.6
+++ Src/cond.c	24 Jan 2005 10:50:03 -0000
@@ -336,7 +336,7 @@
 		return 1;
 	    a = st->st_mtime;
 	    if (!(st = getstat(right)))
-		return 2;
+		return 1;
 	    return !((ctype == COND_NT) ? a > st->st_mtime : a < st->st_mtime);
     case COND_EF:

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.


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