[Bug 687236] New: [yast2-core] YCP: an if-condition evaluating to nil skips both "then" and "else" branches
https://bugzilla.novell.com/show_bug.cgi?id=687236 https://bugzilla.novell.com/show_bug.cgi?id=687236#c0 Summary: [yast2-core] YCP: an if-condition evaluating to nil skips both "then" and "else" branches Classification: openSUSE Product: openSUSE 11.4 Version: Final Platform: All OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: YaST2 AssignedTo: mvidner@novell.com ReportedBy: mvidner@novell.com QAContact: jsrain@novell.com Found By: Development Blocker: --- This is an underlying bug in bnc#655571 which was reported on SLE11 SP1. (but the behavior is very old) The code: { boolean cond = nil; if (cond) { y2milestone ("If of 'if(nil)'"); } else { y2milestone ("Else of 'if(nil)'"); } if (true && cond) { y2milestone ("If of 'if(&&nil)'"); } else { y2milestone ("Else of 'if(&&nil)'"); } } Logs only: <3> trikolka(7401) [Interpreter] snippets/ifnil.ycp:3 'if (cond)' evaluates to non-boolean 'nil' (VOID). <3> trikolka(7401) [Interpreter] snippets/ifnil.ycp:12 if condition is nil. The documentation says: http://doc.opensuse.org/projects/YaST/openSUSE11.3/tdg/id_ycp_conditional.ht... The then_part is executed if and only if condition evaluates to true, the else_part otherwise. It is an error if condition evaluates to something other than true or false. I believe that skipping both branches is never what the developer expects and nil should be regarded as false. -- 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.
https://bugzilla.novell.com/show_bug.cgi?id=687236 https://bugzilla.novell.com/show_bug.cgi?id=687236#c Martin Vidner <mvidner@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 - None |P4 - Low Status|NEW |ASSIGNED Summary|[yast2-core] YCP: an |JJ: [yast2-core] YCP: an |if-condition evaluating to |if-condition evaluating to |nil skips both "then" and |nil skips both "then" and |"else" branches |"else" branches -- 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.
https://bugzilla.novell.com/show_bug.cgi?id=687236 https://bugzilla.novell.com/show_bug.cgi?id=687236#c1 --- Comment #1 from Jiří Suchomel <jsuchome@novell.com> 2011-06-15 15:03:32 UTC --- Created an attachment (id=434635) --> (http://bugzilla.novell.com/attachment.cgi?id=434635) patc for core/libycp/src Could this be the correct solution? (Not mentioning that also other statements and operators need to be adapted) -- 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.
https://bugzilla.novell.com/show_bug.cgi?id=687236 https://bugzilla.novell.com/show_bug.cgi?id=687236#c2 --- Comment #2 from Martin Vidner <mvidner@novell.com> 2011-06-15 17:23:29 CEST --- Yes, thank you! Can you please also extend the test suite to exercise these cases? I wonder whether the ternary operator ?: also has this 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.
https://bugzilla.novell.com/show_bug.cgi?id=687236 https://bugzilla.novell.com/show_bug.cgi?id=687236#c Jiří Suchomel <jsuchome@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jsuchome@novell.com AssignedTo|mvidner@novell.com |jsuchome@novell.com -- 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.
https://bugzilla.novell.com/show_bug.cgi?id=687236 https://bugzilla.novell.com/show_bug.cgi?id=687236#c3 Jiří Suchomel <jsuchome@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #434635|0 |1 is obsolete| | --- Comment #3 from Jiří Suchomel <jsuchome@novell.com> 2011-06-16 13:00:07 UTC --- Created an attachment (id=434822) --> (http://bugzilla.novell.com/attachment.cgi?id=434822) patc for core/libycp/src OK, with this patch: if (nil) -> false (b && nil) -> false (nil && b) -> false (b || nil) -> b (nil || b) -> b nil ? "1st" : "2nd" -> "2nd" (I was obviously wrong with repeat/while checks, having nil there just exits/do not enters the cycle, which is expected behavior) -- 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.
https://bugzilla.novell.com/show_bug.cgi?id=687236 https://bugzilla.novell.com/show_bug.cgi?id=687236#c4 Jiří Suchomel <jsuchome@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #4 from Jiří Suchomel <jsuchome@novell.com> 2011-06-17 14:41:44 UTC --- yast2-core-2.21.4 -- 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.
https://bugzilla.novell.com/show_bug.cgi?id=687236 https://bugzilla.novell.com/show_bug.cgi?id=687236#c5 --- Comment #5 from Bernhard Wiedemann <bwiedemann@novell.com> 2011-06-17 17:00:30 CEST --- This is an autogenerated message for OBS integration: This bug (687236) was mentioned in https://build.opensuse.org/request/show/74060 Factory / yast2-core -- 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.
participants (1)
-
bugzilla_noreply@novell.com