Bug 110743 - possibly broken source code
possibly broken source code
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: epic (Show other bugs)
1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeremy Katz
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-24 07:50 EST by d.binderman
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-11-25 10:18:33 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2003-11-24 07:50:04 EST
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 17:33:55 EST
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 07:50:27 EST
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 10:18:33 EST
Please make any such requests upstream.  Not being the upstream
maintainers of the software, making cosmetic changes to the code is
not viable.

Note You need to log in before you can comment on or make changes to this bug.