Bug 146603

Summary: slang-2.0.5-3: dodgy code
Product: [openSUSE] SUSE LINUX 10.0 Reporter: David Binderman <dcb314>
Component: BasesystemAssignee: Vladimir Nadvornik <nadvornik>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Minor    
Priority: P5 - None    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: SUSE Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description David Binderman 2006-01-30 13:59:20 UTC
I just tried to compile package slang-2.0.5-3 with the Intel C compiler.

It said

/usr/src/packages/BUILD/slang-2.0.5/src/slcommon.c(107): warning #187: use of "=" where "==" may have been intended
/usr/src/packages/BUILD/slang-2.0.5/src/slcommon.c(108): warning #187: use of "=" where "==" may have been intended
/usr/src/packages/BUILD/slang-2.0.5/src/slcommon.c(109): warning #187: use of "=" where "==" may have been intended

The source code is

   if (((locale == NULL) || (*locale == 0))
       && ((NULL == (locale = getenv ("LC_ALL"))) || (*locale = 0))
       && ((NULL == (locale = getenv ("LC_CTYPE"))) || (*locale = 0))
       && ((NULL == (locale = getenv ("LANG"))) || (*locale = 0)))
     return 0;

Maybe the programmer intended

   if (((locale == NULL) || (*locale == 0))
       && ((NULL == (locale = getenv ("LC_ALL"))) || (*locale == 0))
       && ((NULL == (locale = getenv ("LC_CTYPE"))) || (*locale == 0))
       && ((NULL == (locale = getenv ("LANG"))) || (*locale == 0)))
     return 0;
Comment 1 Vladimir Nadvornik 2006-01-30 16:42:45 UTC
The code really looks suspiciously. I sent this report to slang mailinglist.

Comment 2 Vladimir Nadvornik 2006-01-31 09:31:27 UTC
It was a bug and it will be fixed in upstream slang 2.0.6.
I have fixed the SUSE package.