Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package qore-yaml-module for openSUSE:Factory checked in at 2021-11-23 22:10:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qore-yaml-module (Old) and /work/SRC/openSUSE:Factory/.qore-yaml-module.new.1895 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qore-yaml-module" Tue Nov 23 22:10:26 2021 rev:7 rq:928311 version:0.7.0+qore1.0.10 Changes: -------- --- /work/SRC/openSUSE:Factory/qore-yaml-module/qore-yaml-module.changes 2021-08-01 21:51:35.475239328 +0200 +++ /work/SRC/openSUSE:Factory/.qore-yaml-module.new.1895/qore-yaml-module.changes 2021-11-23 22:12:38.918465529 +0100 @@ -1,0 +2,8 @@ +Thu Oct 28 09:42:24 UTC 2021 - Ferdinand Thiessen <r...@fthiessen.de> + +- Update to version 0.7.0 for Qore 1.0.10 + * Fixed module namespace paths + * Fixed deserializing string values + * Fixed handling serialization errors in YAML-RPC responses + +------------------------------------------------------------------- Old: ---- module-yaml-release-0.9.15.tar.gz New: ---- module-yaml-release-1.0.10.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qore-yaml-module.spec ++++++ --- /var/tmp/diff_new_pack.TjAzLt/_old 2021-11-23 22:12:39.378464007 +0100 +++ /var/tmp/diff_new_pack.TjAzLt/_new 2021-11-23 22:12:39.382463995 +0100 @@ -15,7 +15,7 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # -%define qore_version 0.9.15 +%define qore_version 1.0.10 %define src_name module-yaml-release-%{qore_version} %define module_api %(qore --latest-module-api 2>/dev/null) Name: qore-yaml-module @@ -36,7 +36,7 @@ BuildRequires: libtool BuildRequires: libyaml-devel BuildRequires: qore -BuildRequires: qore-devel >= 0.9.0 +BuildRequires: qore-devel >= %{qore_version} Requires: qore-module(abi)%{?_isa} = %{module_api} Suggests: %{name}-doc = %{version} @@ -61,7 +61,7 @@ %build autoreconf -fi %configure \ -%ifarch x86_64 ppc64 ppc64le s390x +%ifarch x86_64 ppc64 ppc64le s390x aarch64 --enable-64bit \ %endif --disable-debug ++++++ module-yaml-release-0.9.15.tar.gz -> module-yaml-release-1.0.10.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/.gitignore new/module-yaml-release-1.0.10/.gitignore --- old/module-yaml-release-0.9.15/.gitignore 2021-05-07 15:25:07.000000000 +0200 +++ new/module-yaml-release-1.0.10/.gitignore 2021-07-31 17:12:28.000000000 +0200 @@ -19,6 +19,7 @@ *~ *.lo *.la +/build autom4te.cache/ m4/ src/.deps/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/.gitlab-ci.yml new/module-yaml-release-1.0.10/.gitlab-ci.yml --- old/module-yaml-release-0.9.15/.gitlab-ci.yml 2021-05-07 15:25:07.000000000 +0200 +++ new/module-yaml-release-1.0.10/.gitlab-ci.yml 2021-07-31 17:12:28.000000000 +0200 @@ -1,21 +1,42 @@ stages: - test -test: - stage: test - image: $CI_REGISTRY/infrastructure/qore-test-base/qore-test-base:5.0 +default: tags: - docker-exec - variables: - REPO_NAME: module-yaml - script: + before_script: - | curl "https://api.github.com/repos/qorelanguage/${REPO_NAME}/statuses/${CI_COMMIT_SHA}" \ -X POST -u omusil24:${GITHUB_ACCESS_TOKEN} -H "Content-Type: application/json" \ -d "{\"state\": \"pending\", \"context\": \"${REPO_NAME}\", \"description\": \"Gitlab CI\", \"target_url\": \"${CI_JOB_URL}\"}" + - set +e + +variables: + REPO_NAME: module-yaml + +test-ubuntu: + stage: test + image: $CI_REGISTRY/infrastructure/qore-test-base/qore-test-base:develop + script: + - | + if test/docker_test/test-ubuntu.sh; then + curl "https://api.github.com/repos/qorelanguage/${REPO_NAME}/statuses/${CI_COMMIT_SHA}" \ + -X POST -u omusil24:${GITHUB_ACCESS_TOKEN} -H "Content-Type: application/json" \ + -d "{\"state\": \"success\", \"context\": \"${REPO_NAME}\", \"description\": \"Gitlab CI\", \"target_url\": \"${CI_JOB_URL}\"}" + exit 0 + else + curl "https://api.github.com/repos/qorelanguage/${REPO_NAME}/statuses/${CI_COMMIT_SHA}" \ + -X POST -u omusil24:${GITHUB_ACCESS_TOKEN} -H "Content-Type: application/json" \ + -d "{\"state\": \"failure\", \"context\": \"${REPO_NAME}\", \"description\": \"Gitlab CI\", \"target_url\": \"${CI_JOB_URL}\"}" + exit 1 + fi + +test-alpine: + stage: test + image: $CI_REGISTRY/infrastructure/qore-test-base/qore-test-base:develop-alpine + script: - | - set +e - if test/docker_test/test.sh; then + if test/docker_test/test-alpine.sh; then curl "https://api.github.com/repos/qorelanguage/${REPO_NAME}/statuses/${CI_COMMIT_SHA}" \ -X POST -u omusil24:${GITHUB_ACCESS_TOKEN} -H "Content-Type: application/json" \ -d "{\"state\": \"success\", \"context\": \"${REPO_NAME}\", \"description\": \"Gitlab CI\", \"target_url\": \"${CI_JOB_URL}\"}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/CMakeLists.txt new/module-yaml-release-1.0.10/CMakeLists.txt --- old/module-yaml-release-0.9.15/CMakeLists.txt 2021-05-07 15:25:07.000000000 +0200 +++ new/module-yaml-release-1.0.10/CMakeLists.txt 2021-07-31 17:12:28.000000000 +0200 @@ -51,7 +51,7 @@ docs/mainpage.doxygen.tmpl ) -add_library(${module_name} SHARED ${CPP_SRC} ${QPP_SOURCES} ${CPP_SRC}) +add_library(${module_name} MODULE ${CPP_SRC} ${QPP_SOURCES} ${CPP_SRC}) if (WIN32 AND MINGW AND MSYS) target_compile_definitions(${module_name} PUBLIC BUILDING_DLL) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/configure.ac new/module-yaml-release-1.0.10/configure.ac --- old/module-yaml-release-0.9.15/configure.ac 2021-05-07 15:25:07.000000000 +0200 +++ new/module-yaml-release-1.0.10/configure.ac 2021-07-31 17:12:28.000000000 +0200 @@ -519,9 +519,9 @@ return fi - AC_MSG_CHECKING([for qore include files]) + AC_MSG_CHECKING([for qore include files in $a]) # try to find include files - if test "$a" = "/"; then + if test "$a" = "/" -o -z "$a" ; then inc=/usr/include else inc=$a/include diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/docs/mainpage.doxygen.tmpl new/module-yaml-release-1.0.10/docs/mainpage.doxygen.tmpl --- old/module-yaml-release-0.9.15/docs/mainpage.doxygen.tmpl 2021-05-07 15:25:07.000000000 +0200 +++ new/module-yaml-release-1.0.10/docs/mainpage.doxygen.tmpl 2021-07-31 17:12:28.000000000 +0200 @@ -4,21 +4,28 @@ @section yamlintro Introduction - The yaml module provides <a href="http://www.yaml.org">YAML</a> functionality to Qore, allowing qore programs to read and write information in %YAML syntax. + The yaml module provides <a href="http://www.yaml.org">YAML</a> functionality to Qore, allowing qore programs to + read and write information in %YAML syntax. -This module is released under a choice of two licenses: + This module is released under a choice of two licenses: - <a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL 2.1</a> - MIT (see COPYING.MIT in the source distribution for more information) . - The module is tagged as such in the module's header (meaning it can be loaded unconditionally regardless of how the %Qore library was initialized). + The module is tagged as such in the module's header (meaning it can be loaded unconditionally regardless of how + the %Qore library was initialized). Like all Qore components, the yaml module is thread-safe. The underlying %YAML functionality is provided by <a href="http://pyyaml.org/wiki/LibYAML">libyaml</a>. User modules implementing the following HTTP-based protocols using YAML for data serialization are included: - - YAML-RPC: similar to JSON-RPC but using YAML-serialized data (<a href="../../YamlRpcClient/html/index.html">YamlRpcClient</a>, <a href="../../YamlRpcHandler/html/index.html">YamlRpcHandler</a>) - - DataStream: allows for data streaming with HTTP 1.1 chunked data transfers where each chunk is a unique data entity (<a href="../../DataStreamUtil/html/index.html">DataStreamUtil</a>, <a href="../../DataStreamClient/html/index.html">DataStreamClient</a>, <a href="../../DataStreamRequestHandler/html/index.html">DataStreamRequestHandler</a>) + - YAML-RPC: similar to JSON-RPC but using YAML-serialized data + (<a href="../../YamlRpcClient/html/index.html">YamlRpcClient</a>, + <a href="../../YamlRpcHandler/html/index.html">YamlRpcHandler</a>) + - DataStream: allows for data streaming with HTTP 1.1 chunked data transfers where each chunk is a unique data + entity (<a href="../../DataStreamUtil/html/index.html">DataStreamUtil</a>, + <a href="../../DataStreamClient/html/index.html">DataStreamClient</a>, + <a href="../../DataStreamRequestHandler/html/index.html">DataStreamRequestHandler</a>) Also included with the binary yaml module: - <a href="../../DataStreamUtil/html/index.html">DataStreamUtil user module</a> @@ -73,16 +80,34 @@ |!QoreType|!YAML Tag|!Qore Example|!YAML Example|!Notes |int|\c !!int|\c 300|\c 300|direct serialization - |float|\c !!float|\c 3.5|\c 3.5|direct serialization; infinity is serialized as <tt>\@inf\@</tt>, "not a number" as <tt>\@nan\@</tt> - |number|\c !number|\c 3.5|<tt>3.5n{128}</tt>|String serialization in scientific notation (for brevity) with the number appended with an \c "n"; the number is serialized so that no precision is lost.<br><br>Infinity is serialized as <tt>\@inf\@n{128}</tt>, "not a number" as <tt>\@nan\@n{128}</tt><br><br>The precision is appended to the string in curly brackets (ex: \"1.1n{128}" means the number <tt>1.1</tt> with 128 bits of precision)<br><br>This tag is a custom tag used only by Qore to serialize Qore arbitrary-precision numeric values with YAML - |string|\c !!str|\c "hello"|\c "hello"|YAML strings are enclosed in double-quotes, and libyaml will perform escaping as necessary to form a proper YAML string + |float|\c !!float|\c 3.5|\c 3.5|direct serialization; infinity is serialized as <tt>\@inf\@</tt>, "not a number" \ + as <tt>\@nan\@</tt> + |number|\c !number|\c 3.5|<tt>3.5n{128}</tt>|String serialization in scientific notation (for brevity) with the \ + number appended with an \c "n"; the number is serialized so that no precision is lost.<br><br>Infinity is \ + serialized as <tt>\@inf\@n{128}</tt>, "not a number" as <tt>\@nan\@n{128}</tt><br><br>The precision is \ + appended to the string in curly brackets (ex: \"1.1n{128}" means the number <tt>1.1</tt> with 128 bits of \ + precision)<br><br>This tag is a custom tag used only by Qore to serialize Qore arbitrary-precision numeric \ + values with YAML + |string|\c !!str|\c "hello"|\c "hello"|YAML strings are enclosed in double-quotes, and libyaml will perform \ + escaping as necessary to form a proper YAML string |bool|\c !!bool|\c True|\c true|direct serialization to \c true and \c false - |date (relative)|\c !duration|\c P2M3DT10H14u|\c P2M3DT10H14u|Relative date/time values (durations) are serialized with Qore's <a href="http://en.wikipedia.org/wiki/ISO_8601#Durations">ISO-8601</a>-based format.<br><br>This tag is a custom tag used only by Qore to serialize Qore relative date/time values with YAML - |date (absolute)|\c !!timestamp|\c 2010-05-05T15:35:02.100|\c 2010-05-05T15:35:02.1+02:00|Absolute date/time values are serialized with YAML's <a href="http://yaml.org/type/timestamp.html">timestamp</a> format.<br><br>Note that qore date/time values without an explicit time zone are assumed to be in the local time zone.<br><br>When converting a YAML timestamp to a Qore date, because Qore supports only up to microsecond resolution in date/time values, any digits after microseconds are lost. + |date (relative)|\c !duration|\c P2M3DT10H14u|\c P2M3DT10H14u|Relative date/time values (durations) are \ + serialized with Qore's \ + <a href="http://en.wikipedia.org/wiki/ISO_8601#Durations">ISO-8601</a>-based format.<br><br>This tag is a \ + custom tag used only by Qore to serialize Qore relative date/time values with YAML + |date (absolute)|\c !!timestamp|\c 2010-05-05T15:35:02.100|\c 2010-05-05T15:35:02.1+02:00|Absolute date/time \ + values are serialized with YAML's <a href="http://yaml.org/type/timestamp.html">timestamp</a> \ + format.<br><br>Note that qore date/time values without an explicit time zone are assumed to be in the local \ + time zone.<br><br>When converting a YAML timestamp to a Qore date, because Qore supports only up to \ + microsecond resolution in date/time values, any digits after microseconds are lost. |NOTHING|\c !!null|\c NOTHING|\c null|direct serialization - |NULL|\c !!null or \c !sqlnull|\c NULL|\c null or \c !sqlnull|without @ref @ref Qore::YAML::EmitSqlNull "EmitSqlNull", serialization to YAML null, just like \c NOTHING; will be deserialized as \c NOTHING, with @ref Qore::YAML::EmitSqlNull "EmitSqlNull" will be deserialized to \c NULL. + |NULL|\c !!null or \c !sqlnull|\c NULL|\c null or \c !sqlnull|without \ + @ref Qore::YAML::EmitSqlNull "EmitSqlNull", serialization to YAML null, just like \c NOTHING; will be \ + deserialized as \c NOTHING, with @ref Qore::YAML::EmitSqlNull "EmitSqlNull" will be deserialized to \c NULL. |list|\c !!seq|\c (1, 2, "three")|\c [1, 2, "three"]|direct serialization - |hash|\c !!map|\c ("key" : 1, "other" : 2.0, "data" : "three")|\c {key: 1, other: 2.0, data: "three"}|direct serialization, although qore will maintain key order as well even though this property is only defined for an ordered map + |hash|\c !!map|\c ("key" : 1, "other" : 2.0, "data" : "three")|\c {key: 1, other: 2.0, data: "three"}|direct \ + serialization, although qore will maintain key order as well even though this property is only defined for \ + an ordered map @section yamlreleasenotes Release Notes @@ -90,6 +115,8 @@ - fixed a bug deserializing implicit string values in some cases (<a href="https://github.com/qorelanguage/qore/issues/4241">issue 4241</a>) + - fixed a bug where serialization errors in YAML-RPC responses would cause a confusing response to be returned + (<a href="https://github.com/qorelanguage/qore/issues/4194">issue 4194</a>) - implemented support for serializing connection objects (<a href="https://github.com/qorelanguage/qore/issues/3696">issue 3696</a>) - fixed parsing XML in XML encoded responses @@ -109,51 +136,70 @@ - fixed a bug where strings with invalid encodings were being emitted as-is in exception strings (<a href="https://github.com/qorelanguage/qore/issues/3394">issue 3394</a>) - - improved the description for the \c DESERIALIZATION-ERROR exception for non-deserializable message bodies from HTTP servers with error responses (<a href="https://github.com/qorelanguage/qore/issues/1033">issue 1033</a>) - - added the \c YamlRpcConnection class to the <a href="../../YamlRpcClient/html/index.html">YamlRpcClient</a> module - - updated the <a href="../../DataStreamClient/html/index.html">DataStreamClient</a> module for complex types and new internal RestClient API changes (<a href="https://github.com/qorelanguage/qore/issues/2073">issue 2073</a>) + - improved the description for the \c DESERIALIZATION-ERROR exception for non-deserializable message bodies from + HTTP servers with error responses (<a href="https://github.com/qorelanguage/qore/issues/1033">issue 1033</a>) + - added the \c YamlRpcConnection class to the <a href="../../YamlRpcClient/html/index.html">YamlRpcClient</a> + module + - updated the <a href="../../DataStreamClient/html/index.html">DataStreamClient</a> module for complex types and + new internal RestClient API changes (<a href="https://github.com/qorelanguage/qore/issues/2073">issue 2073</a>) - updated the <a href="../../DataStreamUtil/html/index.html">DataStreamUtil</a> module for complex types - - fixed a bug deserializing single-quoted strings; also serialized \c "!number" values will always include the tag to avoid - potential future ambiguity (<a href="https://github.com/qorelanguage/qore/issues/2343">issue 2343</a>) - - improved argument error messages with RPC calls in the <a href="../../YamlRpcHandler/html/index.html">YamlRpcHandler</a> module (<a href="https://github.com/qorelanguage/qore/issues/2573">issue 2573</a>) + - fixed a bug deserializing single-quoted strings; also serialized \c "!number" values will always include the tag + to avoid potential future ambiguity (<a href="https://github.com/qorelanguage/qore/issues/2343">issue 2343</a>) + - improved argument error messages with RPC calls in the + <a href="../../YamlRpcHandler/html/index.html">YamlRpcHandler</a> module + (<a href="https://github.com/qorelanguage/qore/issues/2573">issue 2573</a>) @subsection yaml051 yaml Module Version 0.5.1 - <a href="../../DataStreamClient/html/index.html">DataStreamClient</a> update: - - fixed bugs handling chunked non-DataStream messages (<a href="https://github.com/qorelanguage/qore/issues/1438">issue 1438</a>) + - fixed bugs handling chunked non-DataStream messages + (<a href="https://github.com/qorelanguage/qore/issues/1438">issue 1438</a>) - <a href="../../DataStreamUtil/html/index.html">DataStreamUtil</a> update: - - fixed bugs handling chunked non-DataStream messages (<a href="https://github.com/qorelanguage/qore/issues/1438">issue 1438</a>) + - fixed bugs handling chunked non-DataStream messages + (<a href="https://github.com/qorelanguage/qore/issues/1438">issue 1438</a>) @subsection yaml05 yaml Module Version 0.5 <b>New Features and Bug Fixes</b> - - new user modules for DataStream protocol support: YAML-encoded HTTP chunked transfers where each chunk is a unique data entity + - new user modules for DataStream protocol support: YAML-encoded HTTP chunked transfers where each chunk is a + unique data entity - <a href="../../DataStreamClient/html/index.html">DataStreamClient user module</a> - <a href="../../DataStreamRequestHandler/html/index.html">DataStreamRequestHandler user module</a> - <a href="../../DataStreamUtil/html/index.html">DataStreamUtil user module</a> - - user modules moved to top-level qore module directory from version-specific module directory since they are valid for multiple versions of qore - - date/time values (yaml \c !!timestamp type) are now always returned in the current time zone locale so that time zone rules can be applied to deserialized dates; previously time zone information was always lost which could cause errors when performing date arithmetic on deserialized yaml dates - - fixed bugs deserializing canonically-encoded YAML strings; arbitrary-precision numeric values were deserialized with their precision values ignored and floating point +/-inf were deserialized as zero - - deprecated old camel-case names and implemented new function names confirming to the standard naming convention for functions + - user modules moved to top-level qore module directory from version-specific module directory since they are + valid for multiple versions of qore + - date/time values (yaml \c !!timestamp type) are now always returned in the current time zone locale so that + time zone rules can be applied to deserialized dates; previously time zone information was always lost which + could cause errors when performing date arithmetic on deserialized yaml dates + - fixed bugs deserializing canonically-encoded YAML strings; arbitrary-precision numeric values were deserialized + with their precision values ignored and floating point +/-inf were deserialized as zero + - deprecated old camel-case names and implemented new function names confirming to the standard naming convention + for functions @subsection yaml04 yaml Module Version 0.4 <b>New Features and Bug Fixes</b> - - fixed a problem serializing and deserializing 0-length durations; they were serialized as \c "P" and then deserialized as a string; now they are serialized as \c "P0D" and deserialized correctly as a zero-length duration + - fixed a problem serializing and deserializing 0-length durations; they were serialized as \c "P" and then + deserialized as a string; now they are serialized as \c "P0D" and deserialized correctly as a zero-length + duration - enhanced the YamlRpcHandler module for more flexible logging - added the MIT license as a source license option @subsection yaml03 yaml Module Version 0.3 <b>New Features and Bug Fixes</b> - - fixed a problem where an exception was not raised with invalid YAML input when parsing, instead NOTHING was returned - - fixed a problem deserializing integers; the number was converted to a C++ double (floating-point type) first, causing precision to be lost with large numbers + - fixed a problem where an exception was not raised with invalid YAML input when parsing, instead NOTHING was + returned + - fixed a problem deserializing integers; the number was converted to a C++ double (floating-point type) first, + causing precision to be lost with large numbers - added support for Qore's new number type when compiled with Qore 0.8.6+ - added support for serializing special floating point numbers (nan as <tt>\@nan\@</tt>, inf as <tt>\@inf\@</tt>) @subsection yaml02 yaml Module Version 0.2 <b>New Features and Bug Fixes</b> - - fixed a problem with deserializing untagged and not double quoted integer and floating-point 0 and 0.0; they were incorrectly deserialized as strings - - added additional information to the exception when a scalar value cannot be serialized (normally this happens when a string has an encoding error) + - fixed a problem with deserializing untagged and not double quoted integer and floating-point 0 and 0.0; they + were incorrectly deserialized as strings + - added additional information to the exception when a scalar value cannot be serialized (normally this happens + when a string has an encoding error) */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/qlib/DataStreamClient.qm new/module-yaml-release-1.0.10/qlib/DataStreamClient.qm --- old/module-yaml-release-0.9.15/qlib/DataStreamClient.qm 2021-05-07 15:25:07.000000000 +0200 +++ new/module-yaml-release-1.0.10/qlib/DataStreamClient.qm 2021-07-31 17:12:28.000000000 +0200 @@ -718,13 +718,15 @@ decodeError(rmd.arg, \info); throw rmd.err, rmd.desc, rmd.arg; } - throw "DATASTREAM-CLIENT-RECEIVE-ERROR", sprintf("HTTP status code %d received: message: %y", rhdr.status_code, rhdr.status_message), rhdr + ("body": rmd); + throw "DATASTREAM-CLIENT-RECEIVE-ERROR", sprintf("HTTP status code %d received: message: %y", + rhdr.status_code, rhdr.status_message), rhdr + ("body": rmd); } if (send_aborted) - throw "SEND-ABORTED", sprintf("receiver returned status code %d while sending chunked data; send was aborted", rhdr.status_code), ("hdr": rhdr, "data": rmd); + throw "SEND-ABORTED", sprintf("receiver returned status code %d while sending chunked data; send was " + "aborted", rhdr.status_code), ("hdr": rhdr, "data": rmd); - return rhdr + ("body": rmd); - } + return rhdr + {"body": rmd}; + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/qlib/YamlRpcClient.qm new/module-yaml-release-1.0.10/qlib/YamlRpcClient.qm --- old/module-yaml-release-0.9.15/qlib/YamlRpcClient.qm 2021-05-07 15:25:07.000000000 +0200 +++ new/module-yaml-release-1.0.10/qlib/YamlRpcClient.qm 2021-07-31 17:12:28.000000000 +0200 @@ -1,7 +1,7 @@ # -*- mode: qore; indent-tabs-mode: nil -*- #! @file YamlRpcClient.qm @brief provides the definition for the YamlRpcClient class -/* YamlRpcClient.qm Copyright 2012 - 2020 Qore Technologies, s.r.o. +/* YamlRpcClient.qm Copyright 2012 - 2021 Qore Technologies, s.r.o. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -60,7 +60,8 @@ @section yamlrpcclientintro YamlRpcClient Module Introduction - This module implements client-side support for a proprietary RPC-based protocol using <a href="http://yaml.org">YAML</a> for serialization/deserialization of message data. + This module implements client-side support for a proprietary RPC-based protocol using + <a href="http://yaml.org">YAML</a> for serialization/deserialization of message data. The following classes are provided by this module: - @ref YamlRpcClient::YamlRpcClient "YamlRpcClient" @@ -68,26 +69,38 @@ @section YAMLRPC YAML-RPC Protocol Implementation - YAML-RPC is an HTTP-based RPC protocol; it is not a standard protocol, however it is based on <a href="http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html">JSON-RPC 1.1</a> and similar in approach to <a href="http://xmlrpc.scripting.com/">XML-RPC</a>. + YAML-RPC is an HTTP-based RPC protocol; it is not a standard protocol, however it is based on + <a href="http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html">JSON-RPC 1.1</a> and similar in approach to + <a href="http://xmlrpc.scripting.com/">XML-RPC</a>. YAML-RPC has some technical advantages over JSON-RPC and XML-RPC when developing in Qore: - it is relatively fast - it supports the best data serialization for Qore data of all RPC protocols supported by Qore at the moment - it is concise while still being very easy to read. - The major drawback is that it is a proprietary protocol, which is why Qore will continue to support XML-RPC and JSON-RPC alongside YAML-RPC. + The major drawback is that it is a proprietary protocol, which is why Qore will continue to support XML-RPC and + JSON-RPC alongside YAML-RPC. - The information below provides technical information about how this proprietary YAML-RPC protocol is implemented; details which are not normally visible when using the @ref YamlRpcClient::YamlRpcClient "YamlRpcClient" class. + The information below provides technical information about how this proprietary YAML-RPC protocol is implemented; + details which are not normally visible when using the @ref YamlRpcClient::YamlRpcClient "YamlRpcClient" class. - Request messages are sent as a YAML-encoded request string as the message body of an HTTP POST message. The \c "Content-Type" header should be set to \c MimeTypeYamlRpc (from Mime.qm), otherwise there are no special restrictions on the message headers. + Request messages are sent as a YAML-encoded request string as the message body of an HTTP POST message. The + \c "Content-Type" header should be set to \c MimeTypeYamlRpc (from Mime.qm), otherwise there are no special + restrictions on the message headers. Request and response message bodies must always be encoded with UTF-8 encoding. YAML-RPC request strings are constructed as a simple YAML map with the following keys: - \c method: the string method name to call - - \c params: any value giving the arguments for the method; if the method takes more than one argument, then the \c "params" key will hold a list of the arguments. The @ref YamlRpcClient::YamlRpcClient "YamlRpcClient" class will always package a single argument in a list. - - Note that this YAML-RPC implementation uses the Qore YAML module to encode and decode YAML strings; this ensures maximum data fidelity when serializaing data; note that the Qore yaml module uses the proprietary \c !duration tag for durations, otherwise all other tags are standard YAML tags. For details on how Qore data is serialized and deserialized by the yaml module, please see the <a href="../../yaml/html/index.html">yaml module documentation</a>. + - \c params: any value giving the arguments for the method; if the method takes more than one argument, then the + \c "params" key will hold a list of the arguments. The @ref YamlRpcClient::YamlRpcClient "YamlRpcClient" class + will always package a single argument in a list. + + Note that this YAML-RPC implementation uses the Qore YAML module to encode and decode YAML strings; this ensures + maximum data fidelity when serializaing data; note that the Qore yaml module uses the proprietary \c !duration tag + for durations, otherwise all other tags are standard YAML tags. For details on how Qore data is serialized and + deserialized by the yaml module, please see the + <a href="../../yaml/html/index.html">yaml module documentation</a>. The following is an example of a simple request message with headers: @code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/qlib/YamlRpcHandler.qm new/module-yaml-release-1.0.10/qlib/YamlRpcHandler.qm --- old/module-yaml-release-0.9.15/qlib/YamlRpcHandler.qm 2021-05-07 15:25:07.000000000 +0200 +++ new/module-yaml-release-1.0.10/qlib/YamlRpcHandler.qm 2021-07-31 17:12:28.000000000 +0200 @@ -1,7 +1,7 @@ # -*- mode: qore; indent-tabs-mode: nil -*- #! @file YamlRpcHandler.qm @brief YAML-RPC handler class definition for the HttpServer module -/* YamlRpcHandler.qm Copyright (C) 2012 - 2019 Qore Technologies, s.r.o. +/* YamlRpcHandler.qm Copyright (C) 2012 - 2021 Qore Technologies, s.r.o. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -99,6 +99,8 @@ @section ymlarpchandler_relnotes YamlRpcHandler Release Notes @subsection yamlrpchandler_v1_2 YamlRpcHandler v1.2 + - fixed a bug where serialization errors would result in confusing responses + (<a href="https://github.com/qorelanguage/qore/issues/4194">issue 4194</a>) - minor error logging updates - updated minimum qore version to 0.8.12 for get_ex_pos() - updated for new YAML function names (removed references to deprecated camel-case functions) @@ -162,34 +164,40 @@ #! @endcond #! creates the handler with the given method list - /** @param v_auth an authentication object (use new AbstractAuthenticator() for no authentication) - @param v_methods a list of hashes with the following keys: + /** @param auth an authentication object (use new AbstractAuthenticator() for no authentication) + @param methods a list of hashes with the following keys: - \c name: a regular expression to use for matching the method name - \c function: a string (giving a function name to call), a call reference, or a closure to call with the deserialized arguments to the method; the return value will be serialized to YAML-RPC and sent back to the caller - \c help: help text for the method - \c text: the human-readable name of the method - \c logopt: (optional - by convention) log options which can be used by a custom logger (see the getLogMessage parameter) - @param v_get_log_msg an optional closure or call reference to be called when an incoming request is received; if this is set then it will be called with the following arguments: a context hash (see HttpServer::AbstractHttpRequestHandler::handleRequest() for a description of the context hash), the method definition as passed in the methods argument to this constructor, and a reference to the arguments in this call - @param v_dbg this parameter is set to @ref Qore::True "True", then additional information will be logged when errors occur - @param v_get_prefix prefix to add to derived methods with GET requests if no "." characters are in the path - @param v_log an optional closure or call reference to be called when logging + @param get_log_msg an optional closure or call reference to be called when an incoming request is received; if this is set then it will be called with the following arguments: a context hash (see HttpServer::AbstractHttpRequestHandler::handleRequest() for a description of the context hash), the method definition as passed in the methods argument to this constructor, and a reference to the arguments in this call + @param dbg this parameter is set to @ref Qore::True "True", then additional information will be logged when errors occur + @param get_prefix prefix to add to derived methods with GET requests if no "." characters are in the path + @param log an optional closure or call reference to be called when logging @throw YAML-RPC-CONSTRUCTOR-ERROR missing \c "name", \c "function", or \"text" key in method hash, \c "function" key not assigned to a callable value */ - constructor(HttpServer::AbstractAuthenticator v_auth, list v_methods, *code v_get_log_msg, bool v_dbg = False, *string v_get_prefix, *code v_log) : HttpServer::AbstractHttpRequestHandler(v_auth) { - getLogMessage = v_get_log_msg; - debug = v_dbg; - get_prefix = v_get_prefix; - clog = v_log; + constructor(HttpServer::AbstractAuthenticator auth, list<auto> methods, *code get_log_msg, bool dbg = False, + *string get_prefix, *code log) : HttpServer::AbstractHttpRequestHandler(auth) { + getLogMessage = get_log_msg; + debug = dbg; + self.get_prefix = get_prefix; + clog = log; # add internal methods map addMethodInternal($1 + {"internal": True}), YamlRpcHandler::InternalMethods; - foreach hash m in (v_methods) { + foreach auto m in (methods) { + if (m.typeCode() != NT_HASH) { + throw "YAML-RPC-CONSTRUCTOR-ERROR", sprintf("expecting hash elements of 'methods'; got type %y " + "instead", m.fullType()); + } if (!exists m.name) throw "YAML-RPC-CONSTRUCTOR-ERROR", sprintf("expecting 'name' key in method hash: %y", m); if (m.function.typeCode() != NT_CLOSURE && m.function.typeCode() != NT_CALLREF) - throw "YAML-RPC-CONSTRUCTOR-ERROR", sprintf("expecting 'function' key assigned to code in method hash: %y", m); + throw "YAML-RPC-CONSTRUCTOR-ERROR", sprintf("expecting 'function' key assigned to code in method " + "hash: %y", m); if (!exists m.text) throw "YAML-RPC-CONSTRUCTOR-ERROR", sprintf("expecting 'text' key in method hash: %y", m); delete m.internal; @@ -199,7 +207,9 @@ #! adds a method to the handler dynamically /** @param name a regular expression to use for matching the method name - @param func a string (giving a function name to call), a call reference, or a closure to call with the deserialized arguments to the method; the return value will be serialized to YAML-RPC and sent back to the caller + @param func a string (giving a function name to call), a call reference, or a closure to call with the + deserialized arguments to the method; the return value will be serialized to YAML-RPC and sent back to the + caller @param text the human-readable name of the method @param help help text for the method @param logopt log options which can be used by a custom logger (see the getLogMessage parameter) @@ -207,7 +217,8 @@ */ addMethod(string name, code func, string text, string help, auto logopt, auto cmark) { if (!exists func) - throw "YAML-RPC-HANDLER-ADD-METHOD-ERROR", "expecting function name and text name as hash key in argument"; + throw "YAML-RPC-HANDLER-ADD-METHOD-ERROR", "expecting function name and text name as hash key in " + "argument"; addMethodInternal({ "name" : name, @@ -231,21 +242,32 @@ #! serializes a reponse in YAML-RPC format given the arguments static string makeResponse(auto response, int flags = YAML::None) { - return make_yaml(("result":response), flags); + return make_yaml({"result": response}, flags); } #! serializes an error reponse in YAML-RPC format given the arguments static string makeErrorResponse(int code, string mess, auto err, int flags = YAML::None) { - hash h = ("name":"YAMLRPCError","code":code,"message":mess); - if (exists err) - h.error = err; - return make_yaml(("error":h), flags); + hash<auto> h = { + "name": "YAMLRPCError", + "code": code, + "message": mess, + } + (err + ? { + "error": err, + } + : NOTHING); + try { + return make_yaml({"error": h}, flags); + } catch (hash<ExceptionInfo> ex) { + h.error = sprintf("%s: %s: %s: %y", get_ex_pos(ex), ex.err, ex.desc, h); + return make_yaml({"error": h}, flags); + } } #! @cond nodoc # method called by HttpServer to handle a request # don't reimplement this method; fix/enhance it in the module - final hash handleRequest(hash cx, hash hdr, *data body) { + final hash handleRequest(hash cx, hash<auto> hdr, *data body) { #printf("yamlrpc handler context=%y hdr=%y body=%y\n", cx, hdr, body); hash yamlrpc; @@ -302,7 +324,7 @@ return { "code" : 200, "errlog" : str, - "hdr" : ( "Content-Type" : MimeTypeYamlRpc ), + "hdr" : {"Content-Type": MimeTypeYamlRpc}, "body" : YamlRpcHandler::makeErrorResponse(104, str, ex.arg) }; } @@ -320,7 +342,7 @@ methods[i] = h; } - private hash help() { + private hash<auto> help() { hash h; foreach hash m in (methods) { h.(m.text).description = m.help; @@ -330,7 +352,7 @@ return h; } - private hash system_describe() { + private hash<auto> system_describe() { string address = "http://localhost/YAML"; # use parens instead of burly brackets to get a list off hashes softlist<hash> procs = map ( @@ -353,7 +375,7 @@ return map $1.text, methods; } - private log(hash cx, string str) { + private log(hash<auto> cx, string str) { string msg = "YAML-RPC "; if (exists cx.user) msg += sprintf("user %s ", cx.user); @@ -364,11 +386,11 @@ } # don't reimplement this method; fix/enhance it in the module - final private hash callMethod(hash cx, auto params) { + final private hash<auto> callMethod(hash cx, auto params) { string method = cx.method; # find method function - hash found; - foreach hash m in (methods) { + hash<auto> found; + foreach hash<auto> m in (methods) { if (regex(method, m.name)) { found = m; break; @@ -384,12 +406,16 @@ if (msg) log(cx, msg); - #printf("found: %y (getLogMessage: %y method: %s params: %y)\n", getLogMessage, found.text, method, params); + #printf("found: %y (getLogMessage: %y method: %s params: %y)\n", getLogMessage, found.text, method, + # params); auto rv; try { - rv = found.internal ? call_object_method_args(self, found.function, params) : call_function_args(found.function, params); + rv = found.internal + ? call_object_method_args(self, found.function, params) + : call_function_args(found.function, params); } catch (hash<ExceptionInfo> ex) { - # issue #2573: provide a more user-friendly error when the argument cannot be matched to the closure/call ref + # issue #2573: provide a more user-friendly error when the argument cannot be matched to the + # closure/call ref if (ex.err == "RUNTIME-TYPE-ERROR" && (ex.callstack[0].file =~ /YamlRpcHandler.qm$/ && (ex.callstack[0].function == "call_function_args" @@ -398,13 +424,14 @@ "arguments; internal call error: %s: %s", method, ex.err, ex.desc); rethrow; } - hash h.body = YamlRpcHandler::makeResponse(rv); - return h; + return { + "body": YamlRpcHandler::makeResponse(rv), + }; } else { string err = sprintf("YAML-RPC-SERVER-UNKNOWN-METHOD: unknown method %n", method); return { "code" : 200, - "hdr" : {"Content-Type" : MimeTypeYamlRpc}, + "hdr" : {"Content-Type": MimeTypeYamlRpc}, "body" : YamlRpcHandler::makeErrorResponse(105, err), }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/src/yaml-module.cpp new/module-yaml-release-1.0.10/src/yaml-module.cpp --- old/module-yaml-release-0.9.15/src/yaml-module.cpp 2021-05-07 15:25:07.000000000 +0200 +++ new/module-yaml-release-1.0.10/src/yaml-module.cpp 2021-07-31 17:12:28.000000000 +0200 @@ -2,7 +2,7 @@ /* yaml Qore module - Copyright (C) 2010 - 2017 Qore Technologies, s.r.o. + Copyright (C) 2010 - 2021 Qore Technologies, s.r.o. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -63,7 +63,7 @@ return i != event_map.end() ? i->second : "unknown"; } -QoreNamespace YNS("YAML"); +QoreNamespace YNS("Qore::YAML"); static QoreStringNode* yaml_module_init() { // add functions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/test/docker_test/test-alpine.sh new/module-yaml-release-1.0.10/test/docker_test/test-alpine.sh --- old/module-yaml-release-0.9.15/test/docker_test/test-alpine.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/module-yaml-release-1.0.10/test/docker_test/test-alpine.sh 2021-07-31 17:12:28.000000000 +0200 @@ -0,0 +1,52 @@ +#!/bin/bash + +set -e +set -x + +ENV_FILE=/tmp/env.sh + +. ${ENV_FILE} + +# setup MODULE_SRC_DIR env var +cwd=`pwd` +if [ -z "${MODULE_SRC_DIR}" ]; then + if [ -e "$cwd/src/yaml-module.cpp" ]; then + MODULE_SRC_DIR=$cwd + else + MODULE_SRC_DIR=$WORKDIR/module-yaml + fi +fi +echo "export MODULE_SRC_DIR=${MODULE_SRC_DIR}" >> ${ENV_FILE} + +echo "export QORE_UID=1000" >> ${ENV_FILE} +echo "export QORE_GID=1000" >> ${ENV_FILE} + +. ${ENV_FILE} + +export MAKE_JOBS=4 + +# build module and install +echo && echo "-- building module --" +mkdir -p ${MODULE_SRC_DIR}/build +cd ${MODULE_SRC_DIR}/build +cmake .. -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} +make -j${MAKE_JOBS} +make install + +# add Qore user and group +if ! grep -q "^qore:x:${QORE_GID}" /etc/group; then + addgroup -g ${QORE_GID} qore +fi +if ! grep -q "^qore:x:${QORE_UID}" /etc/passwd; then + adduser -u ${QORE_UID} -D -G qore -h /home/qore -s /bin/bash qore +fi + +# own everything by the qore user +chown -R qore:qore ${MODULE_SRC_DIR} + +# run the tests +export QORE_MODULE_DIR=${MODULE_SRC_DIR}/qlib:${QORE_MODULE_DIR} +cd ${MODULE_SRC_DIR} +for test in test/*.qtest; do + gosu qore:qore qore $test -vv +done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/test/docker_test/test-ubuntu.sh new/module-yaml-release-1.0.10/test/docker_test/test-ubuntu.sh --- old/module-yaml-release-0.9.15/test/docker_test/test-ubuntu.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/module-yaml-release-1.0.10/test/docker_test/test-ubuntu.sh 2021-07-31 17:12:28.000000000 +0200 @@ -0,0 +1,48 @@ +#!/bin/bash + +set -e +set -x + +ENV_FILE=/tmp/env.sh + +. ${ENV_FILE} + +# setup MODULE_SRC_DIR env var +cwd=`pwd` +if [ -z "${MODULE_SRC_DIR}" ]; then + if [ -e "$cwd/src/yaml-module.cpp" ]; then + MODULE_SRC_DIR=$cwd + else + MODULE_SRC_DIR=$WORKDIR/module-yaml + fi +fi +echo "export MODULE_SRC_DIR=${MODULE_SRC_DIR}" >> ${ENV_FILE} + +echo "export QORE_UID=999" >> ${ENV_FILE} +echo "export QORE_GID=999" >> ${ENV_FILE} + +. ${ENV_FILE} + +export MAKE_JOBS=4 + +# build module and install +echo && echo "-- building module --" +mkdir -p ${MODULE_SRC_DIR}/build +cd ${MODULE_SRC_DIR}/build +cmake .. -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} +make -j${MAKE_JOBS} +make install + +# add Qore user and group +groupadd -o -g ${QORE_GID} qore +useradd -o -m -d /home/qore -u ${QORE_UID} -g ${QORE_GID} qore + +# own everything by the qore user +chown -R qore:qore ${MODULE_SRC_DIR} + +# run the tests +export QORE_MODULE_DIR=${MODULE_SRC_DIR}/qlib:${QORE_MODULE_DIR} +cd ${MODULE_SRC_DIR} +for test in test/*.qtest; do + gosu qore:qore qore $test -vv +done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/module-yaml-release-0.9.15/test/docker_test/test.sh new/module-yaml-release-1.0.10/test/docker_test/test.sh --- old/module-yaml-release-0.9.15/test/docker_test/test.sh 2021-05-07 15:25:07.000000000 +0200 +++ new/module-yaml-release-1.0.10/test/docker_test/test.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,49 +0,0 @@ -#!/bin/bash - -set -e -set -x - -ENV_FILE=/tmp/env.sh - -. ${ENV_FILE} - -# setup MODULE_SRC_DIR env var -cwd=`pwd` -if [ "${MODULE_SRC_DIR}" = "" ]; then - if [ -e "$cwd/src/yaml-module.cpp" ]; then - MODULE_SRC_DIR=$cwd - else - MODULE_SRC_DIR=$WORKDIR/module-yaml - fi -fi -echo "export MODULE_SRC_DIR=${MODULE_SRC_DIR}" >> ${ENV_FILE} - -echo "export QORE_UID=999" >> ${ENV_FILE} -echo "export QORE_GID=999" >> ${ENV_FILE} - -. ${ENV_FILE} - -export MAKE_JOBS=4 - -# build module and install -echo && echo "-- building module --" -cd ${MODULE_SRC_DIR} -mkdir build -cd build -cmake .. -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -make -j${MAKE_JOBS} -make install - -# add Qore user and group -groupadd -o -g ${QORE_GID} qore -useradd -o -m -d /home/qore -u ${QORE_UID} -g ${QORE_GID} qore - -# own everything by the qore user -chown -R qore:qore ${MODULE_SRC_DIR} - -# run the tests -export QORE_MODULE_DIR=${MODULE_SRC_DIR}/qlib:${QORE_MODULE_DIR} -cd ${MODULE_SRC_DIR} -for test in test/*.qtest; do - gosu qore:qore qore $test -vv -done \ No newline at end of file