This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2goserver. from c2182644 x2goserver/sbin/x2gocleansessions: replace time check with PID validity check in check_pid and calls. new 53293ac0 x2goserver/lib/x2goupdateoptionsstring: simplify a for loop a bit. new 933b1fb9 x2goserver/lib/x2goupdateoptionsstring: fix typo in comment. new 1112f972 x2goserver/lib/x2goupdateoptionsstring: fix typo in print statement syntax. new f2203a79 debian/libx2go-server-perl.install: remove duplicated entry for X2Go/Utils.pm. new a7c08751 x2goserver/lib/x2goupdateoptionsstring: update copyright notice. new e5660cdb X2Go/Server/Agentt/: add new (stub) file NX/Options.pm as a library version of the options string manipulation code. new 088e03f7 x2goserver/lib/x2goupdateoptionsstring: fix man page specification, options string was missing. new 388d4e96 x2goserver/lib/x2goupdateoptionsstring: move most code to X2Go/Server/Agent/NX/Options.pm. new b4937776 x2goserver/lib/x2goupdateoptionsstring: revert for loop simplification. new 70005175 X2Go/Server/Agent/NX/Options.pm: add a lot of documentation. new 56b1302d x2goserver/lib/x2goupdateoptionsstring: update synopsis to include the optional character of a plus sign, but a non-optional character for a minus sign. new 386d9552 x2goserver/lib/x2goupdateoptionsstring: make clear that "additional parameters" are transformations. new f70ada58 x2goserver/lib/x2goupdateoptionsstring: replace occurrences of "option string" with "options string". new 6f553240 X2Go/Server/Agent/NX/Options.pm: replace occurrences of "option string" with "options string". new 9aec8628 X2Go/Server/Agent/NX/Options.pm: document that duplicate keys in the input options string are possible and accepted, but actually discouraged and semantically redundant. new cc5b3a51 X2Go/Server/Agent/NX/Options.pm: whitespace-only in comment. new 7f136552 X2Go/Server/Agent/NX/Options.pm: add and use an enum-like construct as the internal mode selector for transforms. new 19901172 X2Go/Server/Agent/NX/Options.pm: rename options parameter in transform_intermediate to intermediate. new 80c7e3d0 X2Go/Server/Agent/NX/Options.pm: document key-value pairs with either empty keys or empty (!= non-existent) values. new f71c2644 X2Go/Server/Agent/NX/Options.pm: make sure that intermediates never include undef entries. new 5d84e9b6 x2goserver/lib/x2goupdateoptionsstring: switch to "X2Go/NX Agent" term and make it bold to denote something special. new 38189f76 X2Go/Server/Agent/NX/Options.pm: add new function compact_intermediate, used to remove duplicated and empty elements. new 37ddcda0 x2goserver/lib/x2goupdateoptionsstring: add new --compact/-c switch to enable the use of compactation. new 078818ed x2goserver/lib/x2goupdateoptionsstring: document new --compact/-c switch. new d088a26f x2goserver/lib/x2goupdateoptionsstring: split up GetOptionsFromArray () line. new 050d662b X2Go/Server/Agent/NX/Options.pm: document the new compact_intermediate () function and its implications. new 3c7a8f2f X2Go/Server/Agent/NX/Options.pm: fix some Perl Critic warnings and silence others. new 83da2560 x2goserver/lib/x2goupdateoptionsstring: fix some Perl Critic warnings and silence others. new d45745ee X2Go/Server/Agent/NX/Options.pm: grammar/typo fix in comment and improve a different comment. new b4ac4e83 X2Go/Server/Agent/NX/Options.pm: avoid copying arrays if not necessary when passing to grep and map operations. new 39c96020 X2Go/Server/Agent/NX/Options.pm: rework the lastly modified comment again, the changed explanation didn't match the reality. new c91c6934 X2Go/Server/Agent/NX/Options.pm: fix typos in internal section links. new d7a9fb7c X2Go/Server/Agent/NX/Options.pm: add newline before __END__, non-functional. new 5e2aca5f {X2Go/Server/Agent/NX/Options.pm,x2goserver/lib/x2goupdateoptionsstring}: add =pod markers. new ed0a723c {X2Go/Server/Agent/NX/Options.pm,x2goserver/lib/x2goupdateoptionsstring}: update AUTHOR sections with proper links. new 83a01b13 X2Go/Server/Agent/NX/Options.pm: fix nxagent man page link. new 012b9f6e x2goserver/lib/x2goupdateoptionsstring: considerably simplify while loop logic that iterates over transformations. new d140599d {X2Go/Server/Agent/NX/Options.pm,x2goserver/lib/x2goupdateoptionsstring}: reformat/reflow so that each sentence starts on a proper line. new 94fbba20 X2Go/Server/Agent/NX/Options.pm: replace "treat as" with "treat like". new 5402756a X2Go/Server/Agent/NX/Options.pm: clear up "logically equivalent but logically very different" situation. new eee93606 x2goserver/lib/x2goupdateoptionsstring: rename EXAMPLE section to EXAMPLES. new 9b96cb0e x2goserver/lib/x2goupdateoptionsstring: add links to X2Go::Server::Agent::NX::Options documentation on option strings and transformations. new d71b0c21 x2goserver/lib/x2goupdateoptionsstring: document how to cheat and just compact options strings. new 9c38945e x2goserver/lib/x2goupdateoptionsstring: add options terminators to example calls. new 2d52f9c7 X2Go/Server/Agent/NX/Options.pm: document that NUL bytes can only be URL-encoded, but that this not recommended. new 505c2d45 X2Go/Server/Agent/NX/Options.pm: typo compactation => compaction. new 0c1d69af X2Go/Server/Agent/NX/Options.pm: whitespace-only on fake enum-subs. new be41aa97 X2Go/Server/Agent/NX/Options.pm: add empty BEGIN block in case it's ever needed (and if not, it shouldn't have any side effects anyway). new 99e62cbb x2goserver/lib/x2goupdateoptionsstring: add space between link and punctuation character for easier copying. new 85599d36 x2goserver/lib/x2goupdateoptionsstring: better document end-of-options terminator and highlight its importance. new a56be1e1 X2Go/Server/Agent/NX/Options.pm: reflow some text. new 951991f6 X2Go/Server/Agent/NX/Options.pm: document other non-printable characters. new 4760d950 x2goserver/lib/x2goupdateoptionsstring: add comment regarding the shift () operations after sanitizing program options. new 3ea7e0b6 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. new d94c657e X2Go/Server/Agent/NX/Options.pm: make sure to add/modify elements with an empty string or undef key and an undef value as an empty hash. new 61ee4509 x2goserver/lib/x2goupdateoptionsstring: fix parsing of multiple subsequent separating "--" pseudo-options. new 55948b22 x2goserver/lib/x2goupdateoptionsstring: add debug print statements for in-depth examination of program options parsing. new 76188eb6 x2goserver/lib/x2goupdateoptionsstring: add mode selection functionality. new 43cfdcc1 X2Go/Server/Agent/NX/Options.pm: port modes "enum" subs to the constant pragma to make the code more consistent with the program wrapper. new c5e3ee2a {X2Go/Server/Agent/NX/Options.pm,x2goserver/lib/x2goupdateoptionsstring}: update Perl critic overrides to allow the constant pragma and document it and other overrides (unless they are self-explanatory). new 34e08f20 x2goserver/lib/x2goupdateoptionsstring: rework mode selection, split out abbreviation parsing into a separate function to take out nesting complexity. new 992de8b5 debian/changelog: typo and whitespace fixes. new 0b759cd9 debian/changelog: fixup x2goserver/{lib,bin}/x2goupdateoptionsstring. new 486611db {X2Go/Server/Agent/NX/Options.pm,x2goserver/bin/x2goupdateoptionsstring}: fix/silence a few Perl::Critic warnings. new ba4fef7c x2goserver/bin/x2goupdateoptionsstring: typo fix in output message only. new 6c6f5ba8 x2goserver/bin/x2goupdateoptionsstring: remove obsolete comment, we're not using a do block/do-while loop any longer. new 325121d9 X2Go/Server/Agent/NX/Options.pm: undef can't be referenced, so adjust/fix the comments. new 42099742 x2goserver/bin/x2goupdateoptionsstring: more typo fixes in output messages only. new fd76f96d x2goserver/bin/x2goupdateoptionsstring: generalize code looping through program arguments and split out transformation operation into own subroutine. new 39d02690 {X2Go/Server/Agent/NX/Options.pm,x2goserver/bin/x2goupdateoptionsstring}: enable Unicode handling, as far as possible. new 0221e42c {X2Go/Server/Agent/NX/Options.pm,x2goserver/bin/x2goupdateoptionsstring}: fatalize text coding errors. new cc374ff7 x2goserver/bin/x2goupdateoptionsstring: sanitize/convert data in @ARGV. new 74fe2336 x2goserver/bin/x2goupdateoptionsstring: add non-functional extraction mode. new e3c0c52d x2goserver/bin/x2goupdateoptionsstring: fix syntax and strict mode errors. new 1be4e179 X2Go/Server/Agent/NX/Options.pm: simplify error handling by splitting intermediate checking out into a separate subroutine. new 1e81d805 X2Go/Server/Agent/NX/Options.pm: rename $options variable to $intermediate in intermediate_to_string () for internal consistency. new 03840dc1 X2Go/Server/Agent/NX/Options.pm: document that subroutines and constants that are not marked for export are internal and should not be used. new 9a22f595 X2Go/Server/Agent/NX/Options.pm: add extract_element subroutine, used to extract key-value pairs. new cfceb86c x2goserver/bin/x2goupdateoptionsstring: correctly use MIME::Base64. new 1eb1ca4f x2goserver/bin/x2goupdateoptionsstring: actually implement extraction mode. new db1fd92a x2goserver/bin/x2goupdateoptionsstring: don't encode/decode in-place. new 354f6ad1 {X2Go/Server/Agent/NX/Options.pm,x2goserver/bin/x2goupdateoptionsstring}: explicitly use package foreign package names all across the code for consistency. new 7219322e x2goserver/bin/x2goupdateoptionsstring: fix typos in documentation and reword misinterpreted-as-options section. new 3b08baf4 x2goserver/bin/x2goupdateoptionsstring: document mode selection and extraction mode. new 8258288e x2goserver/bin/x2goupdateoptionsstring: fix error handling for kv-pair extraction. new 3e4b3132 x2goserver/bin/x2goupdateoptionsstring: add base64 encode and decode helpers, add new --base64 parameter that enabled global use of base64. new 4a7da0ac X2Go/Server/Agent/NX/Options.pm: actually check for a specific value in the kv-pair filter function if so specified. new 8c4d2205 x2goserver/bin/x2goupdateoptionsstring: extend extraction example for how to check for full key-value pair combinations. new 315ddc33 x2goserver/bin/x2goupdateoptionsstring: document the new base6 pseudo-mode. new 3ccb18ed x2goserver/bin/x2goupdateoptionsstring: an equal sign or space character is mandatory after the -m or --mode switch. new d49f15ab X2Go/Server/Agent/NX/Options.pm: document key-value pair extraction. new 09b5078c x2goserver/bin/x2goupdateoptionsstring: fix some Perl::Critic warnings. new 6a1db509 x2goserver/bin/x2goupdateoptionsstring: encode/decode to/from shell locale. new 8560fd66 x2goserver.spec: add dependency upon perl(Encode::Locale) for older distros. new ed617885 x2goserver/bin: rename x2goupdateoptionsstring to x2gooptionsstring. new 50a0f102 x2goserver/Makefile: rename x2goupdateoptionsstring to x2gooptionsstring. new 319d4cd9 debian/x2goserver.manpages: rename x2goupdateoptionsstring to x2gooptionsstring. new ea00c887 debian/x2goserver.install: rename x2goupdateoptionsstring to x2gooptionsstring. new 08aa5e67 x2goserver/bin/x2gooptionsstring: rename x2goupdateoptionsstring to x2gooptionsstring. The 99 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: X2Go/Server/Agent/NX/Options.pm | 1250 ++++++++++++++++++++++++++++++++ debian/changelog | 204 ++++++ debian/libx2go-server-perl.install | 1 - debian/x2goserver.install | 2 +- debian/x2goserver.manpages | 2 +- x2goserver.spec | 3 + x2goserver/Makefile | 2 +- x2goserver/bin/x2gooptionsstring | 1119 ++++++++++++++++++++++++++++ x2goserver/bin/x2goupdateoptionsstring | 1016 -------------------------- 9 files changed, 2579 insertions(+), 1020 deletions(-) create mode 100644 X2Go/Server/Agent/NX/Options.pm create mode 100755 x2goserver/bin/x2gooptionsstring delete mode 100755 x2goserver/bin/x2goupdateoptionsstring -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 53293ac0cc0030b3aebd09e39f683eeaf0afab51 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Nov 5 09:46:10 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: simplify a for loop a bit. --- debian/changelog | 1 + x2goserver/bin/x2goupdateoptionsstring | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3e27a07a..c7f71624 100644 --- a/debian/changelog +++ b/debian/changelog @@ -184,6 +184,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium created, but we already have such a check in another place. Instead, treat a missing PID, which can only happen during session startup, as a success. + - x2goserver/lib/x2goupdateoptionsstring: simplify a for loop a bit. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 561fd3f5..22d0f34e 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -703,8 +703,7 @@ sub sanitize_program_options { if (!($error_detected)) { $args = dclone ($args); - my $opt = 1; - for (my $cur_arg = shift (@{$args}); ((defined ($cur_arg)) && ($opt)); $cur_arg = shift (@{$args})) { + foreach my $cur_arg (@{$args}) { if (q{-} eq substr ($cur_arg, 0, 1)) { # Looks like an option so far. Let's continue scanning. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 933b1fb98d6bbfc9f06194f3628a6649c829cd48 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Nov 5 10:22:33 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: fix typo in comment. --- debian/changelog | 1 + x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index c7f71624..d2fcf503 100644 --- a/debian/changelog +++ b/debian/changelog @@ -185,6 +185,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium treat a missing PID, which can only happen during session startup, as a success. - x2goserver/lib/x2goupdateoptionsstring: simplify a for loop a bit. + - x2goserver/lib/x2goupdateoptionsstring: fix typo in comment. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 22d0f34e..510022c9 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -220,7 +220,7 @@ sub intermediate_to_string { # We can detect it through counting. my $elements_left = @{$options}; - # Handle entries iteratively, merging then into one string. + # Handle entries iteratively, merging them into one string. foreach my $entry (@{$options}) { --$elements_left; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 088e03f740a371be966cc5bbf77ce40d3ff967ca Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 07:27:16 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: fix man page specification, options string was missing. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 8b94ebbe..d27e1b9a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -191,6 +191,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/lib/x2goupdateoptionsstring: update copyright notice. - X2Go/Server/Agentt/: add new (stub) file NX/Options.pm as a library version of the options string manipulation code. + - x2goserver/lib/x2goupdateoptionsstring: fix man page specification, + options string was missing. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index b7f12b98..6eefec9b 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -933,7 +933,7 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator =item B<x2goupdateoptionsstring> B<--man> -=item B<x2goupdateoptionsstring> [B<--debug>|B<-d>] [B<-->] [B<->|B<+>]I<key>[B<=>I<value>] ... +=item B<x2goupdateoptionsstring> [B<--debug>|B<-d>] [B<-->] I<options_string> [B<->|B<+>]I<key>[B<=>I<value>] ... =back -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit a7c08751b4b2225211f6f399a820568bbdb7e13e Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 06:15:17 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: update copyright notice. --- debian/changelog | 1 + x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 3df36328..2987b440 100644 --- a/debian/changelog +++ b/debian/changelog @@ -188,6 +188,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/lib/x2goupdateoptionsstring: fix typo in comment. - x2goserver/lib/x2goupdateoptionsstring: fix typo in print statement syntax. Non-functional. + - x2goserver/lib/x2goupdateoptionsstring: update copyright notice. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index a2d5d25f..b7f12b98 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Copyright (C) 2018 X2Go Project - https://wiki.x2go.org +# Copyright (C) 2018-2020 X2Go Project - https://wiki.x2go.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit e5660cdb032aeca8178358897cae475550aa73e7 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 06:34:53 2020 +0100 X2Go/Server/Agentt/: add new (stub) file NX/Options.pm as a library version of the options string manipulation code. --- X2Go/Server/Agent/NX/Options.pm | 20 ++++++++++++++++++++ debian/changelog | 2 ++ 2 files changed, 22 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm new file mode 100644 index 00000000..5a1070fe --- /dev/null +++ b/X2Go/Server/Agent/NX/Options.pm @@ -0,0 +1,20 @@ +# Copyright (C) 2018-2020 X2Go Project - https://wiki.x2go.org +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +package X2Go::Server::Agent::NX::Options; + +1; diff --git a/debian/changelog b/debian/changelog index 2987b440..8b94ebbe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -189,6 +189,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/lib/x2goupdateoptionsstring: fix typo in print statement syntax. Non-functional. - x2goserver/lib/x2goupdateoptionsstring: update copyright notice. + - X2Go/Server/Agentt/: add new (stub) file NX/Options.pm as a library + version of the options string manipulation code. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 1112f9724798d88bf75253be390a68e915743741 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 05:58:05 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: fix typo in print statement syntax. Non-functional. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d2fcf503..8786bb3f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -186,6 +186,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium success. - x2goserver/lib/x2goupdateoptionsstring: simplify a for loop a bit. - x2goserver/lib/x2goupdateoptionsstring: fix typo in comment. + - x2goserver/lib/x2goupdateoptionsstring: fix typo in print statement + syntax. Non-functional. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 510022c9..a2d5d25f 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -741,7 +741,7 @@ sub sanitize_program_options { last; } else { - print {*STDERR} "Unknown option encountered: " . $cur_arg ."; erroring out.\n"; + print {*STDERR} "Unknown option encountered: " . $cur_arg . "; erroring out.\n"; $error_detected = 1; last; } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit f2203a79c383214a96cd01e61ffb6d5cab2382bf Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 06:12:45 2020 +0100 debian/libx2go-server-perl.install: remove duplicated entry for X2Go/Utils.pm. --- debian/changelog | 2 ++ debian/libx2go-server-perl.install | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 8786bb3f..3df36328 100644 --- a/debian/changelog +++ b/debian/changelog @@ -211,6 +211,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium string should only be quoted once (so that the shell can parse the quoted result). Quote the values in the variable directly and try not to "double-quote" the resulting string. + * debian/libx2go-server-perl.install: + + Remove duplicated entry for X2Go/Utils.pm. [ Oleksandr Shneyder ] * New upstream version (4.1.0.4): diff --git a/debian/libx2go-server-perl.install b/debian/libx2go-server-perl.install index b75c5da0..59793765 100644 --- a/debian/libx2go-server-perl.install +++ b/debian/libx2go-server-perl.install @@ -9,4 +9,3 @@ usr/share/perl5/X2Go/Server.pm usr/share/perl5/X2Go/Server/Agent* usr/share/perl5/X2Go/SupeReNicer.pm usr/share/perl5/X2Go/Utils.pm -usr/share/perl5/X2Go/Utils.pm -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 388d4e961e3e6c24e6f19a70c39e81269b663781 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 07:35:23 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: move most code to X2Go/Server/Agent/NX/Options.pm. --- X2Go/Server/Agent/NX/Options.pm | 643 +++++++++++++++++++++++++++++++++ debian/changelog | 2 + x2goserver/bin/x2goupdateoptionsstring | 640 +------------------------------- 3 files changed, 650 insertions(+), 635 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 5a1070fe..3acd65f0 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -17,4 +17,647 @@ package X2Go::Server::Agent::NX::Options; +# Disable some Perl::Critic violations. +## no critic (ProhibitParensWithBuiltins) + +use strict; +use warnings; + +use base 'Exporter'; +use English qw (-no_match_vars); +use Storable qw (dclone); + +our @EXPORT_OK = qw (parse_options interpret_transform transform_intermediate intermediate_to_string); + +# Accepts an option string and returns a reference to an array of hashes +# (actually hash references) corresponding to the parsed key-value pairs. +# +# Empty components are allowed, but will issue a warning message. In such a +# case, the hash at the corresponding array position will be empty. +# +# Keys that do not have a value assigned will be given a value of "undef" in +# order to be able to distinguish them from keys with an empty string as their +# value. +# +# Caveat: the last component will be split from the port definition. DO NOT +# SIMPLY JOIN THE LIST OR YOU WILL ADD A TRAILING COMMA! The port component +# hash retains the colon separator. +# +# On error, returns an undef reference. +sub parse_options { + my $ret = undef; + my @intermediate = (); + my $error_detected = 0; + my $options = shift; + my $next_discard = shift; + + if (defined ($next_discard)) { + print {*STDERR} "Multiple arguments passed in, all but the first one are ignored!\n"; + } + + if (!(defined ($options))) { + print {*STDERR} "No argument provided for options string, returning undef.\n"; + $error_detected = 1; + } + + if (!($error_detected)) { + my @components = split (/,/sxm, $options, -1); + foreach my $option (@components) { + # We use undef to denote that some component was not provided at all + # to disambiguate non-provided and empty strings. + my ($key, $value) = (undef, undef); + my %kv_hash = (); + + my @kv = split (/=/sxm, $option, 2); + + if (1 > scalar (@kv)) { + print {*STDERR} "Options string has empty component, this is deprecated. Adding empty element.\n"; + + push (@intermediate, \%kv_hash); + } + elsif (3 <= scalar (@kv)) { + print {*STDERR} "Options string has three or more components, this is a bug in $PROGRAM_NAME. Erroring out.\n"; + $error_detected = 1; + last; + } + else { + $key = shift (@kv); + $value = shift (@kv); + + # Add to hash - every hash will contain a single key-value pair only. + $kv_hash{$key} = $value; + + # Then add the hash as an entry in our return array - by reference. + push (@intermediate, \%kv_hash); + } + } + + # Special handling for the last option, which does not use a comma as the + # delimiter but a colon. + # + # Note that it can either be part of the key or the value. + if (!($error_detected)) { + if ((0 < scalar (@intermediate)) && (defined ($intermediate[0]))) { + my $last_hash_ref = pop (@intermediate); + my $hash_count = 0; + my $last_component = q{}; + my $in_value = 0; + my $last_component_key = undef; + + # Fetch last component and check for sanity. + # An empty hash is implicitly handled by initializing $last_component to + # an empty string, which will fail the splitting later on. + foreach my $key (keys %{$last_hash_ref}) { + ++$hash_count; + + if (1 < $hash_count) { + print {*STDERR} "More than one element found in last element's hash, this is a bug in $PROGRAM_NAME. Ignoring subsequent entries.\n"; + last; + } + + $last_component = $last_component_key = $key; + + if (defined ($last_hash_ref->{$key})) { + # If a value exists, the display specifier can not be part of the + # key. + $in_value = 1; + $last_component = $last_hash_ref->{$key}; + } + } + + # Don't use split() here. While we could use a more or less complex + # regex to extract the last(!) port specifier only, this would render + # the LIMIT parameter to split() useless (since additional capture + # groups are not part of the limit). + # Thus going the manual route here. + my $last_pos = rindex ($last_component, q{:}); + + if ($[ > $last_pos) { + print {*STDERR} "No display port seperator found in the options string. Erroring out.\n"; + $error_detected = 1; + } + else { + my $last_component_left = substr ($last_component, 0, $last_pos); + my $last_component_right = substr ($last_component, $last_pos); + + my %last_component_hash = (); + + if ($in_value) { + $last_component_hash{$last_component_key} = $last_component_left; + } + else { + # Sanity check on the key. If it's empty, issue a warning and don't + # use it. + if (0 == length ($last_component_left)) { + print {*STDERR} "Options string has empty component, this is deprecated. Adding empty element.\n"; + } + else { + $last_component_hash{$last_component_left} = undef; + } + } + + # Now add the last component hash to the array again. + push (@intermediate, \%last_component_hash); + + # Prepare a new hash object, with the key set to the display port part + # and value to undef to mark it invalid. + my %display_port_hash = (); + $display_port_hash{$last_component_right} = undef; + + # Add this to the return value as well. + push (@intermediate, \%display_port_hash); + } + } + } + } + + if (!($error_detected)) { + $ret = \@intermediate; + } + + return $ret; +} + +# Takes an intermediate options string representation array reference(!) and +# returns a string. +# This is essentially the opposite of parse_options. +# Parsing an options string and passing the result through this function again +# SHOULD (if initial options string has been a valid one to begin with) yield +# the initial options string again. +# On error, returns undef. +sub intermediate_to_string { + my $ret = undef; + my $error_detected = 0; + + my $options = shift; + + if ('ARRAY' ne ref ($options)) { + print {*STDERR} 'Invalid options reference type passed (' . ref ($options) . "), returning undef.\n"; + $error_detected = 1; + } + + if (!($error_detected)) { + if (1 == scalar (@{$options})) { + foreach my $entry (@{$options}) { + if (!defined ($entry)) { + print {*STDERR} "Invalid options array passed, returning undef.\n"; + $error_detected = 1; + } + } + } + } + + if (!($error_detected)) { + # Last entry should contain the display port part only. + # We can detect it through counting. + my $elements_left = @{$options}; + + # Handle entries iteratively, merging them into one string. + foreach my $entry (@{$options}) { + --$elements_left; + + if (!defined ($entry)) { + print {*STDERR} "Invalid options entry encountered, returning undef.\n"; + $error_detected = 1; + last; + } + + if ('HASH' ne ref ($entry)) { + print {*STDERR} 'Entry in array has invalid type (' . ref ($entry) ."), returning undef.\n"; + $error_detected = 1; + last; + } + + if (1 < scalar (keys (%{$entry}))) { + print {*STDERR} "More than one entry encountered in hash of current element, returning undef.\n"; + $error_detected = 1; + last; + } + + # Must be either empty or have one element, so... go for it. + if (0 == scalar (keys (%{$entry}))) { + if (0 != $elements_left) { + if (defined ($ret)) { + $ret .= q{,}; + } + else { + # Mark first entry as empty. Don't remove this, or else. + $ret = q{}; + } + } + else { + # Special handling for last element, which is always supposed to + # contain the display port. + print {*STDERR} "No entry found in display port hash, returning undef.\n"; + $error_detected = 1; + last; + } + } + else { + # This foreach loop may look weird because, at that point, we know that + # the hash contains one key exactly, but it's still an elegant way to + # fetch the key and pseudo-iterate over it. + foreach my $key (keys (%{$entry})) { + my $tmp = $key; + + if (0 != $elements_left) { + if (defined ($entry->{$key})) { + $tmp .= q{=} . $entry->{$key}; + } + } + + if (defined ($ret)) { + if (0 != $elements_left) { + $ret = join (q{,}, ($ret, $tmp)); + } + else { + $ret .= $tmp; + } + } + else { + $ret = $tmp; + } + } + } + } + } + + if ($error_detected) { + $ret = undef; + } + + return $ret; +} + +# Helper function that checks for errors in options passed as filter +# parameters (which, in turn, are the parameter this function expects). +# +# Returns true if all checks passed, false otherwise. +sub sanitize_input_filter { + my $ret = 1; + + my $work_option_key = shift; + my $work_option_value = shift; + my $cur_option = shift; + my $elems_left = shift; + + if (!((defined ($work_option_key)) && (defined ($cur_option)) && (defined ($elems_left)))) { + print {*STDERR} "Invalid options passed to filter, keeping entry.\n"; + $ret = 0; + } + + if ($ret) { + if ('HASH' ne ref ($cur_option)) { + print {*STDERR} "Option passed to filter is not a hash reference, keeping entry.\n"; + $ret = 0; + } + } + + if ($ret) { + if (1 < scalar (keys (%{$cur_option}))) { + print {*STDERR} "Option passed to filter has more than one entry in hash, keeping entry.\n"; + $ret = 0; + } + } + + return $ret; +} + +# Helper function that splits up the working option into a key and a value. +# +# Expects the working option as its only parameter. +# +# Returns a reference to an array with two entries - the key and the value. +# Caveat: the key cannot be undef (it's set to the empty string if it would +# be), but the value can be undef. +# +# In case of errors, returns a reference to undef. +sub sanitize_workoption_filter { + my $ret = undef; + my $error_detected = 0; + + my $working_option = shift; + + if (defined ($working_option)) { + my $work_key = undef; + my $work_value = undef; + my @work_kv = split (/=/smx, $working_option, 2); + + if (2 < scalar (@work_kv)) { + print {*STDERR} "Option-to-be-acted-upon string in filter has three or more components, this is a bug in $PROGRAM_NAME. Returning error.\n"; + $error_detected = 1; + } + + if (!($error_detected)) { + $work_key = shift (@work_kv); + + # Key can be undef if splitting failed, e.g., due to an empty input + # string. We don't consider this an error, so reset the key to an empty + # string. + if (!(defined ($work_key))) { + $work_key = q{}; + } + + $work_value = shift (@work_kv); + + $ret = [ $work_key, $work_value ]; + } + } + + return $ret; +} + +# Helper for a grep operation on the intermediate options array. +# +# Takes the option-to-remove's key and value, the current element and amount +# of elements left in the array as arguments and returns true if the element is +# not to be removed, false otherwise. +sub filter_option_remove { + my $ret = 1; + my $skip = 0; + my $to_remove_key = shift; + my $to_remove_value = shift; + my $cur_option = shift; + my $elems_left = shift; + + $skip = ((!(sanitize_input_filter ($to_remove_key, $to_remove_value, $cur_option, $elems_left))) + || (0 == $elems_left)); + + if (!($skip)) { + my $option_key = q{}; + my $option_value = undef; + + foreach my $tmp_option_key (keys (%{$cur_option})) { + $option_key = $tmp_option_key; + $option_value = $cur_option->{$tmp_option_key}; + } + + if ($to_remove_key eq $option_key) { + # Okay, we've got a match. But we might have to also check the value... + if (defined ($to_remove_value)) { + # Yep, value must match, too, but beware of undef values in the current + # option entry. + if ((defined ($option_value)) && ($to_remove_value eq $option_value)) { + # Everything matches, mark for removal. + $ret = 0; + } + } + else { + $ret = 0; + } + } + } + + return $ret; +} + +# Helper for a grep operation on the intermediate options array. +# +# Takes the option-to-find's key and value, the current element and amount of +# elements left in the array as arguments and returns true if the element has +# the same as the option we search for, false otherwise. +sub filter_find_key { + my $ret = 0; + my $skip = 0; + my $needle_key = shift; + my $needle_value = shift; + my $cur_option = shift; + my $elems_left = shift; + + $skip = ((!(sanitize_input_filter ($needle_key, $needle_value, $cur_option, $elems_left))) + || (0 == $elems_left)); + + if (!($skip)) { + # We don't care about the values this time around. + + my $option_key = q{}; + + foreach my $tmp_option_key (keys (%{$cur_option})) { + $option_key = $tmp_option_key; + } + + if ($option_key eq $needle_key) { + $ret = 1; + } + } + + return $ret; +} + +# Helper for a map operation on the intermediate options array. +# +# Takes the option-to-modify's key and value, the current element and amount of +# elements left in the array as arguments and returns the modified element or +# the original one, if modification was not necessary. +sub filter_option_modify { + my $skip = 0; + my $needle_key = shift; + my $needle_value = shift; + my $cur_option = shift; + my $elems_left = shift; + + my @ret = ( $cur_option ); + + $skip = ((!(sanitize_input_filter ($needle_key, $needle_value, $cur_option, $elems_left))) + || (0 == $elems_left)); + + if (!($skip)) { + my $option_key = q{}; + + foreach my $tmp_option_key (keys (%{$cur_option})) { + $option_key = $tmp_option_key; + } + + if ($option_key eq $needle_key) { + my $new_opt = { }; + + # Don't add empty options as an empty string key with undef value; even + # though that's technically legit we want to represent this situation by + # an empty hash. + if (!(($needle_key) || (defined ($needle_value)))) { + print {*STDERR} "Empty option addition/modification requested, this is deprecated. Adding empty hash.\n"; + } + else { + $new_opt->{$needle_key} = $needle_value; + } + + @ret = ( $new_opt ); + } + } + + return @ret; +} + +# Removes from, adds to or modifies an entry in the intermediate options array. +# +# Expects an intermediate options reference as its first parameter, a boolean +# value which should be set to true for removals or false for +# modifications/additions and the option-to-be-modified as a third parameter. +# +# For removals, the function behaves like this: +# - If only a key is specified, removes any entry that matches this key, +# regardless of its value. +# - If both a key and a value are specified, only matching combinations will +# be removed from the array. That is, if the array already contains such a +# key with either no value or a different value, it will be unaffected. +# +# Additions or modifications are handled like this: +# - If a given key is part of the intermediate representation, all such +# occurrences will be replaced by the new value. +# - Otherwise, the new value will be added at the end of the intermediate +# representation. +# +# Returns a reference to a modified *copy* of the intermediate options array. +# +# On error, returns a reference to undef. +sub transform_intermediate { + my $ret = undef; + my $error_detected = 0; + + my $options = shift; + my $remove = shift; + my $option = shift; + + if ('ARRAY' ne ref ($options)) { + print {*STDERR} 'Invalid options reference type passed (' . ref ($options) . "), erroring out.\n"; + $error_detected = 1; + } + + if (!($error_detected)) { + if (1 == scalar (@{$options})) { + foreach my $entry (@{$options}) { + if (!defined ($entry)) { + print {*STDERR} "Invalid options array passed, erroring out.\n"; + $error_detected = 1; + } + } + } + } + + if (!($error_detected)) { + if (!(defined ($remove))) { + print {*STDERR} "Invalid mode option boolean passed, erroring out.\n"; + $error_detected = 1; + } + } + + if (!($error_detected)) { + if (!(defined ($option))) { + print {*STDERR} "No or invalid new option passed, erroring out.\n"; + $error_detected = 1; + } + } + + my $work_option_key = undef; + my $work_option_value = undef; + + if (!($error_detected)) { + my $work_opt_kv = sanitize_workoption_filter ($option); + + if (!(defined ($work_opt_kv))) { + print {*STDERR} "Unable to split up working option into key and value pair, returning undef.\n"; + $error_detected = 1; + } + else { + $work_option_key = shift (@{$work_opt_kv}); + $work_option_value = shift (@{$work_opt_kv}); + } + } + + if (!($error_detected)) { + # Set return value to a *deep copy* of our original array. + $ret = dclone ($options); + + my $elements_left = @{$ret}; + + if ($remove) { + # Let the filter function handle the actual work. + @{$ret} = grep { filter_option_remove ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}); + + # Check to see if the intermediate representation is empty now (save for + # the display port entry) and add an empty element if it is. + if (1 == scalar (@{$ret})) { + print {*STDERR} "Removal operation led to option string being empty, adding empty element though deprecated.\n"; + unshift (@{$ret}, { }); + } + } + else { + # Yes, grep () isn't a great choice for a boolean comparison. It will do + # what we need just fine, but doesn't short-circuit after finding the + # first match, hence uselessly continuing through the full array. + # List::MoreUtils::any would be more appropriate here, but this would add + # another dependency and option strings are pretty small, so don't + # overoptimize here. + if (scalar (grep { filter_find_key ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}))) { + # Such an option already exists, we'll modify all occurrences. + $elements_left = @{$ret}; + $ret = [ map { filter_option_modify ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}) ]; + } + else { + my $new_opt = { $work_option_key => $work_option_value }; + + # No such option exists, we'll add it to the end of the current + # options. + # At least in theory. Practically, there's one special case: if the + # only "real" element is an empty one, for instance because the option + # string was empty to begin with save the display port specifier, then + # we want to replace this option instead. + if ((2 == scalar (@{$ret})) && (!(scalar (keys (%{$ret->[0]}))))) { + splice (@{$ret}, 0, 1, $new_opt); + } + else { + splice (@{$ret}, -1, 0, $new_opt); + } + } + } + } + + return $ret; +} + +# Helper function "interpreting" a transformation string. +# +# Takes the raw transformation string as its only parameter. +# +# Returns an array reference containing two elements: the transformation mode +# and a sanitized version of the transformation string, suitable for passing to +# transform_intermediate (). +# +# On error, returns undef. +sub interpret_transform { + my $ret = undef; + + my $transform = shift; + + if (defined ($transform)) { + my $mode = 0; + my $sanitized_transform = $transform; + + # Check if non-empty, empty transform strings can only mean an + # append/modify operation. + if ($transform) { + if (q{-} eq substr ($transform, 0, 1)) { + # Option starts with a dash, so must be a removal operation. + $mode = 1; + $sanitized_transform = substr ($sanitized_transform, 1); + } + elsif ((q{+}) eq substr ($transform, 0, 1)) { + # Options starting with a plus character are add/modify operations. The + # default mode option here is fine, but we'll need to strip the initial + # character. + $sanitized_transform = substr ($sanitized_transform, 1); + } + + # Everything else does not feature an explicit modifier, so we can take + # the transformation string verbatim. + # No need to actually do anything here, handled by the initialization. + } + + # Set up return value accordingly. + $ret = [ $mode, $sanitized_transform ]; + } + + return $ret; +} + 1; diff --git a/debian/changelog b/debian/changelog index d27e1b9a..71fad52d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -193,6 +193,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium version of the options string manipulation code. - x2goserver/lib/x2goupdateoptionsstring: fix man page specification, options string was missing. + - x2goserver/lib/x2goupdateoptionsstring: move most code to + X2Go/Server/Agent/NX/Options.pm. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 6eefec9b..c472704f 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -29,6 +29,7 @@ use Getopt::Long qw (GetOptionsFromArray); use Pod::Usage; use Storable qw (dclone); use Data::Dumper qw (Dumper); +use X2Go::Server::Agent::NX::Options; exit (Main (@ARGV)); @@ -37,637 +38,6 @@ BEGIN { # No code past this point should be getting executed! -# Accepts an option string and returns a reference to an array of hashes -# (actually hash references) corresponding to the parsed key-value pairs. -# -# Empty components are allowed, but will issue a warning message. In such a -# case, the hash at the corresponding array position will be empty. -# -# Keys that do not have a value assigned will be given a value of "undef" in -# order to be able to distinguish them from keys with an empty string as their -# value. -# -# Caveat: the last component will be split from the port definition. DO NOT -# SIMPLY JOIN THE LIST OR YOU WILL ADD A TRAILING COMMA! The port component -# hash retains the colon separator. -# -# On error, returns an undef reference. -sub parse_options { - my $ret = undef; - my @intermediate = (); - my $error_detected = 0; - my $options = shift; - my $next_discard = shift; - - if (defined ($next_discard)) { - print {*STDERR} "Multiple arguments passed in, all but the first one are ignored!\n"; - } - - if (!(defined ($options))) { - print {*STDERR} "No argument provided for options string, returning undef.\n"; - $error_detected = 1; - } - - if (!($error_detected)) { - my @components = split (/,/sxm, $options, -1); - foreach my $option (@components) { - # We use undef to denote that some component was not provided at all - # to disambiguate non-provided and empty strings. - my ($key, $value) = (undef, undef); - my %kv_hash = (); - - my @kv = split (/=/sxm, $option, 2); - - if (1 > scalar (@kv)) { - print {*STDERR} "Options string has empty component, this is deprecated. Adding empty element.\n"; - - push (@intermediate, \%kv_hash); - } - elsif (3 <= scalar (@kv)) { - print {*STDERR} "Options string has three or more components, this is a bug in $PROGRAM_NAME. Erroring out.\n"; - $error_detected = 1; - last; - } - else { - $key = shift (@kv); - $value = shift (@kv); - - # Add to hash - every hash will contain a single key-value pair only. - $kv_hash{$key} = $value; - - # Then add the hash as an entry in our return array - by reference. - push (@intermediate, \%kv_hash); - } - } - - # Special handling for the last option, which does not use a comma as the - # delimiter but a colon. - # - # Note that it can either be part of the key or the value. - if (!($error_detected)) { - if ((0 < scalar (@intermediate)) && (defined ($intermediate[0]))) { - my $last_hash_ref = pop (@intermediate); - my $hash_count = 0; - my $last_component = q{}; - my $in_value = 0; - my $last_component_key = undef; - - # Fetch last component and check for sanity. - # An empty hash is implicitly handled by initializing $last_component to - # an empty string, which will fail the splitting later on. - foreach my $key (keys %{$last_hash_ref}) { - ++$hash_count; - - if (1 < $hash_count) { - print {*STDERR} "More than one element found in last element's hash, this is a bug in $PROGRAM_NAME. Ignoring subsequent entries.\n"; - last; - } - - $last_component = $last_component_key = $key; - - if (defined ($last_hash_ref->{$key})) { - # If a value exists, the display specifier can not be part of the - # key. - $in_value = 1; - $last_component = $last_hash_ref->{$key}; - } - } - - # Don't use split() here. While we could use a more or less complex - # regex to extract the last(!) port specifier only, this would render - # the LIMIT parameter to split() useless (since additional capture - # groups are not part of the limit). - # Thus going the manual route here. - my $last_pos = rindex ($last_component, q{:}); - - if ($[ > $last_pos) { - print {*STDERR} "No display port seperator found in the options string. Erroring out.\n"; - $error_detected = 1; - } - else { - my $last_component_left = substr ($last_component, 0, $last_pos); - my $last_component_right = substr ($last_component, $last_pos); - - my %last_component_hash = (); - - if ($in_value) { - $last_component_hash{$last_component_key} = $last_component_left; - } - else { - # Sanity check on the key. If it's empty, issue a warning and don't - # use it. - if (0 == length ($last_component_left)) { - print {*STDERR} "Options string has empty component, this is deprecated. Adding empty element.\n"; - } - else { - $last_component_hash{$last_component_left} = undef; - } - } - - # Now add the last component hash to the array again. - push (@intermediate, \%last_component_hash); - - # Prepare a new hash object, with the key set to the display port part - # and value to undef to mark it invalid. - my %display_port_hash = (); - $display_port_hash{$last_component_right} = undef; - - # Add this to the return value as well. - push (@intermediate, \%display_port_hash); - } - } - } - } - - if (!($error_detected)) { - $ret = \@intermediate; - } - - return $ret; -} - -# Takes an intermediate options string representation array reference(!) and -# returns a string. -# This is essentially the opposite of parse_options. -# Parsing an options string and passing the result through this function again -# SHOULD (if initial options string has been a valid one to begin with) yield -# the initial options string again. -# On error, returns undef. -sub intermediate_to_string { - my $ret = undef; - my $error_detected = 0; - - my $options = shift; - - if ('ARRAY' ne ref ($options)) { - print {*STDERR} 'Invalid options reference type passed (' . ref ($options) . "), returning undef.\n"; - $error_detected = 1; - } - - if (!($error_detected)) { - if (1 == scalar (@{$options})) { - foreach my $entry (@{$options}) { - if (!defined ($entry)) { - print {*STDERR} "Invalid options array passed, returning undef.\n"; - $error_detected = 1; - } - } - } - } - - if (!($error_detected)) { - # Last entry should contain the display port part only. - # We can detect it through counting. - my $elements_left = @{$options}; - - # Handle entries iteratively, merging them into one string. - foreach my $entry (@{$options}) { - --$elements_left; - - if (!defined ($entry)) { - print {*STDERR} "Invalid options entry encountered, returning undef.\n"; - $error_detected = 1; - last; - } - - if ('HASH' ne ref ($entry)) { - print {*STDERR} 'Entry in array has invalid type (' . ref ($entry) ."), returning undef.\n"; - $error_detected = 1; - last; - } - - if (1 < scalar (keys (%{$entry}))) { - print {*STDERR} "More than one entry encountered in hash of current element, returning undef.\n"; - $error_detected = 1; - last; - } - - # Must be either empty or have one element, so... go for it. - if (0 == scalar (keys (%{$entry}))) { - if (0 != $elements_left) { - if (defined ($ret)) { - $ret .= q{,}; - } - else { - # Mark first entry as empty. Don't remove this, or else. - $ret = q{}; - } - } - else { - # Special handling for last element, which is always supposed to - # contain the display port. - print {*STDERR} "No entry found in display port hash, returning undef.\n"; - $error_detected = 1; - last; - } - } - else { - # This foreach loop may look weird because, at that point, we know that - # the hash contains one key exactly, but it's still an elegant way to - # fetch the key and pseudo-iterate over it. - foreach my $key (keys (%{$entry})) { - my $tmp = $key; - - if (0 != $elements_left) { - if (defined ($entry->{$key})) { - $tmp .= q{=} . $entry->{$key}; - } - } - - if (defined ($ret)) { - if (0 != $elements_left) { - $ret = join (q{,}, ($ret, $tmp)); - } - else { - $ret .= $tmp; - } - } - else { - $ret = $tmp; - } - } - } - } - } - - if ($error_detected) { - $ret = undef; - } - - return $ret; -} - -# Helper function that checks for errors in options passed as filter -# parameters (which, in turn, are the parameter this function expects). -# -# Returns true if all checks passed, false otherwise. -sub sanitize_input_filter { - my $ret = 1; - - my $work_option_key = shift; - my $work_option_value = shift; - my $cur_option = shift; - my $elems_left = shift; - - if (!((defined ($work_option_key)) && (defined ($cur_option)) && (defined ($elems_left)))) { - print {*STDERR} "Invalid options passed to filter, keeping entry.\n"; - $ret = 0; - } - - if ($ret) { - if ('HASH' ne ref ($cur_option)) { - print {*STDERR} "Option passed to filter is not a hash reference, keeping entry.\n"; - $ret = 0; - } - } - - if ($ret) { - if (1 < scalar (keys (%{$cur_option}))) { - print {*STDERR} "Option passed to filter has more than one entry in hash, keeping entry.\n"; - $ret = 0; - } - } - - return $ret; -} - -# Helper function that splits up the working option into a key and a value. -# -# Expects the working option as its only parameter. -# -# Returns a reference to an array with two entries - the key and the value. -# Caveat: the key cannot be undef (it's set to the empty string if it would -# be), but the value can be undef. -# -# In case of errors, returns a reference to undef. -sub sanitize_workoption_filter { - my $ret = undef; - my $error_detected = 0; - - my $working_option = shift; - - if (defined ($working_option)) { - my $work_key = undef; - my $work_value = undef; - my @work_kv = split (/=/smx, $working_option, 2); - - if (2 < scalar (@work_kv)) { - print {*STDERR} "Option-to-be-acted-upon string in filter has three or more components, this is a bug in $PROGRAM_NAME. Returning error.\n"; - $error_detected = 1; - } - - if (!($error_detected)) { - $work_key = shift (@work_kv); - - # Key can be undef if splitting failed, e.g., due to an empty input - # string. We don't consider this an error, so reset the key to an empty - # string. - if (!(defined ($work_key))) { - $work_key = q{}; - } - - $work_value = shift (@work_kv); - - $ret = [ $work_key, $work_value ]; - } - } - - return $ret; -} - -# Helper for a grep operation on the intermediate options array. -# -# Takes the option-to-remove's key and value, the current element and amount -# of elements left in the array as arguments and returns true if the element is -# not to be removed, false otherwise. -sub filter_option_remove { - my $ret = 1; - my $skip = 0; - my $to_remove_key = shift; - my $to_remove_value = shift; - my $cur_option = shift; - my $elems_left = shift; - - $skip = ((!(sanitize_input_filter ($to_remove_key, $to_remove_value, $cur_option, $elems_left))) - || (0 == $elems_left)); - - if (!($skip)) { - my $option_key = q{}; - my $option_value = undef; - - foreach my $tmp_option_key (keys (%{$cur_option})) { - $option_key = $tmp_option_key; - $option_value = $cur_option->{$tmp_option_key}; - } - - if ($to_remove_key eq $option_key) { - # Okay, we've got a match. But we might have to also check the value... - if (defined ($to_remove_value)) { - # Yep, value must match, too, but beware of undef values in the current - # option entry. - if ((defined ($option_value)) && ($to_remove_value eq $option_value)) { - # Everything matches, mark for removal. - $ret = 0; - } - } - else { - $ret = 0; - } - } - } - - return $ret; -} - -# Helper for a grep operation on the intermediate options array. -# -# Takes the option-to-find's key and value, the current element and amount of -# elements left in the array as arguments and returns true if the element has -# the same as the option we search for, false otherwise. -sub filter_find_key { - my $ret = 0; - my $skip = 0; - my $needle_key = shift; - my $needle_value = shift; - my $cur_option = shift; - my $elems_left = shift; - - $skip = ((!(sanitize_input_filter ($needle_key, $needle_value, $cur_option, $elems_left))) - || (0 == $elems_left)); - - if (!($skip)) { - # We don't care about the values this time around. - - my $option_key = q{}; - - foreach my $tmp_option_key (keys (%{$cur_option})) { - $option_key = $tmp_option_key; - } - - if ($option_key eq $needle_key) { - $ret = 1; - } - } - - return $ret; -} - -# Helper for a map operation on the intermediate options array. -# -# Takes the option-to-modify's key and value, the current element and amount of -# elements left in the array as arguments and returns the modified element or -# the original one, if modification was not necessary. -sub filter_option_modify { - my $skip = 0; - my $needle_key = shift; - my $needle_value = shift; - my $cur_option = shift; - my $elems_left = shift; - - my @ret = ( $cur_option ); - - $skip = ((!(sanitize_input_filter ($needle_key, $needle_value, $cur_option, $elems_left))) - || (0 == $elems_left)); - - if (!($skip)) { - my $option_key = q{}; - - foreach my $tmp_option_key (keys (%{$cur_option})) { - $option_key = $tmp_option_key; - } - - if ($option_key eq $needle_key) { - my $new_opt = { }; - - # Don't add empty options as an empty string key with undef value; even - # though that's technically legit we want to represent this situation by - # an empty hash. - if (!(($needle_key) || (defined ($needle_value)))) { - print {*STDERR} "Empty option addition/modification requested, this is deprecated. Adding empty hash.\n"; - } - else { - $new_opt->{$needle_key} = $needle_value; - } - - @ret = ( $new_opt ); - } - } - - return @ret; -} - -# Removes from, adds to or modifies an entry in the intermediate options array. -# -# Expects an intermediate options reference as its first parameter, a boolean -# value which should be set to true for removals or false for -# modifications/additions and the option-to-be-modified as a third parameter. -# -# For removals, the function behaves like this: -# - If only a key is specified, removes any entry that matches this key, -# regardless of its value. -# - If both a key and a value are specified, only matching combinations will -# be removed from the array. That is, if the array already contains such a -# key with either no value or a different value, it will be unaffected. -# -# Additions or modifications are handled like this: -# - If a given key is part of the intermediate representation, all such -# occurrences will be replaced by the new value. -# - Otherwise, the new value will be added at the end of the intermediate -# representation. -# -# Returns a reference to a modified *copy* of the intermediate options array. -# -# On error, returns a reference to undef. -sub transform_intermediate { - my $ret = undef; - my $error_detected = 0; - - my $options = shift; - my $remove = shift; - my $option = shift; - - if ('ARRAY' ne ref ($options)) { - print {*STDERR} 'Invalid options reference type passed (' . ref ($options) . "), erroring out.\n"; - $error_detected = 1; - } - - if (!($error_detected)) { - if (1 == scalar (@{$options})) { - foreach my $entry (@{$options}) { - if (!defined ($entry)) { - print {*STDERR} "Invalid options array passed, erroring out.\n"; - $error_detected = 1; - } - } - } - } - - if (!($error_detected)) { - if (!(defined ($remove))) { - print {*STDERR} "Invalid mode option boolean passed, erroring out.\n"; - $error_detected = 1; - } - } - - if (!($error_detected)) { - if (!(defined ($option))) { - print {*STDERR} "No or invalid new option passed, erroring out.\n"; - $error_detected = 1; - } - } - - my $work_option_key = undef; - my $work_option_value = undef; - - if (!($error_detected)) { - my $work_opt_kv = sanitize_workoption_filter ($option); - - if (!(defined ($work_opt_kv))) { - print {*STDERR} "Unable to split up working option into key and value pair, returning undef.\n"; - $error_detected = 1; - } - else { - $work_option_key = shift (@{$work_opt_kv}); - $work_option_value = shift (@{$work_opt_kv}); - } - } - - if (!($error_detected)) { - # Set return value to a *deep copy* of our original array. - $ret = dclone ($options); - - my $elements_left = @{$ret}; - - if ($remove) { - # Let the filter function handle the actual work. - @{$ret} = grep { filter_option_remove ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}); - - # Check to see if the intermediate representation is empty now (save for - # the display port entry) and add an empty element if it is. - if (1 == scalar (@{$ret})) { - print {*STDERR} "Removal operation led to option string being empty, adding empty element though deprecated.\n"; - unshift (@{$ret}, { }); - } - } - else { - # Yes, grep () isn't a great choice for a boolean comparison. It will do - # what we need just fine, but doesn't short-circuit after finding the - # first match, hence uselessly continuing through the full array. - # List::MoreUtils::any would be more appropriate here, but this would add - # another dependency and option strings are pretty small, so don't - # overoptimize here. - if (scalar (grep { filter_find_key ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}))) { - # Such an option already exists, we'll modify all occurrences. - $elements_left = @{$ret}; - $ret = [ map { filter_option_modify ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}) ]; - } - else { - my $new_opt = { $work_option_key => $work_option_value }; - - # No such option exists, we'll add it to the end of the current - # options. - # At least in theory. Practically, there's one special case: if the - # only "real" element is an empty one, for instance because the option - # string was empty to begin with save the display port specifier, then - # we want to replace this option instead. - if ((2 == scalar (@{$ret})) && (!(scalar (keys (%{$ret->[0]}))))) { - splice (@{$ret}, 0, 1, $new_opt); - } - else { - splice (@{$ret}, -1, 0, $new_opt); - } - } - } - } - - return $ret; -} - -# Helper function "interpreting" a transformation string. -# -# Takes the raw transformation string as its only parameter. -# -# Returns an array reference containing two elements: the transformation mode -# and a sanitized version of the transformation string, suitable for passing to -# transform_intermediate (). -# -# On error, returns undef. -sub interpret_transform { - my $ret = undef; - - my $transform = shift; - - if (defined ($transform)) { - my $mode = 0; - my $sanitized_transform = $transform; - - # Check if non-empty, empty transform strings can only mean an - # append/modify operation. - if ($transform) { - if (q{-} eq substr ($transform, 0, 1)) { - # Option starts with a dash, so must be a removal operation. - $mode = 1; - $sanitized_transform = substr ($sanitized_transform, 1); - } - elsif ((q{+}) eq substr ($transform, 0, 1)) { - # Options starting with a plus character are add/modify operations. The - # default mode option here is fine, but we'll need to strip the initial - # character. - $sanitized_transform = substr ($sanitized_transform, 1); - } - - # Everything else does not feature an explicit modifier, so we can take - # the transformation string verbatim. - # No need to actually do anything here, handled by the initialization. - } - - # Set up return value accordingly. - $ret = [ $mode, $sanitized_transform ]; - } - - return $ret; -} - # Helper function handling unknown options or ignoring the well-known # separator. It scans for options until hitting the first non-option entry. # @@ -814,7 +184,7 @@ sub Main { print {*STDERR} 'Fetched options string as: ' . Dumper (\$options); } - $intermediate = parse_options ($options); + $intermediate = X2Go::Server::Agent::NX::Options::parse_options ($options); if (!(defined ($intermediate))) { print {*STDERR} "Unable to parse option string, aborting.\n"; @@ -860,7 +230,7 @@ sub Main { print {*STDERR} 'Parsing current raw transformation option: ' . Dumper ($cur_transform); } - my $interpreted_transform_ref = interpret_transform ($cur_transform); + my $interpreted_transform_ref = X2Go::Server::Agent::NX::Options::interpret_transform ($cur_transform); if (!(defined ($interpreted_transform_ref))) { print {*STDERR} "Invalid transformation passed, aborting.\n"; @@ -874,7 +244,7 @@ sub Main { print {*STDERR} 'Parsed raw transformation option into mode \'' . $transform_mode . '\' and sanitized transform option \'' . Dumper ($sanitized_transform) . "'\n"; } - $intermediate = transform_intermediate ($intermediate, $transform_mode, $sanitized_transform); + $intermediate = X2Go::Server::Agent::NX::Options::transform_intermediate ($intermediate, $transform_mode, $sanitized_transform); if (!(defined ($intermediate))) { print {*STDERR} "Error while transforming intermediate representation, aborting.\n"; @@ -904,7 +274,7 @@ sub Main { my $out = undef; if (!($error_detected)) { - $out = intermediate_to_string ($intermediate); + $out = X2Go::Server::Agent::NX::Options::intermediate_to_string ($intermediate); if (!(defined ($out))) { print {*STDERR} "Unable to transform intermediate back into string, aborting.\n"; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 386d95529321e8be3644ff1bad04c46a5ab37ede Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 13:43:36 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: make clear that "additional parameters" are transformations. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index c5337643..893ac466 100644 --- a/debian/changelog +++ b/debian/changelog @@ -202,6 +202,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/lib/x2goupdateoptionsstring: update synopsis to include the optional character of a plus sign, but a non-optional character for a minus sign. + - x2goserver/lib/x2goupdateoptionsstring: make clear that "additional + parameters" are transformations. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 5593f725..3ded909a 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -314,7 +314,7 @@ passed to X2Go Agent/NX Agent. Call it with optional flags, the options string as the first parameter and the options you want to manipulate as additional parameters. At least one -additional parameter must be provided. +additional parameter (i.e., a transformation) must be provided. It can either add, remove or replace components. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 70005175549d61139b2d8f8d9fc61bd0724fa064 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 12:27:28 2020 +0100 X2Go/Server/Agent/NX/Options.pm: add a lot of documentation. --- X2Go/Server/Agent/NX/Options.pm | 236 ++++++++++++++++++++++++++++++++++++++++ debian/changelog | 1 + 2 files changed, 237 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 3acd65f0..375a5d38 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -661,3 +661,239 @@ sub interpret_transform { } 1; +__END__ + +=head1 NAME + +X2Go::Server::Agent::NX::Options - NX Options modification module + +=head1 SYNOPSIS + + use X2Go::Server::Agent::NX::Options; + + # Options string, probably read in from somewhere, but + # hardcoded here. + my $options = 'some=option,another=opt,more=values:90'; + + # Parse into an intermediate form. + my $intermediate = X2Go::Server::Agent::NX::Options::parse_options ($options); + + # Check for errors. + die "Unable to parse option string, aborting.\n" unless (defined ($intermediate)); + + # Add to options string. + my $transform_op = '+new=value'; + + # Parse and sanitize transform string. + my $interpreted_transform_ref = X2Go::Server::Agent::NX::Options::interpret_transform ($transform_op); + + # Error handling... + die "Invalid transformation passed, aborting.\n" unless (defined ($interpreted_transform_ref)); + + # Extract transformation data. + my ($transform_mode, $sanitized_transform) = @{$interpreted_transform_ref}; + + # Apply transformation. + $intermediate = X2Go::Server::Agent::NX::Options::transform_intermediate ($intermediate, $transform_mode, $sanitized_transform); + + # Error handling ... + die "Error while transforming intermediate representation, aborting.\n" unless (defined ($intermediate)); + + # Try to remove a combination which doesn't exist, this should not modify the + # intermediate. + # No more comments for things that were already explained. + $transform_op = '-another=doesnotexist'; + $interpreted_transform_ref = X2Go::Server::Agent::NX::Options::interpret_transform ($transform_op); + die "Invalid transformation passed, aborting.\n" unless (defined ($interpreted_transform_ref)); + ($transform_mode, $sanitized_transform) = @{$interpreted_transform_ref}; + $intermediate = X2Go::Server::Agent::NX::Options::transform_intermediate ($intermediate, $transform_mode, $sanitized_transform); + die "Error while transforming intermediate representation, aborting.\n" unless (defined ($intermediate)); + + # Remove a key unconditionally, this should change the intermediate. + $transform_op = '-some'; + $interpreted_transform_ref = X2Go::Server::Agent::NX::Options::interpret_transform ($transform_op); + die "Invalid transformation passed, aborting.\n" unless (defined ($interpreted_transform_ref)); + ($transform_mode, $sanitized_transform) = @{$interpreted_transform_ref}; + $intermediate = X2Go::Server::Agent::NX::Options::transform_intermediate ($intermediate, $transform_mode, $sanitized_transform); + die "Error while transforming intermediate representation, aborting.\n" unless (defined ($intermediate)); + + # Modify/update a key. + $transform_op = '+another=newval'; + $interpreted_transform_ref = X2Go::Server::Agent::NX::Options::interpret_transform ($transform_op); + die "Invalid transformation passed, aborting.\n" unless (defined ($interpreted_transform_ref)); + ($transform_mode, $sanitized_transform) = @{$interpreted_transform_ref}; + $intermediate = X2Go::Server::Agent::NX::Options::transform_intermediate ($intermediate, $transform_mode, $sanitized_transform); + die "Error while transforming intermediate representation, aborting.\n" unless (defined ($intermediate)); + + # Transform back into a string. + my $out = X2Go::Server::Agent::NX::Options::intermediate_to_string ($intermediate); + + # Error handling ... + die "Unable to transform intermediate back into string, aborting.\n" unless (defined ($out)); + + # At this point, $out should be 'another=newval,more=values,new=value:90'. + +=head1 DESCRIPTION + +Use this module to modify or extract data from B<X2Go/NX Agent> options +strings. Refer to L</OPTION STRINGS> for an in-depth description of options +strings. + +First, transform the input options string into an intermediate representation +via C<parse_options>. The options string I<must> end with a display +specification (i.e., it must end in C<:displaynumber>). +Parsing errors are indicated by it returning C<undef>. +The returned value is actually a I<reference> to an I<array> of I<hash> +I<references>, but you should make no assumptions to the layout or even its +actual format. Treat it as a black box. Crucially, whenever an I<intermediate> +is expected, such a I<reference> should be passed. + +To parse transformations, pass each one to C<interpret_transform>. Refer to +L</TRANSFOMATIONS> for documentation on transformation formats. This will +either return C<undef> on error, or an array of two scalars - the +transformation mode (an internal number) and the sanitized transformation +string (i.e., the original transformation string with any preceding operator +removed). + +Pass the I<intermediate>, the I<transformation mode> and the +I<sanitized transformation string> to C<transform_intermediate> to modify the +intermediate value. + +Repeat this until the I<intermediate> is modified to your liking. + +Finally, pass the I<intermediate> to C<intermediate_to_string> in order to +parse it back into a normal string. This operation is essentially the opposite +of C<parse_options>. As usual, C<undef> is returned on error. + +Generally, parsing an options string to an intermediate via C<parse_options> +and then immediately parsing it back into a string via +C<intermediate_to_string> I<should> always produce an options string that is +identical to the original options string (assuming no errors occurred). + +If this is not the case, please report a bug. + +=head1 OPTIONS STRINGS + +B<X2Go/NX Agent> options strings are fully documented in L<nxagent> and +additional, linked places. + +This module is not concerned with the actual content of an options string, +but merely its format. + +An options string follows the form +[[I<key>[C<=>I<value>,]]C<:>I<displaynumber>. + +This has some interesting implications: + +=over 4 + +=item * + +Key-value pairs are entirely optional. For example, an options string like +C<:42> is well-formed. + +=item * + +Options strings I<must> end with a display number separator, i.e., a B<colon> +(C<:>) and a display number. + +No parsing is done on the display number, so any string (even the empty +string) is valid as far as this module is concerned. + +The display number, however, I<can not> contain a B<colon> (C<:>), since that +would make it a new display number separator. + +This module will parse the options string from right to left when searching +for the display number separator and use the first one it can find. + +=item * + +Key-value pairs are separated via a B<comma> (C<,>). Hence, this character is +not valid in neither keys nor values. As a workaround, it can be URL-encoded, +as, e.g., C<%2C>, and then used as part of either keys or values. + +=item * + +Key-value pairs can be empty. This is supported and empty key-value pairs will +be preserved, but will trigger warnings at parse time. + +An options string such as C<,,,:65> is hence valid. + +=item * + +In a key-value pair, keys and values are separated from each other via an +B<equal sign> (C<=>). + +Hence, this character is not a valid part of a key. It can, however, be a +valid part of a value. + +To use this character as part of a key, it can be URL-encoded as, e.g., +C<%3D>. + +While it is legal as part of a value, it is recommended to also URL-encode it +when used as part of a value in order to not confuse other parsers. + +An options string such as C<this%3Dis%3Da=key:38> is just as valid as +C<this=is=a=key:38> or C<this=is%3Da%3Dkey:38>. + +However, the semantics differ. While the latter two key-value pairs are +logically equivalent, they are logically very much different from the first +one. + +For the first case, the I<key> will be C<this%3Dis%3Da> (or, logically, also +C<this=is=a>, which can not be directly represented), while the I<value> will +be just C<key>. + +The latter two will parse into a I<key> C<this> with a I<value> of C<is=a=key> +(or, logically equivalent, C<is%3Da%3Dkey>). + +=item * + +Quoting with any character is unsupported. Quotes and other grouping +characters (like B<curly braces> [C<{}>]) are seen verbatim without any +special meaning. + +=back + +=head1 TRANSFORMATIONS + +Transformations follow the form [B<+>]|B<->I<key>[B<=>I<value>], which means +that: + +=over 4 + +=item * + +They can be prefixed with a B<plus> character (C<+>) to indicate either +additions or modifications. A missing prefix character is interpreted like a +B<plus> character. + +If the given I<key> already exists in the intermediate, the key-value pair +will be updated with the provided I<value> (if any), or a new key-value pair +added. + +Insertions always take place at the end of the intermediate. + +The I<value> can be omitted, in which case I<key> will be added without a +value on insertions or a potentially existing value removed on updates. + +=item * + +If they are prefixed with a B<minus> character (C<->), deletion mode is +activated. + +If the given I<key> is not part of the intermediate, no deletion will occur. + +Otherwise, the optional I<value> determines deletion: if no value has been +provided, I<key> will be removed from the intermediate regardless of its +value. If the optional I<value> has been provided, I<key> will only be removed +if both values match. + +=back + +=head1 AUTHOR + +This manual has been written by Mihai Moldovan <ionic@ionic.de> for the X2Go +project (https://www.x2go.org). + +=cut diff --git a/debian/changelog b/debian/changelog index 37369101..9b1a90ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -198,6 +198,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/lib/x2goupdateoptionsstring: revert for loop simplification. We actually depend on the subtle modification of the args reference variable. + - X2Go/Server/Agent/NX/Options.pm: add a lot of documentation. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 6f553240ff3beb24eb9d82da7eba369b1b2b7149 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 13:56:32 2020 +0100 X2Go/Server/Agent/NX/Options.pm: replace occurrences of "option string" with "options string". --- X2Go/Server/Agent/NX/Options.pm | 2 +- debian/changelog | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 375a5d38..8c669b8d 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -29,7 +29,7 @@ use Storable qw (dclone); our @EXPORT_OK = qw (parse_options interpret_transform transform_intermediate intermediate_to_string); -# Accepts an option string and returns a reference to an array of hashes +# Accepts an options string and returns a reference to an array of hashes # (actually hash references) corresponding to the parsed key-value pairs. # # Empty components are allowed, but will issue a warning message. In such a diff --git a/debian/changelog b/debian/changelog index e77dedfe..b2a242dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -206,6 +206,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium parameters" are transformations. - x2goserver/lib/x2goupdateoptionsstring: replace occurrences of "option string" with "options string". + - X2Go/Server/Agent/NX/Options.pm: replace occurrences of "option string" + with "options string". * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit b49377763001a48f17fea028e8feac4b009fca2e Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 08:35:30 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: revert for loop simplification. We actually depend on the subtle modification of the args reference variable. --- debian/changelog | 3 +++ x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 71fad52d..37369101 100644 --- a/debian/changelog +++ b/debian/changelog @@ -195,6 +195,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium options string was missing. - x2goserver/lib/x2goupdateoptionsstring: move most code to X2Go/Server/Agent/NX/Options.pm. + - x2goserver/lib/x2goupdateoptionsstring: revert for loop simplification. + We actually depend on the subtle modification of the args reference + variable. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index c472704f..e4ebe962 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -73,7 +73,7 @@ sub sanitize_program_options { if (!($error_detected)) { $args = dclone ($args); - foreach my $cur_arg (@{$args}) { + for (my $cur_arg = shift (@{$args}); defined ($cur_arg); $cur_arg = shift (@{$args})) { if (q{-} eq substr ($cur_arg, 0, 1)) { # Looks like an option so far. Let's continue scanning. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit f70ada5804330edb0ad12259afc2b548d3ba9bff Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 13:55:31 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: replace occurrences of "option string" with "options string". --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 893ac466..e77dedfe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -204,6 +204,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium minus sign. - x2goserver/lib/x2goupdateoptionsstring: make clear that "additional parameters" are transformations. + - x2goserver/lib/x2goupdateoptionsstring: replace occurrences of "option + string" with "options string". * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 3ded909a..f72f94f0 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -187,7 +187,7 @@ sub Main { $intermediate = X2Go::Server::Agent::NX::Options::parse_options ($options); if (!(defined ($intermediate))) { - print {*STDERR} "Unable to parse option string, aborting.\n"; + print {*STDERR} "Unable to parse options string, aborting.\n"; $error_detected = 6; } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 9aec86288f75aa8f83d661eca2156bd6c29301bf Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 02:11:53 2020 +0100 X2Go/Server/Agent/NX/Options.pm: document that duplicate keys in the input options string are possible and accepted, but actually discouraged and semantically redundant. --- X2Go/Server/Agent/NX/Options.pm | 19 +++++++++++++++++-- debian/changelog | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 8c669b8d..e0062cbb 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -777,8 +777,8 @@ If this is not the case, please report a bug. B<X2Go/NX Agent> options strings are fully documented in L<nxagent> and additional, linked places. -This module is not concerned with the actual content of an options string, -but merely its format. +This module is not really concerned with the actual content of an options +string, but mostly its format. An options string follows the form [[I<key>[C<=>I<value>,]]C<:>I<displaynumber>. @@ -853,6 +853,21 @@ Quoting with any character is unsupported. Quotes and other grouping characters (like B<curly braces> [C<{}>]) are seen verbatim without any special meaning. +=item * + +There are no provisions (other than the mentioned invalid characters) on the +content of keys and values. + +Importantly, this also means that the same key can show up multiple times in +the options string. Semantically, this is redundant, since only the last +occurrence of a key (assuming the options string is parsed from left to right) +will take any effect. Syntactically, it's completely legal, though. + +It is recommended to avoid duplicate keys in the input options string. + +Note that, due to the nature of the supported transformations, keys can not be +duplicated with this module. + =back =head1 TRANSFORMATIONS diff --git a/debian/changelog b/debian/changelog index b2a242dd..65507baf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -208,6 +208,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium string" with "options string". - X2Go/Server/Agent/NX/Options.pm: replace occurrences of "option string" with "options string". + - X2Go/Server/Agent/NX/Options.pm: document that duplicate keys in the + input options string are possible and accepted, but actually discouraged + and semantically redundant. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 56b1302d1099612467daf7fa41ced4186ad2af66 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 6 13:41:03 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: update synopsis to include the optional character of a plus sign, but a non-optional character for a minus sign. --- debian/changelog | 3 +++ x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 9b1a90ea..c5337643 100644 --- a/debian/changelog +++ b/debian/changelog @@ -199,6 +199,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium We actually depend on the subtle modification of the args reference variable. - X2Go/Server/Agent/NX/Options.pm: add a lot of documentation. + - x2goserver/lib/x2goupdateoptionsstring: update synopsis to include the + optional character of a plus sign, but a non-optional character for a + minus sign. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index e4ebe962..5593f725 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -303,7 +303,7 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator =item B<x2goupdateoptionsstring> B<--man> -=item B<x2goupdateoptionsstring> [B<--debug>|B<-d>] [B<-->] I<options_string> [B<->|B<+>]I<key>[B<=>I<value>] ... +=item B<x2goupdateoptionsstring> [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... =back -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit cc5b3a512f295fed1d26c3da97e2e4afffb5077c Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 02:51:23 2020 +0100 X2Go/Server/Agent/NX/Options.pm: whitespace-only in comment. --- X2Go/Server/Agent/NX/Options.pm | 2 +- debian/changelog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index e0062cbb..d3cac502 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -687,7 +687,7 @@ X2Go::Server::Agent::NX::Options - NX Options modification module # Parse and sanitize transform string. my $interpreted_transform_ref = X2Go::Server::Agent::NX::Options::interpret_transform ($transform_op); - # Error handling... + # Error handling ... die "Invalid transformation passed, aborting.\n" unless (defined ($interpreted_transform_ref)); # Extract transformation data. diff --git a/debian/changelog b/debian/changelog index 65507baf..122f5f12 100644 --- a/debian/changelog +++ b/debian/changelog @@ -211,6 +211,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: document that duplicate keys in the input options string are possible and accepted, but actually discouraged and semantically redundant. + - X2Go/Server/Agent/NX/Options.pm: whitespace-only in comment. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 80c7e3d0bcf61c86ba762f73285051a02a29de3e Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 06:32:16 2020 +0100 X2Go/Server/Agent/NX/Options.pm: document key-value pairs with either empty keys or empty (!= non-existent) values. --- X2Go/Server/Agent/NX/Options.pm | 8 ++++++++ debian/changelog | 2 ++ 2 files changed, 10 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index b4b3c7fb..9af66113 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -879,6 +879,14 @@ It is recommended to avoid duplicate keys in the input options string. Note that, due to the nature of the supported transformations, keys can not be duplicated with this module. +=item * + +A key-value pair with an empty key but a non-empty value is allowed. + +Likewise, a key-value pair with a non-empty key, but an empty value is +allowed. In this case, the value will be interpreted as an empty string in +order to differentiate it from a non-existent value. + =back =head1 TRANSFORMATIONS diff --git a/debian/changelog b/debian/changelog index 9ff9f95c..67120a4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -216,6 +216,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium the internal mode selector for transforms. - X2Go/Server/Agent/NX/Options.pm: rename options parameter in transform_intermediate to intermediate. + - X2Go/Server/Agent/NX/Options.pm: document key-value pairs with either + empty keys or empty (!= non-existent) values. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 19901172aabbc26ecc10d841db52c57b47ad6775 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 05:52:30 2020 +0100 X2Go/Server/Agent/NX/Options.pm: rename options parameter in transform_intermediate to intermediate. --- X2Go/Server/Agent/NX/Options.pm | 12 ++++++------ debian/changelog | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 25d99b1f..b4b3c7fb 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -524,18 +524,18 @@ sub transform_intermediate { my $ret = undef; my $error_detected = 0; - my $options = shift; + my $intermediate = shift; my $mode = shift; my $option = shift; - if ('ARRAY' ne ref ($options)) { - print {*STDERR} 'Invalid options reference type passed (' . ref ($options) . "), erroring out.\n"; + if ('ARRAY' ne ref ($intermediate)) { + print {*STDERR} 'Invalid options reference type passed (' . ref ($intermediate) . "), erroring out.\n"; $error_detected = 1; } if (!($error_detected)) { - if (1 == scalar (@{$options})) { - foreach my $entry (@{$options}) { + if (1 == scalar (@{$intermediate})) { + foreach my $entry (@{$intermediate}) { if (!defined ($entry)) { print {*STDERR} "Invalid options array passed, erroring out.\n"; $error_detected = 1; @@ -576,7 +576,7 @@ sub transform_intermediate { if (!($error_detected)) { # Set return value to a *deep copy* of our original array. - $ret = dclone ($options); + $ret = dclone ($intermediate); my $elements_left = @{$ret}; diff --git a/debian/changelog b/debian/changelog index 35978155..9ff9f95c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -214,6 +214,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: whitespace-only in comment. - X2Go/Server/Agent/NX/Options.pm: add and use an enum-like construct as the internal mode selector for transforms. + - X2Go/Server/Agent/NX/Options.pm: rename options parameter in + transform_intermediate to intermediate. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 7f136552e8011bf4a66b616616e5cdd1f75c1d2e Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 03:01:25 2020 +0100 X2Go/Server/Agent/NX/Options.pm: add and use an enum-like construct as the internal mode selector for transforms. --- X2Go/Server/Agent/NX/Options.pm | 29 ++++++++++++++++++++--------- debian/changelog | 2 ++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index d3cac502..25d99b1f 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -27,7 +27,17 @@ use base 'Exporter'; use English qw (-no_match_vars); use Storable qw (dclone); -our @EXPORT_OK = qw (parse_options interpret_transform transform_intermediate intermediate_to_string); +our @EXPORT_OK = qw (MODE_INVALID MODE_ADD_UPDATE MODE_REMOVE + parse_options interpret_transform transform_intermediate intermediate_to_string); + + +# These are actually supposed to be enums, but since Perl doesn't have a +# proper way of creating enums (at least not natively), we'll emulate that +# using small functions. +sub MODE_INVALID { return 0; } +sub MODE_ADD_UPDATE { return 1; } +sub MODE_REMOVE { return 2; } + # Accepts an options string and returns a reference to an array of hashes # (actually hash references) corresponding to the parsed key-value pairs. @@ -490,8 +500,8 @@ sub filter_option_modify { # Removes from, adds to or modifies an entry in the intermediate options array. # -# Expects an intermediate options reference as its first parameter, a boolean -# value which should be set to true for removals or false for +# Expects an intermediate options reference as its first parameter, a mode +# value which can be either MODE_REMOVE for removals or MODE_ADD_UPDATE for # modifications/additions and the option-to-be-modified as a third parameter. # # For removals, the function behaves like this: @@ -515,7 +525,7 @@ sub transform_intermediate { my $error_detected = 0; my $options = shift; - my $remove = shift; + my $mode = shift; my $option = shift; if ('ARRAY' ne ref ($options)) { @@ -535,8 +545,8 @@ sub transform_intermediate { } if (!($error_detected)) { - if (!(defined ($remove))) { - print {*STDERR} "Invalid mode option boolean passed, erroring out.\n"; + if (!(defined ($mode)) || (MODE_INVALID == $mode)) { + print {*STDERR} "Invalid mode option passed, erroring out.\n"; $error_detected = 1; } } @@ -570,7 +580,7 @@ sub transform_intermediate { my $elements_left = @{$ret}; - if ($remove) { + if (MODE_REMOVE == $mode) { # Let the filter function handle the actual work. @{$ret} = grep { filter_option_remove ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}); @@ -629,8 +639,9 @@ sub interpret_transform { my $transform = shift; + my $mode = MODE_INVALID; if (defined ($transform)) { - my $mode = 0; + $mode = MODE_ADD_UPDATE; my $sanitized_transform = $transform; # Check if non-empty, empty transform strings can only mean an @@ -638,7 +649,7 @@ sub interpret_transform { if ($transform) { if (q{-} eq substr ($transform, 0, 1)) { # Option starts with a dash, so must be a removal operation. - $mode = 1; + $mode = MODE_REMOVE; $sanitized_transform = substr ($sanitized_transform, 1); } elsif ((q{+}) eq substr ($transform, 0, 1)) { diff --git a/debian/changelog b/debian/changelog index 122f5f12..35978155 100644 --- a/debian/changelog +++ b/debian/changelog @@ -212,6 +212,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium input options string are possible and accepted, but actually discouraged and semantically redundant. - X2Go/Server/Agent/NX/Options.pm: whitespace-only in comment. + - X2Go/Server/Agent/NX/Options.pm: add and use an enum-like construct as + the internal mode selector for transforms. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit f71c26442ac4699f7062848688a4e62942175d50 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 07:48:42 2020 +0100 X2Go/Server/Agent/NX/Options.pm: make sure that intermediates never include undef entries. --- X2Go/Server/Agent/NX/Options.pm | 4 ++-- debian/changelog | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 9af66113..67cbb343 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -207,7 +207,7 @@ sub intermediate_to_string { } if (!($error_detected)) { - if (1 == scalar (@{$options})) { + if (0 < scalar (@{$options})) { foreach my $entry (@{$options}) { if (!defined ($entry)) { print {*STDERR} "Invalid options array passed, returning undef.\n"; @@ -534,7 +534,7 @@ sub transform_intermediate { } if (!($error_detected)) { - if (1 == scalar (@{$intermediate})) { + if (0 < scalar (@{$intermediate})) { foreach my $entry (@{$intermediate}) { if (!defined ($entry)) { print {*STDERR} "Invalid options array passed, erroring out.\n"; diff --git a/debian/changelog b/debian/changelog index 67120a4b..909ceb86 100644 --- a/debian/changelog +++ b/debian/changelog @@ -218,6 +218,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium transform_intermediate to intermediate. - X2Go/Server/Agent/NX/Options.pm: document key-value pairs with either empty keys or empty (!= non-existent) values. + - X2Go/Server/Agent/NX/Options.pm: make sure that intermediates never + include undef entries. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 5d84e9b6d4e240daaf26c244a9745387db8ef66d Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 10:13:28 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: switch to "X2Go/NX Agent" term and make it bold to denote something special. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 909ceb86..e42be487 100644 --- a/debian/changelog +++ b/debian/changelog @@ -220,6 +220,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium empty keys or empty (!= non-existent) values. - X2Go/Server/Agent/NX/Options.pm: make sure that intermediates never include undef entries. + - x2goserver/lib/x2goupdateoptionsstring: switch to "X2Go/NX Agent" term + and make it bold to denote something special. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index f72f94f0..9a344dcb 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -310,7 +310,7 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator =head1 DESCRIPTION B<x2goupdateoptionsstring> is a utility for manipulating options strings as -passed to X2Go Agent/NX Agent. +passed to B<X2Go/NX Agent>. Call it with optional flags, the options string as the first parameter and the options you want to manipulate as additional parameters. At least one -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 38189f763eedeff2ed61949b872c86aa1cdb954e Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 11:00:53 2020 +0100 X2Go/Server/Agent/NX/Options.pm: add new function compact_intermediate, used to remove duplicated and empty elements. --- X2Go/Server/Agent/NX/Options.pm | 105 +++++++++++++++++++++++++++++++++++++++- debian/changelog | 2 + 2 files changed, 106 insertions(+), 1 deletion(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 67cbb343..a73d4e46 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -28,7 +28,7 @@ use English qw (-no_match_vars); use Storable qw (dclone); our @EXPORT_OK = qw (MODE_INVALID MODE_ADD_UPDATE MODE_REMOVE - parse_options interpret_transform transform_intermediate intermediate_to_string); + parse_options interpret_transform transform_intermediate intermediate_to_string compact_intermediate); # These are actually supposed to be enums, but since Perl doesn't have a @@ -671,6 +671,109 @@ sub interpret_transform { return $ret; } +# Compacts entries in the intermediate options array. +# +# Expects an intermediate options reference as its first and only parameter. +# +# Compacting means that: +# - Duplicated keys are removed, only the last one is kept. +# - Empty key-value pairs are discarded (unless it's the only element). +# +# Returns a reference to the modified, compacted intermediate options array. +# +# On error, returns a reference to undef. +sub compact_intermediate { + my $ret = undef; + my $error_detected = 0; + my @new_intermediate = (); + + my $intermediate = shift; + + if ('ARRAY' ne ref ($intermediate)) { + print {*STDERR} 'Invalid options reference type passed (' . ref ($intermediate) . "), erroring out.\n"; + $error_detected = 1; + } + + if (!($error_detected)) { + if (0 < scalar (@{$intermediate})) { + foreach my $entry (@{$intermediate}) { + if (!defined ($entry)) { + print {*STDERR} "Invalid options array passed, erroring out.\n"; + $error_detected = 1; + } + } + } + } + + if (!($error_detected)) { + # First, save display number part. + my $display_number = pop (@{$intermediate}); + + # Here's the clever part: + # - Copy data into a single hash. + # This will not preserve the order, but make sure that each entry is + # unique. + # - To preserve the order, evict entries from the original intermediate + # array iff this temporary hash already contains such a key. + # This makes sure that the original intermediate array will only + # contain unique entries in the right order - at least if the order is + # "first seen". Implementing this in a "last seen" manner would be a + # lot more complicated. + my %temp_hash = (); + @{$intermediate} = grep { + my $grep_ret = 0; + + # This foreach loop will only execute at most once, really, since each + # hash in an intermediate array is supposed to contain just one element. + # + # Additionally, it might not execute at all if the hash is empty, which + # will implicitly remove the empty element through our $grep_ret's + # initial value. + # + # Do not use each () here. It doesn't shorten the code and is very + # sensitive to the internal iterator. Additionally, it makes + # modifications unsafe. While we don't need that right now, it's + # probably a good idea to keep this future-proof. + foreach my $key (keys (%{$_})) { + my $value = $_->{$key}; + + # If the key exists in the temporary hash, this element is a duplicate + # and we can mark it for deletion. + # Otherwise, we'll have to keep it. + if (!(exists ($temp_hash{$key}))) { + $grep_ret = 1; + } + + # And in any case, update the value (or create a new entry). + $temp_hash{$key} = $value; + } + + $grep_ret; + } @{$intermediate}; + + # Lastly, map values from the temporary hash back to the intermediate + # array. + foreach my $entry (@{$intermediate}) { + foreach my $key (keys (%{$entry})) { + $entry->{$key} = $temp_hash{$key}; + } + } + + # We need to add an empty element if the intermediate array is now empty. + if (0 == scalar (@{$intermediate})) { + print {*STDERR} "Compacting operation led to option string being empty, adding empty element though deprecated.\n"; + push (@{$intermediate}, { }); + } + + # Lastly, re-add the display number part. + push (@{$intermediate}, $display_number); + + $ret = $intermediate; + } + + return $ret; +} + 1; __END__ diff --git a/debian/changelog b/debian/changelog index e42be487..2d73e953 100644 --- a/debian/changelog +++ b/debian/changelog @@ -222,6 +222,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium include undef entries. - x2goserver/lib/x2goupdateoptionsstring: switch to "X2Go/NX Agent" term and make it bold to denote something special. + - X2Go/Server/Agent/NX/Options.pm: add new function compact_intermediate, + used to remove duplicated and empty elements. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 37ddcda0c83d4bf5ddc29f2d3f2cc6950feeba1f Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 11:11:29 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: add new --compact/-c switch to enable the use of compactation. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 35 ++++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2d73e953..d03235a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -224,6 +224,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium and make it bold to denote something special. - X2Go/Server/Agent/NX/Options.pm: add new function compact_intermediate, used to remove duplicated and empty elements. + - x2goserver/lib/x2goupdateoptionsstring: add new --compact/-c switch to + enable the use of compactation. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 9a344dcb..d7b3f04a 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -145,7 +145,8 @@ sub Main { my $help = 0; my $man = 0; my $debug = 0; - GetOptionsFromArray (\@program_arguments, 'help|?|h' => \$help, 'man' => \$man, 'debug|d' => \$debug) or pod2usage (2); + my $compact = 0; + GetOptionsFromArray (\@program_arguments, 'help|?|h' => \$help, 'man' => \$man, 'debug|d' => \$debug, 'compact|c' => \$compact) or pod2usage (2); if ($help) { pod2usage (1); @@ -201,6 +202,24 @@ sub Main { } } + if (!($error_detected)) { + if ($debug) { + print {*STDERR} 'Dumping intermediate array after initial parsing: ' . Dumper ($intermediate); + } + + if ($compact) { + $intermediate = X2Go::Server::Agent::NX::Options::compact_intermediate ($intermediate); + + if (!(defined ($intermediate))) { + print {*STDERR} "Unable to compact intermediate options representation, aborting.\n"; + $error_detected = 8; + } + elsif ($debug) { + print {*STDERR} 'Dumping intermediate array after compacting: ' . Dumper ($intermediate); + } + } + } + if (!($error_detected)) { $found_separator |= (0 + shift (@{$sanitized_options})); $sanitized_options = shift (@{$sanitized_options}); @@ -208,10 +227,6 @@ sub Main { my $cur_transform = shift (@program_arguments); - if ($debug) { - print {*STDERR} 'Dumping intermediate array after initial parsing: ' . Dumper ($intermediate); - } - # Nasty trick (to some degree): "do"-blocks are not recognized as loops by # Perl, but we could wrap the body in another block, which WILL BE recognized # as a loop (one, that only executes once), oddly enough. However, using @@ -222,7 +237,7 @@ sub Main { # Shall only be relevant for the first run of the loop. if (!(defined ($cur_transform))) { print {*STDERR} "No transformation passed, aborting.\n"; - $error_detected = 8; + $error_detected = 9; last; } @@ -234,7 +249,7 @@ sub Main { if (!(defined ($interpreted_transform_ref))) { print {*STDERR} "Invalid transformation passed, aborting.\n"; - $error_detected = 9; + $error_detected = 10; last; } @@ -248,7 +263,7 @@ sub Main { if (!(defined ($intermediate))) { print {*STDERR} "Error while transforming intermediate representation, aborting.\n"; - $error_detected = 10; + $error_detected = 11; last; } @@ -261,7 +276,7 @@ sub Main { if (!(defined ($sanitized_options))) { pod2usage (-exitval => 'NOEXIT'); - $error_detected = 11; + $error_detected = 12; last; } @@ -278,7 +293,7 @@ sub Main { if (!(defined ($out))) { print {*STDERR} "Unable to transform intermediate back into string, aborting.\n"; - $error_detected = 12; + $error_detected = 13; } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 078818eda6c95ad7ce6124409c96f15538d81716 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 11:12:17 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: document new --compact/-c switch. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d03235a3..7a7496e9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -226,6 +226,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium used to remove duplicated and empty elements. - x2goserver/lib/x2goupdateoptionsstring: add new --compact/-c switch to enable the use of compactation. + - x2goserver/lib/x2goupdateoptionsstring: document new --compact/-c + switch. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index d7b3f04a..259cd09a 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -318,7 +318,7 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator =item B<x2goupdateoptionsstring> B<--man> -=item B<x2goupdateoptionsstring> [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... +=item B<x2goupdateoptionsstring> [B<--compact>|B<-c>] [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... =back @@ -343,6 +343,9 @@ different value, the component will be replaced with the provided value. To fully remove a component, pass B<->I<key>. To only remove it if it is set to a specific value, pass B<->I<key>B<=>I<value>. +Use the B<--compact> option to minimize the original options string, removing +duplicated and empty entries. + You can terminate program options parsing via a standard double-dash (B<-->) pseudo-option. It is recommended to always do so if you pass removal transformation operations, even if no actual options are used to avoid @@ -364,6 +367,11 @@ Prints the manual page and exits. Enables noisy debug output. +=item B<--compact>|B<-c> + +Remove duplicate and empty entries after the initial parsing. The order of +arguments is preserved in a first-seen fashion. + =back =head1 EXAMPLE -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 050d662b5743463867b8e78ca8b4e7e1c95e0ae1 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 11:31:40 2020 +0100 X2Go/Server/Agent/NX/Options.pm: document the new compact_intermediate () function and its implications. --- X2Go/Server/Agent/NX/Options.pm | 24 ++++++++++++++++++++++-- debian/changelog | 2 ++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index a73d4e46..ecd7a8a7 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -787,7 +787,7 @@ X2Go::Server::Agent::NX::Options - NX Options modification module # Options string, probably read in from somewhere, but # hardcoded here. - my $options = 'some=option,another=opt,more=values:90'; + my $options = 'some=option,another=opt,more=values,some=override,more=data:90'; # Parse into an intermediate form. my $intermediate = X2Go::Server::Agent::NX::Options::parse_options ($options); @@ -795,6 +795,13 @@ X2Go::Server::Agent::NX::Options - NX Options modification module # Check for errors. die "Unable to parse option string, aborting.\n" unless (defined ($intermediate)); + # (Optionally) compact it, this should make the duplicated "some" and "more" + # keys unique. + $intermediate = X2Go::Server::Agent::NX::Options::compact_intermediate ($intermediate); + + # Error handling ... + die "Unable to compact intermediate array, aborting.\n" unless (defined ($intermediate)); + # Add to options string. my $transform_op = '+new=value'; @@ -845,7 +852,7 @@ X2Go::Server::Agent::NX::Options - NX Options modification module # Error handling ... die "Unable to transform intermediate back into string, aborting.\n" unless (defined ($out)); - # At this point, $out should be 'another=newval,more=values,new=value:90'. + # At this point, $out should be 'another=newval,more=data,new=value:90'. =head1 DESCRIPTION @@ -862,6 +869,10 @@ I<references>, but you should make no assumptions to the layout or even its actual format. Treat it as a black box. Crucially, whenever an I<intermediate> is expected, such a I<reference> should be passed. +To remove redundant or empty entries within an options string, pass the +I<intermediate> to C<compact_intermediate>. This is entirely optional and can +be done at any step, as long as an I<intermediate> is available. + To parse transformations, pass each one to C<interpret_transform>. Refer to L</TRANSFOMATIONS> for documentation on transformation formats. This will either return C<undef> on error, or an array of two scalars - the @@ -933,6 +944,12 @@ be preserved, but will trigger warnings at parse time. An options string such as C<,,,:65> is hence valid. +To remove such empty elements, use C<compact_intermediate>. An implicit empty +element is added whenever the resulting options string would only contain the +display number. This one I<can not> be removed, but also won't show up +anywhere. Adding any non-empty new key will automatically replace such an +empty element, without any need for actual compactation. + =item * In a key-value pair, keys and values are separated from each other via an @@ -982,6 +999,9 @@ It is recommended to avoid duplicate keys in the input options string. Note that, due to the nature of the supported transformations, keys can not be duplicated with this module. +To remove duplicated keys, use C<compact_intermediate>. This will preserve the +order in a first-seen fashion. + =item * A key-value pair with an empty key but a non-empty value is allowed. diff --git a/debian/changelog b/debian/changelog index 8c24ca26..f3914ee0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -230,6 +230,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium switch. - x2goserver/lib/x2goupdateoptionsstring: split up GetOptionsFromArray () line. Non-functional. + - X2Go/Server/Agent/NX/Options.pm: document the new + compact_intermediate () function and its implications. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit d088a26feaa4304d94a50a75a2a629aa360be89d Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 11:14:38 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: split up GetOptionsFromArray () line. Non-functional. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7a7496e9..8c24ca26 100644 --- a/debian/changelog +++ b/debian/changelog @@ -228,6 +228,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium enable the use of compactation. - x2goserver/lib/x2goupdateoptionsstring: document new --compact/-c switch. + - x2goserver/lib/x2goupdateoptionsstring: split up GetOptionsFromArray () + line. Non-functional. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 259cd09a..8bb6485f 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -146,7 +146,10 @@ sub Main { my $man = 0; my $debug = 0; my $compact = 0; - GetOptionsFromArray (\@program_arguments, 'help|?|h' => \$help, 'man' => \$man, 'debug|d' => \$debug, 'compact|c' => \$compact) or pod2usage (2); + GetOptionsFromArray (\@program_arguments, 'help|?|h' => \$help, + 'man' => \$man, + 'debug|d' => \$debug, + 'compact|c' => \$compact) or pod2usage (2); if ($help) { pod2usage (1); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit d45745ee42740b4ceb64d951d60de2ded09995c2 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 8 03:43:17 2020 +0100 X2Go/Server/Agent/NX/Options.pm: grammar/typo fix in comment and improve a different comment. --- X2Go/Server/Agent/NX/Options.pm | 5 +++-- debian/changelog | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 952adfa3..3982e1cf 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -300,7 +300,7 @@ sub intermediate_to_string { } # Helper function that checks for errors in options passed as filter -# parameters (which, in turn, are the parameter this function expects). +# parameters (which, in turn, are the parameters this function expects). # # Returns true if all checks passed, false otherwise. sub sanitize_input_filter { @@ -482,7 +482,8 @@ sub filter_option_modify { my $new_opt = { }; # Don't add empty options as an empty string key with undef value; even - # though that's technically legit we want to represent this situation by + # though that's technically legit, we want to reserve this notation for + # the last display number element and rather represent this situation by # an empty hash. if (!(($needle_key) || (defined ($needle_value)))) { print {*STDERR} "Empty option addition/modification requested, this is deprecated. Adding empty hash.\n"; diff --git a/debian/changelog b/debian/changelog index 98722c55..07dde87f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -236,6 +236,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium silence others. - x2goserver/lib/x2goupdateoptionsstring: fix some Perl Critic warnings and silence others. + - X2Go/Server/Agent/NX/Options.pm: grammar/typo fix in comment and improve + a different comment. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit b4ac4e83b14bdf61bba1a9abed281dccd10cbde3 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 8 03:44:21 2020 +0100 X2Go/Server/Agent/NX/Options.pm: avoid copying arrays if not necessary when passing to grep and map operations. --- X2Go/Server/Agent/NX/Options.pm | 6 +++--- debian/changelog | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 3982e1cf..b0e6e612 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -583,7 +583,7 @@ sub transform_intermediate { if (MODE_REMOVE == $mode) { # Let the filter function handle the actual work. - @{$ret} = grep { filter_option_remove ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}); + @{$ret} = grep { filter_option_remove ($work_option_key, $work_option_value, $_, --$elements_left) } @{$ret}; # Check to see if the intermediate representation is empty now (save for # the display port entry) and add an empty element if it is. @@ -600,11 +600,11 @@ sub transform_intermediate { # another dependency and option strings are pretty small, so don't # overoptimize here. ## no critic (BuiltinFunctions::ProhibitBooleanGrep) - if (scalar (grep { filter_find_key ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}))) { + if (scalar (grep { filter_find_key ($work_option_key, $work_option_value, $_, --$elements_left) } @{$ret})) { ## critic (BuiltinFunctions::ProhibitBooleanGrep) # Such an option already exists, we'll modify all occurrences. $elements_left = @{$ret}; - $ret = [ map { filter_option_modify ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}) ]; + $ret = [ map { filter_option_modify ($work_option_key, $work_option_value, $_, --$elements_left) } @{$ret} ]; } else { my $new_opt = { $work_option_key => $work_option_value }; diff --git a/debian/changelog b/debian/changelog index 07dde87f..8de6381f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -238,6 +238,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium and silence others. - X2Go/Server/Agent/NX/Options.pm: grammar/typo fix in comment and improve a different comment. + - X2Go/Server/Agent/NX/Options.pm: avoid copying arrays if not necessary + when passing to grep and map operations. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 83da25608167226f652911c9fe222cb5ce4af79e Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 12:51:36 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: fix some Perl Critic warnings and silence others. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d85d7e91..98722c55 100644 --- a/debian/changelog +++ b/debian/changelog @@ -234,6 +234,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium compact_intermediate () function and its implications. - X2Go/Server/Agent/NX/Options.pm: fix some Perl Critic warnings and silence others. + - x2goserver/lib/x2goupdateoptionsstring: fix some Perl Critic warnings + and silence others. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 8bb6485f..a06a487f 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -73,7 +73,9 @@ sub sanitize_program_options { if (!($error_detected)) { $args = dclone ($args); + ## no critic (ControlStructures::ProhibitCStyleForLoops) for (my $cur_arg = shift (@{$args}); defined ($cur_arg); $cur_arg = shift (@{$args})) { + ## critic (ControlStructures::ProhibitCStyleForLoops) if (q{-} eq substr ($cur_arg, 0, 1)) { # Looks like an option so far. Let's continue scanning. @@ -111,7 +113,7 @@ sub sanitize_program_options { last; } else { - print {*STDERR} "Unknown option encountered: " . $cur_arg . "; erroring out.\n"; + print {*STDERR} q{Unknown option encountered: } . $cur_arg . "; erroring out.\n"; $error_detected = 1; last; } @@ -135,7 +137,9 @@ sub sanitize_program_options { # Main function, no code outside of it shall be executed. # # Expects @ARGV to be passed in. +## no critic (NamingConventions::Capitalization) sub Main { +## critic (NamingConventions::Capitalization) my @program_arguments = @_; my $error_detected = 0; my $found_separator = 0; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 3c7a8f2fbaf99515f20c2a62ad13c5c538d2d98d Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 7 12:50:53 2020 +0100 X2Go/Server/Agent/NX/Options.pm: fix some Perl Critic warnings and silence others. --- X2Go/Server/Agent/NX/Options.pm | 6 ++++-- debian/changelog | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index ecd7a8a7..952adfa3 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -598,7 +598,9 @@ sub transform_intermediate { # List::MoreUtils::any would be more appropriate here, but this would add # another dependency and option strings are pretty small, so don't # overoptimize here. + ## no critic (BuiltinFunctions::ProhibitBooleanGrep) if (scalar (grep { filter_find_key ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}))) { + ## critic (BuiltinFunctions::ProhibitBooleanGrep) # Such an option already exists, we'll modify all occurrences. $elements_left = @{$ret}; $ret = [ map { filter_option_modify ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}) ]; @@ -899,8 +901,8 @@ If this is not the case, please report a bug. =head1 OPTIONS STRINGS -B<X2Go/NX Agent> options strings are fully documented in L<nxagent> and -additional, linked places. +B<X2Go/NX Agent> options strings are fully documented in +L<nxagent's documentation|nxagent> and additional, linked places therein. This module is not really concerned with the actual content of an options string, but mostly its format. diff --git a/debian/changelog b/debian/changelog index f3914ee0..d85d7e91 100644 --- a/debian/changelog +++ b/debian/changelog @@ -232,6 +232,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium line. Non-functional. - X2Go/Server/Agent/NX/Options.pm: document the new compact_intermediate () function and its implications. + - X2Go/Server/Agent/NX/Options.pm: fix some Perl Critic warnings and + silence others. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit d7a9fb7c7bb5bba9343a04eff235cf6f5dc051fd Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 8 04:27:42 2020 +0100 X2Go/Server/Agent/NX/Options.pm: add newline before __END__, non-functional. --- X2Go/Server/Agent/NX/Options.pm | 1 + debian/changelog | 2 ++ 2 files changed, 3 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 68d127f5..eea1fcd0 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -777,6 +777,7 @@ sub compact_intermediate { } 1; + __END__ =head1 NAME diff --git a/debian/changelog b/debian/changelog index cd79e37c..fce9af9d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -243,6 +243,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: rework the lastly modified comment again, the changed explanation didn't match the reality. - X2Go/Server/Agent/NX/Options.pm: fix typos in internal section links. + - X2Go/Server/Agent/NX/Options.pm: add newline before __END__, + non-functional. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 39c960208e3cb0c226541de23b11b3b38e48ee70 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 8 04:06:55 2020 +0100 X2Go/Server/Agent/NX/Options.pm: rework the lastly modified comment again, the changed explanation didn't match the reality. --- X2Go/Server/Agent/NX/Options.pm | 5 ++--- debian/changelog | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index b0e6e612..9422b852 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -482,9 +482,8 @@ sub filter_option_modify { my $new_opt = { }; # Don't add empty options as an empty string key with undef value; even - # though that's technically legit, we want to reserve this notation for - # the last display number element and rather represent this situation by - # an empty hash. + # 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)))) { print {*STDERR} "Empty option addition/modification requested, this is deprecated. Adding empty hash.\n"; } diff --git a/debian/changelog b/debian/changelog index 8de6381f..505b54f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -240,6 +240,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium a different comment. - X2Go/Server/Agent/NX/Options.pm: avoid copying arrays if not necessary when passing to grep and map operations. + - X2Go/Server/Agent/NX/Options.pm: rework the lastly modified comment + again, the changed explanation didn't match the reality. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 5e2aca5f148885f01246ad2e7392c72c5f78e775 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 8 04:29:18 2020 +0100 {X2Go/Server/Agent/NX/Options.pm,x2goserver/lib/x2goupdateoptionsstring}: add =pod markers. --- X2Go/Server/Agent/NX/Options.pm | 2 ++ debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 2 ++ 3 files changed, 6 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index eea1fcd0..2944c07d 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -780,6 +780,8 @@ sub compact_intermediate { __END__ +=pod + =head1 NAME X2Go::Server::Agent::NX::Options - NX Options modification module diff --git a/debian/changelog b/debian/changelog index fce9af9d..d512cb91 100644 --- a/debian/changelog +++ b/debian/changelog @@ -245,6 +245,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: fix typos in internal section links. - X2Go/Server/Agent/NX/Options.pm: add newline before __END__, non-functional. + - {X2Go/Server/Agent/NX/Options.pm, + x2goserver/lib/x2goupdateoptionsstring}: add =pod markers. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index a06a487f..fbcb0cd8 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -313,6 +313,8 @@ sub Main { __END__ +=pod + =head1 NAME x2goupdateoptionsstring - X2Go Agent Options String Manipulator -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit c91c69340c0bdc0255b13785590bfa43e301f7c7 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 8 04:23:16 2020 +0100 X2Go/Server/Agent/NX/Options.pm: fix typos in internal section links. --- X2Go/Server/Agent/NX/Options.pm | 4 ++-- debian/changelog | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 9422b852..68d127f5 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -859,7 +859,7 @@ X2Go::Server::Agent::NX::Options - NX Options modification module =head1 DESCRIPTION Use this module to modify or extract data from B<X2Go/NX Agent> options -strings. Refer to L</OPTION STRINGS> for an in-depth description of options +strings. Refer to L</OPTIONS STRINGS> for an in-depth description of options strings. First, transform the input options string into an intermediate representation @@ -876,7 +876,7 @@ I<intermediate> to C<compact_intermediate>. This is entirely optional and can be done at any step, as long as an I<intermediate> is available. To parse transformations, pass each one to C<interpret_transform>. Refer to -L</TRANSFOMATIONS> for documentation on transformation formats. This will +L</TRANSFORMATIONS> for documentation on transformation formats. This will either return C<undef> on error, or an array of two scalars - the transformation mode (an internal number) and the sanitized transformation string (i.e., the original transformation string with any preceding operator diff --git a/debian/changelog b/debian/changelog index 505b54f5..cd79e37c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -242,6 +242,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium when passing to grep and map operations. - X2Go/Server/Agent/NX/Options.pm: rework the lastly modified comment again, the changed explanation didn't match the reality. + - X2Go/Server/Agent/NX/Options.pm: fix typos in internal section links. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 83a01b13787f027ae0dd7dc56f51c96327ca7792 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 8 04:52:55 2020 +0100 X2Go/Server/Agent/NX/Options.pm: fix nxagent man page link. --- X2Go/Server/Agent/NX/Options.pm | 2 +- debian/changelog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 78179e31..f64a8ce3 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -905,7 +905,7 @@ If this is not the case, please report a bug. =head1 OPTIONS STRINGS B<X2Go/NX Agent> options strings are fully documented in -L<nxagent's documentation|nxagent> and additional, linked places therein. +L<nxagent's documentation|nxagent(1)> and additional, linked places therein. This module is not really concerned with the actual content of an options string, but mostly its format. diff --git a/debian/changelog b/debian/changelog index 66d24289..59e6ac35 100644 --- a/debian/changelog +++ b/debian/changelog @@ -250,6 +250,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - {X2Go/Server/Agent/NX/Options.pm, x2goserver/lib/x2goupdateoptionsstring}: update AUTHOR sections with proper links. + - X2Go/Server/Agent/NX/Options.pm: fix nxagent man page link. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 94fbba208b269393f3a2897da2c1fd6ef6de6af0 Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 9 10:45:01 2020 +0100 X2Go/Server/Agent/NX/Options.pm: replace "treat as" with "treat like". --- X2Go/Server/Agent/NX/Options.pm | 2 +- debian/changelog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 0a1628bb..9b9de642 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -873,7 +873,7 @@ Parsing errors are indicated by it returning C<undef>. The returned value is actually a I<reference> to an I<array> of I<hash> I<references>, but you should make no assumptions to the layout or even its actual format. -Treat it as a black box. +Treat it like a black box. Crucially, whenever an I<intermediate> is expected, such a I<reference> should be passed. diff --git a/debian/changelog b/debian/changelog index be8b4dd9..894513ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -261,6 +261,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium spaces (by default) after a punctuation character wouldn't trigger otherwise. Since it has no adverse effects on other generators, let's just do it like that. + - X2Go/Server/Agent/NX/Options.pm: replace "treat as" with "treat like". * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit d140599d670f8aa7f7c4504da268d837afa13543 Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 9 10:12:28 2020 +0100 {X2Go/Server/Agent/NX/Options.pm,x2goserver/lib/x2goupdateoptionsstring}: reformat/reflow so that each sentence starts on a proper line. This is particularly interesting for the troff output, since GNU troff's heuristic for generating double spaces (by default) after a punctuation character wouldn't trigger otherwise. Since it has no adverse effects on other generators, let's just do it like that. --- X2Go/Server/Agent/NX/Options.pm | 98 +++++++++++++++++++--------------- debian/changelog | 7 +++ x2goserver/bin/x2goupdateoptionsstring | 34 ++++++------ 3 files changed, 81 insertions(+), 58 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index f64a8ce3..0a1628bb 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -862,25 +862,29 @@ X2Go::Server::Agent::NX::Options - NX Options modification module =head1 DESCRIPTION Use this module to modify or extract data from B<X2Go/NX Agent> options -strings. Refer to L</OPTIONS STRINGS> for an in-depth description of options strings. +Refer to L</OPTIONS STRINGS> for an in-depth description of options strings. First, transform the input options string into an intermediate representation -via C<parse_options>. The options string I<must> end with a display -specification (i.e., it must end in C<:displaynumber>). +via C<parse_options>. +The options string I<must> end with a display specification (i.e., it must end +in C<:displaynumber>). Parsing errors are indicated by it returning C<undef>. The returned value is actually a I<reference> to an I<array> of I<hash> I<references>, but you should make no assumptions to the layout or even its -actual format. Treat it as a black box. Crucially, whenever an I<intermediate> -is expected, such a I<reference> should be passed. +actual format. +Treat it as a black box. +Crucially, whenever an I<intermediate> is expected, such a I<reference> should +be passed. To remove redundant or empty entries within an options string, pass the -I<intermediate> to C<compact_intermediate>. This is entirely optional and can -be done at any step, as long as an I<intermediate> is available. +I<intermediate> to C<compact_intermediate>. +This is entirely optional and can be done at any step, as long as an +I<intermediate> is available. -To parse transformations, pass each one to C<interpret_transform>. Refer to -L</TRANSFORMATIONS> for documentation on transformation formats. This will -either return C<undef> on error, or an array of two scalars - the +To parse transformations, pass each one to C<interpret_transform>. +Refer to L</TRANSFORMATIONS> for documentation on transformation formats. +This will either return C<undef> on error, or an array of two scalars - the transformation mode (an internal number) and the sanitized transformation string (i.e., the original transformation string with any preceding operator removed). @@ -892,8 +896,9 @@ intermediate value. Repeat this until the I<intermediate> is modified to your liking. Finally, pass the I<intermediate> to C<intermediate_to_string> in order to -parse it back into a normal string. This operation is essentially the opposite -of C<parse_options>. As usual, C<undef> is returned on error. +parse it back into a normal string. +This operation is essentially the opposite of C<parse_options>. +As usual, C<undef> is returned on error. Generally, parsing an options string to an intermediate via C<parse_options> and then immediately parsing it back into a string via @@ -919,8 +924,8 @@ This has some interesting implications: =item * -Key-value pairs are entirely optional. For example, an options string like -C<:42> is well-formed. +Key-value pairs are entirely optional. +For example, an options string like C<:42> is well-formed. =item * @@ -938,30 +943,33 @@ for the display number separator and use the first one it can find. =item * -Key-value pairs are separated via a B<comma> (C<,>). Hence, this character is -not valid in neither keys nor values. As a workaround, it can be URL-encoded, -as, e.g., C<%2C>, and then used as part of either keys or values. +Key-value pairs are separated via a B<comma> (C<,>). +Hence, this character is not valid in neither keys nor values. +As a workaround, it can be URL-encoded, as, e.g., C<%2C>, and then used as +part of either keys or values. =item * -Key-value pairs can be empty. This is supported and empty key-value pairs will -be preserved, but will trigger warnings at parse time. +Key-value pairs can be empty. +This is supported and empty key-value pairs will be preserved, but will +trigger warnings at parse time. An options string such as C<,,,:65> is hence valid. -To remove such empty elements, use C<compact_intermediate>. An implicit empty -element is added whenever the resulting options string would only contain the -display number. This one I<can not> be removed, but also won't show up -anywhere. Adding any non-empty new key will automatically replace such an -empty element, without any need for actual compactation. +To remove such empty elements, use C<compact_intermediate>. +An implicit empty element is added whenever the resulting options string would +only contain the display number. +This one I<can not> be removed, but also won't show up anywhere. +Adding any non-empty new key will automatically replace such an empty element, +without any need for actual compactation. =item * In a key-value pair, keys and values are separated from each other via an B<equal sign> (C<=>). -Hence, this character is not a valid part of a key. It can, however, be a -valid part of a value. +Hence, this character is not a valid part of a key. +It can, however, be a valid part of a value. To use this character as part of a key, it can be URL-encoded as, e.g., C<%3D>. @@ -972,9 +980,9 @@ when used as part of a value in order to not confuse other parsers. An options string such as C<this%3Dis%3Da=key:38> is just as valid as C<this=is=a=key:38> or C<this=is%3Da%3Dkey:38>. -However, the semantics differ. While the latter two key-value pairs are -logically equivalent, they are logically very much different from the first -one. +However, the semantics differ. +While the latter two key-value pairs are logically equivalent, they are +logically very much different from the first one. For the first case, the I<key> will be C<this%3Dis%3Da> (or, logically, also C<this=is=a>, which can not be directly represented), while the I<value> will @@ -985,9 +993,9 @@ The latter two will parse into a I<key> C<this> with a I<value> of C<is=a=key> =item * -Quoting with any character is unsupported. Quotes and other grouping -characters (like B<curly braces> [C<{}>]) are seen verbatim without any -special meaning. +Quoting with any character is unsupported. +Quotes and other grouping characters (like B<curly braces> [C<{}>]) are seen +verbatim without any special meaning. =item * @@ -995,25 +1003,28 @@ There are no provisions (other than the mentioned invalid characters) on the content of keys and values. Importantly, this also means that the same key can show up multiple times in -the options string. Semantically, this is redundant, since only the last -occurrence of a key (assuming the options string is parsed from left to right) -will take any effect. Syntactically, it's completely legal, though. +the options string. +Semantically, this is redundant, since only the last occurrence of a key +(assuming the options string is parsed from left to right) will take any +effect. +Syntactically, it's completely legal, though. It is recommended to avoid duplicate keys in the input options string. Note that, due to the nature of the supported transformations, keys can not be duplicated with this module. -To remove duplicated keys, use C<compact_intermediate>. This will preserve the -order in a first-seen fashion. +To remove duplicated keys, use C<compact_intermediate>. +This will preserve the order in a first-seen fashion. =item * A key-value pair with an empty key but a non-empty value is allowed. Likewise, a key-value pair with a non-empty key, but an empty value is -allowed. In this case, the value will be interpreted as an empty string in -order to differentiate it from a non-existent value. +allowed. +In this case, the value will be interpreted as an empty string in order to +differentiate it from a non-existent value. =back @@ -1027,8 +1038,8 @@ that: =item * They can be prefixed with a B<plus> character (C<+>) to indicate either -additions or modifications. A missing prefix character is interpreted like a -B<plus> character. +additions or modifications. +A missing prefix character is interpreted like a B<plus> character. If the given I<key> already exists in the intermediate, the key-value pair will be updated with the provided I<value> (if any), or a new key-value pair @@ -1048,8 +1059,9 @@ If the given I<key> is not part of the intermediate, no deletion will occur. Otherwise, the optional I<value> determines deletion: if no value has been provided, I<key> will be removed from the intermediate regardless of its -value. If the optional I<value> has been provided, I<key> will only be removed -if both values match. +value. +If the optional I<value> has been provided, I<key> will only be removed if +both values match. =back diff --git a/debian/changelog b/debian/changelog index 295f1d83..be8b4dd9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -254,6 +254,13 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/lib/x2goupdateoptionsstring: considerably simplify while loop logic that iterates over transformations. I have no idea why I thought it had to be so complicated in the first place... + - {X2Go/Server/Agent/NX/Options.pm, + x2goserver/lib/x2goupdateoptionsstring}: reformat/reflow so that each + sentence starts on a proper line. This is particularly interesting for + the troff output, since GNU troff's heuristic for generating double + spaces (by default) after a punctuation character wouldn't trigger + otherwise. Since it has no adverse effects on other generators, let's + just do it like that. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 092c03a1..200d8f52 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -337,28 +337,32 @@ B<x2goupdateoptionsstring> is a utility for manipulating options strings as passed to B<X2Go/NX Agent>. Call it with optional flags, the options string as the first parameter and the -options you want to manipulate as additional parameters. At least one -additional parameter (i.e., a transformation) must be provided. +options you want to manipulate as additional parameters. +At least one additional parameter (i.e., a transformation) must be provided. It can either add, remove or replace components. To add or replace a component, pass I<key>[B<=>I<value>] or -B<+>I<key>[B<=>I<value>] as a parameter. The latter syntax is useful if I<key> -starts with a dash and would therefore be interpreted as a removal operation. -If the options string does not include a B<key> key, it will be appended to the -end of the options string. If it already exists, either with no value or a -different value, the component will be replaced with the provided value. - -To fully remove a component, pass B<->I<key>. To only remove it if it is set to -a specific value, pass B<->I<key>B<=>I<value>. +B<+>I<key>[B<=>I<value>] as a parameter. +The latter syntax is useful if I<key> starts with a dash and would therefore +be interpreted as a removal operation. +If the options string does not include a B<key> key, it will be appended to +the end of the options string. +If it already exists, either with no value or a different value, the component +will be replaced with the provided value. + +To fully remove a component, pass B<->I<key>. +To only remove it if it is set to a specific value, pass +B<->I<key>B<=>I<value>. Use the B<--compact> option to minimize the original options string, removing duplicated and empty entries. You can terminate program options parsing via a standard double-dash (B<-->) -pseudo-option. It is recommended to always do so if you pass removal -transformation operations, even if no actual options are used to avoid -misinterpreting such transformation options as options/flags to the program. +pseudo-option. +It is recommended to always do so if you pass removal transformation +operations, even if no actual options are used to avoid misinterpreting such +transformation options as options/flags to the program. =head1 OPTIONS @@ -378,8 +382,8 @@ Enables noisy debug output. =item B<--compact>|B<-c> -Remove duplicate and empty entries after the initial parsing. The order of -arguments is preserved in a first-seen fashion. +Remove duplicate and empty entries after the initial parsing. +The order of arguments is preserved in a first-seen fashion. =back -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 012b9f6e66060e7495b982a6cf897b125139c276 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 8 06:46:27 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: considerably simplify while loop logic that iterates over transformations. I have no idea why I thought it had to be so complicated in the first place... --- debian/changelog | 3 +++ x2goserver/bin/x2goupdateoptionsstring | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/debian/changelog b/debian/changelog index 59e6ac35..295f1d83 100644 --- a/debian/changelog +++ b/debian/changelog @@ -251,6 +251,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium x2goserver/lib/x2goupdateoptionsstring}: update AUTHOR sections with proper links. - X2Go/Server/Agent/NX/Options.pm: fix nxagent man page link. + - x2goserver/lib/x2goupdateoptionsstring: considerably simplify while loop + logic that iterates over transformations. I have no idea why I thought + it had to be so complicated in the first place... * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index a9749c1c..092c03a1 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -232,7 +232,7 @@ sub Main { $sanitized_options = shift (@{$sanitized_options}); @program_arguments = @{$sanitized_options}; - my $cur_transform = shift (@program_arguments); + my $transformed = 0; # Nasty trick (to some degree): "do"-blocks are not recognized as loops by # Perl, but we could wrap the body in another block, which WILL BE recognized @@ -240,13 +240,8 @@ sub Main { # "last" won't work in such a situation, but rather behave like "next". # Worse, the condition will also not be checked in such a case. # Thus, we'd better use a real loop. - while (1) { - # Shall only be relevant for the first run of the loop. - if (!(defined ($cur_transform))) { - print {*STDERR} "No transformation passed, aborting.\n"; - $error_detected = 9; - last; - } + while (defined (my $cur_transform = shift (@program_arguments))) { + $transformed = 1; if ($debug) { print {*STDERR} 'Parsing current raw transformation option: ' . Dumper ($cur_transform); @@ -256,7 +251,7 @@ sub Main { if (!(defined ($interpreted_transform_ref))) { print {*STDERR} "Invalid transformation passed, aborting.\n"; - $error_detected = 10; + $error_detected = 9; last; } @@ -270,7 +265,7 @@ sub Main { if (!(defined ($intermediate))) { print {*STDERR} "Error while transforming intermediate representation, aborting.\n"; - $error_detected = 11; + $error_detected = 10; last; } @@ -283,14 +278,19 @@ sub Main { if (!(defined ($sanitized_options))) { pod2usage (-exitval => 'NOEXIT'); - $error_detected = 12; + $error_detected = 11; last; } $found_separator |= (0 + shift (@{$sanitized_options})); $sanitized_options = shift (@{$sanitized_options}); @program_arguments = @{$sanitized_options}; - } continue { last unless (defined ($cur_transform = shift (@program_arguments))) }; + } + + if ((!($error_detected)) && (!($transformed))) { + print {*STDERR} "No transformation passed, aborting.\n"; + $error_detected = 12; + } } my $out = undef; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit ed0a723c9576cd3ee7706f7f5ae17ba2a5a993d8 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 8 04:51:43 2020 +0100 {X2Go/Server/Agent/NX/Options.pm,x2goserver/lib/x2goupdateoptionsstring}: update AUTHOR sections with proper links. --- X2Go/Server/Agent/NX/Options.pm | 5 +++-- debian/changelog | 3 +++ x2goserver/bin/x2goupdateoptionsstring | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 2944c07d..78179e31 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -1055,7 +1055,8 @@ if both values match. =head1 AUTHOR -This manual has been written by Mihai Moldovan <ionic@ionic.de> for the X2Go -project (https://www.x2go.org). +This manual has been written by +Mihai Moldovan L<E<lt>ionic@ionic.deE<gt>|mailto:ionic@ionic.de> for the X2Go +project (L<https://www.x2go.org>). =cut diff --git a/debian/changelog b/debian/changelog index d512cb91..66d24289 100644 --- a/debian/changelog +++ b/debian/changelog @@ -247,6 +247,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium non-functional. - {X2Go/Server/Agent/NX/Options.pm, x2goserver/lib/x2goupdateoptionsstring}: add =pod markers. + - {X2Go/Server/Agent/NX/Options.pm, + x2goserver/lib/x2goupdateoptionsstring}: update AUTHOR sections with + proper links. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index fbcb0cd8..a9749c1c 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -411,7 +411,8 @@ and calling C<x2goupdateoptionsstring 'nx/nx,clipboard=both,foo:50' '+-bar' =head1 AUTHOR -This manual has been written by Mihai Moldovan <ionic@ionic.de> for the X2Go -project (https://www.x2go.org). +This manual has been written by +Mihai Moldovan L<E<lt>ionic@ionic.deE<gt>|mailto:ionic@ionic.de> for the X2Go +project (L<https://www.x2go.org>). =cut -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit eee93606e257b6a8882b019d96c48071bcf9ee2e Author: Mihai Moldovan <ionic@ionic.de> Date: Tue Nov 10 07:40:19 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: rename EXAMPLE section to EXAMPLES. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 84b96064..f0b256fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -264,6 +264,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: replace "treat as" with "treat like". - X2Go/Server/Agent/NX/Options.pm: clear up "logically equivalent but logically very different" situation. + - x2goserver/lib/x2goupdateoptionsstring: rename EXAMPLE section to + EXAMPLES. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 200d8f52..b343b0f9 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -387,7 +387,7 @@ The order of arguments is preserved in a first-seen fashion. =back -=head1 EXAMPLE +=head1 EXAMPLES For an options string such as -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit d71b0c213efc123289a8b67a6134488aaf830d7f Author: Mihai Moldovan <ionic@ionic.de> Date: Tue Nov 10 07:48:31 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: document how to cheat and just compact options strings. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/debian/changelog b/debian/changelog index 96cb0367..f917c5e6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -269,6 +269,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/lib/x2goupdateoptionsstring: add links to X2Go::Server::Agent::NX::Options documentation on option strings and transformations. + - x2goserver/lib/x2goupdateoptionsstring: document how to cheat and just + compact options strings. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 5796c359..cb6ef453 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -407,6 +407,8 @@ For an options string such as nx/nx,clipboard=both,foo:50 +=over 2 + calling C<x2goupdateoptionsstring 'nx/nx,clipboard=both,foo:50' '-clipboard'> shall return @@ -427,6 +429,23 @@ and calling C<x2goupdateoptionsstring 'nx/nx,clipboard=both,foo:50' '+-bar' nx/nx,clipboard=both,foo=gulp,-bar:50 +=back + +For an options string such as + + nx/nx,clipboard=both,foo=bar,bar=baz,foo=oof:50 + +=over 2 + +you can get a compacted version by cheating a bit and providing a +transformation which will certainly be a no-operation using +C<x2goupdateoptionsstring '-c' +'nx/nx,clipboard=both,foo=bar,bar=baz,,foo=oof,:50' '-'>, which shall return + + nx/nx,clipboard=both,foo=oof,bar=baz:50 + +=back + =head1 AUTHOR This manual has been written by -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 5402756ace931bda06b0c8949d3186067d7d8c39 Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 9 10:47:27 2020 +0100 X2Go/Server/Agent/NX/Options.pm: clear up "logically equivalent but logically very different" situation. --- X2Go/Server/Agent/NX/Options.pm | 4 ++-- debian/changelog | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 9b9de642..56b28297 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -981,8 +981,8 @@ An options string such as C<this%3Dis%3Da=key:38> is just as valid as C<this=is=a=key:38> or C<this=is%3Da%3Dkey:38>. However, the semantics differ. -While the latter two key-value pairs are logically equivalent, they are -logically very much different from the first one. +While the latter two key-value pairs are logically equivalent to each other, +they are very much different from the first one. For the first case, the I<key> will be C<this%3Dis%3Da> (or, logically, also C<this=is=a>, which can not be directly represented), while the I<value> will diff --git a/debian/changelog b/debian/changelog index 894513ec..84b96064 100644 --- a/debian/changelog +++ b/debian/changelog @@ -262,6 +262,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium otherwise. Since it has no adverse effects on other generators, let's just do it like that. - X2Go/Server/Agent/NX/Options.pm: replace "treat as" with "treat like". + - X2Go/Server/Agent/NX/Options.pm: clear up "logically equivalent but + logically very different" situation. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 9b96cb0e4deab2c6a7d61ca4350ebadc9dff5c10 Author: Mihai Moldovan <ionic@ionic.de> Date: Tue Nov 10 07:43:10 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: add links to X2Go::Server::Agent::NX::Options documentation on option strings and transformations. --- debian/changelog | 3 +++ x2goserver/bin/x2goupdateoptionsstring | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index f0b256fb..96cb0367 100644 --- a/debian/changelog +++ b/debian/changelog @@ -266,6 +266,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium logically very different" situation. - x2goserver/lib/x2goupdateoptionsstring: rename EXAMPLE section to EXAMPLES. + - x2goserver/lib/x2goupdateoptionsstring: add links to + X2Go::Server::Agent::NX::Options documentation on option strings and + transformations. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index b343b0f9..5796c359 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -333,12 +333,26 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator =head1 DESCRIPTION +=for comment +Due to parser oddities, breaking a line during an L<> formatter code right +after the separating pipe character will generate broken links. +Make sure to only break it during the description or, generally, on space +characters. +A workaround for this as been proposed in +https://github.com/Perl/perl5/issues/18305. + B<x2goupdateoptionsstring> is a utility for manipulating options strings as passed to B<X2Go/NX Agent>. +For more information about supported options strings, refer to the L<OPTIONS +STRINGS section in the X2Go::Server::Agent::NX::Options +documentation|X2Go::Server::Agent::NX::Options/OPTIONS STRINGS>. Call it with optional flags, the options string as the first parameter and the -options you want to manipulate as additional parameters. +transformations to be carried out as additional parameters. At least one additional parameter (i.e., a transformation) must be provided. +Transformations are described here briefly, but also in the L<TRANSFORMATIONS +section in the X2Go::Server::Agent::NX::Options +documentation|X2Go::Server::Agent::NX::Options/TRANSFORMATIONS>. It can either add, remove or replace components. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 2d52f9c7e98bdcb6c01a529d87f12001c8d3bc7a Author: Mihai Moldovan <ionic@ionic.de> Date: Tue Nov 10 08:10:25 2020 +0100 X2Go/Server/Agent/NX/Options.pm: document that NUL bytes can only be URL-encoded, but that this not recommended. --- X2Go/Server/Agent/NX/Options.pm | 15 +++++++++++++++ debian/changelog | 2 ++ 2 files changed, 17 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 56b28297..ee0d8b0a 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -999,6 +999,21 @@ verbatim without any special meaning. =item * +Since options strings are typically parsed by C applications, C<NUL> (control) +characters are prematurely terminating the string and hence cannot be directly +embedded. +Indirectly, they can be embedded by URL-encoding them as C<%00>. + +There is, however, no guarantee that an application unpacking such a string +will be able to scan any data after the first embedded C<NUL> character. + +It is highly recommended to avoid using embedded C<NUL> characters. + +This module will not explicitly scan for them, and, hence, also not issue warnings +related to those characters. + +=item * + There are no provisions (other than the mentioned invalid characters) on the content of keys and values. diff --git a/debian/changelog b/debian/changelog index bc041346..54af6d1a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -273,6 +273,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium compact options strings. - x2goserver/lib/x2goupdateoptionsstring: add options terminators to example calls. + - X2Go/Server/Agent/NX/Options.pm: document that NUL bytes can only be + URL-encoded, but that this not recommended. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 9c38945e86d5f44ccd4f4845d8c6bc6f0deab63e Author: Mihai Moldovan <ionic@ionic.de> Date: Tue Nov 10 07:56:21 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: add options terminators to example calls. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index f917c5e6..bc041346 100644 --- a/debian/changelog +++ b/debian/changelog @@ -271,6 +271,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium transformations. - x2goserver/lib/x2goupdateoptionsstring: document how to cheat and just compact options strings. + - x2goserver/lib/x2goupdateoptionsstring: add options terminators to + example calls. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index cb6ef453..52b9bc43 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -409,23 +409,23 @@ For an options string such as =over 2 -calling C<x2goupdateoptionsstring 'nx/nx,clipboard=both,foo:50' +calling C<x2goupdateoptionsstring '--' 'nx/nx,clipboard=both,foo:50' '-clipboard'> shall return nx/nx,foo:50 -while calling C<x2goupdateoptionsstring 'nx/nx,clipboard=both,foo:50' +while calling C<x2goupdateoptionsstring '--' 'nx/nx,clipboard=both,foo:50' '-clipboard=server'> shall return nx/nx,clipboard=both,foo:50 -Calling C<x2goupdateoptionsstring 'nx/nx,clipboard=both,foo:50' 'bar'> shall -return +Calling C<x2goupdateoptionsstring '--' 'nx/nx,clipboard=both,foo:50' 'bar'> +shall return nx/nx,clipboard=both,foo,bar:50 -and calling C<x2goupdateoptionsstring 'nx/nx,clipboard=both,foo:50' '+-bar' -'foo=gulp' '-clipboard=client'> shall return +and calling C<x2goupdateoptionsstring '--' 'nx/nx,clipboard=both,foo:50' +'+-bar' 'foo=gulp' '-clipboard=client'> shall return nx/nx,clipboard=both,foo=gulp,-bar:50 @@ -439,7 +439,7 @@ For an options string such as you can get a compacted version by cheating a bit and providing a transformation which will certainly be a no-operation using -C<x2goupdateoptionsstring '-c' +C<x2goupdateoptionsstring '-c' '--' 'nx/nx,clipboard=both,foo=bar,bar=baz,,foo=oof,:50' '-'>, which shall return nx/nx,clipboard=both,foo=oof,bar=baz:50 -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 505c2d4503f5c9e0ac1b7a07600b32df9524c53d Author: Mihai Moldovan <ionic@ionic.de> Date: Tue Nov 10 08:20:22 2020 +0100 X2Go/Server/Agent/NX/Options.pm: typo compactation => compaction. --- X2Go/Server/Agent/NX/Options.pm | 2 +- debian/changelog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index ee0d8b0a..14973ddc 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -961,7 +961,7 @@ An implicit empty element is added whenever the resulting options string would only contain the display number. This one I<can not> be removed, but also won't show up anywhere. Adding any non-empty new key will automatically replace such an empty element, -without any need for actual compactation. +without any need for actual compaction. =item * diff --git a/debian/changelog b/debian/changelog index 54af6d1a..ee406cab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -275,6 +275,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium example calls. - X2Go/Server/Agent/NX/Options.pm: document that NUL bytes can only be URL-encoded, but that this not recommended. + - X2Go/Server/Agent/NX/Options.pm: typo compactation => compaction. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 951991f6414df6a97c385a0fd3975e4d2eb836f7 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 20 00:14:07 2020 +0100 X2Go/Server/Agent/NX/Options.pm: document other non-printable characters. --- X2Go/Server/Agent/NX/Options.pm | 6 ++++++ debian/changelog | 2 ++ 2 files changed, 8 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 3eae2a54..119d0db0 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -1034,6 +1034,12 @@ duplicated with this module. To remove duplicated keys, use C<compact_intermediate>. This will preserve the order in a first-seen fashion. +Additionally, most non-printable control characters can be used verbatim. +This includes, but is not limited to, characters like C<LF> (C<\n>), C<TAB> +(C<\t>) and C<VT> (C<\v>). + +Naturally, it is recommended to avoid such characters. + =item * A key-value pair with an empty key but a non-empty value is allowed. diff --git a/debian/changelog b/debian/changelog index 6f7f9c60..2a89cd2a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -284,6 +284,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/lib/x2goupdateoptionsstring: better document end-of-options terminator and highlight its importance. - X2Go/Server/Agent/NX/Options.pm: reflow some text. + - X2Go/Server/Agent/NX/Options.pm: document other non-printable + characters. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 85599d36afb19aed34ed580ba3fa8ab171c17913 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Nov 12 11:35:32 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: better document end-of-options terminator and highlight its importance. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 26 +++++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2a7201ba..9e2f2ed5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -281,6 +281,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium needed (and if not, it shouldn't have any side effects anyway). - x2goserver/lib/x2goupdateoptionsstring: add space between link and punctuation character for easier copying. + - x2goserver/lib/x2goupdateoptionsstring: better document end-of-options + terminator and highlight its importance. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 582a33d2..4e4f0993 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -372,11 +372,8 @@ B<->I<key>B<=>I<value>. Use the B<--compact> option to minimize the original options string, removing duplicated and empty entries. -You can terminate program options parsing via a standard double-dash (B<-->) -pseudo-option. -It is recommended to always do so if you pass removal transformation -operations, even if no actual options are used to avoid misinterpreting such -transformation options as options/flags to the program. +Refer to the L<OPTIONS PARSING section|/OPTIONS PARSING> for a description of +when and how to terminate options passed to this program. =head1 OPTIONS @@ -401,6 +398,25 @@ The order of arguments is preserved in a first-seen fashion. =back +=head2 OPTIONS PARSING + +You can terminate program options parsing via a standard double-dash (B<-->) +pseudo-option. +It is B<highly recommended> to always do so. + +If you pass removal transformation operations, passing the options terminator +is B<mandatory>, even if no actual options are used. +Otherwise, transformation operations will be interpreted as options to the +program, which will almost certainly lead to an error. + +For example, passing C<-clipboard> as a transformation operation without a +previous options terminator will be interpreted as the option C<-c>, with the +rest of the string modified into C<-lipboard>. +Since this program does not accept an option called C<-l>, it will terminate +with an error. +Even then, this is certainly not what the original transformation operation +was supposed to represent. + =head1 EXAMPLES For an options string such as -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit a56be1e16cbb94c86ab25e014b67d395e1ba8bb9 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Nov 19 23:23:27 2020 +0100 X2Go/Server/Agent/NX/Options.pm: reflow some text. --- X2Go/Server/Agent/NX/Options.pm | 4 ++-- debian/changelog | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 9d95e3fd..3eae2a54 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -1011,8 +1011,8 @@ will be able to scan any data after the first embedded C<NUL> character. It is highly recommended to avoid using embedded C<NUL> characters. -This module will not explicitly scan for them, and, hence, also not issue warnings -related to those characters. +This module will not explicitly scan for them, and, hence, also not issue +warnings related to those characters. =item * diff --git a/debian/changelog b/debian/changelog index 9e2f2ed5..6f7f9c60 100644 --- a/debian/changelog +++ b/debian/changelog @@ -283,6 +283,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium punctuation character for easier copying. - x2goserver/lib/x2goupdateoptionsstring: better document end-of-options terminator and highlight its importance. + - X2Go/Server/Agent/NX/Options.pm: reflow some text. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 99e62cbbf2f9dbad6d670be4636a08ea5e5b0c86 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Nov 12 10:33:26 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: add space between link and punctuation character for easier copying. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 797fd9a6..2a7201ba 100644 --- a/debian/changelog +++ b/debian/changelog @@ -279,6 +279,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: whitespace-only on fake enum-subs. - X2Go/Server/Agent/NX/Options.pm: add empty BEGIN block in case it's ever needed (and if not, it shouldn't have any side effects anyway). + - x2goserver/lib/x2goupdateoptionsstring: add space between link and + punctuation character for easier copying. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 52b9bc43..582a33d2 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -339,7 +339,7 @@ after the separating pipe character will generate broken links. Make sure to only break it during the description or, generally, on space characters. A workaround for this as been proposed in -https://github.com/Perl/perl5/issues/18305. +https://github.com/Perl/perl5/issues/18305 . B<x2goupdateoptionsstring> is a utility for manipulating options strings as passed to B<X2Go/NX Agent>. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 0c1d69afc79e16d819aaf217080dfadd720d753f Author: Mihai Moldovan <ionic@ionic.de> Date: Tue Nov 10 08:24:50 2020 +0100 X2Go/Server/Agent/NX/Options.pm: whitespace-only on fake enum-subs. --- X2Go/Server/Agent/NX/Options.pm | 4 ++-- debian/changelog | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 14973ddc..2f8c48bb 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -34,9 +34,9 @@ our @EXPORT_OK = qw (MODE_INVALID MODE_ADD_UPDATE MODE_REMOVE # These are actually supposed to be enums, but since Perl doesn't have a # proper way of creating enums (at least not natively), we'll emulate that # using small functions. -sub MODE_INVALID { return 0; } +sub MODE_INVALID { return 0; } sub MODE_ADD_UPDATE { return 1; } -sub MODE_REMOVE { return 2; } +sub MODE_REMOVE { return 2; } # Accepts an options string and returns a reference to an array of hashes diff --git a/debian/changelog b/debian/changelog index ee406cab..23b7701f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -276,6 +276,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: document that NUL bytes can only be URL-encoded, but that this not recommended. - X2Go/Server/Agent/NX/Options.pm: typo compactation => compaction. + - X2Go/Server/Agent/NX/Options.pm: whitespace-only on fake enum-subs. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit be41aa972c10d698932fc12047b646bda8f26584 Author: Mihai Moldovan <ionic@ionic.de> Date: Tue Nov 10 08:29:54 2020 +0100 X2Go/Server/Agent/NX/Options.pm: add empty BEGIN block in case it's ever needed (and if not, it shouldn't have any side effects anyway). --- X2Go/Server/Agent/NX/Options.pm | 2 ++ debian/changelog | 2 ++ 2 files changed, 4 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 2f8c48bb..9d95e3fd 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -38,6 +38,8 @@ sub MODE_INVALID { return 0; } sub MODE_ADD_UPDATE { return 1; } sub MODE_REMOVE { return 2; } +BEGIN { +} # Accepts an options string and returns a reference to an array of hashes # (actually hash references) corresponding to the parsed key-value pairs. diff --git a/debian/changelog b/debian/changelog index 23b7701f..797fd9a6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -277,6 +277,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium URL-encoded, but that this not recommended. - X2Go/Server/Agent/NX/Options.pm: typo compactation => compaction. - X2Go/Server/Agent/NX/Options.pm: whitespace-only on fake enum-subs. + - X2Go/Server/Agent/NX/Options.pm: add empty BEGIN block in case it's ever + needed (and if not, it shouldn't have any side effects anyway). * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 4760d950b90a9ed646a5a2e36cc8533f59b02a98 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Nov 20 23:37:35 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: add comment regarding the shift () operations after sanitizing program options. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/debian/changelog b/debian/changelog index 2a89cd2a..8d5655ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -286,6 +286,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: reflow some text. - X2Go/Server/Agent/NX/Options.pm: document other non-printable characters. + - x2goserver/lib/x2goupdateoptionsstring: add comment regarding the + shift () operations after sanitizing program options. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 4e4f0993..c867e7c4 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -173,6 +173,15 @@ sub Main { my $options = undef; if (!($error_detected)) { + # The shift () operations here actually shift the outer array, not the + # inner elements. + # This can be very confusing. + # The return value is an array consisting of a boolean value and an array + # reference. + # + # Thus, shifting once returns the boolean value, while shifting again + # returns the options array reference. Crucially, no shift () operation + # here modifies the modified options array. $found_separator |= (0 + shift (@{$sanitized_options})); $sanitized_options = shift (@{$sanitized_options}); @program_arguments = @{$sanitized_options}; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit d94c657edf1d664be314b8022e4f62d2e3be39c1 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 21 22:01:57 2020 +0100 X2Go/Server/Agent/NX/Options.pm: make sure to add/modify elements with an empty string or undef key and an undef value as an empty hash. --- X2Go/Server/Agent/NX/Options.pm | 9 ++++++++- debian/changelog | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 5f9b27f8..e1ad68cc 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -608,7 +608,14 @@ sub transform_intermediate { $ret = [ map { filter_option_modify ($work_option_key, $work_option_value, $_, --$elements_left) } @{$ret} ]; } else { - my $new_opt = { $work_option_key => $work_option_value }; + my $new_opt = { }; + + if (((defined ($work_option_key)) && (q{} ne $work_option_key)) || (defined ($work_option_value))) { + $new_opt->{$work_option_key} = $work_option_value; + } + else { + print {*STDERR} "Asked to add/modify empty key with no value, adding empty element though deprecated.\n"; + } # No such option exists, we'll add it to the end of the current # options. diff --git a/debian/changelog b/debian/changelog index da923aac..2d215ad1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -294,6 +294,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium 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: make sure to add/modify elements with + an empty string or undef key and an undef value as an empty hash. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 76188eb60b9bf8914c14057096f6ad9f7742d33d Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 22 21:44:33 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: add mode selection functionality. --- debian/changelog | 2 + x2goserver/bin/x2goupdateoptionsstring | 169 ++++++++++++++++++++++++++++++--- 2 files changed, 158 insertions(+), 13 deletions(-) diff --git a/debian/changelog b/debian/changelog index b1ef9d8a..f951ea0f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -301,6 +301,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium treat subsequent pseudo-options literally and to not just consume them. - x2goserver/lib/x2goupdateoptionsstring: add debug print statements for in-depth examination of program options parsing. + - x2goserver/lib/x2goupdateoptionsstring: add mode selection + functionality. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 1babf755..127bdc7d 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -30,6 +30,7 @@ use Pod::Usage; use Storable qw (dclone); use Data::Dumper qw (Dumper); use X2Go::Server::Agent::NX::Options; +use List::Util qw (max); exit (Main (@ARGV)); @@ -38,6 +39,17 @@ BEGIN { # No code past this point should be getting executed! +# These are actually supposed to be enums, but since Perl doesn't have a +# proper way of creating enums (at least not natively), we'll emulate that +# using list constants. +# The syntax is ( q{stringified mode name}, enum_value ). +# +# Make sure that enum_value is always a power of two! +use constant MODE_INVALID_DATA => ( q{invalid}, 0 ); +use constant MODE_TRANSFORM_DATA => ( q{transform}, 1 ); +use constant MODE_EXTRACT_DATA => ( q{extract}, 2 ); +use constant MODES => ( \&MODE_TRANSFORM_DATA, \&MODE_EXTRACT_DATA ); + # Helper function handling unknown options or ignoring the well-known # separator. It scans for options until hitting the first non-option entry. # @@ -137,6 +149,117 @@ sub sanitize_program_options { return $ret; } +# Helper function handling the parsing and setting of program modes. +# +# Takes a string, which represents a (potentially abbreviated) mode name, a +# boolean denoting transformation mode and a boolean denoting extract mode as +# its parameters. +# +# Returns a mode enum element. +# +# On error, returns the mode number corresponding to MODE_INVALID. +sub handle_mode { + my $ret = (MODE_INVALID_DATA)[1]; + my $error_detected = 0; + my $mode_aggregate = 0; + my $mode_parse = \&MODE_INVALID_DATA; + + my $mode = shift; + my $transform = shift; + my $extract = shift; + + if (!(defined ($mode))) { + print {*STDERR} "Invalid mode argument passed to mode selecttion helper, erroring out.\n"; + $error_detected = 1; + } + + if ((!($error_detected)) && (!(defined ($transform)))) { + print {*STDERR} "Invalid transformation argument passed to mode selecttion helper, erroring out.\n"; + $error_detected = 1; + } + + if ((!($error_detected)) && (!(defined ($extract)))) { + print {*STDERR} "Invalid extract argument passed to mode selecttion helper, erroring out.\n"; + $error_detected = 1; + } + + if (!($error_detected)) { + # Next check for mutual exclusiveness regarding modes. + if ($transform) { + $mode_aggregate |= (&{(MODES)[0]}())[1]; + } + + if ($extract) { + $mode_aggregate |= (&{(MODES)[1]}())[1]; + } + + if (($mode_aggregate) && ($mode_aggregate & ($mode_aggregate - 1))) { + print {*STDERR} "Mutually exclusive modes specified, erroring out.\n"; + $error_detected = 1; + } + } + + if (!($error_detected)) { + if ($mode ne q{}) { + # Mode has been passed, support substrings of the actual modes. + my $length = length ($mode); + my $found = 0; + + my %modes = (); + foreach my $elem (MODES) { + $modes{(&$elem())[0]} = 1; + } + + if ($length < max (map { length ((&$_())[0]); } (MODES))) { + foreach my $elem (MODES) { + if (substr ((&$elem())[0], 0, $length) eq $mode) { + if (!($found)) { + $mode_parse = $elem; + } + ++$found; + } + } + } + + # Now check if value matches a known one. + if (!($found)) { + foreach my $elem (MODES) { + if (exists ($modes{(&$elem())[0]})) { + $mode_parse = $elem; + $found = 1; + last; + } + } + } + + if (!($found)) { + print {*STDERR} 'Invalid mode specified (' . $mode . "), erroring out.\n"; + $error_detected = 1; + } + elsif (1 < $found) { + print {*STDERR} 'Supplied mode (' . $mode . ") is ambiguous, erroring out.\n"; + $error_detected = 1; + } + } + } + + # Okay, now check for mutual exclusiveness and map to return value. + if (!($error_detected)) { + $ret = ($mode_aggregate | (&$mode_parse())[1]); + + if (($ret) && ($ret & ($ret - 1))) { + print {*STDERR} "Mutually exclusive modes specified, erroring out.\n"; + $error_detected = 1; + } + } + + if ($error_detected) { + $ret = (MODE_INVALID_DATA)[1]; + } + + return $ret; +} + # Main function, no code outside of it shall be executed. # # Expects @ARGV to be passed in. @@ -153,10 +276,16 @@ sub Main { my $man = 0; my $debug = 0; my $compact = 0; + my $mode_transform = 0; + my $mode_extract = 0; + my $mode_arg = q{}; GetOptionsFromArray (\@program_arguments, 'help|?|h' => \$help, 'man' => \$man, 'debug|d' => \$debug, - 'compact|c' => \$compact) or pod2usage (2); + 'compact|c' => \$compact, + 'transform|t' => \$mode_transform, + 'extract|e' => \$mode_extract, + 'mode|m=s' => \$mode_arg) or pod2usage (2); if ($help) { pod2usage (1); @@ -166,13 +295,27 @@ sub Main { pod2usage (-verbose => 2, -exitval => 3); } - my $sanitized_options = sanitize_program_options (\@program_arguments, (!($found_separator))); + my $mode = handle_mode ($mode_arg, $mode_transform, $mode_extract); + + if ($debug) { + print {*STDERR} 'Parsed mode as: ' . $mode . "\n"; + } - if (!(defined ($sanitized_options))) { - pod2usage (-exitval => 'NOEXIT'); + if ((MODE_INVALID_DATA)[1] == $mode) { $error_detected = 4; } + my $sanitized_options = undef; + + if (!($error_detected)) { + $sanitized_options = sanitize_program_options (\@program_arguments, (!($found_separator))); + + if (!(defined ($sanitized_options))) { + pod2usage (-exitval => 'NOEXIT'); + $error_detected = 5; + } + } + my $options = undef; if (!($error_detected)) { @@ -197,7 +340,7 @@ sub Main { if (!(defined ($options))) { print {*STDERR} "No options string given, aborting.\n"; - $error_detected = 5; + $error_detected = 6; } } @@ -212,7 +355,7 @@ sub Main { if (!(defined ($intermediate))) { print {*STDERR} "Unable to parse options string, aborting.\n"; - $error_detected = 6; + $error_detected = 7; } } @@ -221,7 +364,7 @@ sub Main { if (!(defined ($sanitized_options))) { pod2usage (-exitval => 'NOEXIT'); - $error_detected = 7; + $error_detected = 8; } } @@ -236,7 +379,7 @@ sub Main { if (!(defined ($intermediate))) { print {*STDERR} "Unable to compact intermediate options representation, aborting.\n"; - $error_detected = 8; + $error_detected = 9; } elsif ($debug) { print {*STDERR} 'Dumping intermediate array after compacting: ' . Dumper ($intermediate); @@ -268,7 +411,7 @@ sub Main { if (!(defined ($interpreted_transform_ref))) { print {*STDERR} "Invalid transformation passed, aborting.\n"; - $error_detected = 9; + $error_detected = 10; last; } @@ -282,7 +425,7 @@ sub Main { if (!(defined ($intermediate))) { print {*STDERR} "Error while transforming intermediate representation, aborting.\n"; - $error_detected = 10; + $error_detected = 11; last; } @@ -295,7 +438,7 @@ sub Main { if (!(defined ($sanitized_options))) { pod2usage (-exitval => 'NOEXIT'); - $error_detected = 11; + $error_detected = 12; last; } elsif ($debug) { @@ -309,7 +452,7 @@ sub Main { if ((!($error_detected)) && (!($transformed))) { print {*STDERR} "No transformation passed, aborting.\n"; - $error_detected = 12; + $error_detected = 13; } } @@ -320,7 +463,7 @@ sub Main { if (!(defined ($out))) { print {*STDERR} "Unable to transform intermediate back into string, aborting.\n"; - $error_detected = 13; + $error_detected = 14; } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 61ee4509e6c459eb2658d777c8261e782aaf6bef Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 21 22:15:49 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: fix parsing of multiple subsequent separating "--" pseudo-options. We just have to make sure to treat subsequent pseudo-options literally and to not just consume them. --- debian/changelog | 3 +++ x2goserver/bin/x2goupdateoptionsstring | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 2d215ad1..d6148679 100644 --- a/debian/changelog +++ b/debian/changelog @@ -296,6 +296,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium rather negate sub-terms as required. - X2Go/Server/Agent/NX/Options.pm: make sure to add/modify elements with an empty string or undef key and an undef value as an empty hash. + - x2goserver/lib/x2goupdateoptionsstring: fix parsing of multiple + subsequent separating "--" pseudo-options. We just have to make sure to + treat subsequent pseudo-options literally and to not just consume them. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index c867e7c4..08d8ab92 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -88,8 +88,11 @@ sub sanitize_program_options { elsif ((2 == length ($cur_arg)) && (q{-} eq substr ($cur_arg, 1, 1))) { if ($skip_separator) { # Found separating "--" pseudo-option, but skipping requested. Only - # set the boolean value for our return value. + # set the boolean value for our return value and make sure that we + # don't skip another separating pseudo-option if it comes up again + # right next to this one. $found_separator = 1; + $skip_separator = 0; } else { # Not skipping separating "--" pseudo-option - i.e., we'll treat this -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 55948b22c36c7651af236015a494e13bb6d660b3 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 21 22:19:16 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: add debug print statements for in-depth examination of program options parsing. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index d6148679..b1ef9d8a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -299,6 +299,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/lib/x2goupdateoptionsstring: fix parsing of multiple subsequent separating "--" pseudo-options. We just have to make sure to treat subsequent pseudo-options literally and to not just consume them. + - x2goserver/lib/x2goupdateoptionsstring: add debug print statements for + in-depth examination of program options parsing. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 08d8ab92..1babf755 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -176,6 +176,10 @@ sub Main { my $options = undef; if (!($error_detected)) { + if ($debug) { + print {*STDERR} 'Sanitized program options string as: ' . Dumper ($sanitized_options); + } + # The shift () operations here actually shift the outer array, not the # inner elements. # This can be very confusing. @@ -223,6 +227,7 @@ sub Main { if (!($error_detected)) { if ($debug) { + print {*STDERR} 'Sanitized program options string as: ' . Dumper ($sanitized_options); print {*STDERR} 'Dumping intermediate array after initial parsing: ' . Dumper ($intermediate); } @@ -293,6 +298,9 @@ sub Main { $error_detected = 11; last; } + elsif ($debug) { + print {*STDERR} 'Sanitized program options string as: ' . Dumper ($sanitized_options); + } $found_separator |= (0 + shift (@{$sanitized_options})); $sanitized_options = shift (@{$sanitized_options}); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
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@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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 34e08f203c8d213974b16ba4bac7c001aabb5a4f Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 23 03:03:17 2020 +0100 x2goserver/lib/x2goupdateoptionsstring: rework mode selection, split out abbreviation parsing into a separate function to take out nesting complexity. This trades off nesting complexity (to some degree) with code complexity. --- debian/changelog | 4 ++ x2goserver/bin/x2goupdateoptionsstring | 94 ++++++++++++++++++++++++++++------ 2 files changed, 81 insertions(+), 17 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0cb1421a..4bcc4745 100644 --- a/debian/changelog +++ b/debian/changelog @@ -309,6 +309,10 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium x2goserver/lib/x2goupdateoptionsstring}: update Perl critic overrides to allow the constant pragma and document it and other overrides (unless they are self-explanatory). + - x2goserver/lib/x2goupdateoptionsstring: rework mode selection, split out + abbreviation parsing into a separate function to take out nesting + complexity. This trades off nesting complexity (to some degree) with + code complexity. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 890b541a..689f75c9 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -155,6 +155,49 @@ sub sanitize_program_options { return $ret; } +# Helper function handling mode abbreviations. +# +# Takes a string, which represents a (potentially abbreviated) mode name as +# its only parameter. +# +# Returns an array reference containing a count, denoting how often the +# abbreviated mode matched the known modes and a reference to an internal mode +# element. +# +# On error, returns undef. +sub handle_mode_abbrev { + my $ret = undef; + my $error_detected = 0; + my $found = 0; + my $mode_parse = \&MODE_INVALID_DATA; + + my $mode = shift; + + if (!(defined ($mode))) { + print {*STDERR} "Invalid mode argument passed to mode abbreviation selection helper, erroring out.\n"; + $error_detected = 1; + } + + if (!($error_detected)) { + my $length = length ($mode); + + if ($length < max (map { length ((&{$_}())[0]); } (MODES))) { + foreach my $elem (MODES) { + if (substr ((&{$elem}())[0], 0, $length) eq $mode) { + if (!($found)) { + $mode_parse = $elem; + } + ++$found; + } + } + } + + $ret = [ $found, $mode_parse ]; + } + + return $ret; +} + # Helper function handling the parsing and setting of program modes. # # Takes a string, which represents a (potentially abbreviated) mode name, a @@ -208,7 +251,6 @@ sub handle_mode { if (!($error_detected)) { if ($mode ne q{}) { # Mode has been passed, support substrings of the actual modes. - my $length = length ($mode); my $found = 0; my %modes = (); @@ -216,19 +258,35 @@ sub handle_mode { $modes{(&$elem())[0]} = 1; } - if ($length < max (map { length ((&$_())[0]); } (MODES))) { - foreach my $elem (MODES) { - if (substr ((&$elem())[0], 0, $length) eq $mode) { - if (!($found)) { - $mode_parse = $elem; - } - ++$found; - } + my $abbrev_ret = handle_mode_abbrev ($mode); + + if (!(defined ($abbrev_ret))) { + print {*STDERR} 'Unable to parse given mode (' . $mode . ") as an abbreviation, erroring out.\n"; + $error_detected = 1; + } + elsif (2 != scalar (@{$abbrev_ret})) { + print {*STDERR} 'Return value of abbreviation parsing for mode (' . $mode . ") has a wrong format, erroring out.\n"; + $error_detected = 1; + } + else { + # Check data. + my $first_reftype = ref ($abbrev_ret->[0]); + my $second_reftype = ref ($abbrev_ret->[1]); + if ((q{} ne $first_reftype) || (q{CODE} ne $second_reftype)) { + print {*STDERR} 'Return value of abbreviation parsing for mode (' . $mode . ") has a wrong format.\n"; + print {*STDERR} 'Expected scalar (empty string), got "' . $first_reftype . '" and CODE, got "' . $second_reftype . q{"} . "\n"; + print {*STDERR} "Erroring out.\n"; + $error_detected = 1; + } + else { + # Unpack return data. + $found = shift (@{$abbrev_ret}); + $mode_parse = shift (@{$abbrev_ret}); } } # Now check if value matches a known one. - if (!($found)) { + if ((!($error_detected)) && (!($found))) { foreach my $elem (MODES) { if (exists ($modes{(&$elem())[0]})) { $mode_parse = $elem; @@ -238,13 +296,15 @@ sub handle_mode { } } - if (!($found)) { - print {*STDERR} 'Invalid mode specified (' . $mode . "), erroring out.\n"; - $error_detected = 1; - } - elsif (1 < $found) { - print {*STDERR} 'Supplied mode (' . $mode . ") is ambiguous, erroring out.\n"; - $error_detected = 1; + if (!($error_detected)) { + if (!($found)) { + print {*STDERR} 'Invalid mode specified (' . $mode . "), erroring out.\n"; + $error_detected = 1; + } + elsif (1 < $found) { + print {*STDERR} 'Supplied mode (' . $mode . ") is ambiguous, erroring out.\n"; + $error_detected = 1; + } } } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 0b759cd998bd9d8f7c540ece40ce7f00e32bae21 Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 23 03:41:08 2020 +0100 debian/changelog: fixup x2goserver/{lib,bin}/x2goupdateoptionsstring. --- debian/changelog | 62 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/debian/changelog b/debian/changelog index 36c3ab1d..40cd42aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -184,27 +184,27 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium created, but we already have such a check in another place. Instead, treat a missing PID, which can only happen during session startup, as a success. - - x2goserver/lib/x2goupdateoptionsstring: simplify a for loop a bit. - - x2goserver/lib/x2goupdateoptionsstring: fix typo in comment. - - x2goserver/lib/x2goupdateoptionsstring: fix typo in print statement + - x2goserver/bin/x2goupdateoptionsstring: simplify a for loop a bit. + - x2goserver/bin/x2goupdateoptionsstring: fix typo in comment. + - x2goserver/bin/x2goupdateoptionsstring: fix typo in print statement syntax. Non-functional. - - x2goserver/lib/x2goupdateoptionsstring: update copyright notice. + - x2goserver/bin/x2goupdateoptionsstring: update copyright notice. - X2Go/Server/Agent/: add new (stub) file NX/Options.pm as a library version of the options string manipulation code. - - x2goserver/lib/x2goupdateoptionsstring: fix man page specification, + - x2goserver/bin/x2goupdateoptionsstring: fix man page specification, options string was missing. - - x2goserver/lib/x2goupdateoptionsstring: move most code to + - x2goserver/bin/x2goupdateoptionsstring: move most code to X2Go/Server/Agent/NX/Options.pm. - - x2goserver/lib/x2goupdateoptionsstring: revert for loop simplification. + - x2goserver/bin/x2goupdateoptionsstring: revert for loop simplification. We actually depend on the subtle modification of the args reference variable. - X2Go/Server/Agent/NX/Options.pm: add a lot of documentation. - - x2goserver/lib/x2goupdateoptionsstring: update synopsis to include the + - x2goserver/bin/x2goupdateoptionsstring: update synopsis to include the optional character of a plus sign, but a non-optional character for a minus sign. - - x2goserver/lib/x2goupdateoptionsstring: make clear that "additional + - x2goserver/bin/x2goupdateoptionsstring: make clear that "additional parameters" are transformations. - - x2goserver/lib/x2goupdateoptionsstring: replace occurrences of "option + - x2goserver/bin/x2goupdateoptionsstring: replace occurrences of "option string" with "options string". - X2Go/Server/Agent/NX/Options.pm: replace occurrences of "option string" with "options string". @@ -220,21 +220,21 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium empty keys or empty (!= non-existent) values. - X2Go/Server/Agent/NX/Options.pm: make sure that intermediates never include undef entries. - - x2goserver/lib/x2goupdateoptionsstring: switch to "X2Go/NX Agent" term + - x2goserver/bin/x2goupdateoptionsstring: switch to "X2Go/NX Agent" term and make it bold to denote something special. - X2Go/Server/Agent/NX/Options.pm: add new function compact_intermediate, used to remove duplicated and empty elements. - - x2goserver/lib/x2goupdateoptionsstring: add new --compact/-c switch to + - x2goserver/bin/x2goupdateoptionsstring: add new --compact/-c switch to enable the use of compactation. - - x2goserver/lib/x2goupdateoptionsstring: document new --compact/-c + - x2goserver/bin/x2goupdateoptionsstring: document new --compact/-c switch. - - x2goserver/lib/x2goupdateoptionsstring: split up GetOptionsFromArray () + - x2goserver/bin/x2goupdateoptionsstring: split up GetOptionsFromArray () line. Non-functional. - X2Go/Server/Agent/NX/Options.pm: document the new compact_intermediate () function and its implications. - X2Go/Server/Agent/NX/Options.pm: fix some Perl Critic warnings and silence others. - - x2goserver/lib/x2goupdateoptionsstring: fix some Perl Critic warnings + - x2goserver/bin/x2goupdateoptionsstring: fix some Perl Critic warnings and silence others. - X2Go/Server/Agent/NX/Options.pm: grammar/typo fix in comment and improve a different comment. @@ -246,16 +246,16 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: add newline before __END__, non-functional. - {X2Go/Server/Agent/NX/Options.pm, - x2goserver/lib/x2goupdateoptionsstring}: add =pod markers. + x2goserver/bin/x2goupdateoptionsstring}: add =pod markers. - {X2Go/Server/Agent/NX/Options.pm, - x2goserver/lib/x2goupdateoptionsstring}: update AUTHOR sections with + x2goserver/bin/x2goupdateoptionsstring}: update AUTHOR sections with proper links. - X2Go/Server/Agent/NX/Options.pm: fix nxagent man page link. - - x2goserver/lib/x2goupdateoptionsstring: considerably simplify while loop + - x2goserver/bin/x2goupdateoptionsstring: considerably simplify while loop logic that iterates over transformations. I have no idea why I thought it had to be so complicated in the first place... - {X2Go/Server/Agent/NX/Options.pm, - x2goserver/lib/x2goupdateoptionsstring}: reformat/reflow so that each + x2goserver/bin/x2goupdateoptionsstring}: reformat/reflow so that each sentence starts on a proper line. This is particularly interesting for the troff output, since GNU troff's heuristic for generating double spaces (by default) after a punctuation character wouldn't trigger @@ -264,14 +264,14 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: replace "treat as" with "treat like". - X2Go/Server/Agent/NX/Options.pm: clear up "logically equivalent but logically very different" situation. - - x2goserver/lib/x2goupdateoptionsstring: rename EXAMPLE section to + - x2goserver/bin/x2goupdateoptionsstring: rename EXAMPLE section to EXAMPLES. - - x2goserver/lib/x2goupdateoptionsstring: add links to + - x2goserver/bin/x2goupdateoptionsstring: add links to X2Go::Server::Agent::NX::Options documentation on option strings and transformations. - - x2goserver/lib/x2goupdateoptionsstring: document how to cheat and just + - x2goserver/bin/x2goupdateoptionsstring: document how to cheat and just compact options strings. - - x2goserver/lib/x2goupdateoptionsstring: add options terminators to + - x2goserver/bin/x2goupdateoptionsstring: add options terminators to example calls. - X2Go/Server/Agent/NX/Options.pm: document that NUL bytes can only be URL-encoded, but that this not recommended. @@ -279,14 +279,14 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: whitespace-only on fake enum-subs. - X2Go/Server/Agent/NX/Options.pm: add empty BEGIN block in case it's ever needed (and if not, it shouldn't have any side effects anyway). - - x2goserver/lib/x2goupdateoptionsstring: add space between link and + - x2goserver/bin/x2goupdateoptionsstring: add space between link and punctuation character for easier copying. - - x2goserver/lib/x2goupdateoptionsstring: better document end-of-options + - x2goserver/bin/x2goupdateoptionsstring: better document end-of-options terminator and highlight its importance. - X2Go/Server/Agent/NX/Options.pm: reflow some text. - X2Go/Server/Agent/NX/Options.pm: document other non-printable characters. - - x2goserver/lib/x2goupdateoptionsstring: add comment regarding the + - x2goserver/bin/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 @@ -296,20 +296,20 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium rather negate sub-terms as required. - X2Go/Server/Agent/NX/Options.pm: make sure to add/modify elements with an empty string or undef key and an undef value as an empty hash. - - x2goserver/lib/x2goupdateoptionsstring: fix parsing of multiple + - x2goserver/bin/x2goupdateoptionsstring: fix parsing of multiple subsequent separating "--" pseudo-options. We just have to make sure to treat subsequent pseudo-options literally and to not just consume them. - - x2goserver/lib/x2goupdateoptionsstring: add debug print statements for + - x2goserver/bin/x2goupdateoptionsstring: add debug print statements for in-depth examination of program options parsing. - - x2goserver/lib/x2goupdateoptionsstring: add mode selection + - x2goserver/bin/x2goupdateoptionsstring: add mode selection functionality. - X2Go/Server/Agent/NX/Options.pm: port modes "enum" subs to the constant pragma to make the code more consistent with the program wrapper. - {X2Go/Server/Agent/NX/Options.pm, - x2goserver/lib/x2goupdateoptionsstring}: update Perl critic overrides + x2goserver/bin/x2goupdateoptionsstring}: update Perl critic overrides to allow the constant pragma and document it and other overrides (unless they are self-explanatory). - - x2goserver/lib/x2goupdateoptionsstring: rework mode selection, split out + - x2goserver/bin/x2goupdateoptionsstring: rework mode selection, split out abbreviation parsing into a separate function to take out nesting complexity. This trades off nesting complexity (to some degree) with code complexity. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit c5e3ee2a64251a49196589cf5b60e4b0154d8b7e Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 22 22:13:48 2020 +0100 {X2Go/Server/Agent/NX/Options.pm,x2goserver/lib/x2goupdateoptionsstring}: update Perl critic overrides to allow the constant pragma and document it and other overrides (unless they are self-explanatory). --- X2Go/Server/Agent/NX/Options.pm | 6 ++++++ debian/changelog | 4 ++++ x2goserver/bin/x2goupdateoptionsstring | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 79bb4d44..83bfb70b 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -18,7 +18,13 @@ package X2Go::Server::Agent::NX::Options; # Disable some Perl::Critic violations. +# +# I like parentheses. ## no critic (ProhibitParensWithBuiltins) +# +# It's recommended not to use the constant pragma, but we don't want to use +# non-core modules like Readonly. +## no critic (ValuesAndExpressions::ProhibitConstantPragma) use strict; use warnings; diff --git a/debian/changelog b/debian/changelog index b04c120c..0cb1421a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -305,6 +305,10 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium functionality. - X2Go/Server/Agent/NX/Options.pm: port modes "enum" subs to the constant pragma to make the code more consistent with the program wrapper. + - {X2Go/Server/Agent/NX/Options.pm, + x2goserver/lib/x2goupdateoptionsstring}: update Perl critic overrides + to allow the constant pragma and document it and other overrides + (unless they are self-explanatory). * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 127bdc7d..890b541a 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -18,7 +18,13 @@ # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Disable some Perl::Critic violations. +# +# I like parentheses. ## no critic (ProhibitParensWithBuiltins) +# +# It's recommended not to use the constant pragma, but we don't want to use +# non-core modules like Readonly. +## no critic (ValuesAndExpressions::ProhibitConstantPragma) use strict; use warnings; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 43cfdcc1f915d6ba2e50b079761424afd644b805 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 22 22:12:18 2020 +0100 X2Go/Server/Agent/NX/Options.pm: port modes "enum" subs to the constant pragma to make the code more consistent with the program wrapper. --- X2Go/Server/Agent/NX/Options.pm | 9 ++++++--- debian/changelog | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index e1ad68cc..79bb4d44 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -34,9 +34,12 @@ our @EXPORT_OK = qw (MODE_INVALID MODE_ADD_UPDATE MODE_REMOVE # These are actually supposed to be enums, but since Perl doesn't have a # proper way of creating enums (at least not natively), we'll emulate that # using small functions. -sub MODE_INVALID { return 0; } -sub MODE_ADD_UPDATE { return 1; } -sub MODE_REMOVE { return 2; } +# IF adding more modes, please make sure that each number is a proper +# power-of-two. While we currently don't rely on this here, we might do so +# later. +use constant MODE_INVALID => 0; +use constant MODE_ADD_UPDATE => 1; +use constant MODE_REMOVE => 2; BEGIN { } diff --git a/debian/changelog b/debian/changelog index f951ea0f..b04c120c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -303,6 +303,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium in-depth examination of program options parsing. - x2goserver/lib/x2goupdateoptionsstring: add mode selection functionality. + - X2Go/Server/Agent/NX/Options.pm: port modes "enum" subs to the constant + pragma to make the code more consistent with the program wrapper. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 992de8b5e51ae32df8c34873fe0d624c09f1b973 Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 23 03:07:59 2020 +0100 debian/changelog: typo and whitespace fixes. --- debian/changelog | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4bcc4745..36c3ab1d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -189,7 +189,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/lib/x2goupdateoptionsstring: fix typo in print statement syntax. Non-functional. - x2goserver/lib/x2goupdateoptionsstring: update copyright notice. - - X2Go/Server/Agentt/: add new (stub) file NX/Options.pm as a library + - X2Go/Server/Agent/: add new (stub) file NX/Options.pm as a library version of the options string manipulation code. - x2goserver/lib/x2goupdateoptionsstring: fix man page specification, options string was missing. @@ -249,18 +249,18 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium x2goserver/lib/x2goupdateoptionsstring}: add =pod markers. - {X2Go/Server/Agent/NX/Options.pm, x2goserver/lib/x2goupdateoptionsstring}: update AUTHOR sections with - proper links. + proper links. - X2Go/Server/Agent/NX/Options.pm: fix nxagent man page link. - x2goserver/lib/x2goupdateoptionsstring: considerably simplify while loop logic that iterates over transformations. I have no idea why I thought it had to be so complicated in the first place... - {X2Go/Server/Agent/NX/Options.pm, x2goserver/lib/x2goupdateoptionsstring}: reformat/reflow so that each - sentence starts on a proper line. This is particularly interesting for - the troff output, since GNU troff's heuristic for generating double - spaces (by default) after a punctuation character wouldn't trigger - otherwise. Since it has no adverse effects on other generators, let's - just do it like that. + sentence starts on a proper line. This is particularly interesting for + the troff output, since GNU troff's heuristic for generating double + spaces (by default) after a punctuation character wouldn't trigger + otherwise. Since it has no adverse effects on other generators, let's + just do it like that. - X2Go/Server/Agent/NX/Options.pm: replace "treat as" with "treat like". - X2Go/Server/Agent/NX/Options.pm: clear up "logically equivalent but logically very different" situation. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 486611dbf1679ee218b07a7c1042bf4d91dd5b0b Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 23 05:31:11 2020 +0100 {X2Go/Server/Agent/NX/Options.pm,x2goserver/bin/x2goupdateoptionsstring}: fix/silence a few Perl::Critic warnings. --- X2Go/Server/Agent/NX/Options.pm | 8 +++++++- debian/changelog | 3 +++ x2goserver/bin/x2goupdateoptionsstring | 12 ++++++------ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 83bfb70b..90132422 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -153,7 +153,13 @@ sub parse_options { # Thus going the manual route here. my $last_pos = rindex ($last_component, q{:}); + # There is no English variant for this variable and it's deprecated + # anyway, replaced by the index 0 in most cases. + # We'll keep it for backwards compatibility for now and disable the + # warning. + ## no critic (Variables::ProhibitPunctuationVars) if ($[ > $last_pos) { + ## critic (Variables::ProhibitPunctuationVars) print {*STDERR} "No display port seperator found in the options string. Erroring out.\n"; $error_detected = 1; } @@ -1108,6 +1114,6 @@ both values match. This manual has been written by Mihai Moldovan L<E<lt>ionic@ionic.deE<gt>|mailto:ionic@ionic.de> for the X2Go -project (L<https://www.x2go.org>). +project (L<https://www.x2go.org|https://www.x2go.org>). =cut diff --git a/debian/changelog b/debian/changelog index 40cd42aa..0682e3f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -313,6 +313,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium abbreviation parsing into a separate function to take out nesting complexity. This trades off nesting complexity (to some degree) with code complexity. + - {X2Go/Server/Agent/NX/Options.pm, + x2goserver/bin/x2goupdateoptionsstring}: fix/silence a few Perl::Critic + warnings. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 689f75c9..b248add8 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -255,7 +255,7 @@ sub handle_mode { my %modes = (); foreach my $elem (MODES) { - $modes{(&$elem())[0]} = 1; + $modes{(&{$elem}())[0]} = 1; } my $abbrev_ret = handle_mode_abbrev ($mode); @@ -288,7 +288,7 @@ sub handle_mode { # Now check if value matches a known one. if ((!($error_detected)) && (!($found))) { foreach my $elem (MODES) { - if (exists ($modes{(&$elem())[0]})) { + if (exists ($modes{(&{$elem}())[0]})) { $mode_parse = $elem; $found = 1; last; @@ -311,7 +311,7 @@ sub handle_mode { # Okay, now check for mutual exclusiveness and map to return value. if (!($error_detected)) { - $ret = ($mode_aggregate | (&$mode_parse())[1]); + $ret = ($mode_aggregate | (&{$mode_parse}())[1]); if (($ret) && ($ret & ($ret - 1))) { print {*STDERR} "Mutually exclusive modes specified, erroring out.\n"; @@ -563,8 +563,8 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator =head1 DESCRIPTION =for comment -Due to parser oddities, breaking a line during an L<> formatter code right -after the separating pipe character will generate broken links. +Due to parser oddities, breaking a line during an L<dummy|text> formatter code +right after the separating pipe character will generate broken links. Make sure to only break it during the description or, generally, on space characters. A workaround for this as been proposed in @@ -695,6 +695,6 @@ C<x2goupdateoptionsstring '-c' '--' This manual has been written by Mihai Moldovan L<E<lt>ionic@ionic.deE<gt>|mailto:ionic@ionic.de> for the X2Go -project (L<https://www.x2go.org>). +project (L<https://www.x2go.org|https://www.x2go.org>). =cut -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 6c6f5ba83684465534226a3e84fc5a6e3083deff Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 23 05:52:58 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: remove obsolete comment, we're not using a do block/do-while loop any longer. While the information provided there might be an interesting tidbit, it's not relevant to the code any longer and might actually confuse readers. --- debian/changelog | 4 ++++ x2goserver/bin/x2goupdateoptionsstring | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2d671f6d..c3c973c2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -317,6 +317,10 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium x2goserver/bin/x2goupdateoptionsstring}: fix/silence a few Perl::Critic warnings. - x2goserver/bin/x2goupdateoptionsstring: typo fix in output message only. + - x2goserver/bin/x2goupdateoptionsstring: remove obsolete comment, we're + not using a do block/do-while loop any longer. While the information + provided there might be an interesting tidbit, it's not relevant to the + code any longer and might actually confuse readers. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 6d7e20bb..cb48325c 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -460,12 +460,6 @@ sub Main { my $transformed = 0; - # Nasty trick (to some degree): "do"-blocks are not recognized as loops by - # Perl, but we could wrap the body in another block, which WILL BE recognized - # as a loop (one, that only executes once), oddly enough. However, using - # "last" won't work in such a situation, but rather behave like "next". - # Worse, the condition will also not be checked in such a case. - # Thus, we'd better use a real loop. while (defined (my $cur_transform = shift (@program_arguments))) { $transformed = 1; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit ba4fef7c205eb823f0e833b83d3a6e2ef1453896 Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 23 05:32:00 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: typo fix in output message only. --- debian/changelog | 1 + x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 0682e3f5..2d671f6d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -316,6 +316,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - {X2Go/Server/Agent/NX/Options.pm, x2goserver/bin/x2goupdateoptionsstring}: fix/silence a few Perl::Critic warnings. + - x2goserver/bin/x2goupdateoptionsstring: typo fix in output message only. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index b248add8..6d7e20bb 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -218,7 +218,7 @@ sub handle_mode { my $extract = shift; if (!(defined ($mode))) { - print {*STDERR} "Invalid mode argument passed to mode selecttion helper, erroring out.\n"; + print {*STDERR} "Invalid mode argument passed to mode selection helper, erroring out.\n"; $error_detected = 1; } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 325121d9ce387385765f0b7809131c3699f4f263 Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 23 07:08:23 2020 +0100 X2Go/Server/Agent/NX/Options.pm: undef can't be referenced, so adjust/fix the comments. --- X2Go/Server/Agent/NX/Options.pm | 6 +++--- debian/changelog | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 90132422..2f620cd4 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -64,7 +64,7 @@ BEGIN { # SIMPLY JOIN THE LIST OR YOU WILL ADD A TRAILING COMMA! The port component # hash retains the colon separator. # -# On error, returns an undef reference. +# On error, returns undef. sub parse_options { my $ret = undef; my @intermediate = (); @@ -536,7 +536,7 @@ sub filter_option_modify { # # Returns a reference to a modified *copy* of the intermediate options array. # -# On error, returns a reference to undef. +# On error, returns undef. sub transform_intermediate { my $ret = undef; my $error_detected = 0; @@ -707,7 +707,7 @@ sub interpret_transform { # # Returns a reference to the modified, compacted intermediate options array. # -# On error, returns a reference to undef. +# On error, returns undef. sub compact_intermediate { my $ret = undef; my $error_detected = 0; diff --git a/debian/changelog b/debian/changelog index c3c973c2..8b161141 100644 --- a/debian/changelog +++ b/debian/changelog @@ -321,6 +321,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium not using a do block/do-while loop any longer. While the information provided there might be an interesting tidbit, it's not relevant to the code any longer and might actually confuse readers. + - X2Go/Server/Agent/NX/Options.pm: undef can't be referenced, so + adjust/fix the comments. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 420997423166209087f8b6bfee762647d3ddc42b Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 23 07:43:37 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: more typo fixes in output messages only. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8b161141..d5528dd6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -323,6 +323,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium code any longer and might actually confuse readers. - X2Go/Server/Agent/NX/Options.pm: undef can't be referenced, so adjust/fix the comments. + - x2goserver/bin/x2goupdateoptionsstring: more typo fixes in output + messages only. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index cb48325c..82577e74 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -223,12 +223,12 @@ sub handle_mode { } if ((!($error_detected)) && (!(defined ($transform)))) { - print {*STDERR} "Invalid transformation argument passed to mode selecttion helper, erroring out.\n"; + print {*STDERR} "Invalid transformation argument passed to mode selection helper, erroring out.\n"; $error_detected = 1; } if ((!($error_detected)) && (!(defined ($extract)))) { - print {*STDERR} "Invalid extract argument passed to mode selecttion helper, erroring out.\n"; + print {*STDERR} "Invalid extract argument passed to mode selection helper, erroring out.\n"; $error_detected = 1; } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit fd76f96dfda718585e88287c7f7f09996b2c8aa1 Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Nov 23 23:58:51 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: generalize code looping through program arguments and split out transformation operation into own subroutine. --- debian/changelog | 3 + x2goserver/bin/x2goupdateoptionsstring | 134 +++++++++++++++++++++++---------- 2 files changed, 97 insertions(+), 40 deletions(-) diff --git a/debian/changelog b/debian/changelog index d5528dd6..93fa7fc5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -325,6 +325,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium adjust/fix the comments. - x2goserver/bin/x2goupdateoptionsstring: more typo fixes in output messages only. + - x2goserver/bin/x2goupdateoptionsstring: generalize code looping through + program arguments and split out transformation operation into own + subroutine. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 82577e74..cb3470ad 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -326,6 +326,78 @@ sub handle_mode { return $ret; } +# Helper function applying a transformation to an intermediate options string. +# +# Takes an intermediate options string, a transformation string and a boolean +# value indicating whether debugging is turned on or off as its parameters. +# +# Returns a modified intermediate options string. +# +# On error, returns undef. +sub apply_transformation { + my $ret = undef; + my $error_detected = 0; + + my $intermediate = shift; + my $transform = shift; + my $debug = shift; + + if (!(defined ($intermediate))) { + print {*STDERR} "Invalid intermediate argument passed to transformation helper, erroring out.\n"; + $error_detected = 1; + } + + if ((!($error_detected)) && (!(defined ($transform)))) { + print {*STDERR} "Invalid transformation argument passed to transformation helper, erroring out.\n"; + $error_detected = 1; + } + + if ((!($error_detected)) && (!(defined ($debug)))) { + print {*STDERR} "Invalid debug argument passed to transformation helper, erroring out.\n"; + $error_detected = 1; + } + + my $interpreted_transform_ref = undef; + + if (!($error_detected)) { + if ($debug) { + print {*STDERR} 'Parsing current raw transformation option: ' . Dumper ($transform); + } + + $interpreted_transform_ref = X2Go::Server::Agent::NX::Options::interpret_transform ($transform); + + if (!(defined ($interpreted_transform_ref))) { + print {*STDERR} "Invalid transformation passed, aborting.\n"; + $error_detected = 1; + } + } + + if (!($error_detected)) { + my ($transform_mode, $sanitized_transform) = @{$interpreted_transform_ref}; + + if ($debug) { + print {*STDERR} 'Parsed raw transformation option into mode \'' . $transform_mode . '\' and sanitized transform option \'' . Dumper ($sanitized_transform) . "'\n"; + } + + $intermediate = X2Go::Server::Agent::NX::Options::transform_intermediate ($intermediate, $transform_mode, $sanitized_transform); + + if (!(defined ($intermediate))) { + print {*STDERR} "Error while transforming intermediate representation, aborting.\n"; + $error_detected = 1; + } + } + + if (!($error_detected)) { + if ($debug) { + print {*STDERR} 'Dumping transformed intermediate array: ' . Dumper ($intermediate); + } + + $ret = $intermediate; + } + + return $ret; +} + # Main function, no code outside of it shall be executed. # # Expects @ARGV to be passed in. @@ -453,44 +525,26 @@ sub Main { } } + my $out = undef; + if (!($error_detected)) { $found_separator |= (0 + shift (@{$sanitized_options})); $sanitized_options = shift (@{$sanitized_options}); @program_arguments = @{$sanitized_options}; - my $transformed = 0; - - while (defined (my $cur_transform = shift (@program_arguments))) { - $transformed = 1; + my $operation = 0; - if ($debug) { - print {*STDERR} 'Parsing current raw transformation option: ' . Dumper ($cur_transform); - } + while (defined (my $cur_arg = shift (@program_arguments))) { + $operation = 1; - my $interpreted_transform_ref = X2Go::Server::Agent::NX::Options::interpret_transform ($cur_transform); + if ((MODE_TRANSFORM_DATA)[1] == $mode) { + $intermediate = apply_transformation ($intermediate, $cur_arg, $debug); - if (!(defined ($interpreted_transform_ref))) { - print {*STDERR} "Invalid transformation passed, aborting.\n"; - $error_detected = 10; - last; - } - - my ($transform_mode, $sanitized_transform) = @{$interpreted_transform_ref}; - - if ($debug) { - print {*STDERR} 'Parsed raw transformation option into mode \'' . $transform_mode . '\' and sanitized transform option \'' . Dumper ($sanitized_transform) . "'\n"; - } - - $intermediate = X2Go::Server::Agent::NX::Options::transform_intermediate ($intermediate, $transform_mode, $sanitized_transform); - - if (!(defined ($intermediate))) { - print {*STDERR} "Error while transforming intermediate representation, aborting.\n"; - $error_detected = 11; - last; - } - - if ($debug) { - print {*STDERR} 'Dumping transformed intermediate array: ' . Dumper ($intermediate); + if (!(defined ($intermediate))) { + print {*STDERR} 'Unable to apply transformation "' . $cur_arg . '"' . ", aborting.\n"; + $error_detected = 10; + last; + } } # Skip pseudo-option, if necessary. @@ -498,7 +552,7 @@ sub Main { if (!(defined ($sanitized_options))) { pod2usage (-exitval => 'NOEXIT'); - $error_detected = 12; + $error_detected = 11; last; } elsif ($debug) { @@ -510,20 +564,20 @@ sub Main { @program_arguments = @{$sanitized_options}; } - if ((!($error_detected)) && (!($transformed))) { - print {*STDERR} "No transformation passed, aborting.\n"; - $error_detected = 13; + if ((!($error_detected)) && (!($operation))) { + print {*STDERR} "No operation carried out, aborting.\n"; + $error_detected = 12; } } - my $out = undef; - if (!($error_detected)) { - $out = X2Go::Server::Agent::NX::Options::intermediate_to_string ($intermediate); + if ((MODE_TRANSFORM_DATA)[1] == $mode) { + $out = X2Go::Server::Agent::NX::Options::intermediate_to_string ($intermediate); - if (!(defined ($out))) { - print {*STDERR} "Unable to transform intermediate back into string, aborting.\n"; - $error_detected = 14; + if (!(defined ($out))) { + print {*STDERR} "Unable to transform intermediate back into string, aborting.\n"; + $error_detected = 13; + } } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 0221e42cebe122d1668db40d0960d432aef72c19 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Nov 25 01:57:01 2020 +0100 {X2Go/Server/Agent/NX/Options.pm,x2goserver/bin/x2goupdateoptionsstring}: fatalize text coding errors. --- X2Go/Server/Agent/NX/Options.pm | 3 +++ debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 3 +++ 3 files changed, 8 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 97f8afb8..8a4c068b 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -35,6 +35,9 @@ use 5.012; # Enable UTF-8 encoded data in the script itself. use utf8; +# Make text coding issues fatal. +use warnings qw (FATAL utf8); + use base 'Exporter'; use English qw (-no_match_vars); use Storable qw (dclone); diff --git a/debian/changelog b/debian/changelog index 60ce2bfa..18632ee9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -331,6 +331,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - {X2Go/Server/Agent/NX/Options.pm, x2goserver/bin/x2goupdateoptionsstring}: enable Unicode handling, as far as possible. + - {X2Go/Server/Agent/NX/Options.pm, + x2goserver/bin/x2goupdateoptionsstring}: fatalize text coding errors. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 00a829c5..64baca08 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -35,6 +35,9 @@ use 5.012; # Enable UTF-8 encoded data in the script itself. use utf8; +# Make text coding issues fatal. +use warnings qw (FATAL utf8); + #use X2Go::Utils qw (is_int); use English qw (-no_match_vars); use Getopt::Long qw (GetOptionsFromArray); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit cc374ff78fc9830e8f7db714a7cfaee1c0143ca3 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Nov 26 07:05:21 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: sanitize/convert data in @ARGV. --- debian/changelog | 1 + x2goserver/bin/x2goupdateoptionsstring | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 18632ee9..3ebc9408 100644 --- a/debian/changelog +++ b/debian/changelog @@ -333,6 +333,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium far as possible. - {X2Go/Server/Agent/NX/Options.pm, x2goserver/bin/x2goupdateoptionsstring}: fatalize text coding errors. + - x2goserver/bin/x2goupdateoptionsstring: sanitize/convert data in @ARGV. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 64baca08..9494c465 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -46,8 +46,10 @@ use Storable qw (dclone); use Data::Dumper qw (Dumper); use X2Go::Server::Agent::NX::Options; use List::Util qw (max); +use Encode qw (encode decode); -exit (Main (@ARGV)); +# Convert data in ARGV. +exit (Main (map { decode ("UTF-8", $_, Encode::FB_CROAK); } @ARGV)); BEGIN { } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 74fe23368d747cb4e986f3827c03b94eb6e2acd3 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Nov 26 07:10:53 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: add non-functional extraction mode. Needs proper implementation. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 33 +++++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3ebc9408..a27759b1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -334,6 +334,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - {X2Go/Server/Agent/NX/Options.pm, x2goserver/bin/x2goupdateoptionsstring}: fatalize text coding errors. - x2goserver/bin/x2goupdateoptionsstring: sanitize/convert data in @ARGV. + - x2goserver/bin/x2goupdateoptionsstring: add non-functional extraction + mode. Needs proper implementation. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 9494c465..b0201629 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -45,6 +45,7 @@ use Pod::Usage; use Storable qw (dclone); use Data::Dumper qw (Dumper); use X2Go::Server::Agent::NX::Options; +use MIME::Base64 qw (encode_base64); use List::Util qw (max); use Encode qw (encode decode); @@ -523,7 +524,7 @@ sub Main { print {*STDERR} 'Dumping intermediate array after initial parsing: ' . Dumper ($intermediate); } - if ($compact) { + if (((MODE_EXTRACT_DATA)[1] == $mode) || ($compact)) { $intermediate = X2Go::Server::Agent::NX::Options::compact_intermediate ($intermediate); if (!(defined ($intermediate))) { @@ -557,13 +558,37 @@ sub Main { last; } } + elsif ((MODE_EXTRACT_DATA)[1] == $mode) { + my $extract = extract_data ($intermediate, $cur_arg, $debug); + + if (!(defined ($extract)) { + print {*STDERR} 'Unable to extract data for "' . $cur_arg . '"' . ", aborting.\n"; + $error_detected = 11; + } + else { + # Convert into bytes. + $bytes = encode ("UTF-8", $extract, Encode::FB_CROAK); + + # Encode the data. + my $base64 = base64_encode ($extract, q{}); + + if (!(defined ($out))) { + # Create it. + $out = $base64; + } + else { + # Otherwise, append and make sure to separate fields. + $out .= q{|} . $base64; + } + } + } # Skip pseudo-option, if necessary. $sanitized_options = sanitize_program_options (\@program_arguments, (!($found_separator))); if (!(defined ($sanitized_options))) { pod2usage (-exitval => 'NOEXIT'); - $error_detected = 11; + $error_detected = 12; last; } elsif ($debug) { @@ -577,7 +602,7 @@ sub Main { if ((!($error_detected)) && (!($operation))) { print {*STDERR} "No operation carried out, aborting.\n"; - $error_detected = 12; + $error_detected = 13; } } @@ -587,7 +612,7 @@ sub Main { if (!(defined ($out))) { print {*STDERR} "Unable to transform intermediate back into string, aborting.\n"; - $error_detected = 13; + $error_detected = 14; } } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 39d02690ca14de59bcc142248aeedfa77b37ec4a Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Nov 25 01:25:46 2020 +0100 {X2Go/Server/Agent/NX/Options.pm,x2goserver/bin/x2goupdateoptionsstring}: enable Unicode handling, as far as possible. --- X2Go/Server/Agent/NX/Options.pm | 6 ++++++ debian/changelog | 3 +++ x2goserver/bin/x2goupdateoptionsstring | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 2f620cd4..97f8afb8 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -29,6 +29,12 @@ package X2Go::Server::Agent::NX::Options; use strict; use warnings; +# Enable full Unicode handling, if possible. +use 5.012; + +# Enable UTF-8 encoded data in the script itself. +use utf8; + use base 'Exporter'; use English qw (-no_match_vars); use Storable qw (dclone); diff --git a/debian/changelog b/debian/changelog index 93fa7fc5..60ce2bfa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -328,6 +328,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/bin/x2goupdateoptionsstring: generalize code looping through program arguments and split out transformation operation into own subroutine. + - {X2Go/Server/Agent/NX/Options.pm, + x2goserver/bin/x2goupdateoptionsstring}: enable Unicode handling, as + far as possible. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index cb3470ad..00a829c5 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -29,6 +29,12 @@ use strict; use warnings; +# Enable full Unicode handling, if possible. +use 5.012; + +# Enable UTF-8 encoded data in the script itself. +use utf8; + #use X2Go::Utils qw (is_int); use English qw (-no_match_vars); use Getopt::Long qw (GetOptionsFromArray); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit e3c0c52d003967ec583fe664044b06449bd9c80a Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 29 06:46:24 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: fix syntax and strict mode errors. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index a27759b1..82572d4e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -336,6 +336,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/bin/x2goupdateoptionsstring: sanitize/convert data in @ARGV. - x2goserver/bin/x2goupdateoptionsstring: add non-functional extraction mode. Needs proper implementation. + - x2goserver/bin/x2goupdateoptionsstring: fix syntax and strict mode + errors. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index b0201629..69848a26 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -561,13 +561,13 @@ sub Main { elsif ((MODE_EXTRACT_DATA)[1] == $mode) { my $extract = extract_data ($intermediate, $cur_arg, $debug); - if (!(defined ($extract)) { + if (!(defined ($extract))) { print {*STDERR} 'Unable to extract data for "' . $cur_arg . '"' . ", aborting.\n"; $error_detected = 11; } else { # Convert into bytes. - $bytes = encode ("UTF-8", $extract, Encode::FB_CROAK); + my $bytes = encode ("UTF-8", $extract, Encode::FB_CROAK); # Encode the data. my $base64 = base64_encode ($extract, q{}); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 9a22f595d654da226c657a1425488210d0ec5e82 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 29 14:14:40 2020 +0100 X2Go/Server/Agent/NX/Options.pm: add extract_element subroutine, used to extract key-value pairs. This one will be exportable, too. Documentation to be done. --- X2Go/Server/Agent/NX/Options.pm | 59 ++++++++++++++++++++++++++++++++++++++++- debian/changelog | 3 +++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 5b0ac0fe..41725a48 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -43,7 +43,7 @@ use English qw (-no_match_vars); use Storable qw (dclone); our @EXPORT_OK = qw (MODE_INVALID MODE_ADD_UPDATE MODE_REMOVE - parse_options interpret_transform transform_intermediate intermediate_to_string compact_intermediate); + parse_options interpret_transform transform_intermediate extract_element intermediate_to_string compact_intermediate); # These are actually supposed to be enums, but since Perl doesn't have a @@ -674,6 +674,63 @@ sub transform_intermediate { return $ret; } +# Extracts entries from the intermediate options array. +# +# Expects an intermediate options reference as its first parameter, and the +# option-to-be-extracted as its parameter. +# +# This option can either be a full key-value pair, which is useful for testing +# for existence, or just a key, which is useful for extracting unknown, +# matching value(s). +# +# Returns a reference to a modified *copy* of the extracted elements. This is +# an array of hash references, with each hash containing one element. +# +# On error, returns undef. +sub extract_element { + my $ret = undef; + my $error_detected = 0; + + my $intermediate = shift; + my $option = shift; + + $error_detected = (!(validate_intermediate ($intermediate))); + + if (!($error_detected)) { + if (!(defined ($option))) { + print {*STDERR} "No or invalid option to extract passed, erroring out.\n"; + $error_detected = 1; + } + } + + my $work_option_key = undef; + my $work_option_value = undef; + + if (!($error_detected)) { + my $work_opt_kv = sanitize_workoption_filter ($option); + + if (!(defined ($work_opt_kv))) { + print {*STDERR} "Unable to split up working option into key and value pair, returning undef.\n"; + $error_detected = 1; + } + else { + $work_option_key = shift (@{$work_opt_kv}); + $work_option_value = shift (@{$work_opt_kv}); + } + } + + if (!($error_detected)) { + my $elements_left = @{$intermediate}; + + my @results = grep { filter_find_key ($work_option_key, $work_option_value, $_, --$elements_left) } @{$intermediate}; + + # Okay, got the results, now let's clone that. + $ret = dclone (\@results); + } + + return $ret; +} + # Helper function "interpreting" a transformation string. # # Takes the raw transformation string as its only parameter. diff --git a/debian/changelog b/debian/changelog index 6741b45a..6c473c2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -346,6 +346,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium that are not marked for export are internal and should not be used. Usually, that should implicitly be clear, but it doesn't hurt to be verbose with a disclaimer. + - X2Go/Server/Agent/NX/Options.pm: add extract_element subroutine, used to + extract key-value pairs. This one will be exportable, too. Documentation + to be done. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 03840dc1cef1f5f33e2252e9589af3318168e211 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 29 08:23:02 2020 +0100 X2Go/Server/Agent/NX/Options.pm: document that subroutines and constants that are not marked for export are internal and should not be used. Usually, that should implicitly be clear, but it doesn't hurt to be verbose with a disclaimer. --- X2Go/Server/Agent/NX/Options.pm | 5 +++++ debian/changelog | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index af165bfe..5b0ac0fe 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -940,6 +940,11 @@ identical to the original options string (assuming no errors occurred). If this is not the case, please report a bug. +Any subroutines and constants not marked as exportable are +B<explicitly not documented> and should be regarded as internal and +B<not be used>. +There is B<no> guarantee regarding their behavior or existence. + =head1 OPTIONS STRINGS B<X2Go/NX Agent> options strings are fully documented in diff --git a/debian/changelog b/debian/changelog index a7b01e0f..6741b45a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -342,6 +342,10 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium intermediate checking out into a separate subroutine. - X2Go/Server/Agent/NX/Options.pm: rename $options variable to $intermediate in intermediate_to_string () for internal consistency. + - X2Go/Server/Agent/NX/Options.pm: document that subroutines and constants + that are not marked for export are internal and should not be used. + Usually, that should implicitly be clear, but it doesn't hurt to be + verbose with a disclaimer. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 1be4e179571c47d6860055a68d64429f7b4bedaf Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 29 08:05:38 2020 +0100 X2Go/Server/Agent/NX/Options.pm: simplify error handling by splitting intermediate checking out into a separate subroutine. --- X2Go/Server/Agent/NX/Options.pm | 90 ++++++++++++++++++++--------------------- debian/changelog | 2 + 2 files changed, 47 insertions(+), 45 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 8a4c068b..b7ddcca3 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -214,6 +214,48 @@ sub parse_options { return $ret; } +# Takes an intermediate options string representation array reference(!) and +# checks its validity. +# Returns true, iff the array reference contains at least one element (since +# the terminating display port specifier is mandatory) and all elements are +# defined. +# Otherwise, returns false. +sub validate_intermediate { + my $ret = 1; + + my $intermediate = shift; + + if (!(defined ($intermediate))) { + print {*STDERR} "Invalid options reference passed to check function (undefined), returning false.\n"; + $ret = 0; + } + + if ($ret) { + if ('ARRAY' ne ref ($intermediate)) { + print {*STDERR} 'Invalid options reference type passed to check function (' . ref ($intermediate) . "), returning false.\n"; + $ret = 0; + } + } + + if ($ret) { + if (0 == scalar (@{$intermediate})) { + print {*STDERR} "Empty options array reference passed to check function, returning false.\n"; + $ret = 0; + } + } + + if ($ret) { + foreach my $entry (@{$intermediate}) { + if (!defined ($entry)) { + print {*STDERR} "Invalid options array reference passed to check function, at least one element is undefined, returning false.\n"; + $ret = 0; + } + } + } + + return $ret; +} + # Takes an intermediate options string representation array reference(!) and # returns a string. # This is essentially the opposite of parse_options. @@ -227,21 +269,7 @@ sub intermediate_to_string { my $options = shift; - if ('ARRAY' ne ref ($options)) { - print {*STDERR} 'Invalid options reference type passed (' . ref ($options) . "), returning undef.\n"; - $error_detected = 1; - } - - if (!($error_detected)) { - if (0 < scalar (@{$options})) { - foreach my $entry (@{$options}) { - if (!defined ($entry)) { - print {*STDERR} "Invalid options array passed, returning undef.\n"; - $error_detected = 1; - } - } - } - } + $error_detected = (!(validate_intermediate ($options))); if (!($error_detected)) { # Last entry should contain the display port part only. @@ -554,21 +582,7 @@ sub transform_intermediate { my $mode = shift; my $option = shift; - if ('ARRAY' ne ref ($intermediate)) { - print {*STDERR} 'Invalid options reference type passed (' . ref ($intermediate) . "), erroring out.\n"; - $error_detected = 1; - } - - if (!($error_detected)) { - if (0 < scalar (@{$intermediate})) { - foreach my $entry (@{$intermediate}) { - if (!defined ($entry)) { - print {*STDERR} "Invalid options array passed, erroring out.\n"; - $error_detected = 1; - } - } - } - } + $error_detected = (!(validate_intermediate ($intermediate))); if (!($error_detected)) { if (!(defined ($mode)) || (MODE_INVALID == $mode)) { @@ -724,21 +738,7 @@ sub compact_intermediate { my $intermediate = shift; - if ('ARRAY' ne ref ($intermediate)) { - print {*STDERR} 'Invalid options reference type passed (' . ref ($intermediate) . "), erroring out.\n"; - $error_detected = 1; - } - - if (!($error_detected)) { - if (0 < scalar (@{$intermediate})) { - foreach my $entry (@{$intermediate}) { - if (!defined ($entry)) { - print {*STDERR} "Invalid options array passed, erroring out.\n"; - $error_detected = 1; - } - } - } - } + $error_detected = (!(validate_intermediate ($intermediate))); if (!($error_detected)) { # First, save display number part. diff --git a/debian/changelog b/debian/changelog index 82572d4e..5494d6aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -338,6 +338,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium mode. Needs proper implementation. - x2goserver/bin/x2goupdateoptionsstring: fix syntax and strict mode errors. + - X2Go/Server/Agent/NX/Options.pm: simplify error handling by splitting + intermediate checking out into a separate subroutine. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit cfceb86cf447d3afd4ea259065f771dffa94e005 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 29 16:02:32 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: correctly use MIME::Base64. --- debian/changelog | 1 + x2goserver/bin/x2goupdateoptionsstring | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 6c473c2b..c2e44815 100644 --- a/debian/changelog +++ b/debian/changelog @@ -349,6 +349,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - X2Go/Server/Agent/NX/Options.pm: add extract_element subroutine, used to extract key-value pairs. This one will be exportable, too. Documentation to be done. + - x2goserver/bin/x2goupdateoptionsstring: correctly use MIME::Base64. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 69848a26..e29e44e7 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -570,7 +570,7 @@ sub Main { my $bytes = encode ("UTF-8", $extract, Encode::FB_CROAK); # Encode the data. - my $base64 = base64_encode ($extract, q{}); + my $base64 = MIME::Base64::encode_base64 ($extract, q{}); if (!(defined ($out))) { # Create it. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 1e81d805964933f9725ac896ffbaa97aa229321f Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 29 08:08:01 2020 +0100 X2Go/Server/Agent/NX/Options.pm: rename $options variable to $intermediate in intermediate_to_string () for internal consistency. --- X2Go/Server/Agent/NX/Options.pm | 8 ++++---- debian/changelog | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index b7ddcca3..af165bfe 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -267,17 +267,17 @@ sub intermediate_to_string { my $ret = undef; my $error_detected = 0; - my $options = shift; + my $intermediate = shift; - $error_detected = (!(validate_intermediate ($options))); + $error_detected = (!(validate_intermediate ($intermediate))); if (!($error_detected)) { # Last entry should contain the display port part only. # We can detect it through counting. - my $elements_left = @{$options}; + my $elements_left = @{$intermediate}; # Handle entries iteratively, merging them into one string. - foreach my $entry (@{$options}) { + foreach my $entry (@{$intermediate}) { --$elements_left; if (!defined ($entry)) { diff --git a/debian/changelog b/debian/changelog index 5494d6aa..a7b01e0f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -340,6 +340,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium errors. - X2Go/Server/Agent/NX/Options.pm: simplify error handling by splitting intermediate checking out into a separate subroutine. + - X2Go/Server/Agent/NX/Options.pm: rename $options variable to + $intermediate in intermediate_to_string () for internal consistency. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 354f6ad17dd766155059ae29abdb9bb9d957407a Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 29 16:43:40 2020 +0100 {X2Go/Server/Agent/NX/Options.pm,x2goserver/bin/x2goupdateoptionsstring}: explicitly use package foreign package names all across the code for consistency. --- X2Go/Server/Agent/NX/Options.pm | 4 +-- debian/changelog | 3 ++ x2goserver/bin/x2goupdateoptionsstring | 52 +++++++++++++++++----------------- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index 41725a48..ca22b1fa 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -616,7 +616,7 @@ sub transform_intermediate { if (!($error_detected)) { # Set return value to a *deep copy* of our original array. - $ret = dclone ($intermediate); + $ret = Storable::dclone ($intermediate); my $elements_left = @{$ret}; @@ -725,7 +725,7 @@ sub extract_element { my @results = grep { filter_find_key ($work_option_key, $work_option_value, $_, --$elements_left) } @{$intermediate}; # Okay, got the results, now let's clone that. - $ret = dclone (\@results); + $ret = Storable::dclone (\@results); } return $ret; diff --git a/debian/changelog b/debian/changelog index c1350481..291630de 100644 --- a/debian/changelog +++ b/debian/changelog @@ -353,6 +353,9 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/bin/x2goupdateoptionsstring: actually implement extraction mode. - x2goserver/bin/x2goupdateoptionsstring: don't encode/decode in-place. + - {X2Go/Server/Agent/NX/Options.pm, + x2goserver/bin/x2goupdateoptionsstring}: explicitly use package foreign + package names all across the code for consistency. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 9871c6b0..9e74479e 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -50,7 +50,7 @@ use List::Util qw (max); use Encode qw (encode decode); # Convert data in ARGV. -exit (Main (map { decode ("UTF-8", $_, (Encode::FB_CROAK | Encode::LEAVE_SRC)); } @ARGV)); +exit (Main (map { Encode::decode ("UTF-8", $_, (Encode::FB_CROAK | Encode::LEAVE_SRC)); } @ARGV)); BEGIN { } @@ -101,7 +101,7 @@ sub sanitize_program_options { } if (!($error_detected)) { - $args = dclone ($args); + $args = Storable::dclone ($args); ## no critic (ControlStructures::ProhibitCStyleForLoops) for (my $cur_arg = shift (@{$args}); defined ($cur_arg); $cur_arg = shift (@{$args})) { @@ -193,7 +193,7 @@ sub handle_mode_abbrev { if (!($error_detected)) { my $length = length ($mode); - if ($length < max (map { length ((&{$_}())[0]); } (MODES))) { + if ($length < List::Util::max (map { length ((&{$_}())[0]); } (MODES))) { foreach my $elem (MODES) { if (substr ((&{$elem}())[0], 0, $length) eq $mode) { if (!($found)) { @@ -373,7 +373,7 @@ sub apply_transformation { if (!($error_detected)) { if ($debug) { - print {*STDERR} 'Parsing current raw transformation option: ' . Dumper ($transform); + print {*STDERR} 'Parsing current raw transformation option: ' . Data::Dumper::Dumper ($transform); } $interpreted_transform_ref = X2Go::Server::Agent::NX::Options::interpret_transform ($transform); @@ -388,7 +388,7 @@ sub apply_transformation { my ($transform_mode, $sanitized_transform) = @{$interpreted_transform_ref}; if ($debug) { - print {*STDERR} 'Parsed raw transformation option into mode \'' . $transform_mode . '\' and sanitized transform option \'' . Dumper ($sanitized_transform) . "'\n"; + print {*STDERR} 'Parsed raw transformation option into mode \'' . $transform_mode . '\' and sanitized transform option \'' . Data::Dumper::Dumper ($sanitized_transform) . "'\n"; } $intermediate = X2Go::Server::Agent::NX::Options::transform_intermediate ($intermediate, $transform_mode, $sanitized_transform); @@ -401,7 +401,7 @@ sub apply_transformation { if (!($error_detected)) { if ($debug) { - print {*STDERR} 'Dumping transformed intermediate array: ' . Dumper ($intermediate); + print {*STDERR} 'Dumping transformed intermediate array: ' . Data::Dumper::Dumper ($intermediate); } $ret = $intermediate; @@ -457,7 +457,7 @@ sub extract_data { my $result = X2Go::Server::Agent::NX::Options::extract_element ($intermediate, $kv); - print {*STDERR} 'Dumping returned value, length ' . scalar (@{$result}) . ': ' . Dumper ($result); + print {*STDERR} 'Dumping returned value, length ' . scalar (@{$result}) . ': ' . Data::Dumper::Dumper ($result); if (!(defined ($result))) { print {*STDERR} "Unable to extract element, erroring out.\n"; @@ -468,7 +468,7 @@ sub extract_data { $error_detected = 1; if ($debug) { - print {*STDERR} 'Dumping returned value, length ' . scalar (@{$result}) . ': ' . Dumper ($result); + print {*STDERR} 'Dumping returned value, length ' . scalar (@{$result}) . ': ' . Data::Dumper::Dumper ($result); } } elsif (0 == scalar (@{$result})) { @@ -514,20 +514,20 @@ sub Main { my $mode_transform = 0; my $mode_extract = 0; my $mode_arg = q{}; - GetOptionsFromArray (\@program_arguments, 'help|?|h' => \$help, - 'man' => \$man, - 'debug|d' => \$debug, - 'compact|c' => \$compact, - 'transform|t' => \$mode_transform, - 'extract|e' => \$mode_extract, - 'mode|m=s' => \$mode_arg) or pod2usage (2); + Getopt::Long::GetOptionsFromArray (\@program_arguments, 'help|?|h' => \$help, + 'man' => \$man, + 'debug|d' => \$debug, + 'compact|c' => \$compact, + 'transform|t' => \$mode_transform, + 'extract|e' => \$mode_extract, + 'mode|m=s' => \$mode_arg) or Pod::Usage::pod2usage (2); if ($help) { - pod2usage (1); + Pod::Usage::pod2usage (1); } if ($man) { - pod2usage (-verbose => 2, -exitval => 3); + Pod::Usage::pod2usage (-verbose => 2, -exitval => 3); } my $mode = handle_mode ($mode_arg, $mode_transform, $mode_extract); @@ -546,7 +546,7 @@ sub Main { $sanitized_options = sanitize_program_options (\@program_arguments, (!($found_separator))); if (!(defined ($sanitized_options))) { - pod2usage (-exitval => 'NOEXIT'); + Pod::Usage::pod2usage (-exitval => 'NOEXIT'); $error_detected = 5; } } @@ -555,7 +555,7 @@ sub Main { if (!($error_detected)) { if ($debug) { - print {*STDERR} 'Sanitized program options string as: ' . Dumper ($sanitized_options); + print {*STDERR} 'Sanitized program options string as: ' . Data::Dumper::Dumper ($sanitized_options); } # The shift () operations here actually shift the outer array, not the @@ -583,7 +583,7 @@ sub Main { if (!($error_detected)) { if ($debug) { - print {*STDERR} 'Fetched options string as: ' . Dumper (\$options); + print {*STDERR} 'Fetched options string as: ' . Data::Dumper::Dumper (\$options); } $intermediate = X2Go::Server::Agent::NX::Options::parse_options ($options); @@ -598,15 +598,15 @@ sub Main { $sanitized_options = sanitize_program_options (\@program_arguments, (!($found_separator))); if (!(defined ($sanitized_options))) { - pod2usage (-exitval => 'NOEXIT'); + Pod::Usage::pod2usage (-exitval => 'NOEXIT'); $error_detected = 8; } } if (!($error_detected)) { if ($debug) { - print {*STDERR} 'Sanitized program options string as: ' . Dumper ($sanitized_options); - print {*STDERR} 'Dumping intermediate array after initial parsing: ' . Dumper ($intermediate); + print {*STDERR} 'Sanitized program options string as: ' . Data::Dumper::Dumper ($sanitized_options); + print {*STDERR} 'Dumping intermediate array after initial parsing: ' . Data::Dumper::Dumper ($intermediate); } if (((MODE_EXTRACT_DATA)[1] == $mode) || ($compact)) { @@ -617,7 +617,7 @@ sub Main { $error_detected = 9; } elsif ($debug) { - print {*STDERR} 'Dumping intermediate array after compacting: ' . Dumper ($intermediate); + print {*STDERR} 'Dumping intermediate array after compacting: ' . Data::Dumper::Dumper ($intermediate); } } } @@ -672,12 +672,12 @@ sub Main { $sanitized_options = sanitize_program_options (\@program_arguments, (!($found_separator))); if (!(defined ($sanitized_options))) { - pod2usage (-exitval => 'NOEXIT'); + Pod::Usage::pod2usage (-exitval => 'NOEXIT'); $error_detected = 12; last; } elsif ($debug) { - print {*STDERR} 'Sanitized program options string as: ' . Dumper ($sanitized_options); + print {*STDERR} 'Sanitized program options string as: ' . Data::Dumper::Dumper ($sanitized_options); } $found_separator |= (0 + shift (@{$sanitized_options})); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 3b08baf4c3a7bf2fa3c2d8be2b73608a830c7b75 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Dec 9 02:16:57 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: document mode selection and extraction mode. --- debian/changelog | 2 + x2goserver/bin/x2goupdateoptionsstring | 118 ++++++++++++++++++++++++++++++--- 2 files changed, 110 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 63931311..e7c9ca9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -358,6 +358,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium package names all across the code for consistency. - x2goserver/bin/x2goupdateoptionsstring: fix typos in documentation and reword misinterpreted-as-options section. + - x2goserver/bin/x2goupdateoptionsstring: document mode selection and + extraction mode. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 68ad7a24..f7c4a2d7 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -715,7 +715,7 @@ __END__ =head1 NAME -x2goupdateoptionsstring - X2Go Agent Options String Manipulator +x2goupdateoptionsstring - X2Go Agent Options String Manipulator and Extractor =head1 SYNOPSIS @@ -725,7 +725,9 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator =item B<x2goupdateoptionsstring> B<--man> -=item B<x2goupdateoptionsstring> [B<--compact>|B<-c>] [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... +=item B<x2goupdateoptionsstring> [<B<--mode>|B<-m>>[B<=>| ]B<t>[B<ransform>]|B<-t>] [B<--compact>|B<-c>] [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... + +=item B<x2goupdateoptionsstring> <B<--mode>|B<-m>>[B<=>| ]B<e>[B<xtract>]|B<-e> [B<--debug>|B<-d>] [B<-->] I<options_string> I<key>[B<=>I<value>] ... =back @@ -739,14 +741,23 @@ characters. A workaround for this has been proposed in https://github.com/Perl/perl5/issues/18305 . -B<x2goupdateoptionsstring> is a utility for manipulating options strings as -passed to B<X2Go/NX Agent>. +B<x2goupdateoptionsstring> is a utility for manipulating and extracting data +from options strings as passed to B<X2Go/NX Agent>. For more information about supported options strings, refer to the L<OPTIONS STRINGS section in the X2Go::Server::Agent::NX::Options documentation|X2Go::Server::Agent::NX::Options/OPTIONS STRINGS>. -Call it with optional flags, the options string as the first parameter and the -transformations to be carried out as additional parameters. +Currently, two modes are supported: + +=over + +=item Transform (default) + +Transformation mode is enabled by default if no mode has been explicitly +selected. + +Call this program with optional flags, the options string as the first +parameter and the transformations to be carried out as additional parameters. At least one additional parameter (i.e., a transformation) must be provided. Transformations are described here briefly, but also in the L<TRANSFORMATIONS section in the X2Go::Server::Agent::NX::Options @@ -770,6 +781,36 @@ B<->I<key>B<=>I<value>. Use the B<--compact> option to minimize the original options string, removing duplicated and empty entries. +Assuming no error happened, the resulting options string is written to +C<stdout>. + +=item Extract + +Extraction mode must be explicitly requested using the B<-e> or +<B<--mode>|B<-m>>[B<=>| ]B<e>[B<xtract>] flags. + +Call this program with optional flags, the options string as the first +parameter and key-value pairs to be extracted as additional parameters. +At least one additional parameter (i.e., a key-value pair to extract) must be +provided. + +A degenerated key-value pair without an explicit value can be used to test for +the existence of a key and extract its value at the same time. + +A full, proper key-value pair can be used to test for the existence of a +key-value pair exactly as provided. + +Assuming no error happened, the extracted key-value pairs will be written to +C<stdout>. +Each pair will be base64-encoded and, if multiple key-value pairs to extract +have been provided, delimited via C<pipe> characters (C<|>). + +Key-value pairs which haven't been found in the original options string, as +well as potentially an empty key-value pair, will be represented as empty +fields. + +=back + Refer to the L<OPTIONS PARSING section|/OPTIONS PARSING> for a description of when and how to terminate options passed to this program. @@ -789,11 +830,44 @@ Prints the manual page and exits. Enables noisy debug output. +=item B<-t> + +Shorthand for B<--mode=transform>. + +=item B<-e> + +Shorthand for B<--mode=extract>. + +=item <B<--mode>|B<-m>>[B<=>| ]I<mode string> + +Selects a specific program mode. + +Currently, the following mode strings are supported: + +=over + +=item * + +transform + +=item * + +extract + +=back + +Mode strings can be abbreviated, as long as the abbreviation is uniquely +selecting one mode exactly. + =item B<--compact>|B<-c> Remove duplicate and empty entries after the initial parsing. The order of arguments is preserved in a first-seen fashion. +This option is only available in B<transformation mode>. +It will be silently ignored in B<extraction mode>, as compaction is a +pre-requisite and done automatically during extraction. + =back =head2 OPTIONS PARSING @@ -802,10 +876,12 @@ You can terminate program options parsing via a standard double-dash (B<-->) pseudo-option. It is B<highly recommended> to always do so. -If you pass removal transformation operations, passing the options terminator -is B<mandatory>, even if no actual options are used. -Otherwise, transformation operations will be interpreted as options to the -program, which will almost certainly lead to an error. +If you pass removal transformation operations or an extraction key-value pair +starts with a dash (B<->), passing the options terminator is B<mandatory>, even +if no actual options are used. +Otherwise, transformation operations or extraction key-value pairs will be +interpreted as options to the program, which will almost certainly lead to an +error. For example, passing C<-clipboard> as a transformation operation without a previous options terminator will be interpreted as the option C<-c>, with the @@ -818,6 +894,8 @@ transformation operation was supposed to represent. =head1 EXAMPLES +=head2 TRANSFORMATIONS + For an options string such as nx/nx,clipboard=both,foo:50 @@ -861,6 +939,26 @@ C<x2goupdateoptionsstring '-c' '--' =back +=head2 EXTRACTIONS + +For an options string such as + + nx/nx,clipboard=both,foo=bar,-=-,,bar=baz,foo=oof:50 + +=over 2 + +Calling C<x2goupdateoptionsstring '-e' '--' +'nx/nx,clipboard=both,foo=bar,-=-,bar=baz,foo=oof,:50' 'foo'> shall return + + Zm9vPW9vZg== + +while calling C<x2goupdateoptionsstring '-e' '--' +'nx/nx,clipboard=both,foo=bar,-=-,bar=baz,foo=oof,:50' 'bar' '' '-'> shall return + + YmFyPWJheg==||LT0t + +=back + =head1 AUTHOR This manual has been written by -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 7219322e9d7ba220615cff36d70316f2ae0f5d14 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Dec 9 01:37:54 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: fix typos in documentation and reword misinterpreted-as-options section. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 291630de..63931311 100644 --- a/debian/changelog +++ b/debian/changelog @@ -356,6 +356,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - {X2Go/Server/Agent/NX/Options.pm, x2goserver/bin/x2goupdateoptionsstring}: explicitly use package foreign package names all across the code for consistency. + - x2goserver/bin/x2goupdateoptionsstring: fix typos in documentation and + reword misinterpreted-as-options section. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 9e74479e..68ad7a24 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -736,7 +736,7 @@ Due to parser oddities, breaking a line during an L<dummy|text> formatter code right after the separating pipe character will generate broken links. Make sure to only break it during the description or, generally, on space characters. -A workaround for this as been proposed in +A workaround for this has been proposed in https://github.com/Perl/perl5/issues/18305 . B<x2goupdateoptionsstring> is a utility for manipulating options strings as @@ -812,8 +812,9 @@ previous options terminator will be interpreted as the option C<-c>, with the rest of the string modified into C<-lipboard>. Since this program does not accept an option called C<-l>, it will terminate with an error. -Even then, this is certainly not what the original transformation operation -was supposed to represent. +Even if the program does not terminate with an error due to an unknown option +being supplied, a degradation into options is certainly not what the original +transformation operation was supposed to represent. =head1 EXAMPLES -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 1eb1ca4ffaeb6becf9c150fada11fb6f191b58b2 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 29 16:03:11 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: actually implement extraction mode. --- debian/changelog | 2 + x2goserver/bin/x2goupdateoptionsstring | 85 ++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/debian/changelog b/debian/changelog index c2e44815..b8ea67d2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -350,6 +350,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium extract key-value pairs. This one will be exportable, too. Documentation to be done. - x2goserver/bin/x2goupdateoptionsstring: correctly use MIME::Base64. + - x2goserver/bin/x2goupdateoptionsstring: actually implement extraction + mode. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index e29e44e7..1c5d6dd0 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -410,6 +410,91 @@ sub apply_transformation { return $ret; } +# Helper function extracting a key-value pair from an intermediate options +# string. +# +# Takes an intermediate options string, a key-value pair as a plain string to +# search for and a boolean value indicating whether debugging is turned on or +# off as its parameters. +# +# The provided key-value pair can actually either be a sole key, which is +# useful for checking if such a key exists and extracting its value, or a +# proper key-value pair with both components set, which can be used for +# checking for exactly this combination. +# +# Returns the extracted key-value pair as included in the intermediate options +# string as a plain string, or alternatively an empty string if the key-value +# pair was not found. +# +# On error, returns undef. +sub extract_data { + my $ret = undef; + my $error_detected = 0; + + my $intermediate = shift; + my $kv = shift; + my $debug = shift; + + if (!(defined ($intermediate))) { + print {*STDERR} "Invalid intermediate argument passed to extraction helper, erroring out.\n"; + $error_detected = 1; + } + + if ((!($error_detected)) && (!(defined ($kv)))) { + print {*STDERR} "Invalid key-value pair argument passed to extraction helper, erroring out.\n"; + $error_detected = 1; + } + + if ((!($error_detected)) && (!(defined ($debug)))) { + print {*STDERR} "Invalid debug argument passed to extraction helper, erroring out.\n"; + $error_detected = 1; + } + + if (!($error_detected)) { + if ($debug) { + print {*STDERR} 'Processing option to extract \'' . $kv . "'\n"; + } + + my $result = X2Go::Server::Agent::NX::Options::extract_element ($intermediate, $kv); + + print {*STDERR} 'Dumping returned value, length ' . scalar (@{$result}) . ': ' . Dumper ($result); + + if (!(defined ($result))) { + print {*STDERR} "Unable to extract element, erroring out.\n"; + $error_detected = 1; + } + elsif (1 < scalar (@{$result})) { + print {*STDERR} "More than one element returned during extraction, this is supposed to be impossible due to compaction.\n"; + $error_detected = 1; + + if ($debug) { + print {*STDERR} 'Dumping returned value, length ' . scalar (@{$result}) . ': ' . Dumper ($result); + } + } + elsif (0 == scalar (@{$result})) { + # No such combination found, this is fine. + # Return empty string. + $ret = q{}; + } + else { + # Everything went fine, go ahead and create the resulting string. + foreach my $entry (@{$result}) { + foreach my $key (keys (%{$entry})) { + $ret = $key; + + my $value = $entry->{$key}; + + if (defined ($value)) { + $ret .= '=' . $value; + } + } + } + } + } + + return $ret; +} + # Main function, no code outside of it shall be executed. # # Expects @ARGV to be passed in. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit db1fd92a629c9c16824aa3d8f0ea03d736eeee3e Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Nov 29 16:34:50 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: don't encode/decode in-place. --- debian/changelog | 1 + x2goserver/bin/x2goupdateoptionsstring | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index b8ea67d2..c1350481 100644 --- a/debian/changelog +++ b/debian/changelog @@ -352,6 +352,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/bin/x2goupdateoptionsstring: correctly use MIME::Base64. - x2goserver/bin/x2goupdateoptionsstring: actually implement extraction mode. + - x2goserver/bin/x2goupdateoptionsstring: don't encode/decode in-place. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 1c5d6dd0..9871c6b0 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -50,7 +50,7 @@ use List::Util qw (max); use Encode qw (encode decode); # Convert data in ARGV. -exit (Main (map { decode ("UTF-8", $_, Encode::FB_CROAK); } @ARGV)); +exit (Main (map { decode ("UTF-8", $_, (Encode::FB_CROAK | Encode::LEAVE_SRC)); } @ARGV)); BEGIN { } @@ -652,7 +652,7 @@ sub Main { } else { # Convert into bytes. - my $bytes = encode ("UTF-8", $extract, Encode::FB_CROAK); + my $bytes = Encode::encode ("UTF-8", $extract, (Encode::FB_CROAK | Encode::LEAVE_SRC)); # Encode the data. my $base64 = MIME::Base64::encode_base64 ($extract, q{}); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 3e4b3132b45c224122943278d9485591a62d83f9 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Dec 10 17:13:43 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: add base64 encode and decode helpers, add new --base64 parameter that enabled global use of base64. --- debian/changelog | 2 + x2goserver/bin/x2goupdateoptionsstring | 147 +++++++++++++++++++++++++++++---- 2 files changed, 133 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index 27afe320..061d90d7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -362,6 +362,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium extraction mode. - x2goserver/bin/x2goupdateoptionsstring: fix error handling for kv-pair extraction. + - x2goserver/bin/x2goupdateoptionsstring: add base64 encode and decode + helpers, add new --base64 parameter that enabled global use of base64. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index d05d290b..8ab92112 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -495,6 +495,64 @@ sub extract_data { return $ret; } +# Helper function encoding a string to its base64 form. +# +# Takes a string as its first and only parameter. +# +# Returns a base64-encoded representation of the original string. +# +# On error, returns undef. +sub encode_base64_internal { + my $ret = undef; + my $error_detected = 0; + + my $input = shift; + + if (!(defined ($input))) { + print {*STDERR} "Invalid input argument passed to base64 encode helper, erroring out.\n"; + $error_detected = 1; + } + + if (!($error_detected)) { + # Convert into bytes. + my $bytes = Encode::encode ("UTF-8", $input, (Encode::FB_CROAK | Encode::LEAVE_SRC)); + + # Encode the data. + $ret = MIME::Base64::encode_base64 ($bytes, q{}); + } + + return $ret; +} + +# Helper function decoding a base64-encoded string to its original form. +# +# Takes a string as its first and only parameter. +# +# Returns the original representation of the base64-encoded string. +# +# On error, returns undef. +sub decode_base64_internal { + my $ret = undef; + my $error_detected = 0; + + my $input = shift; + + if (!(defined ($input))) { + print {*STDERR} "Invalid input argument passed to base64 encode helper, erroring out.\n"; + $error_detected = 1; + } + + if (!($error_detected)) { + # Decode the data. + my $decoded = MIME::Base64::decode_base64 ($input); + + # Convert into string. + $ret = Encode::decode ("UTF-8", $decoded, (Encode::FB_CROAK | Encode::LEAVE_SRC)); + } + + return $ret; +} + # Main function, no code outside of it shall be executed. # # Expects @ARGV to be passed in. @@ -514,13 +572,15 @@ sub Main { my $mode_transform = 0; my $mode_extract = 0; my $mode_arg = q{}; + my $base64 = 0; Getopt::Long::GetOptionsFromArray (\@program_arguments, 'help|?|h' => \$help, 'man' => \$man, 'debug|d' => \$debug, 'compact|c' => \$compact, 'transform|t' => \$mode_transform, 'extract|e' => \$mode_extract, - 'mode|m=s' => \$mode_arg) or Pod::Usage::pod2usage (2); + 'mode|m=s' => \$mode_arg, + 'base64|b' => \$base64) or Pod::Usage::pod2usage (2); if ($help) { Pod::Usage::pod2usage (1); @@ -586,11 +646,27 @@ sub Main { print {*STDERR} 'Fetched options string as: ' . Data::Dumper::Dumper (\$options); } + if ($base64) { + my $decoded_options = decode_base64_internal ($options); + + if (!(defined ($options))) { + print {*STDERR} 'Unable to decode base64 representation of options string \'' . $options . "', aborting.\n"; + $error_detected = 7; + } + else { + if ($debug) { + print {*STDERR} 'Decoded options string from base64 to \'' . $decoded_options . "'.\n"; + } + + $options = $decoded_options; + } + } + $intermediate = X2Go::Server::Agent::NX::Options::parse_options ($options); if (!(defined ($intermediate))) { print {*STDERR} "Unable to parse options string, aborting.\n"; - $error_detected = 7; + $error_detected = 8; } } @@ -599,7 +675,7 @@ sub Main { if (!(defined ($sanitized_options))) { Pod::Usage::pod2usage (-exitval => 'NOEXIT'); - $error_detected = 8; + $error_detected = 9; } } @@ -614,7 +690,7 @@ sub Main { if (!(defined ($intermediate))) { print {*STDERR} "Unable to compact intermediate options representation, aborting.\n"; - $error_detected = 9; + $error_detected = 10; } elsif ($debug) { print {*STDERR} 'Dumping intermediate array after compacting: ' . Data::Dumper::Dumper ($intermediate); @@ -634,37 +710,60 @@ sub Main { while (defined (my $cur_arg = shift (@program_arguments))) { $operation = 1; + if ($base64) { + my $decoded_arg = decode_base64_internal ($cur_arg); + + if (!(defined ($decoded_arg))) { + print {*STDERR} 'Unable to decode base64 representation of argument \'' . $cur_arg . "', aborting.\n"; + $error_detected = 11; + last; + } + else { + if ($debug) { + print {*STDERR} 'Decoded current argument from base64 to \'' . $decoded_arg . "'.\n"; + } + + $cur_arg = $decoded_arg; + } + } + if ((MODE_TRANSFORM_DATA)[1] == $mode) { $intermediate = apply_transformation ($intermediate, $cur_arg, $debug); if (!(defined ($intermediate))) { print {*STDERR} 'Unable to apply transformation "' . $cur_arg . '"' . ", aborting.\n"; - $error_detected = 10; + $error_detected = 12; last; } } elsif ((MODE_EXTRACT_DATA)[1] == $mode) { - my $extract = extract_data ($intermediate, $cur_arg, $debug); + my $extract = extract_data ($intermediate, $cur_arg, $debug, $base64); if (!(defined ($extract))) { print {*STDERR} 'Unable to extract data for "' . $cur_arg . '"' . ", aborting.\n"; - $error_detected = 11; + $error_detected = 13; last; } else { - # Convert into bytes. - my $bytes = Encode::encode ("UTF-8", $extract, (Encode::FB_CROAK | Encode::LEAVE_SRC)); + my $extract_encoded = encode_base64_internal ($extract); - # Encode the data. - my $base64 = MIME::Base64::encode_base64 ($extract, q{}); + if (!(defined ($extract_encoded))) { + print {*STDERR} 'Unable to base64-encode extracted key-value pair \'' . $extract . "', aborting.\n"; + $error_detected = 14; + last; + } + + if ($debug) { + print {*STDERR} 'Base64-encoded extracted key-value pair to \'' . $extract_encoded . "'.\n"; + } if (!(defined ($out))) { # Create it. - $out = $base64; + $out = $extract_encoded; } else { # Otherwise, append and make sure to separate fields. - $out .= q{|} . $base64; + $out .= q{|} . $extract_encoded; } } } @@ -674,7 +773,7 @@ sub Main { if (!(defined ($sanitized_options))) { Pod::Usage::pod2usage (-exitval => 'NOEXIT'); - $error_detected = 12; + $error_detected = 15; last; } elsif ($debug) { @@ -688,7 +787,7 @@ sub Main { if ((!($error_detected)) && (!($operation))) { print {*STDERR} "No operation carried out, aborting.\n"; - $error_detected = 13; + $error_detected = 16; } } @@ -698,7 +797,23 @@ sub Main { if (!(defined ($out))) { print {*STDERR} "Unable to transform intermediate back into string, aborting.\n"; - $error_detected = 14; + $error_detected = 17; + } + elsif ($base64) { + my $out_encoded = encode_base64_internal ($out); + + if (!(defined ($out_encoded))) { + print {*STDERR} 'Unable to base64-encode output string \'' . $out . "', aborting.\n"; + $error_detected = 18; + last; + } + else { + if ($debug) { + print {*STDERR} 'Base64-encoded output string to \'' . $out_encoded . "'.\n"; + } + + $out = $out_encoded; + } } } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 8c4d220530a15cf563db281a65892337a7fe1698 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Dec 10 17:49:37 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: extend extraction example for how to check for full key-value pair combinations. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4b4311a5..1e150270 100644 --- a/debian/changelog +++ b/debian/changelog @@ -366,6 +366,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium helpers, add new --base64 parameter that enabled global use of base64. - X2Go/Server/Agent/NX/Options.pm: actually check for a specific value in the kv-pair filter function if so specified. Big oops. + - x2goserver/bin/x2goupdateoptionsstring: extend extraction example for + how to check for full key-value pair combinations. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 8ab92112..7bacf990 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -1069,9 +1069,10 @@ Calling C<x2goupdateoptionsstring '-e' '--' Zm9vPW9vZg== while calling C<x2goupdateoptionsstring '-e' '--' -'nx/nx,clipboard=both,foo=bar,-=-,bar=baz,foo=oof,:50' 'bar' '' '-'> shall return +'nx/nx,clipboard=both,foo=bar,-=-,bar=baz,foo=oof,:50' 'bar' '' +'clipboard=none' '-'> shall return - YmFyPWJheg==||LT0t + YmFyPWJheg==|||LT0t =back -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 8258288e10bb8a17e104aa99a3b7ad5e86c1169b Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Dec 10 04:12:30 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: fix error handling for kv-pair extraction. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 1 + 2 files changed, 3 insertions(+) diff --git a/debian/changelog b/debian/changelog index e7c9ca9c..27afe320 100644 --- a/debian/changelog +++ b/debian/changelog @@ -360,6 +360,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium reword misinterpreted-as-options section. - x2goserver/bin/x2goupdateoptionsstring: document mode selection and extraction mode. + - x2goserver/bin/x2goupdateoptionsstring: fix error handling for kv-pair + extraction. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index f7c4a2d7..d05d290b 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -649,6 +649,7 @@ sub Main { if (!(defined ($extract))) { print {*STDERR} 'Unable to extract data for "' . $cur_arg . '"' . ", aborting.\n"; $error_detected = 11; + last; } else { # Convert into bytes. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 4a7da0acdc9a9b0b455d3f837a55e67ded611705 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Dec 10 17:24:41 2020 +0100 X2Go/Server/Agent/NX/Options.pm: actually check for a specific value in the kv-pair filter function if so specified. Big oops. --- X2Go/Server/Agent/NX/Options.pm | 12 ++++++++---- debian/changelog | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index ca22b1fa..c4010d54 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -492,16 +492,20 @@ sub filter_find_key { || (0 == $elems_left)); if (!($skip)) { - # We don't care about the values this time around. - my $option_key = q{}; + my $option_value = q{}; foreach my $tmp_option_key (keys (%{$cur_option})) { $option_key = $tmp_option_key; + $option_value = $cur_option->{$tmp_option_key}; } if ($option_key eq $needle_key) { - $ret = 1; + # If we were asked to check for a specific value, i.e., if it defined, + # do that, too. + if ((!(defined ($needle_value))) || ($option_value eq $needle_value)) { + $ret = 1; + } } } @@ -639,7 +643,7 @@ sub transform_intermediate { # another dependency and option strings are pretty small, so don't # overoptimize here. ## no critic (BuiltinFunctions::ProhibitBooleanGrep) - if (scalar (grep { filter_find_key ($work_option_key, $work_option_value, $_, --$elements_left) } @{$ret})) { + if (scalar (grep { filter_find_key ($work_option_key, undef, $_, --$elements_left) } @{$ret})) { ## critic (BuiltinFunctions::ProhibitBooleanGrep) # Such an option already exists, we'll modify all occurrences. $elements_left = @{$ret}; diff --git a/debian/changelog b/debian/changelog index 061d90d7..4b4311a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -364,6 +364,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium extraction. - x2goserver/bin/x2goupdateoptionsstring: add base64 encode and decode helpers, add new --base64 parameter that enabled global use of base64. + - X2Go/Server/Agent/NX/Options.pm: actually check for a specific value in + the kv-pair filter function if so specified. Big oops. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 315ddc33e263edcffc9c8896e121a64c227b19bb Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Dec 10 17:51:05 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: document the new base6 pseudo-mode. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1e150270..a2fe85e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -368,6 +368,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium the kv-pair filter function if so specified. Big oops. - x2goserver/bin/x2goupdateoptionsstring: extend extraction example for how to check for full key-value pair combinations. + - x2goserver/bin/x2goupdateoptionsstring: document the new base64 + pseudo-mode. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 7bacf990..2572600f 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -841,9 +841,9 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator and Extractor =item B<x2goupdateoptionsstring> B<--man> -=item B<x2goupdateoptionsstring> [<B<--mode>|B<-m>>[B<=>| ]B<t>[B<ransform>]|B<-t>] [B<--compact>|B<-c>] [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... +=item B<x2goupdateoptionsstring> [<B<--mode>|B<-m>>[B<=>| ]B<t>[B<ransform>]|B<-t>] [B<--compact>|B<-c>] [B<--base64>|B<-b>] [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... -=item B<x2goupdateoptionsstring> <B<--mode>|B<-m>>[B<=>| ]B<e>[B<xtract>]|B<-e> [B<--debug>|B<-d>] [B<-->] I<options_string> I<key>[B<=>I<value>] ... +=item B<x2goupdateoptionsstring> <B<--mode>|B<-m>>[B<=>| ]B<e>[B<xtract>]|B<-e> [B<--base64>|B<-b>] [B<--debug>|B<-d>] [B<-->] I<options_string> I<key>[B<=>I<value>] ... =back @@ -863,6 +863,13 @@ For more information about supported options strings, refer to the L<OPTIONS STRINGS section in the X2Go::Server::Agent::NX::Options documentation|X2Go::Server::Agent::NX::Options/OPTIONS STRINGS>. +For full support of options string, which are allowed (but not recommended) to +include binary data, the special B<--base64>|B<-b> switch is supported. +If given, all arguments other than flags must be base64-encoded (making it +possible to pass binary data via shells, for instance). +The program's output, minus potentially debugging messages, will also be +base64-encoded. + Currently, two modes are supported: =over @@ -984,6 +991,21 @@ This option is only available in B<transformation mode>. It will be silently ignored in B<extraction mode>, as compaction is a pre-requisite and done automatically during extraction. +=item B<--base64>|B<-b> + +Enable a special full base64 mode. + +Any binary data can be given and output by this program in this mode, even +when operating on a shell. + +Input parameters must always be provided encoded in base64 form. + +Likewise, the program will always output data encoded in a base64 form. +Since key-value pairs returned in extraction mode are already base64-encoded +and delimited with a character that is not legal in the base64 encoding, this +flag does not modify the extraction's mode output (i.e., you will B<not> have +to decode the output data twice). + =back =head2 OPTIONS PARSING -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit d49f15abb50ec1368cb61d70719931f57422db3b Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Dec 16 08:30:42 2020 +0100 X2Go/Server/Agent/NX/Options.pm: document key-value pair extraction. --- X2Go/Server/Agent/NX/Options.pm | 56 +++++++++++++++++++++++++++++++++++++++++ debian/changelog | 1 + 2 files changed, 57 insertions(+) diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm index c4010d54..ed81781a 100644 --- a/X2Go/Server/Agent/NX/Options.pm +++ b/X2Go/Server/Agent/NX/Options.pm @@ -945,6 +945,45 @@ X2Go::Server::Agent::NX::Options - NX Options modification module $intermediate = X2Go::Server::Agent::NX::Options::transform_intermediate ($intermediate, $transform_mode, $sanitized_transform); die "Error while transforming intermediate representation, aborting.\n" unless (defined ($intermediate)); + # Extract the "more" key. + my $extract = X2Go::Server::Agent::NX::Options::extract_element ($intermediate, q{more}); + + # Error handling ... + die "Unable to extract 'more' key from intermediate, aborting.\n" unless defined ($extract); + + # Fetching multiple elements could be fine, for instance when the intermediate is not compact. + # Hence, this need not be a general error, but we'll treat it as one here. + die "Extract operation returned more than one element, this should not happen with a compacted intermediate, aborting.\n" if (1 < scalar (@{$extract})); + + # Likewise, it would be okay for the resul to be empty, but not for us right here. + die "Extract operation returned no result, aborting.\n" if (1 > scalar (@{$extract})); + + my $extracted_kv = q{}; + + # Now, get the actual data in a presentable form. + foreach my $entry (@{$extract}) { + foreach my $key (%{$entry}) { + $extracted_kv .= $key; + my $value = $entry->{$key}; + if (defined ($value)) { + $extracted_kv .= q{=} . $value; + } + last; + } + last; + } + + # At this point, $extracted_kv should be "more=data". + + # Yet again, but this time extracting a key which does not exist. + $extract = X2Go::Server::Agent::NX::Options::extract_element ($intermediate, q{nosuchey}); + + # Error handling ... + die "Unable to extract 'nosuchkey' key from intermediate, aborting.\n" unless defined ($extract); + + # Should be empty. + die "Extract operation returned a result, aborting.\n" if (0 < scalar (@{$extract})); + # Transform back into a string. my $out = X2Go::Server::Agent::NX::Options::intermediate_to_string ($intermediate); @@ -975,6 +1014,23 @@ To remove redundant or empty entries within an options string, pass the I<intermediate> to C<compact_intermediate>. This is entirely optional and can be done at any step, as long as an I<intermediate> is available. +If you intend to extract data, it is recommended, but not necessary, to +compact the I<intermediate> first. + +In order to extract key-value pairs, supply the I<intermediate> and a +I<key-value pair> to extract to C<extract_element>. +Its result will be either undefined on error, or a reference to an array +consisting of references to hashes. +Each hash contains exactly one key-value pair. + +The same approach using C<extract_element> can be used to check for the +existence of either keys or full key-value pairs. +If the returned array is empty, no such element exists. + +For compacted I<intermediates>, each extraction operation returns an array +with at most one hash reference entry. +Non-compacted I<intermediates> can contain a key multiple times, so no +guarantee regarding the result's magnitude can be given. To parse transformations, pass each one to C<interpret_transform>. Refer to L</TRANSFORMATIONS> for documentation on transformation formats. diff --git a/debian/changelog b/debian/changelog index 007631dc..36af5adf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -372,6 +372,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium pseudo-mode. - x2goserver/bin/x2goupdateoptionsstring: an equal sign or space character is mandatory after the -m or --mode switch. + - X2Go/Server/Agent/NX/Options.pm: document key-value pair extraction. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 09b5078c4a253f77e7252e43bf0404f02e5af649 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Dec 16 09:53:00 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: fix some Perl::Critic warnings. --- debian/changelog | 1 + x2goserver/bin/x2goupdateoptionsstring | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 36af5adf..9a23c5dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -373,6 +373,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/bin/x2goupdateoptionsstring: an equal sign or space character is mandatory after the -m or --mode switch. - X2Go/Server/Agent/NX/Options.pm: document key-value pair extraction. + - x2goserver/bin/x2goupdateoptionsstring: fix some Perl::Critic warnings. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 48c9d17f..9da8d6ec 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -50,7 +50,7 @@ use List::Util qw (max); use Encode qw (encode decode); # Convert data in ARGV. -exit (Main (map { Encode::decode ("UTF-8", $_, (Encode::FB_CROAK | Encode::LEAVE_SRC)); } @ARGV)); +exit (Main (map { Encode::decode ('UTF-8', $_, (Encode::FB_CROAK | Encode::LEAVE_SRC)); } @ARGV)); BEGIN { } @@ -485,7 +485,7 @@ sub extract_data { my $value = $entry->{$key}; if (defined ($value)) { - $ret .= '=' . $value; + $ret .= q{=} . $value; } } } @@ -731,7 +731,7 @@ sub Main { $intermediate = apply_transformation ($intermediate, $cur_arg, $debug); if (!(defined ($intermediate))) { - print {*STDERR} 'Unable to apply transformation "' . $cur_arg . '"' . ", aborting.\n"; + print {*STDERR} 'Unable to apply transformation "' . $cur_arg . q{"} . ", aborting.\n"; $error_detected = 12; last; } @@ -740,7 +740,7 @@ sub Main { my $extract = extract_data ($intermediate, $cur_arg, $debug, $base64); if (!(defined ($extract))) { - print {*STDERR} 'Unable to extract data for "' . $cur_arg . '"' . ", aborting.\n"; + print {*STDERR} 'Unable to extract data for "' . $cur_arg . q{"} . ", aborting.\n"; $error_detected = 13; last; } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 3ccb18eda1d0ef037f2ee4e61daa3db32d0615b8 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Dec 10 17:55:13 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: an equal sign or space character is mandatory after the -m or --mode switch. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index a2fe85e3..007631dc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -370,6 +370,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium how to check for full key-value pair combinations. - x2goserver/bin/x2goupdateoptionsstring: document the new base64 pseudo-mode. + - x2goserver/bin/x2goupdateoptionsstring: an equal sign or space character + is mandatory after the -m or --mode switch. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 2572600f..48c9d17f 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -841,9 +841,9 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator and Extractor =item B<x2goupdateoptionsstring> B<--man> -=item B<x2goupdateoptionsstring> [<B<--mode>|B<-m>>[B<=>| ]B<t>[B<ransform>]|B<-t>] [B<--compact>|B<-c>] [B<--base64>|B<-b>] [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... +=item B<x2goupdateoptionsstring> [<B<--mode>|B<-m>><B<=>| >B<t>[B<ransform>]|B<-t>] [B<--compact>|B<-c>] [B<--base64>|B<-b>] [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... -=item B<x2goupdateoptionsstring> <B<--mode>|B<-m>>[B<=>| ]B<e>[B<xtract>]|B<-e> [B<--base64>|B<-b>] [B<--debug>|B<-d>] [B<-->] I<options_string> I<key>[B<=>I<value>] ... +=item B<x2goupdateoptionsstring> <B<--mode>|B<-m>><B<=>| >B<e>[B<xtract>]|B<-e> [B<--base64>|B<-b>] [B<--debug>|B<-d>] [B<-->] I<options_string> I<key>[B<=>I<value>] ... =back @@ -910,7 +910,7 @@ C<stdout>. =item Extract Extraction mode must be explicitly requested using the B<-e> or -<B<--mode>|B<-m>>[B<=>| ]B<e>[B<xtract>] flags. +<B<--mode>|B<-m>><B<=>| >B<e>[B<xtract>] flags. Call this program with optional flags, the options string as the first parameter and key-value pairs to be extracted as additional parameters. @@ -961,7 +961,7 @@ Shorthand for B<--mode=transform>. Shorthand for B<--mode=extract>. -=item <B<--mode>|B<-m>>[B<=>| ]I<mode string> +=item <B<--mode>|B<-m>><B<=>| >I<mode string> Selects a specific program mode. -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 6a1db5094aa6facdef6eaf61c0976c56757e6333 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Dec 27 07:43:38 2020 +0100 x2goserver/bin/x2goupdateoptionsstring: encode/decode to/from shell locale. --- debian/changelog | 2 ++ x2goserver/bin/x2goupdateoptionsstring | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9a23c5dd..9b39beab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -374,6 +374,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium is mandatory after the -m or --mode switch. - X2Go/Server/Agent/NX/Options.pm: document key-value pair extraction. - x2goserver/bin/x2goupdateoptionsstring: fix some Perl::Critic warnings. + - x2goserver/bin/x2goupdateoptionsstring: encode/decode to/from shell + locale. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2goupdateoptionsstring index 9da8d6ec..75c9ccca 100755 --- a/x2goserver/bin/x2goupdateoptionsstring +++ b/x2goserver/bin/x2goupdateoptionsstring @@ -48,9 +48,21 @@ use X2Go::Server::Agent::NX::Options; use MIME::Base64 qw (encode_base64); use List::Util qw (max); use Encode qw (encode decode); +use Encode::Locale; + +# Set up automatic encoding. +if (-t STDIN) { + binmode STDIN, ":encoding(console_in)"; +} +if (-t STDOUT) { + binmode STDOUT, ":encoding(console_out)"; +} +if (-t STDERR) { + binmode STDERR, ":encoding(console_out)"; +} # Convert data in ARGV. -exit (Main (map { Encode::decode ('UTF-8', $_, (Encode::FB_CROAK | Encode::LEAVE_SRC)); } @ARGV)); +exit (Main (map { Encode::decode (locale => $_, (Encode::FB_CROAK | Encode::LEAVE_SRC)); } @ARGV)); BEGIN { } @@ -515,7 +527,7 @@ sub encode_base64_internal { if (!($error_detected)) { # Convert into bytes. - my $bytes = Encode::encode ("UTF-8", $input, (Encode::FB_CROAK | Encode::LEAVE_SRC)); + my $bytes = Encode::encode (locale => $input, (Encode::FB_CROAK | Encode::LEAVE_SRC)); # Encode the data. $ret = MIME::Base64::encode_base64 ($bytes, q{}); @@ -547,7 +559,7 @@ sub decode_base64_internal { my $decoded = MIME::Base64::decode_base64 ($input); # Convert into string. - $ret = Encode::decode ("UTF-8", $decoded, (Encode::FB_CROAK | Encode::LEAVE_SRC)); + $ret = Encode::decode (locale => $decoded, (Encode::FB_CROAK | Encode::LEAVE_SRC)); } return $ret; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 50a0f102b5734d2efaa234a237c76902fd128710 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Dec 27 18:10:01 2020 +0100 x2goserver/Makefile: rename x2goupdateoptionsstring to x2gooptionsstring. --- debian/changelog | 2 ++ x2goserver/Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 364807c4..ac4fd5b6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -378,6 +378,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium locale. - x2goserver/bin: rename x2goupdateoptionsstring to x2gooptionsstring. It's not just modifying it any longer. + - x2goserver/Makefile: rename x2goupdateoptionsstring to + x2gooptionsstring. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/Makefile b/x2goserver/Makefile index 9a53a015..d597272e 100755 --- a/x2goserver/Makefile +++ b/x2goserver/Makefile @@ -26,7 +26,7 @@ BIN_SCRIPTS=$(shell cd bin && echo *) SBIN_SCRIPTS=$(shell cd sbin && echo *) LIB_FILES=$(shell cd lib && echo *) FEATURE_SCRIPTS=$(shell cd share/x2gofeature.d && echo *.features) -POD_SCRIPTS=sbin/x2gocleansessions.8 bin/x2goupdateoptionsstring.1 +POD_SCRIPTS=sbin/x2gocleansessions.8 bin/x2gooptionsstring.1 man_pages = `cd man && find * -type f` -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit ea00c887061e83268cfe81a3c0fdfad86da2bcb6 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Dec 27 18:11:41 2020 +0100 debian/x2goserver.install: rename x2goupdateoptionsstring to x2gooptionsstring. --- debian/changelog | 1 + debian/x2goserver.install | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 3626af96..de7b61db 100644 --- a/debian/changelog +++ b/debian/changelog @@ -398,6 +398,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium the module as part of core. * debian/x2goserver.install: + Install bin/x2goupdateoptionsstring. + + Rename x2goupdateoptionsstring to x2gooptionsstring. * debian/rules: + Export and pass down LIBDIR. + Fix standalone make call by specifying PREFIX, NXLIBDIR and LIBDIR diff --git a/debian/x2goserver.install b/debian/x2goserver.install index e1524cce..f28d1f0a 100644 --- a/debian/x2goserver.install +++ b/debian/x2goserver.install @@ -24,7 +24,7 @@ usr/bin/x2gosuspend-session usr/bin/x2goterminate-session usr/bin/x2goumount-session usr/bin/x2goumount_session -usr/bin/x2goupdateoptionsstring +usr/bin/x2gooptionsstring usr/bin/x2goversion usr/lib/x2go/x2go* usr/sbin/x2go* -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 319d4cd90919892cb27b97fc5174db93adebb527 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Dec 27 18:10:41 2020 +0100 debian/x2goserver.manpages: rename x2goupdateoptionsstring to x2gooptionsstring. --- debian/changelog | 1 + debian/x2goserver.manpages | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index ac4fd5b6..3626af96 100644 --- a/debian/changelog +++ b/debian/changelog @@ -385,6 +385,7 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium * debian/x2goserver.manpages: + Install x2gocleansessions man page. + Install x2goupdateoptionsstring man page. + + Rename x2goupdateoptionsstring to x2gooptionsstring. * x2goserver.spec: + Install new x2goisint wrapper. + Install section 1 man pages. diff --git a/debian/x2goserver.manpages b/debian/x2goserver.manpages index 84daaa31..b58465f1 100644 --- a/debian/x2goserver.manpages +++ b/debian/x2goserver.manpages @@ -23,5 +23,5 @@ debian/tmp/usr/share/man/man8/x2gosuspend-session.8* debian/tmp/usr/share/man/man8/x2goterminate-session.8* debian/tmp/usr/share/man/man8/x2goumount-session.8* debian/tmp/usr/share/man/man8/x2goumount_session.8* -debian/tmp/usr/share/man/man1/x2goupdateoptionsstring.1* +debian/tmp/usr/share/man/man1/x2gooptionsstring.1* debian/tmp/usr/share/man/man8/x2goversion.8* -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit ed617885d4d3d31de71954e43b9aaf12b4ba20bf Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Dec 27 17:28:44 2020 +0100 x2goserver/bin: rename x2goupdateoptionsstring to x2gooptionsstring. It's not just modifying it any longer. --- debian/changelog | 2 ++ x2goserver/bin/{x2goupdateoptionsstring => x2gooptionsstring} | 0 2 files changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index 37edbe2c..364807c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -376,6 +376,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/bin/x2goupdateoptionsstring: fix some Perl::Critic warnings. - x2goserver/bin/x2goupdateoptionsstring: encode/decode to/from shell locale. + - x2goserver/bin: rename x2goupdateoptionsstring to x2gooptionsstring. + It's not just modifying it any longer. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2goupdateoptionsstring b/x2goserver/bin/x2gooptionsstring similarity index 100% rename from x2goserver/bin/x2goupdateoptionsstring rename to x2goserver/bin/x2gooptionsstring -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 8560fd6686ac33082c8cf2a6ae0a66a7b63d9464 Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Dec 27 09:37:39 2020 +0100 x2goserver.spec: add dependency upon perl(Encode::Locale) for older distros. Others ship the module as part of core. --- debian/changelog | 2 ++ x2goserver.spec | 3 +++ 2 files changed, 5 insertions(+) diff --git a/debian/changelog b/debian/changelog index 9b39beab..37edbe2c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -389,6 +389,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium sed. + X2Go KDrive package has been renamed to xorg-x11-server-x2gokdrive to be in line with general RPM package names. + + Add dependency upon perl(Encode::Locale) for older distros. Others ship + the module as part of core. * debian/x2goserver.install: + Install bin/x2goupdateoptionsstring. * debian/rules: diff --git a/x2goserver.spec b/x2goserver.spec index 186d967e..57cc91c0 100644 --- a/x2goserver.spec +++ b/x2goserver.spec @@ -130,6 +130,9 @@ Requires: perl(File::BaseDir) Requires: perl(Config::Simple) Requires: perl(Switch) +%if ( ! 0%{?fedora} ) && ( ( 0%{?rhel} && 0%{?rhel} < 8 ) || ( 0%{?suse_version} && 0%{?suse_version} < 1500 ) ) +Requires: perl(Encode::Locale) +%endif Requires: xkeyboard-config -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 08aa5e67a3809c424866cb0fdb5949a61f22a86e Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Dec 27 18:12:35 2020 +0100 x2goserver/bin/x2gooptionsstring: rename x2goupdateoptionsstring to x2gooptionsstring. --- debian/changelog | 2 ++ x2goserver/bin/x2gooptionsstring | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index de7b61db..16966f97 100644 --- a/debian/changelog +++ b/debian/changelog @@ -380,6 +380,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium It's not just modifying it any longer. - x2goserver/Makefile: rename x2goupdateoptionsstring to x2gooptionsstring. + - x2goserver/bin/x2gooptionsstring: rename x2goupdateoptionsstring to + x2gooptionsstring. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/bin/x2gooptionsstring b/x2goserver/bin/x2gooptionsstring index 75c9ccca..303af2da 100755 --- a/x2goserver/bin/x2gooptionsstring +++ b/x2goserver/bin/x2gooptionsstring @@ -843,19 +843,19 @@ __END__ =head1 NAME -x2goupdateoptionsstring - X2Go Agent Options String Manipulator and Extractor +x2gooptionsstring - X2Go Agent Options String Manipulator and Extractor =head1 SYNOPSIS =over -=item B<x2goupdateoptionsstring> B<--help>|B<-h>|B<-?> +=item B<x2gooptionsstring> B<--help>|B<-h>|B<-?> -=item B<x2goupdateoptionsstring> B<--man> +=item B<x2gooptionsstring> B<--man> -=item B<x2goupdateoptionsstring> [<B<--mode>|B<-m>><B<=>| >B<t>[B<ransform>]|B<-t>] [B<--compact>|B<-c>] [B<--base64>|B<-b>] [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... +=item B<x2gooptionsstring> [<B<--mode>|B<-m>><B<=>| >B<t>[B<ransform>]|B<-t>] [B<--compact>|B<-c>] [B<--base64>|B<-b>] [B<--debug>|B<-d>] [B<-->] I<options_string> [B<+>]|B<->I<key>[B<=>I<value>] ... -=item B<x2goupdateoptionsstring> <B<--mode>|B<-m>><B<=>| >B<e>[B<xtract>]|B<-e> [B<--base64>|B<-b>] [B<--debug>|B<-d>] [B<-->] I<options_string> I<key>[B<=>I<value>] ... +=item B<x2gooptionsstring> <B<--mode>|B<-m>><B<=>| >B<e>[B<xtract>]|B<-e> [B<--base64>|B<-b>] [B<--debug>|B<-d>] [B<-->] I<options_string> I<key>[B<=>I<value>] ... =back @@ -869,8 +869,8 @@ characters. A workaround for this has been proposed in https://github.com/Perl/perl5/issues/18305 . -B<x2goupdateoptionsstring> is a utility for manipulating and extracting data -from options strings as passed to B<X2Go/NX Agent>. +B<x2gooptionsstring> is a utility for manipulating and extracting data from +options strings as passed to B<X2Go/NX Agent>. For more information about supported options strings, refer to the L<OPTIONS STRINGS section in the X2Go::Server::Agent::NX::Options documentation|X2Go::Server::Agent::NX::Options/OPTIONS STRINGS>. @@ -1052,22 +1052,22 @@ For an options string such as =over 2 -calling C<x2goupdateoptionsstring '--' 'nx/nx,clipboard=both,foo:50' +calling C<x2gooptionsstring '--' 'nx/nx,clipboard=both,foo:50' '-clipboard'> shall return nx/nx,foo:50 -while calling C<x2goupdateoptionsstring '--' 'nx/nx,clipboard=both,foo:50' +while calling C<x2gooptionsstring '--' 'nx/nx,clipboard=both,foo:50' '-clipboard=server'> shall return nx/nx,clipboard=both,foo:50 -Calling C<x2goupdateoptionsstring '--' 'nx/nx,clipboard=both,foo:50' 'bar'> +Calling C<x2gooptionsstring '--' 'nx/nx,clipboard=both,foo:50' 'bar'> shall return nx/nx,clipboard=both,foo,bar:50 -and calling C<x2goupdateoptionsstring '--' 'nx/nx,clipboard=both,foo:50' +and calling C<x2gooptionsstring '--' 'nx/nx,clipboard=both,foo:50' '+-bar' 'foo=gulp' '-clipboard=client'> shall return nx/nx,clipboard=both,foo=gulp,-bar:50 @@ -1082,7 +1082,7 @@ For an options string such as you can get a compacted version by cheating a bit and providing a transformation which will certainly be a no-operation using -C<x2goupdateoptionsstring '-c' '--' +C<x2gooptionsstring '-c' '--' 'nx/nx,clipboard=both,foo=bar,bar=baz,,foo=oof,:50' '-'>, which shall return nx/nx,clipboard=both,foo=oof,bar=baz:50 @@ -1097,12 +1097,12 @@ For an options string such as =over 2 -Calling C<x2goupdateoptionsstring '-e' '--' +Calling C<x2gooptionsstring '-e' '--' 'nx/nx,clipboard=both,foo=bar,-=-,bar=baz,foo=oof,:50' 'foo'> shall return Zm9vPW9vZg== -while calling C<x2goupdateoptionsstring '-e' '--' +while calling C<x2gooptionsstring '-e' '--' 'nx/nx,clipboard=both,foo=bar,-=-,bar=baz,foo=oof,:50' 'bar' '' 'clipboard=none' '-'> shall return -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git