Stuart Henderson <st...@openbsd.org> writes:

> On 2015/10/04 20:22, Jérémie Courrèges-Anglas wrote:
>> I also had a diff for newsbeuter-2.9 but given the big changes - c++11
>> and wordexp - I kinda lost interest. ;)
>
> I think most actively-developed c++ programs seem to either already
> require c++11 or plan to need it soon (we are getting close to the
> situation we were in before we added gcc 4 to base). Since it has
> crash fixes I think updating makes sense.
>
> Requiring ports gcc won't restrict arch choices for newsbeuter - there
> are only packages for alpha, amd64, hppa, i386, sparc64.

ack

>> Looking at the differences between 2.7 and 2.9, I doubt that this issue
>> got fixed.  newsbeuter stores rss feeds and items timestamps as integers
>> in cache.db, an sqlite database.  sqlite3 uses 64 bits integers under
>> the hood, but the sqlite3 format strings used in newsbeuter specify '%u'
>> for timestamps.  This can't work on i386, and may also be the reason for
>> a weird time_t value on amd64 in
>> https://marc.info/?l=openbsd-ports&m=144251853400773&w=2 .
>> 
>> I can easily reproduce on i386 the crashes experienced by Raf, the
>> following patch seems to fix those, and also addresses other similar
>> problems.  I could port it to 2.9 for inclusion in the ports tree, but
>> maybe it would be better to contact upstream, and fix both wordexp and
>> time_t problems there first.
>> 
>> Anyway, here's the patch for 2.7.  Thoughts?
>
> Definitely makes sense to me. OK (with a REVISION bump of course).

Sure.

> Side-note, -Wformat isn't triggered here. The sqlite printf-like
> functions aren't annotated, but even if I add this it doesn't help.
> I wonder what's up there.

Probably because sqlite3_vmprintf is wrapped in another function,
prepare_query.  The following would activate warnings, but sqlite3
format strings are slightly different from printf format strings, making
the warnings unusable.

diff -pu /usr/obj/pobj/newsbeuter-2.7/newsbeuter-2.7/include/cache.h\~ 
/usr/obj/pobj/newsbeuter-2.7/newsbeuter-2.7/include/cache.h
--- /usr/obj/pobj/newsbeuter-2.7/newsbeuter-2.7/include/cache.h~        Tue Aug 
27 14:20:39 2013
+++ /usr/obj/pobj/newsbeuter-2.7/newsbeuter-2.7/include/cache.h Mon Oct  5 
13:18:38 2015
@@ -44,7 +44,7 @@ class cache {
                void clean_old_articles();
                void update_rssitem_unlocked(std::tr1::shared_ptr<rss_item> 
item, const std::string& feedurl, bool reset_unread);
 
-               std::string prepare_query(const char * format, ...);
+               std::string prepare_query(const char * format, ...)  
__attribute__((__format__ (printf, 2, 3)));;
                        
                sqlite3 * db;
                configcontainer * cfg;

(For the curious, "2, 3" instead of "1, 2" because that function has an
implicit "this" argument.)

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to