Control: tags 1146263 + patch Control: tags 1146263 + pending Dear maintainer,
I've prepared an NMU for libmatio (versioned as 1.6.0-1.1) and uploaded it to DELAYED/2. Please feel free to tell me if I should cancel it. cu Adrian
diffstat for libmatio-1.6.0 libmatio-1.6.0 changelog | 7 patches/0001-Fix-testcase-failures-in-big-endian-machines.patch | 95 ++++++++++ patches/series | 1 3 files changed, 103 insertions(+) diff -Nru libmatio-1.6.0/debian/changelog libmatio-1.6.0/debian/changelog --- libmatio-1.6.0/debian/changelog 2026-08-23 02:58:28.000000000 +0300 +++ libmatio-1.6.0/debian/changelog 2026-10-02 20:54:31.000000000 +0300 @@ -1,3 +1,10 @@ +libmatio (1.6.0-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Add fix from Pranav P for FTBFS on big endian. (Closes: #1146263) + + -- Adrian Bunk <[email protected]> Fri, 02 Oct 2026 20:54:31 +0300 + libmatio (1.6.0-1) unstable; urgency=medium * New upstream version 1.6.0 diff -Nru libmatio-1.6.0/debian/patches/0001-Fix-testcase-failures-in-big-endian-machines.patch libmatio-1.6.0/debian/patches/0001-Fix-testcase-failures-in-big-endian-machines.patch --- libmatio-1.6.0/debian/patches/0001-Fix-testcase-failures-in-big-endian-machines.patch 1970-01-01 02:00:00.000000000 +0200 +++ libmatio-1.6.0/debian/patches/0001-Fix-testcase-failures-in-big-endian-machines.patch 2026-10-02 20:54:04.000000000 +0300 @@ -0,0 +1,95 @@ +From 14106bd69da91dcef38c567d5afa9b0a29aefcd4 Mon Sep 17 00:00:00 2001 +From: Pranav P <[email protected]> +Date: Tue, 29 Sep 2026 00:23:56 +0530 +Subject: Fix testcase failures in big endian machines + +As reported by https://github.com/tbeu/matio/pull/372 + +--------- + +Co-authored-by: tbeu <[email protected]> +--- + src/mat5.c | 9 ++++++--- + tools/matdump.c | 17 +++++++++++------ + 2 files changed, 17 insertions(+), 9 deletions(-) + +diff --git a/src/mat5.c b/src/mat5.c +index 1c86d8b..e9c638b 100644 +--- a/src/mat5.c ++++ b/src/mat5.c +@@ -5713,13 +5713,14 @@ ReadTaggedString(mat_t *mat, char **str, const mat_uint32_t *pre_buf) + return err; + if ( mat->byteswap ) { + (void)Mat_uint32Swap(&tag[0]); +- (void)Mat_uint32Swap(&tag[1]); + } + } + + if ( tag[0] == MAT_T_INT8 ) { /* Normal format: type in tag[0], length in tag[1] */ +- mat_uint32_t len = tag[1]; +- mat_uint32_t len_pad; ++ mat_uint32_t len, len_pad; ++ if ( pre_buf == NULL && mat->byteswap ) ++ (void)Mat_uint32Swap(&tag[1]); ++ len = tag[1]; + if ( len % 8 == 0 ) + len_pad = len; + else if ( len < UINT32_MAX - 8 + (len % 8) ) +@@ -5744,6 +5745,8 @@ ReadTaggedString(mat_t *mat, char **str, const mat_uint32_t *pre_buf) + *str = (char *)malloc(len + 1); + if ( *str == NULL ) + return MATIO_E_OUT_OF_MEMORY; ++ if ( pre_buf != NULL && mat->byteswap ) ++ (void)Mat_uint32Swap(&tag[1]); + memcpy(*str, &tag[1], len); + (*str)[len] = '\0'; + } +diff --git a/tools/matdump.c b/tools/matdump.c +index d1687f0..18b8fd6 100644 +--- a/tools/matdump.c ++++ b/tools/matdump.c +@@ -170,7 +170,6 @@ snprint_mcos_string_row(const matvar_t *any, int row, char *buf, size_t bufsz) + { + const mat_uint64_t *u64; + size_t n = 1, nstrs, header_len, char_offset, slen, j; +- const unsigned char *bytes; + int pos = 0; + + if ( any == NULL || any->class_type != MAT_C_UINT64 || any->data == NULL ) +@@ -193,8 +192,6 @@ snprint_mcos_string_row(const matvar_t *any, int row, char *buf, size_t bufsz) + if ( header_len >= n ) + return 0; + +- bytes = (const unsigned char *)&u64[header_len]; +- + /* Compute char offset for this row */ + char_offset = 0; + for ( j = 0; j < (size_t)row; j++ ) +@@ -203,13 +200,21 @@ snprint_mcos_string_row(const matvar_t *any, int row, char *buf, size_t bufsz) + slen = (size_t)u64[4 + row]; + + { +- size_t data_bytes = (n - header_len) * sizeof(mat_uint64_t); ++ size_t data_elems = n - header_len; + for ( j = 0; j < slen && (size_t)pos < bufsz - 1; j++ ) { + size_t byte_idx = (char_offset + j) * 2; ++ size_t elem_idx = byte_idx / sizeof(mat_uint64_t); ++ unsigned shift = (unsigned)(byte_idx % sizeof(mat_uint64_t)) * 8; + mat_uint16_t ch; +- if ( byte_idx + 1 >= data_bytes ) ++ if ( elem_idx >= data_elems ) + break; +- ch = (mat_uint16_t)(bytes[byte_idx] | ((mat_uint16_t)bytes[byte_idx + 1] << 8)); ++ /* u64[] has already been byte-swapped into host order by the ++ * library. Extract the two UTF-16LE code unit bytes from the ++ * numeric value so the result does not depend on the host byte ++ * order. byte_idx is always even, so the two bytes never straddle ++ * a uint64 boundary. */ ++ ch = (mat_uint16_t)((u64[header_len + elem_idx] >> shift) & 0xff); ++ ch = (mat_uint16_t)(ch | (((u64[header_len + elem_idx] >> (shift + 8)) & 0xff) << 8)); + if ( ch >= 32 && ch < 127 ) + buf[pos++] = (char)ch; + else if ( ch == 0 ) +-- +2.47.3 + diff -Nru libmatio-1.6.0/debian/patches/series libmatio-1.6.0/debian/patches/series --- libmatio-1.6.0/debian/patches/series 1970-01-01 02:00:00.000000000 +0200 +++ libmatio-1.6.0/debian/patches/series 2026-10-02 20:54:31.000000000 +0300 @@ -0,0 +1 @@ +0001-Fix-testcase-failures-in-big-endian-machines.patch

