Bug 110743

Summary: possibly broken source code
Product: [Fedora] Fedora Reporter: d.binderman
Component: epicAssignee: Jeremy Katz <katzj>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1CC: d.binderman
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-11-25 15:18:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description d.binderman 2003-11-24 12:50:04 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)

Description of problem:
I just tried to compile package epic-1_0_1-15 from Fedora.

The compiler said

functions.c(4205): warning #187: use of "=" where "==" may have been 
intended
functions.c(4205): warning #187: use of "=" where "==" may have been 
intended

The source code is

        while (((*word == 'r') && (variable = 1)) || ((*word == 'g') 
&& (global = 1)) || ((*word == 'i') && (func = stristr)))
                word++;

Better source code might be

        while (((*word == 'r') && (variable == 1)) 
		|| ((*word == 'g') && (global == 1)) 
		|| ((*word == 'i') && (func == stristr)))
		{
                word++;
		}


Version-Release number of selected component (if applicable):
epic-1_0_1-15 

How reproducible:
Always

Steps to Reproduce:
1. by inspection of source code
2.
3.
    

Additional info:

Comment 1 Jeremy Katz 2003-11-24 22:33:55 UTC
This is, although baroque and disgusting, exactly what's intended. 
When 'g' is the letter, it wants to set the context as global for any
function getting called.

Comment 2 d.binderman 2003-11-25 12:50:27 UTC
Would it be possible to rewrite code to be more clear,
so that other folks don't fall into the same trap I did ?

Something like

while (((*word == 'r') && ((variable = 1) != 0)) 
    || ((*word == 'g') && ((global = 1) != 0)) 
    || ((*word == 'i') && ((func = stristr) != 0)))
                word++;


Comment 3 Jeremy Katz 2003-11-25 15:18:33 UTC
Please make any such requests upstream.  Not being the upstream
maintainers of the software, making cosmetic changes to the code is
not viable.