Hello community,

here is the log from the commit of package blosc for openSUSE:Factory checked 
in at 2020-03-31 17:17:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/blosc (Old)
 and      /work/SRC/openSUSE:Factory/.blosc.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "blosc"

Tue Mar 31 17:17:04 2020 rev:16 rq:790061 version:1.18.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/blosc/blosc.changes      2020-02-07 
15:55:26.711544567 +0100
+++ /work/SRC/openSUSE:Factory/.blosc.new.3160/blosc.changes    2020-03-31 
17:17:08.995700173 +0200
@@ -1,0 +2,7 @@
+Tue Mar 31 09:39:10 UTC 2020 - Martin Pluskal <[email protected]>
+
+- Update to version 1.18.1:
+  * Fixed the copy of the leftovers of a chunk when its size is not
+    a multiple of the typesize.
+
+-------------------------------------------------------------------

Old:
----
  blosc-1.17.1.tar.gz

New:
----
  blosc-1.18.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ blosc.spec ++++++
--- /var/tmp/diff_new_pack.phW0Pq/_old  2020-03-31 17:17:09.703700622 +0200
+++ /var/tmp/diff_new_pack.phW0Pq/_new  2020-03-31 17:17:09.707700625 +0200
@@ -19,7 +19,7 @@
 %define major   1
 %define libname lib%{name}%{major}
 Name:           blosc
-Version:        1.17.1
+Version:        1.18.1
 Release:        0
 Summary:        A blocking, shuffling and lossless compression library
 License:        MIT AND BSD-3-Clause AND BSD-2-Clause

++++++ blosc-1.17.1.tar.gz -> blosc-1.18.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/c-blosc-1.17.1/ANNOUNCE.rst 
new/c-blosc-1.18.1/ANNOUNCE.rst
--- old/c-blosc-1.17.1/ANNOUNCE.rst     2019-12-12 13:25:17.000000000 +0100
+++ new/c-blosc-1.18.1/ANNOUNCE.rst     2020-03-29 15:21:59.000000000 +0200
@@ -1,13 +1,15 @@
 ===============================================================
- Announcing C-Blosc 1.17.1
+ Announcing C-Blosc 1.18.1
  A blocking, shuffling and lossless compression library for C
 ===============================================================
 
 What is new?
 ============
 
