[X2Go-Commits] [x2goserver] 54/99: X2Go/Server/Agent/NX/Options.pm: if ("string") in Perl does something weird in a dualvar sense - it converts a string to a number, which typically evaluates into a plain "0" if it doesn't start with any digits.

git-admin at x2go.org git-admin at x2go.org
Mon Dec 28 06:10:47 CET 2020


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit 3ea7e0b62dc2795e5e9187160033a1b5e60d44fc
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Nov 21 21:57:21 2020 +0100

    X2Go/Server/Agent/NX/Options.pm: if ("string") in Perl does something weird in a dualvar sense - it converts a string to a number, which typically evaluates into a plain "0" if it doesn't start with any digits.
    
    We actually meant to check against an empty string.
    
    Also, change the whole expression to not enclose everything in a
    negation but rather negate sub-terms as required.
---
 X2Go/Server/Agent/NX/Options.pm | 2 +-
 debian/changelog                | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm
index 119d0db0..5f9b27f8 100644
--- a/X2Go/Server/Agent/NX/Options.pm
+++ b/X2Go/Server/Agent/NX/Options.pm
@@ -486,7 +486,7 @@ sub filter_option_modify {
       # Don't add empty options as an empty string key with undef value; even
       # though that's technically legit and would semantically fit the notion
       # as well, we rather want to represent this situation by an empty hash.
-      if (!(($needle_key) || (defined ($needle_value)))) {
+      if ((q{} eq $needle_key) && (!(defined ($needle_value)))) {
         print {*STDERR} "Empty option addition/modification requested, this is deprecated. Adding empty hash.\n";
       }
       else {
diff --git a/debian/changelog b/debian/changelog
index 8d5655ac..da923aac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -288,6 +288,12 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium
       characters.
     - x2goserver/lib/x2goupdateoptionsstring: add comment regarding the
       shift () operations after sanitizing program options.
+    - X2Go/Server/Agent/NX/Options.pm: if ("string") in Perl does something
+      weird in a dualvar sense - it converts a string to a number, which
+      typically evaluates into a plain "0" if it doesn't start with any
+      digits. We actually meant to check against an empty string. Also,
+      change the whole expression to not enclose everything in a negation but
+      rather negate sub-terms as required.
   * debian/control:
     + Build-depend upon lsb-release for distro version detection.
   * debian/x2goserver.manpages:

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list