[exim-cvs] Cond !bool{}/!bool_lax{} did not negate. Fixed.

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Exim Git Commits Mailing List
Dátum:  
Címzett: exim-cvs
Tárgy: [exim-cvs] Cond !bool{}/!bool_lax{} did not negate. Fixed.
Gitweb: http://git.exim.org/exim.git/commitdiff/5ee6f336ce27e7887fdc07ef45e0f3052d3893b0
Commit:     5ee6f336ce27e7887fdc07ef45e0f3052d3893b0
Parent:     a5b5269546e02d1f2e90000e79df8409d4f269db
Author:     Phil Pennock <pdp@???>
AuthorDate: Tue Apr 26 15:02:09 2011 -0400
Committer:  Phil Pennock <pdp@???>
CommitDate: Tue Apr 26 15:02:09 2011 -0400


    Cond !bool{}/!bool_lax{} did not negate. Fixed.


    Fixes bug: 1104
---
 doc/doc-txt/ChangeLog        |    3 +++
 src/src/expand.c             |    2 +-
 test/scripts/0000-Basic/0002 |    4 ++++
 3 files changed, 8 insertions(+), 1 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index e6684b4..7bf9ebb 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -24,6 +24,9 @@ PP/06 Extra paranoia around buffer usage at the STARTTLS transition.
 PP/07 Catch divide-by-zero in ${eval:...}.
       Fixes bugzilla 1102.


+PP/08 Condition negation of bool{}/bool_lax{} did not negate.  Fixed.
+      Bugzilla 1104.
+


 Exim version 4.75
 -----------------
diff --git a/src/src/expand.c b/src/src/expand.c
index fece8c1..2e59c40 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -2558,7 +2558,7 @@ switch(cond_type)
        "value \"%s\"", t);
       return NULL;
       }
-    if (yield != NULL) *yield = (boolvalue != 0);
+    if (yield != NULL) *yield = (boolvalue == testfor);
     return s;
     }


diff --git a/test/scripts/0000-Basic/0002 b/test/scripts/0000-Basic/0002
index 9e427dd..625050c 100644
--- a/test/scripts/0000-Basic/0002
+++ b/test/scripts/0000-Basic/0002
@@ -551,6 +551,8 @@ abcdea abc z   ${tr{abcdea}{abc}{z}}
 "text "               ${if bool{text }{true}{false}}     EXPECT: error
 " text "              ${if bool{ text }{true}{false}}     EXPECT: error
 "00"                  ${if bool{00}{true}{false}}     EXPECT: false
+"!true"               ${if !bool{true}{true}{false}}     EXPECT: false
+"!false"              ${if !bool{false}{true}{false}}     EXPECT: true


 "TrUe"                ${if bool_lax{TrUe}{true}{false}}      EXPECT: true
 "FALSE"               ${if bool_lax{FALSE}{true}{false}}     EXPECT: false
@@ -570,6 +572,8 @@ abcdea abc z   ${tr{abcdea}{abc}{z}}
 "text "               ${if bool_lax{text }{true}{false}}      EXPECT: true
 " text "              ${if bool_lax{ text }{true}{false}}      EXPECT: true
 "00"                  ${if bool_lax{00}{true}{false}}      EXPECT: true
+"!true"               ${if !bool_lax{true}{true}{false}}      EXPECT: false
+"!false"              ${if !bool_lax{false}{true}{false}}      EXPECT: true


# RFC 2047