Subject: bin/23817: sh allows empty LHS to short-circuit operators
To: None <email@example.com>
From: None <firstname.lastname@example.org>
Date: 12/21/2003 01:38:58
>Synopsis: sh allows empty LHS to short-circuit operators
>Arrival-Date: Sun Dec 21 06:54:00 UTC 2003
>Release: NetBSD 1.5.1
$ && echo hi
I just want to document this behavior first, before I try fixing things.
I think this should be a syntax error (it is in BASH). This patch is
dependent on one I just sent in a few hours ago, but is simple. I found
this error when I was trying to continue lines in an if conditional
After looking at the code, it's not surprising to me that ash's parser has
some dark corners.
--- sh.1~ Sun Dec 21 01:28:36 2003
+++ sh.1 Sun Dec 21 01:30:39 2003
@@ -581,6 +581,9 @@
and nothing else. This is not the way it works in C.
+Also, if you forget the left-hand side (for example when continuing lines but
+forgetting to use a backslash) it defaults to a true statement. This behavior
+is not useful and should not be relied upon.
.Ss Flow-Control Constructs -- if, while, for, case
The syntax of the if command is
.Bd -literal -offset indent