-A maintenance release where LZ4 and Zstd internal codecs have been updated
-to latest versions.
+A maintenance release where the copy of the leftovers of a chunk when
+its size is not a multiple of typesize.  Although this is a very unusual
+situation, it can certainly happen (e.g.
+https://github.com/Blosc/python-blosc/issues/220).
 
 For more info, please see the release notes in:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/c-blosc-1.17.1/RELEASE_NOTES.rst 
new/c-blosc-1.18.1/RELEASE_NOTES.rst
--- old/c-blosc-1.17.1/RELEASE_NOTES.rst        2019-12-12 13:25:17.000000000 
+0100
+++ new/c-blosc-1.18.1/RELEASE_NOTES.rst        2020-03-29 15:21:59.000000000 
+0200
@@ -3,6 +3,15 @@
 ===========================
 
 
+Changes from 1.17.1 to 1.18.1
+=============================
+
+- Fixed the copy of the leftovers of a chunk when its size is not a
+  multiple of the typesize.  Although this is a very unusual situation,
+  it can certainly happen (e.g.
+  https://github.com/Blosc/python-blosc/issues/220).
+
+
 Changes from 1.17.0 to 1.17.1
 =============================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/c-blosc-1.17.1/blosc/blosc.h 
new/c-blosc-1.18.1/blosc/blosc.h
--- old/c-blosc-1.17.1/blosc/blosc.h    2019-12-12 13:25:17.000000000 +0100
+++ new/c-blosc-1.18.1/blosc/blosc.h    2020-03-29 15:21:59.000000000 +0200
@@ -18,12 +18,12 @@
 
 /* Version numbers */
 #define BLOSC_VERSION_MAJOR    1    /* for major interface/format changes  */
-#define BLOSC_VERSION_MINOR    17   /* for minor interface/format changes  */
+#define BLOSC_VERSION_MINOR    18   /* for minor interface/format changes  */
 #define BLOSC_VERSION_RELEASE  1    /* for tweaks, bug-fixes, or development */
 
-#define BLOSC_VERSION_STRING   "1.17.1"  /* string version.  Sync with above! 
*/
+#define BLOSC_VERSION_STRING   "1.18.1"  /* string version.  Sync with above! 
*/
 #define BLOSC_VERSION_REVISION "$Rev$"   /* revision version */
-#define BLOSC_VERSION_DATE     "$Date:: 2019-12-12 #$"    /* date version */
+#define BLOSC_VERSION_DATE     "$Date:: 2020-03-29 #$"    /* date version */
 
 #define BLOSCLZ_VERSION_STRING "2.0.0"   /* the internal compressor version */
 
@@ -369,7 +369,7 @@
 
 /**
   Select the compressor to be used.  The supported ones are "blosclz",
-  "lz4", "lz4hc", "snappy", "zlib" and "ztsd".  If this function is not
+  "lz4", "lz4hc", "snappy", "zlib" and "zstd".  If this function is not
   called, then "blosclz" will be used by default.
 
   In case the compressor is not recognized, or there is not support
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/c-blosc-1.17.1/blosc/shuffle.c 
new/c-blosc-1.18.1/blosc/shuffle.c
--- old/c-blosc-1.17.1/blosc/shuffle.c  2019-12-12 13:25:17.000000000 +0100
+++ new/c-blosc-1.18.1/blosc/shuffle.c  2020-03-29 15:21:59.000000000 +0200
@@ -404,14 +404,20 @@
   /* Initialize the shuffle implementation if necessary. */
   init_shuffle_implementation();
 
-  if ((size % 8) == 0)
+  if ((size % 8) == 0) {
     /* The number of elems is a multiple of 8 which is supported by
        bitshuffle. */
-    return (int)(host_implementation.bitshuffle)((void*)_src, (void*)_dest,
-                                                 blocksize / bytesoftype,
-                                                 bytesoftype, (void*)_tmp);
-  else
-    memcpy((void*)_dest, (void*)_src, blocksize);
+    int ret = (int)(host_implementation.bitshuffle)((void *) _src, (void *) 
_dest,
+                                                    blocksize / bytesoftype,
+                                                    bytesoftype, (void *) 
_tmp);
+    /* Copy the leftovers */
+    size_t offset = size * bytesoftype;
+    memcpy((void *) (_dest + offset), (void *) (_src + offset), blocksize - 
offset);
+    return ret;
+  }
+  else {
+    memcpy((void *) _dest, (void *) _src, blocksize);
+  }
   return size;
 }
 
@@ -425,13 +431,19 @@
   /* Initialize the shuffle implementation if necessary. */
   init_shuffle_implementation();
 
-  if ((size % 8) == 0)
+  if ((size % 8) == 0) {
     /* The number of elems is a multiple of 8 which is supported by
        bitshuffle. */
-    return (int)(host_implementation.bitunshuffle)((void*)_src, (void*)_dest,
-                                                   blocksize / bytesoftype,
-                                                   bytesoftype, (void*)_tmp);
-  else
-    memcpy((void*)_dest, (void*)_src, blocksize);
+    int ret = (int) (host_implementation.bitunshuffle)((void *) _src, (void *) 
_dest,
+                                                       blocksize / bytesoftype,
+                                                       bytesoftype, (void *) 
_tmp);
+    /* Copy the leftovers */
+    size_t offset = size * bytesoftype;
+    memcpy((void *) (_dest + offset), (void *) (_src + offset), blocksize - 
offset);
+    return ret;
+  }
+  else {
+    memcpy((void *) _dest, (void *) _src, blocksize);
+  }
   return size;
 }
