diff --git a/VERSION b/VERSION index d9df1bbc..af88ba82 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11.0 +0.11.1 diff --git a/configure.ac b/configure.ac index 53a095f8..899d4744 100644 --- a/configure.ac +++ b/configure.ac @@ -213,6 +213,7 @@ AC_CONFIG_FILES([ examples/c/Makefile examples/c++-lib/Makefile dbus/Makefile + dbus/testsuite/Makefile server/Makefile client/Makefile client/utils/Makefile diff --git a/dbus/Makefile.am b/dbus/Makefile.am index 560b02f3..9c0456a2 100644 --- a/dbus/Makefile.am +++ b/dbus/Makefile.am @@ -2,6 +2,8 @@ # Makefile.am for snapper/dbus # +SUBDIRS = . testsuite + AM_CPPFLAGS = -I$(top_srcdir) $(DBUS_CFLAGS) noinst_LTLIBRARIES = libdbus.la diff --git a/dbus/testsuite/.gitignore b/dbus/testsuite/.gitignore new file mode 100644 index 00000000..85f0d0bb --- /dev/null +++ b/dbus/testsuite/.gitignore @@ -0,0 +1,5 @@ +*.log +*.o +*.test +*.trs +test-suite.log diff --git a/dbus/testsuite/Makefile.am b/dbus/testsuite/Makefile.am new file mode 100644 index 00000000..52ec8242 --- /dev/null +++ b/dbus/testsuite/Makefile.am @@ -0,0 +1,14 @@ +# +# Makefile.am for snapper/dbus/testsuite +# + +AM_CPPFLAGS = -I$(top_srcdir) $(DBUS_CFLAGS) + +LDADD = ../../snapper/libsnapper.la ../libdbus.la -lboost_unit_test_framework + +check_PROGRAMS = escape.test + +TESTS = $(check_PROGRAMS) + +AM_DEFAULT_SOURCE_EXT = .cc + diff --git a/testsuite/dbus-escape.cc b/dbus/testsuite/escape.cc similarity index 100% rename from testsuite/dbus-escape.cc rename to dbus/testsuite/escape.cc diff --git a/dists/debian/changelog b/dists/debian/changelog index 12d5580e..bfd1d046 100644 --- a/dists/debian/changelog +++ b/dists/debian/changelog @@ -1,3 +1,9 @@ +snapper (0.11.1) stable; urgency=low + + * Updated to version 0.11.1 + + -- Arvin Schnell Fri, 5 Jul 2024 14:33:53 +0000 + snapper (0.11.0) stable; urgency=low * Updated to version 0.11.0 diff --git a/package/snapper.changes b/package/snapper.changes index 1feb5058..522b54a3 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -3,6 +3,7 @@ Fri Jul 05 16:03:42 CEST 2024 - aschnell@suse.com - handle content-length of stomp in zypper plugin (gh#openSUSE/snapper#918) +- version 0.11.1 ------------------------------------------------------------------- Wed May 22 17:21:18 CEST 2024 - aschnell@suse.com diff --git a/stomp/Stomp.cc b/stomp/Stomp.cc index ebdd2af9..3fb5a27d 100644 --- a/stomp/Stomp.cc +++ b/stomp/Stomp.cc @@ -20,7 +20,6 @@ */ -#include #include @@ -48,6 +47,7 @@ namespace Stomp { string line; getline(is, line); + line = strip_cr(line); if (state == State::Start) { @@ -150,6 +150,18 @@ namespace Stomp } + std::string + strip_cr(const std::string& in) + { + string::size_type length = in.size(); + + if (length > 0 && in[length - 1] == '\r') + return in.substr(0, length - 1); + + return in; + } + + std::string escape_header(const std::string& in) { diff --git a/stomp/Stomp.h b/stomp/Stomp.h index 2220d8dc..1a024da6 100644 --- a/stomp/Stomp.h +++ b/stomp/Stomp.h @@ -51,6 +51,8 @@ namespace Stomp Message ack(); Message nack(); + std::string strip_cr(const std::string& in); + std::string escape_header(const std::string& in); std::string unescape_header(const std::string& in); diff --git a/stomp/testsuite/read1.cc b/stomp/testsuite/read1.cc index 2d89dd70..a5c31eb4 100644 --- a/stomp/testsuite/read1.cc +++ b/stomp/testsuite/read1.cc @@ -36,9 +36,9 @@ BOOST_AUTO_TEST_CASE(test1) BOOST_AUTO_TEST_CASE(test2) { - // optional content-lenght + // optional content-lenght and body with null character - istringstream s1("HELLO\nkey:value\ncontent-length:5\n\nWORLD" + null); + istringstream s1("HELLO\nkey:value\ncontent-length:5\n\nW" + null + "RLD" + null); istream s2(s1.rdbuf()); Message msg = read_message(s2); @@ -51,6 +51,24 @@ BOOST_AUTO_TEST_CASE(test2) BOOST_CHECK_EQUAL(msg.headers["key"], "value"); BOOST_CHECK_EQUAL(msg.headers["content-length"], "5"); + BOOST_CHECK_EQUAL(msg.body, "W" + null + "RLD"); +} + + +BOOST_AUTO_TEST_CASE(cr1) +{ + // optional carriage returns + + istringstream s1("HELLO\r\nkey:value\r\n\r\nWORLD" + null); + istream s2(s1.rdbuf()); + + Message msg = read_message(s2); + + BOOST_CHECK_EQUAL(msg.command, "HELLO"); + + BOOST_CHECK_EQUAL(msg.headers.size(), 1); + BOOST_CHECK_EQUAL(msg.headers["key"], "value"); + BOOST_CHECK_EQUAL(msg.body, "WORLD"); } diff --git a/stomp/testsuite/strip.cc b/stomp/testsuite/strip.cc new file mode 100644 index 00000000..685a285d --- /dev/null +++ b/stomp/testsuite/strip.cc @@ -0,0 +1,19 @@ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE snapper + +#include + +#include "../Stomp.h" + + +using namespace std; +using namespace Stomp; + + +BOOST_AUTO_TEST_CASE(cr) +{ + BOOST_CHECK_EQUAL(Stomp::strip_cr("hello"), "hello"); + BOOST_CHECK_EQUAL(Stomp::strip_cr("hello\r"), "hello"); + BOOST_CHECK_EQUAL(Stomp::strip_cr("hello\r\n"), "hello\r\n"); +} diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index ccb84d37..4ae904b7 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -7,7 +7,7 @@ AM_CPPFLAGS = -I$(top_srcdir) $(DBUS_CFLAGS) LDADD = ../snapper/libsnapper.la ../dbus/libdbus.la -lboost_unit_test_framework check_PROGRAMS = sysconfig-get1.test dirname1.test basename1.test \ - equal-date.test dbus-escape.test cmp-lt.test humanstring.test uuid.test \ + equal-date.test cmp-lt.test humanstring.test uuid.test \ table.test table-formatter.test csv-formatter.test json-formatter.test \ getopts.test scan-datetime.test root-prefix.test range.test limit.test diff --git a/zypp-plugin/snapper-zypp-plugin.cc b/zypp-plugin/snapper-zypp-plugin.cc index 45d5af3d..e13dc33d 100644 --- a/zypp-plugin/snapper-zypp-plugin.cc +++ b/zypp-plugin/snapper-zypp-plugin.cc @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/zypp-plugin/zypp-plugin.cc b/zypp-plugin/zypp-plugin.cc index 943963f4..b7c67911 100644 --- a/zypp-plugin/zypp-plugin.cc +++ b/zypp-plugin/zypp-plugin.cc @@ -20,10 +20,6 @@ */ -#include -#include -#include -#include using namespace std;