From 4f85d9e1b3e66adef2cb3d7b2003bc9736c9a5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 2 Dec 2020 17:48:28 +0100 Subject: [PATCH] debian/patches: Don't byte-swap two times the NBIS print array contents Fixes virtual-image test in libfprint for s390x --- ...wap-two-times-the-NBIS-array-content.patch | 65 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 66 insertions(+) create mode 100644 debian/patches/fp-print-Don-t-byte-swap-two-times-the-NBIS-array-content.patch diff --git a/debian/patches/fp-print-Don-t-byte-swap-two-times-the-NBIS-array-content.patch b/debian/patches/fp-print-Don-t-byte-swap-two-times-the-NBIS-array-content.patch new file mode 100644 index 00000000..c4cf6437 --- /dev/null +++ b/debian/patches/fp-print-Don-t-byte-swap-two-times-the-NBIS-array-content.patch @@ -0,0 +1,65 @@ +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= +Date: Wed, 2 Dec 2020 14:58:09 +0000 +Subject: fp-print: Don't byte-swap two times the NBIS array contents + +When serializing an image print in big endian machine we ended up +swapping the arrays contents two times, first when adding the values and +eventually when calling g_variant_byteswap which already handles this +properly. + +With this, we get the test passing into s390x. + +Fixes: #236 + +Origin: https://gitlab.freedesktop.org/libfprint/libfprint/-/commit/de271a0 +--- + libfprint/fp-print.c | 23 ++++++----------------- + 1 file changed, 6 insertions(+), 17 deletions(-) + +diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c +index c485975..70775c9 100644 +--- a/libfprint/fp-print.c ++++ b/libfprint/fp-print.c +@@ -667,36 +667,25 @@ fp_print_serialize (FpPrint *print, + for (i = 0; i < print->prints->len; i++) + { + struct xyt_struct *xyt = g_ptr_array_index (print->prints, i); +- gint j; +- gint32 *col = g_new (gint32, xyt->nrows); + + g_variant_builder_open (&nested, G_VARIANT_TYPE ("(aiaiai)")); + +- for (j = 0; j < xyt->nrows; j++) +- col[j] = GINT32_TO_LE (xyt->xcol[j]); + g_variant_builder_add_value (&nested, + g_variant_new_fixed_array (G_VARIANT_TYPE_INT32, +- col, ++ xyt->xcol, + xyt->nrows, +- sizeof (col[0]))); +- +- for (j = 0; j < xyt->nrows; j++) +- col[j] = GINT32_TO_LE (xyt->ycol[j]); ++ sizeof (xyt->xcol[0]))); + g_variant_builder_add_value (&nested, + g_variant_new_fixed_array (G_VARIANT_TYPE_INT32, +- col, ++ xyt->ycol, + xyt->nrows, +- sizeof (col[0]))); +- +- for (j = 0; j < xyt->nrows; j++) +- col[j] = GINT32_TO_LE (xyt->thetacol[j]); ++ sizeof (xyt->ycol[0]))); + g_variant_builder_add_value (&nested, + g_variant_new_fixed_array (G_VARIANT_TYPE_INT32, +- col, ++ xyt->thetacol, + xyt->nrows, +- sizeof (col[0]))); ++ sizeof (xyt->thetacol[0]))); + g_variant_builder_close (&nested); +- g_free (col); + } + + g_variant_builder_close (&nested); diff --git a/debian/patches/series b/debian/patches/series index f02bfa81..9385410f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ debian/Tweak-the-udev-rules-creator-for-Debian-usage.patch fpi-device-Return-proper-type-on-identification-success.patch test-fpi-device-Always-check-the-return-values-for-the-AP.patch +fp-print-Don-t-byte-swap-two-times-the-NBIS-array-content.patch