[Bug 231709] New: kpowersave-0.7.1-12: comparison with string literal
https://bugzilla.novell.com/show_bug.cgi?id=231709 Summary: kpowersave-0.7.1-12: comparison with string literal Product: openSUSE 10.3 Version: unspecified Platform: All OS/Version: SuSE Other Status: NEW Severity: Normal Priority: P5 - None Component: KDE AssignedTo: kde-maintainers@suse.de ReportedBy: dcb314@hotmail.com QAContact: qa@suse.de I just tried to compile package kpowersave-0.7.1-12 The compiler said /usr/src/packages/BUILD/kpowersave-0.7.1/src/kpowersave.cpp:1482: warning: comparison with string literal The source code is } else if ((getenv("DESKTOP_SESSION") == "gnome") && (display->checkScreenSaverStatus() == 11)) { I agree with the compiler. Suggest new code } else if ((strcmp( getenv("DESKTOP_SESSION"), "gnome") == 0) && (display->checkScreenSaverStatus() == 11)) { -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 stbinner@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|kde-maintainers@suse.de |dkukawka@novell.com Component|KDE |Mobile Devices -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dkukawka@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from dkukawka@novell.com 2007-01-04 11:24 MST ------- This is only a warning ... and this cause IMO no problems. Btw. the patch is wrong because if must be: } else if ((!strcmp( getenv("DESKTOP_SESSION"), "gnome") == 0) ... to work correct. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dcb314@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | ------- Comment #2 from dcb314@hotmail.com 2007-01-04 15:24 MST ------- (In reply to comment #1)
This is only a warning ... and this cause IMO no problems.
Thanks for your opinion - this is basically C code, not C++. The code looks wrong to both me and the compiler. Suggest you examine the code again.
Btw. the patch is wrong because if must be:
} else if ((!strcmp( getenv("DESKTOP_SESSION"), "gnome") == 0) ...
to work correct.
Your suggested patch also looks wrong to me. strcmp returns zero when the strings are the same. Suggest try again. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dkukawka@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED ------- Comment #3 from dkukawka@novell.com 2007-01-05 05:35 MST ------- No comment - c-a-p error, remove the ==. This is fixed! And IMO this is not a real problem, since this worked also perfect in the former version. This is only a warning and not a error from the compiler -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dcb314@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | ------- Comment #4 from dcb314@hotmail.com 2007-01-05 08:28 MST ------- (In reply to comment #3)
No comment - c-a-p error, remove the ==. This is fixed!
!? I would be grateful if you could explain to me how your proposed fix solves the problem.
And IMO this is not a real problem, since this worked also perfect in the former version. This is only a warning and not a error from the compiler
I agree it is only a warning - but it indicates a coding error. C and C++ are powerful tools and easy to use wrongly. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dkukawka@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED ------- Comment #5 from dkukawka@novell.com 2007-01-06 04:46 MST ------- This bug is fixed! Don't change the state of the bug! -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dcb314@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | ------- Comment #6 from dcb314@hotmail.com 2007-01-06 06:29 MST ------- (In reply to comment #5)
This bug is fixed! Don't change the state of the bug!
If this bug is fixed, then please show me the patch which fixes the bug. Until this time, the bug stays open. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dkukawka@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED ------- Comment #7 from dkukawka@novell.com 2007-01-08 07:42 MST ------- Sorry, But it's not my job to explain this. Close the bug now, and don't touch the state of the bug! -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dcb314@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | ------- Comment #8 from dcb314@hotmail.com 2007-01-08 11:02 MST ------- (In reply to comment #7)
Sorry, But it's not my job to explain this.
I disagree. I think it is *precisely* your job to explain this. If you can't or won't, then I am very happy for someone else to take over this bug report. You haven't produced a patch and yet you claim that the bug is fixed. I fail to see how. Please educate me. I could be hard of thinking. What does c-a-p mean, anyway ? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dkukawka@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED ------- Comment #9 from dkukawka@novell.com 2007-01-08 11:05 MST ------- Sorry, but It's not my job to educate you. This bug is correct fixed and you can see this in SVN or with the next package. Sorry, but I don't waste my time with explain how I fix my programms and at least not for compiler warnings! -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dcb314@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | ------- Comment #10 from dcb314@hotmail.com 2007-01-08 11:15 MST ------- (In reply to comment #9)
Sorry, but It's not my job to educate you.
Thanks for your advice. Your helpfulness and degree of customer support has been noted.
This bug is correct fixed and you can see this in SVN or with the next package.
I don't have access to SVN, but I will be having another look at this package sometime soon. Perhaps I can figure out what change you have made then.
Sorry, but I don't waste my time with explain how I fix my programms
Thanks.
and at least not for compiler warnings!
Dear oh dear - IMHO a very short sighted view. It may surprise you to know that I've found over a thousand bugs in various versions of Suse Linux merely by looking at compiler warnings. So they do seem to be sometimes helpful. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dkukawka@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED ------- Comment #11 from dkukawka@novell.com 2007-01-08 12:10 MST ------- --- trunk/kpowersave/src/kpowersave.cpp 2006-12-28 07:28:57 UTC (rev 2743) +++ trunk/kpowersave/src/kpowersave.cpp 2007-01-04 06:32:04 UTC (rev 2744) @@ -1589,7 +1589,7 @@ // Maybe nothing ?! } } - } else if ((getenv("DESKTOP_SESSION") == "gnome") && (display->checkScreenSaverStatus() == 11)) { + } else if ((!strcmp(getenv("DESKTOP_SESSION"), "gnome")) && (display->checkScreenSaverStatus() == 11)) { // use this to set XScreensaver back to default settings this should // also cover the DPMS settings for GNOME/XScreensaver -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231709 dkukawka@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
participants (1)
-
bugzilla_noreply@novell.com