pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/news/newsbeuter



Module Name:    pkgsrc
Committed By:   joerg
Date:           Fri Dec 16 00:00:25 UTC 2016

Modified Files:
        pkgsrc/news/newsbeuter: Makefile distinfo
Added Files:
        pkgsrc/news/newsbeuter/patches: patch-include_configcontainer.h
            patch-src_configcontainer.cpp

Log Message:
Avoid UB for variadic functions. Avoid unnecessary string copies.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 pkgsrc/news/newsbeuter/Makefile
cvs rdiff -u -r1.1 -r1.2 pkgsrc/news/newsbeuter/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/news/newsbeuter/patches/patch-include_configcontainer.h \
    pkgsrc/news/newsbeuter/patches/patch-src_configcontainer.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/news/newsbeuter/Makefile
diff -u pkgsrc/news/newsbeuter/Makefile:1.4 pkgsrc/news/newsbeuter/Makefile:1.5
--- pkgsrc/news/newsbeuter/Makefile:1.4 Sun Dec  4 05:17:39 2016
+++ pkgsrc/news/newsbeuter/Makefile     Fri Dec 16 00:00:25 2016
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.4 2016/12/04 05:17:39 ryoon Exp $
+# $NetBSD: Makefile,v 1.5 2016/12/16 00:00:25 joerg Exp $
 
 DISTNAME=      newsbeuter-2.9
-PKGREVISION=   3
+PKGREVISION=   4
 CATEGORIES=    news
 MASTER_SITES=  http://www.newsbeuter.org/downloads/
 

Index: pkgsrc/news/newsbeuter/distinfo
diff -u pkgsrc/news/newsbeuter/distinfo:1.1 pkgsrc/news/newsbeuter/distinfo:1.2
--- pkgsrc/news/newsbeuter/distinfo:1.1 Tue May 24 09:27:09 2016
+++ pkgsrc/news/newsbeuter/distinfo     Fri Dec 16 00:00:25 2016
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.1 2016/05/24 09:27:09 leot Exp $
+$NetBSD: distinfo,v 1.2 2016/12/16 00:00:25 joerg Exp $
 
 SHA1 (newsbeuter-2.9.tar.gz) = e0d61cda874ea9b77ed27f2edfea50a6ea471894
 RMD160 (newsbeuter-2.9.tar.gz) = b93adbf5305191c40f3e4b2d770d9984bb7c32e3
@@ -6,4 +6,6 @@ SHA512 (newsbeuter-2.9.tar.gz) = b173008
 Size (newsbeuter-2.9.tar.gz) = 432763 bytes
 SHA1 (patch-Makefile) = 53d6ddfa518a1a371428afdf36745028530b30de
 SHA1 (patch-config.sh) = e5d4adf96cae46c8febf818ff03b4f598a865945
+SHA1 (patch-include_configcontainer.h) = 54c7756cf29550c60181c3cdf52e9178183b78ed
+SHA1 (patch-src_configcontainer.cpp) = 3f799235a4d36acbfa3938ed68abd48776eb143f
 SHA1 (patch-src_controller.cpp) = 927b11064deac38acbb577aa0d3f750f72c0e55a

Added files:

Index: pkgsrc/news/newsbeuter/patches/patch-include_configcontainer.h
diff -u /dev/null pkgsrc/news/newsbeuter/patches/patch-include_configcontainer.h:1.1
--- /dev/null   Fri Dec 16 00:00:25 2016
+++ pkgsrc/news/newsbeuter/patches/patch-include_configcontainer.h      Fri Dec 16 00:00:25 2016
@@ -0,0 +1,20 @@
+$NetBSD: patch-include_configcontainer.h,v 1.1 2016/12/16 00:00:25 joerg Exp $
+
+Avoid unnecessary string copies.
+
+Passing non-POD types to variadic functions is UB, so use C++11 rvalues
+and proper typing.
+
+--- include/configcontainer.h.orig     2016-12-15 14:37:54.279263729 +0000
++++ include/configcontainer.h
+@@ -8,8 +8,8 @@ namespace newsbeuter {
+ 
+ struct configdata {
+       enum configdata_type { INVALID, BOOL, INT, STR, PATH, ALIAS, ENUM };
+-      configdata(std::string v = "", configdata_type t = INVALID, bool m = false) : value(v), default_value(v), type(t), multi_option(m) { }
+-      configdata(std::string v, ...);
++      configdata(const std::string &v = "", configdata_type t = INVALID, bool m = false) : value(v), default_value(v), type(t), multi_option(m) { }
++      configdata(const std::string &v, std::set<std::string> &&);
+       std::string value;
+       std::string default_value;
+       configdata_type type;
Index: pkgsrc/news/newsbeuter/patches/patch-src_configcontainer.cpp
diff -u /dev/null pkgsrc/news/newsbeuter/patches/patch-src_configcontainer.cpp:1.1
--- /dev/null   Fri Dec 16 00:00:25 2016
+++ pkgsrc/news/newsbeuter/patches/patch-src_configcontainer.cpp        Fri Dec 16 00:00:25 2016
@@ -0,0 +1,77 @@
+$NetBSD: patch-src_configcontainer.cpp,v 1.1 2016/12/16 00:00:25 joerg Exp $
+
+Passing non-POD types to variadic functions is UB, so use C++11 rvalues
+and proper typing.
+
+--- src/configcontainer.cpp.orig       2016-12-15 14:37:26.527419424 +0000
++++ src/configcontainer.cpp
+@@ -15,20 +15,8 @@
+ 
+ namespace newsbeuter {
+ 
+-configdata::configdata(std::string v, ...) : value(v), default_value(v), type(ENUM) {
+-      va_list ap;
+-      va_start(ap, v);
+-
+-      const char * arg;
+-
+-      do {
+-              arg = va_arg(ap, const char *);
+-              if (arg) {
+-                      enum_values.insert(arg);
+-              }
+-      } while (arg != NULL);
+-
+-      va_end(ap);
++configdata::configdata(const std::string &v, std::set<std::string> &&enumv) : value(v), default_value(v), type(ENUM) {
++      enum_values = std::move(enumv);
+ }
+ 
+ configcontainer::configcontainer() {
+@@ -51,8 +39,8 @@ configcontainer::configcontainer() {
+       config_data["cache-file"]      = configdata("", configdata::PATH);
+       config_data["proxy"]           = configdata("", configdata::STR);
+       config_data["proxy-auth"]      = configdata("", configdata::STR);
+-      config_data["proxy-auth-method"] = configdata("any", "any", "basic", "digest", "digest_ie", "gssnegotiate", "ntlm", "anysafe", NULL);
+-      config_data["http-auth-method"] = configdata("any", "any", "basic", "digest", "digest_ie", "gssnegotiate", "ntlm", "anysafe", NULL);
++      config_data["proxy-auth-method"] = configdata("any", std::set<std::string>({"any", "basic", "digest", "digest_ie", "gssnegotiate", "ntlm", "anysafe"}));
++      config_data["http-auth-method"] = configdata("any", std::set<std::string>({"any", "basic", "digest", "digest_ie", "gssnegotiate", "ntlm", "anysafe"}));
+       config_data["confirm-exit"]    = configdata("no", configdata::BOOL);
+       config_data["error-log"]       = configdata("", configdata::PATH);
+       config_data["notify-screen"]   = configdata("no", configdata::BOOL);
+@@ -62,7 +50,7 @@ configcontainer::configcontainer() {
+       config_data["notify-program"]  = configdata("", configdata::PATH);
+       config_data["notify-format"]   = configdata(_("newsbeuter: finished reload, %f unread feeds (%n unread articles total)"), configdata::STR);
+       config_data["datetime-format"] = configdata("%b %d", configdata::STR);
+-      config_data["urls-source"]     = configdata("local", "local", "opml", "oldreader", "ttrss", "newsblur", "feedhq", NULL); // enum
++      config_data["urls-source"]     = configdata("local", std::set<std::string>({"local", "opml", "oldreader", "ttrss", "newsblur", "feedhq"})); // enum
+       config_data["bookmark-cmd"]    = configdata("", configdata::STR);
+       config_data["opml-url"]        = configdata("", configdata::STR, true);
+       config_data["html-renderer"]   = configdata("internal", configdata::PATH);
+@@ -90,7 +78,7 @@ configcontainer::configcontainer() {
+       config_data["history-limit"] = configdata("100", configdata::INT);
+       config_data["prepopulate-query-feeds"] = configdata("false", configdata::BOOL);
+       config_data["goto-first-unread"] = configdata("true", configdata::BOOL);
+-      config_data["proxy-type"] = configdata("http", "http", "socks4", "socks4a", "socks5", NULL); // enum
++      config_data["proxy-type"] = configdata("http", std::set<std::string>({"http", "socks4", "socks4a", "socks5"})); // enum
+       config_data["oldreader-login"] = configdata("", configdata::STR);
+       config_data["oldreader-password"] = configdata("", configdata::STR);
+       config_data["oldreader-passwordfile"] = configdata("", configdata::PATH);
+@@ -106,7 +94,7 @@ configcontainer::configcontainer() {
+       config_data["feedhq-show-special-feeds"] = configdata("true", configdata::BOOL);
+       config_data["feedhq-min-items"] = configdata("20", configdata::INT);
+       config_data["feedhq-url"] = configdata("https://feedhq.org/";, configdata::STR);
+-      config_data["ignore-mode"] = configdata("download", "download", "display", NULL); // enum
++      config_data["ignore-mode"] = configdata("download", std::set<std::string>({"download", "display"})); // enum
+       config_data["max-download-speed"] = configdata("0", configdata::INT);
+       config_data["cookie-cache"] = configdata("", configdata::PATH);
+       config_data["download-full-page"] = configdata("false", configdata::BOOL);
+@@ -115,7 +103,7 @@ configcontainer::configcontainer() {
+       config_data["ttrss-password"] = configdata("", configdata::STR);
+       config_data["ttrss-passwordfile"] = configdata("", configdata::PATH);
+       config_data["ttrss-url"] = configdata("", configdata::STR);
+-      config_data["ttrss-mode"] = configdata("multi", "single", "multi", NULL); // enum
++      config_data["ttrss-mode"] = configdata("multi", std::set<std::string>({"single", "multi"})); // enum
+       config_data["ttrss-flag-star"] = configdata("", configdata::STR);
+       config_data["ttrss-flag-publish"] = configdata("", configdata::STR);
+       config_data["newsblur-login"] = configdata("", configdata::STR);



Home | Main Index | Thread Index | Old Index