Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-raindrops for openSUSE:Factory checked in at 2022-02-02 22:41:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-raindrops (Old) and /work/SRC/openSUSE:Factory/.rubygem-raindrops.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-raindrops" Wed Feb 2 22:41:30 2022 rev:6 rq:950638 version:0.20.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-raindrops/rubygem-raindrops.changes 2021-07-02 13:28:47.896140871 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-raindrops.new.1898/rubygem-raindrops.changes 2022-02-02 22:42:30.467086907 +0100 @@ -1,0 +2,17 @@ +Tue Jan 25 07:24:42 UTC 2022 - Stephan Kulow <co...@suse.com> + +updated to version 0.20.0 + see installed NEWS + + === raindrops 0.20.0 / 2021-12-06 23:41 UTC + + Raindrops may now use file-backed mmap() rather than anonymous + memory. Thanks to KJ Tsanaktsidis for the patch: + + https://yhbt.net/raindrops-public/20211125065618.3432-1-ktsanaktsi...@zendesk.com/T/ + + The documentation is also updated to note our mail archives are now + available via IMAP(S). + + +------------------------------------------------------------------- Old: ---- raindrops-0.19.2.gem New: ---- raindrops-0.20.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-raindrops.spec ++++++ --- /var/tmp/diff_new_pack.Qvf2kc/_old 2022-02-02 22:42:30.955083599 +0100 +++ /var/tmp/diff_new_pack.Qvf2kc/_new 2022-02-02 22:42:30.959083573 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-raindrops # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-raindrops -Version: 0.19.2 +Version: 0.20.0 Release: 0 %define mod_name raindrops %define mod_full_name %{mod_name}-%{version} ++++++ raindrops-0.19.2.gem -> raindrops-0.20.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.olddoc.yml new/.olddoc.yml --- old/.olddoc.yml 2021-05-26 01:14:25.000000000 +0200 +++ new/.olddoc.yml 2021-12-07 00:43:16.000000000 +0100 @@ -5,8 +5,11 @@ ml_url: - https://yhbt.net/raindrops-public/ - http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/raindrops-public +imap_url: +- imaps://yhbt.net/inbox.comp.lang.ruby.raindrops.0 +- imap://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.raindrops.0 nntp_url: -- nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops +- nntps://news.public-inbox.org/inbox.comp.lang.ruby.raindrops - nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.raindrops source_code: - git clone https://yhbt.net/raindrops.git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GIT-VERSION-FILE new/GIT-VERSION-FILE --- old/GIT-VERSION-FILE 2021-05-26 01:14:25.000000000 +0200 +++ new/GIT-VERSION-FILE 2021-12-07 00:43:16.000000000 +0100 @@ -1 +1 @@ -GIT_VERSION = 0.19.2 +GIT_VERSION = 0.20.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GIT-VERSION-GEN new/GIT-VERSION-GEN --- old/GIT-VERSION-GEN 2021-05-26 01:14:25.000000000 +0200 +++ new/GIT-VERSION-GEN 2021-12-07 00:43:16.000000000 +0100 @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v0.19.2 +DEF_VER=v0.20.0 LF=' ' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/LATEST new/LATEST --- old/LATEST 2021-05-26 01:14:25.000000000 +0200 +++ new/LATEST 2021-12-07 00:43:16.000000000 +0100 @@ -1,7 +1,10 @@ -=== raindrops 0.19.2 / 2021-05-25 23:13 UTC +=== raindrops 0.20.0 / 2021-12-06 23:41 UTC - This release fixes compatibility with GC.compact on Ruby 3.x - when using ListenStats on Linux. The listener stats - functionality is rarely used and does not affect most users - who just have raindrops installed for shared atomic counters. + Raindrops may now use file-backed mmap() rather than anonymous + memory. Thanks to KJ Tsanaktsidis for the patch: + + https://yhbt.net/raindrops-public/20211125065618.3432-1-ktsanaktsi...@zendesk.com/T/ + + The documentation is also updated to note our mail archives are now + available via IMAP(S). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/NEWS new/NEWS --- old/NEWS 2021-05-26 01:14:25.000000000 +0200 +++ new/NEWS 2021-12-07 00:43:16.000000000 +0100 @@ -1,3 +1,13 @@ +=== raindrops 0.20.0 / 2021-12-06 23:41 UTC + + Raindrops may now use file-backed mmap() rather than anonymous + memory. Thanks to KJ Tsanaktsidis for the patch: + + https://yhbt.net/raindrops-public/20211125065618.3432-1-ktsanaktsi...@zendesk.com/T/ + + The documentation is also updated to note our mail archives are now + available via IMAP(S). + === raindrops 0.19.2 / 2021-05-25 23:13 UTC This release fixes compatibility with GC.compact on Ruby 3.x diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README new/README --- old/README 2021-05-26 01:14:25.000000000 +0200 +++ new/README 2021-12-07 00:43:16.000000000 +0100 @@ -58,24 +58,20 @@ See Raindrops::Middleware and Raindrops::LastDataRecv documentation for use Rack servers. The entire library is fully-documented and we are -responsive on the publically archived mailing list -(mailto:raindrops-pub...@yhbt.net) if -you have any questions or comments. +responsive on the publicly archived mailbox +(mailto:raindrops-pub...@yhbt.net) if you have any questions or comments. == Development You can get the latest source via git from the following locations: - git://yhbt.net/raindrops.git - git://repo.or.cz/raindrops.git (mirror) + https://yhbt.net/raindrops.git + http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/raindrops.git + http://repo.or.cz/w/raindrops.git (gitweb mirror) -You may browse the code from the web and download the latest snapshot -tarballs here: +Snapshots and tarballs are available. -* https://yhbt.net/raindrops.git -* http://repo.or.cz/w/raindrops.git (gitweb) - -Inline patches (from "git format-patch") to the mailing list are +Inline patches (from "git format-patch") to the mailbox are preferred because they allow code review and comments in the reply to the patch. @@ -89,14 +85,17 @@ == Contact All feedback (bug reports, user/development discussion, patches, pull -requests) go to the publically archived mailing list: +requests) go to the publicly archived mailbox: mailto:raindrops-pub...@yhbt.net -Mailing list archives are available over HTTPS and NNTP: +Mail archives are available over HTTP(S), IMAP(S) and NNTP(S): * https://yhbt.net/raindrops-public/ * http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/raindrops-public/ -* nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops +* imaps://yhbt.net/inbox.comp.lang.ruby.raindrops.0 +* imap://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.raindrops.0 +* nntps://news.public-inbox.org/inbox.comp.lang.ruby.raindrops +* nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.raindrops Since archives are public, scrub sensitive information and use anonymity tools such as Tor or Mixmaster if you deem necessary. Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/raindrops/raindrops.c new/ext/raindrops/raindrops.c --- old/ext/raindrops/raindrops.c 2021-05-26 01:14:25.000000000 +0200 +++ new/ext/raindrops/raindrops.c 2021-12-07 00:43:16.000000000 +0100 @@ -4,6 +4,7 @@ #include <assert.h> #include <errno.h> #include <stddef.h> +#include <string.h> #include "raindrops_atomic.h" #ifndef SIZET2NUM @@ -34,10 +35,18 @@ size_t size; size_t capa; pid_t pid; + VALUE io; struct raindrop *drops; }; /* called by GC */ +static void rd_mark(void *ptr) +{ + struct raindrops *r = ptr; + rb_gc_mark(r->io); +} + +/* called by GC */ static void rd_free(void *ptr) { struct raindrops *r = ptr; @@ -60,7 +69,7 @@ static const rb_data_type_t rd_type = { "raindrops", - { NULL, rd_free, rd_memsize, /* reserved */ }, + { rd_mark, rd_free, rd_memsize, /* reserved */ }, /* parent, data, [ flags ] */ }; @@ -87,16 +96,10 @@ } /* - * call-seq: - * Raindrops.new(size) -> raindrops object - * - * Initializes a Raindrops object to hold +size+ counters. +size+ is - * only a hint and the actual number of counters the object has is - * dependent on the CPU model, number of cores, and page size of - * the machine. The actual size of the object will always be equal - * or greater than the specified +size+. + * This is the _actual_ implementation of #initialize - the Ruby wrapper + * handles keyword-argument handling then calls this method. */ -static VALUE init(VALUE self, VALUE size) +static VALUE init_cimpl(VALUE self, VALUE size, VALUE io, VALUE zero) { struct raindrops *r = DATA_PTR(self); int tries = 1; @@ -113,9 +116,19 @@ r->capa = tmp / raindrop_size; assert(PAGE_ALIGN(raindrop_size * r->capa) == tmp && "not aligned"); + r->io = io; + retry: - r->drops = mmap(NULL, tmp, - PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0); + if (RTEST(r->io)) { + int fd = NUM2INT(rb_funcall(r->io, rb_intern("fileno"), 0)); + rb_funcall(r->io, rb_intern("truncate"), 1, SIZET2NUM(tmp)); + r->drops = mmap(NULL, tmp, + PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + } else { + r->drops = mmap(NULL, tmp, + PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, + -1, 0); + } if (r->drops == MAP_FAILED) { int err = errno; @@ -127,6 +140,9 @@ } r->pid = getpid(); + if (RTEST(zero)) + memset(r->drops, 0, tmp); + return self; } @@ -217,14 +233,16 @@ * call-seq: * rd.dup -> rd_copy * - * Duplicates and snapshots the current state of a Raindrops object. + * Duplicates and snapshots the current state of a Raindrops object. Even + * if the given Raindrops object is backed by a file, the copy will be backed + * by independent, anonymously mapped memory. */ static VALUE init_copy(VALUE dest, VALUE source) { struct raindrops *dst = DATA_PTR(dest); struct raindrops *src = get(source); - init(dest, SIZET2NUM(src->size)); + init_cimpl(dest, SIZET2NUM(src->size), Qnil, Qfalse); memcpy(dst->drops, src->drops, raindrop_size * src->size); return dest; @@ -375,6 +393,20 @@ return Qnil; } +/* + * call-seq: + * to_io -> IO + * + * Returns the IO object backing the memory for this raindrop, if + * one was specified when constructing this Raindrop. If this + * Raindrop is backed by anonymous memory, this method returns nil. + */ +static VALUE to_io(VALUE self) +{ + struct raindrops *r = get(self); + return r->io; +} + void Init_raindrops_ext(void) { VALUE cRaindrops = rb_define_class("Raindrops", rb_cObject); @@ -433,7 +465,7 @@ rb_define_alloc_func(cRaindrops, alloc); - rb_define_method(cRaindrops, "initialize", init, 1); + rb_define_private_method(cRaindrops, "initialize_cimpl", init_cimpl, 3); rb_define_method(cRaindrops, "incr", incr, -1); rb_define_method(cRaindrops, "decr", decr, -1); rb_define_method(cRaindrops, "to_ary", to_ary, 0); @@ -444,6 +476,7 @@ rb_define_method(cRaindrops, "capa", capa, 0); rb_define_method(cRaindrops, "initialize_copy", init_copy, 1); rb_define_method(cRaindrops, "evaporate!", evaporate_bang, 0); + rb_define_method(cRaindrops, "to_io", to_io, 0); #ifdef __linux__ Init_raindrops_linux_inet_diag(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/raindrops.rb new/lib/raindrops.rb --- old/lib/raindrops.rb 2021-05-26 01:14:25.000000000 +0200 +++ new/lib/raindrops.rb 2021-12-07 00:43:16.000000000 +0100 @@ -36,6 +36,30 @@ def total active + queued end + end unless defined? ListenStats + + # call-seq: + # Raindrops.new(size, io: nil) -> raindrops object + # + # Initializes a Raindrops object to hold +size+ counters. +size+ is + # only a hint and the actual number of counters the object has is + # dependent on the CPU model, number of cores, and page size of + # the machine. The actual size of the object will always be equal + # or greater than the specified +size+. + # If +io+ is provided, then the Raindrops memory will be backed by + # the specified file; otherwise, it will allocate anonymous memory. + # The IO object must respond to +truncate+, as this is used to set + # the size of the file. + # If +zero+ is provided, then the memory region is zeroed prior to + # returning. This is only meaningful if +io+ is also provided; in + # that case it controls whether any existing counter values in +io+ + # are retained (false) or whether it is entirely zeroed (true). + def initialize(size, io: nil, zero: false) + # This ruby wrapper exists to handle the keyword-argument handling, + # which is otherwise kind of awkward in C. We delegate the keyword + # arguments to the _actual_ initialize implementation as positional + # args. + initialize_cimpl(size, io, zero) end autoload :Linux, 'raindrops/linux' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2021-05-26 01:14:25.000000000 +0200 +++ new/metadata 2021-12-07 00:43:16.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: raindrops version: !ruby/object:Gem::Version - version: 0.19.2 + version: 0.20.0 platform: ruby authors: - raindrops hackers autorequire: bindir: bin cert_chain: [] -date: 2021-05-25 00:00:00.000000000 Z +date: 2021-12-06 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: aggregate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_raindrops.rb new/test/test_raindrops.rb --- old/test/test_raindrops.rb 2021-05-26 01:14:25.000000000 +0200 +++ new/test/test_raindrops.rb 2021-12-07 00:43:16.000000000 +0100 @@ -1,6 +1,7 @@ # -*- encoding: binary -*- require 'test/unit' require 'raindrops' +require 'tempfile' class TestRaindrops < Test::Unit::TestCase @@ -162,4 +163,45 @@ assert status.success? assert_equal [ 1, 2 ], tmp.to_ary end + + def test_io_backed + file = Tempfile.new('test_io_backed') + rd = Raindrops.new(4, io: file, zero: true) + rd[0] = 123 + rd[1] = 456 + + assert_equal 123, rd[0] + assert_equal 456, rd[1] + + rd.evaporate! + + file.rewind + data = file.read + assert_equal 123, data.unpack('L!')[0] + assert_equal 456, data[Raindrops::SIZE..data.size].unpack('L!')[0] + end + + def test_io_backed_reuse + file = Tempfile.new('test_io_backed') + rd = Raindrops.new(4, io: file, zero: true) + rd[0] = 123 + rd[1] = 456 + rd.evaporate! + + rd = Raindrops.new(4, io: file, zero: false) + assert_equal 123, rd[0] + assert_equal 456, rd[1] + end + + def test_iobacked_noreuse + file = Tempfile.new('test_io_backed') + rd = Raindrops.new(4, io: file, zero: true) + rd[0] = 123 + rd[1] = 456 + rd.evaporate! + + rd = Raindrops.new(4, io: file, zero: true) + assert_equal 0, rd[0] + assert_equal 0, rd[1] + end end