[libur-perl] 01/05: Fix UR::DataSource::File breakage with reused memory locations
Niko Tyni
ntyni at moszumanska.debian.org
Fri Sep 23 08:00:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
ntyni pushed a commit to branch master
in repository libur-perl.
commit 99393cc1f8670c73900a352a9c060985d0fd0d21
Author: Niko Tyni <ntyni at debian.org>
Date: Thu Sep 22 22:33:50 2016 +0300
Fix UR::DataSource::File breakage with reused memory locations
Closes: #834914
---
...es-can-be-re-used-use-a-serial-number-ins.patch | 87 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 88 insertions(+)
diff --git a/debian/patches/0001-Ref-addresses-can-be-re-used-use-a-serial-number-ins.patch b/debian/patches/0001-Ref-addresses-can-be-re-used-use-a-serial-number-ins.patch
new file mode 100644
index 0000000..4d13029
--- /dev/null
+++ b/debian/patches/0001-Ref-addresses-can-be-re-used-use-a-serial-number-ins.patch
@@ -0,0 +1,87 @@
+From c4e0046aa79b619032c9e4364bb779fe5bce9e58 Mon Sep 17 00:00:00 2001
+From: Anthony Brummett <brummett at gmail.com>
+Date: Mon, 19 Sep 2016 10:10:41 -0500
+Subject: [PATCH] Ref addresses can be re-used, use a serial number instead
+
+In some cases, the refaddr of the generated iterator code ref can be recycled
+between different get() instances. When that happens, the code thinks it's
+within the same get() and neglects to reset the file position with seek().
+
+Some perl builds seem to use smaller address spaces than others, judging on
+the size of a refaddr. Maybe it is just more likely to happen on builds
+with smaller address spaces. For example:
+ perl -e 'my $a = \1; print "$a\n"'
+ OS X: SCALAR(0x7fd852825dc8)
+ Ubuntu: SCALAR(0x27fb958)
+Even though they're build 64-bit perls with the same ptrsize.
+
+This fixes #126
+
+Bug-Debian: https://bugs.debian.org/834914
+Bug: https://github.com/genome/UR/issues/126
+Origin: upstream, https://github.com/genome/UR/commit/c4e0046aa79b619032c9e4364bb779fe5bce9e58
+
+---
+ lib/UR/DataSource/File.pm | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/lib/UR/DataSource/File.pm b/lib/UR/DataSource/File.pm
+index daf4422..ac4aab4 100644
+--- a/lib/UR/DataSource/File.pm
++++ b/lib/UR/DataSource/File.pm
+@@ -558,7 +558,7 @@ sub _comparator_for_operator_and_property {
+ }
+ }
+
+-
++my $iterator_serial = 0;
+ sub create_iterator_closure_for_rule {
+ my($self,$rule) = @_;
+
+@@ -698,7 +698,7 @@ sub create_iterator_closure_for_rule {
+ UR::DBI->sql_fh->printf("\nFILE: %s\nFILTERS %s\n\n", $self->server, $filter_list);
+ }
+
+- $self->{'_last_read_fingerprint'} ||= '';
++ $self->{'_last_read_serial'} ||= '';
+
+ my $record_separator = $self->record_separator;
+ my $cache_slot = $self->_allocate_offset_cache_slot();
+@@ -709,7 +709,7 @@ sub create_iterator_closure_for_rule {
+ my $lines_matched = 0;
+
+ my $fh; # File handle we'll be reading from
+- my $read_fingerprint; # The stringified version of $iterator (to avoid circular references), filled in below
++ my $this_iterator_serial = $iterator_serial++;
+ my $iterator = sub {
+
+ unless (ref($fh)) {
+@@ -725,7 +725,7 @@ sub create_iterator_closure_for_rule {
+ $monitor_printed_first_fetch = 1;
+ }
+
+- if ($self->{'_last_read_fingerprint'} ne $read_fingerprint) {
++ if ($self->{'_last_read_serial'} ne $this_iterator_serial) {
+ UR::DBI->sql_fh->printf("FILE: Resetting file position to $file_pos\n") if $ENV{'UR_DBI_MONITOR_SQL'};
+ # The last read was from a different request, reset the position
+ $fh->seek($file_pos,0);
+@@ -737,7 +737,7 @@ sub create_iterator_closure_for_rule {
+ }
+ $file_pos = $self->_file_position();
+
+- $self->{'_last_read_fingerprint'} = $read_fingerprint;
++ $self->{'_last_read_serial'} = $this_iterator_serial;
+ }
+
+ local $/; # Make sure some wise guy hasn't changed this out from under us
+@@ -848,7 +848,6 @@ sub create_iterator_closure_for_rule {
+ return $next_candidate_row;
+ }
+ }; # end sub $iterator
+- $read_fingerprint = $iterator . '';
+
+ Sub::Name::subname('UR::DataSource::File::__datasource_iterator(closure)__', $iterator);
+
+--
+2.9.3
+
diff --git a/debian/patches/series b/debian/patches/series
index 3d0bc4b..ac92cd3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
spelling.patch
Honour-SOURCE_DATE_EPOCH-for-embedded-timestamp-in-genera.patch
+0001-Ref-addresses-can-be-re-used-use-a-serial-number-ins.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libur-perl.git
More information about the Pkg-perl-cvs-commits
mailing list