Bug 13146 - source3/torture/pdbtest.c:192: bad test ?
Summary: source3/torture/pdbtest.c:192: bad test ?
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: 4.7.2
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-15 14:57 UTC by David Binderman
Modified: 2019-04-04 08:32 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2017-11-15 14:57:43 UTC
source3/torture/pdbtest.c:192:22: warning: logical ‘and’ of mutually exclusive tests is always false [-Wlogical-op]

Source code is

        d1_buf = pdb_get_hours(s1);
        d2_buf = pdb_get_hours(s2);
        if (d2_buf == NULL && d2_buf != NULL) {

Maybe better code:

        d1_buf = pdb_get_hours(s1);
        d2_buf = pdb_get_hours(s2);
        if (d1_buf == NULL && d2_buf != NULL) {
Comment 1 David Binderman 2018-06-15 10:09:18 UTC
Still broken some seven months later.

Not much point sending in bug reports if they get ignored.
Comment 2 Jeremy Allison 2018-06-15 23:08:24 UTC
Sorry, this is a low priority - it's in test code.

I appreciate you provided a fix here, but a better way to get attention would be to submit as a git-am format patch to samba-technical@lists.samba.org.

This is worth fixing in master, but not back-porting as a bug to current release branches.

Jeremy.
Comment 3 Björn Jacke 2018-06-17 10:41:01 UTC
but submitting a patch via Bugzilla also perfectly fine of course. For a to post to the list you would have to be subscribed, which not everybody wants to. We should definetely all watch bugzilla bugs closer.
Comment 4 David Binderman 2019-04-04 08:32:41 UTC
Obvious untested patch:

diff -c ./source3/torture/pdbtest.c.sav ./source3/torture/pdbtest.c
*** ./source3/torture/pdbtest.c.sav	2019-04-04 09:29:21.327102480 +0100
--- ./source3/torture/pdbtest.c	2019-04-04 09:29:30.714048329 +0100
***************
*** 191,197 ****
  	} else if (pdb_get_hours_len(s1) != 0) {
  		d1_buf = pdb_get_hours(s1);
  		d2_buf = pdb_get_hours(s2);
! 		if (d2_buf == NULL && d2_buf != NULL) {
  			DEBUG(0, ("Logon hours is not set\n"));
  			ret = False;
  		} else if (d1_buf == NULL) {
--- 191,197 ----
  	} else if (pdb_get_hours_len(s1) != 0) {
  		d1_buf = pdb_get_hours(s1);
  		d2_buf = pdb_get_hours(s2);
! 		if (d1_buf == NULL && d2_buf != NULL) {
  			DEBUG(0, ("Logon hours is not set\n"));
  			ret = False;
  		} else if (d1_buf == NULL) {