Binary files old/c-blosc-1.17.1/compat/blosc-1.18.0-blosclz-bitshuffle.cdata 
and new/c-blosc-1.18.1/compat/blosc-1.18.0-blosclz-bitshuffle.cdata differ
Binary files old/c-blosc-1.17.1/compat/blosc-1.18.0-blosclz.cdata and 
new/c-blosc-1.18.1/compat/blosc-1.18.0-blosclz.cdata differ
Binary files old/c-blosc-1.17.1/compat/blosc-1.18.0-lz4-bitshuffle.cdata and 
new/c-blosc-1.18.1/compat/blosc-1.18.0-lz4-bitshuffle.cdata differ
Binary files old/c-blosc-1.17.1/compat/blosc-1.18.0-lz4.cdata and 
new/c-blosc-1.18.1/compat/blosc-1.18.0-lz4.cdata differ
Binary files old/c-blosc-1.17.1/compat/blosc-1.18.0-lz4hc.cdata and 
new/c-blosc-1.18.1/compat/blosc-1.18.0-lz4hc.cdata differ
Binary files old/c-blosc-1.17.1/compat/blosc-1.18.0-zlib.cdata and 
new/c-blosc-1.18.1/compat/blosc-1.18.0-zlib.cdata differ
Binary files old/c-blosc-1.17.1/compat/blosc-1.18.0-zstd.cdata and 
new/c-blosc-1.18.1/compat/blosc-1.18.0-zstd.cdata differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/c-blosc-1.17.1/tests/test_bitshuffle_leftovers.c 
new/c-blosc-1.18.1/tests/test_bitshuffle_leftovers.c
--- old/c-blosc-1.17.1/tests/test_bitshuffle_leftovers.c        1970-01-01 
01:00:00.000000000 +0100
+++ new/c-blosc-1.18.1/tests/test_bitshuffle_leftovers.c        2020-03-29 
15:21:59.000000000 +0200
@@ -0,0 +1,140 @@
+/*********************************************************************
+  Blosc - Blocked Shuffling and Compression Library
+
+  Unit test for the bitshuffle with blocks that are not aligned.
+  See https://github.com/Blosc/python-blosc/issues/220
+  Probably related: https://github.com/Blosc/c-blosc/issues/240
+
+  Creation date: 2020-02-18
+  Author: Francesc Alted <[email protected]>
+
+  See LICENSES/BLOSC.txt for details about copyright and rights to use.
+ **********************************************************************/
+
+#include "test_common.h"
+
+
+static int test_roundtrip_bitshuffle8(int size, void *data, void *data_out, 
void *data_dest) {
+  /* Compress with bitshuffle active  */
+  int isize = size;
+  int osize = size + BLOSC_MIN_HEADER_LENGTH;
+  int csize = blosc_compress(9, BLOSC_BITSHUFFLE, 8, isize, data, data_out, 
osize);
+  int dsize;
+  int exit_code;
+  FILE *fout = fopen("test-bitshuffle8-nomemcpy.cdata", "w");
+
+  if (csize == 0) {
+    printf("Buffer is uncompressible.  Giving up.\n");
+    return 1;
+  }
+  else if (csize < 0) {
+    printf("Compression error.  Error code: %d\n", csize);
+    return csize;
+  }
+  printf("Compression: %d -> %d (%.1fx)\n", isize, csize, (1.*isize) / csize);
+
+  fwrite(data_out, csize, 1, fout);
+  fclose(fout);
+
+  /* Decompress  */
+  dsize = blosc_decompress(data_out, data_dest, isize);
+  if (dsize < 0) {
+    printf("Decompression error.  Error code: %d\n", dsize);
+    return dsize;
+  }
+
+  printf("Decompression succesful!\n");
+
+  exit_code = memcmp(data, data_dest, size) ? EXIT_FAILURE : EXIT_SUCCESS;
+
+  if (exit_code == EXIT_SUCCESS)
+    printf("Succesful roundtrip!\n");
+  else
+    printf("Decompressed data differs from original!\n");
+
+  return exit_code;
+}
+
+static int test_roundtrip_bitshuffle4(int size, void *data, void *data_out, 
void *data_dest) {
+  /* Compress with bitshuffle active  */
+  int isize = size;
+  int osize = size + BLOSC_MIN_HEADER_LENGTH;
+  int csize = blosc_compress(9, BLOSC_BITSHUFFLE, 4, isize, data, data_out, 
osize);
+  int dsize;
+  int exit_code;
+  FILE *fout = fopen("test-bitshuffle4-memcpy.cdata", "w");
+
+  if (csize == 0) {
+    printf("Buffer is uncompressible.  Giving up.\n");
+    return 1;
+  }
+  else if (csize < 0) {
+    printf("Compression error.  Error code: %d\n", csize);
+    return csize;
+  }
+  printf("Compression: %d -> %d (%.1fx)\n", isize, csize, (1.*isize) / csize);
+
+  fwrite(data_out, csize, 1, fout);
+  fclose(fout);
+
+  /* Decompress  */
+  dsize = blosc_decompress(data_out, data_dest, isize);
+  if (dsize < 0) {
+    printf("Decompression error.  Error code: %d\n", dsize);
+    return dsize;
+  }
+
+  printf("Decompression succesful!\n");
+
+  exit_code = memcmp(data, data_dest, size) ? EXIT_FAILURE : EXIT_SUCCESS;
+  if (exit_code == EXIT_SUCCESS)
+    printf("Succesful roundtrip!\n");
+  else
+    printf("Decompressed data differs from original!\n");
+
+  return exit_code;
+}
+
+int main() {
+  /* `size` below is chosen so that it is not divisible by 8
+   * (not supported by bitshuffle) and in addition, it is not
+   * divisible by 8 (typesize) again.
+   */
+  int size = 641091;
+  int32_t *data = malloc(size);
+  int32_t *data_out = malloc(size + BLOSC_MIN_HEADER_LENGTH);
+  int32_t *data_dest = malloc(size);
+  int result;
+  int i;
+
+  /* Initialize data */
+  for (i = 0; i < size / sizeof(int32_t); i++) {
+    ((uint32_t*)data)[i] = i;
+  }
+  /* leftovers */
+  for (i = size / sizeof(int32_t) * sizeof(int32_t); i < size; i++) {
+    ((uint8_t*)data)[i] = i;
+  }
+
+  blosc_init();
+  blosc_set_nthreads(1);
+  blosc_set_compressor("lz4");
+  printf("Blosc version info: %s (%s)\n", BLOSC_VERSION_STRING, 
BLOSC_VERSION_DATE);
+  result = test_roundtrip_bitshuffle4(size, data, data_out, data_dest);
+  if (result != EXIT_SUCCESS) {
+    goto fail;
+  }
+  result = test_roundtrip_bitshuffle8(size, data, data_out, data_dest);
+  if (result != EXIT_SUCCESS) {
+    goto fail;
+  }
+
+  free(data);
+  free(data_out);
+  free(data_dest);
+
+  blosc_destroy();
+
+  fail:
+  return result;
+}


Reply via email to