From 1278e62e877b1b7792af5a8693251adfd83dd5a1 Mon Sep 17 00:00:00 2001 From: Hugo Hurskainen Date: Mon, 8 Jun 2026 19:32:18 +0000 Subject: [PATCH 1/7] configure: detect ICU via icu-uc/icu-i18n pkg-config modules icu-config was deprecated and removed in ICU 63+, so it is absent on modern Debian/Ubuntu where only libicu-dev with pkg-config support is shipped. The pkg-config fallback used the monolithic "icu" module name, which those distros no longer provide, so configure failed to find ICU even when it was installed. Try the split modules "icu-uc" and "icu-i18n" (used since ICU 58) first, falling back to the legacy "icu" module for older systems. Also fall back to "pkg-config --modversion icu-uc" for the --enable-icu-6x version check when icu-config is unavailable. The icu-config path is still tried first, so older distros that still provide it continue to work unchanged. --- configure.ac | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f28d2b28..bf30be7b 100644 --- a/configure.ac +++ b/configure.ac @@ -336,12 +336,16 @@ fi dnl dnl Check for ICU +dnl Prefer icu-config for legacy distros; fall back to pkg-config icu-uc/icu-i18n +dnl (icu-config was removed in ICU 63+ and is absent on modern Debian/Ubuntu). dnl ICU_MODULE_CFLAGS="`icu-config --cppflags 2> /dev/null`"; ICU_MODULE_LIBS="`icu-config --ldflags 2> /dev/null`"; if test -z "$ICU_MODULE_LIBS" then - PKG_CHECK_MODULES([ICU_MODULE], [icu >= 0.21]) + PKG_CHECK_MODULES([ICU_MODULE], [icu-uc >= 0.21 icu-i18n >= 0.21], + [], + [PKG_CHECK_MODULES([ICU_MODULE], [icu >= 0.21])]) fi AC_MSG_CHECKING([use latest ICU]) @@ -356,6 +360,10 @@ if test "x${icu_6x}" = "xyes" then AC_MSG_CHECKING(for ICU version) ICU_MODULE_VERSION="`icu-config --version 2> /dev/null`"; + if test -z "$ICU_MODULE_VERSION" + then + ICU_MODULE_VERSION="`$PKG_CONFIG --modversion icu-uc 2> /dev/null`"; + fi if test "${ICU_MODULE_VERSION%%.*}" -ge "60" then AM_EXTRA_CPPFLAGS="${AM_EXTRA_CPPFLAGS} -D ICU6x" From d10f449eeac73fbfebcc31addc76b9a943ddf085 Mon Sep 17 00:00:00 2001 From: Matej Kenda Date: Wed, 29 Jul 2026 20:14:17 +0200 Subject: [PATCH 2/7] fix: correct inverted status checks in the SCSI tape backends. (#610) --- src/tape_drivers/linux/sg/sg_tape.c | 9 ++++++--- src/tape_drivers/osx/iokit/iokit_tape.c | 16 ++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/tape_drivers/linux/sg/sg_tape.c b/src/tape_drivers/linux/sg/sg_tape.c index 19f2beb8..47b60132 100644 --- a/src/tape_drivers/linux/sg/sg_tape.c +++ b/src/tape_drivers/linux/sg/sg_tape.c @@ -4630,7 +4630,9 @@ static bool is_ame(void *device) unsigned char buf[TC_MP_READ_WRITE_CTRL_SIZE] = {0}; const int ret = sg_modesense(device, TC_MP_READ_WRITE_CTRL, TC_MP_PC_CURRENT, 0, buf, sizeof(buf)); - if (ret != 0) { + /* sg_modesense returns the transferred byte count (> 0) on success and a + * negative error code on failure. */ + if (ret < 0) { char message[100] = {0}; sprintf(message, "failed to get MP %02Xh (%d)", TC_MP_READ_WRITE_CTRL, ret); ltfsmsg(LTFS_DEBUG, 30392D, __FUNCTION__, message); @@ -4720,7 +4722,7 @@ int sg_set_key(void *device, const unsigned char *keyalias, const unsigned char unsigned char buf[TC_MP_READ_WRITE_CTRL_SIZE] = {0}; ret = sg_modesense(device, TC_MP_READ_WRITE_CTRL, TC_MP_PC_CURRENT, 0, buf, sizeof(buf)); - if (ret != DEVICE_GOOD) + if (ret < 0) /* sg_modesense returns a byte count (> 0) on success */ goto out; ltfs_u16tobe(buffer + 0, sps); @@ -4767,8 +4769,9 @@ int sg_set_key(void *device, const unsigned char *keyalias, const unsigned char memset(buf, 0, sizeof(buf)); ret = sg_modesense(device, TC_MP_READ_WRITE_CTRL, TC_MP_PC_CURRENT, 0, buf, sizeof(buf)); - if (ret != DEVICE_GOOD) + if (ret < 0) /* sg_modesense returns a byte count (> 0) on success */ goto out; + ret = DEVICE_GOOD; /* normalize the byte count to a success code */ free: free(buffer); diff --git a/src/tape_drivers/osx/iokit/iokit_tape.c b/src/tape_drivers/osx/iokit/iokit_tape.c index 76f14628..ea6b86bd 100644 --- a/src/tape_drivers/osx/iokit/iokit_tape.c +++ b/src/tape_drivers/osx/iokit/iokit_tape.c @@ -285,7 +285,7 @@ static int _get_dump(struct iokit_data *priv, char *fname) long long data_length, buf_offset; int dumpfd = -1; int transfer_size, num_transfers, excess_transfer; - int i, bytes; + int bytes; unsigned char cap_buf[DUMP_HEADER_SIZE]; unsigned char *dump_buf; int buf_id; @@ -331,14 +331,11 @@ static int _get_dump(struct iokit_data *priv, char *fname) /* start to transfer data */ buf_offset = 0; - i = 0; ltfsmsg(LTFS_DEBUG, 30859D); while(num_transfers) { int length; - i++; - /* Allocation Length is transfer_size or excess_transfer*/ if(excess_transfer && num_transfers == 1) length = excess_transfer; @@ -3412,7 +3409,9 @@ int iokit_set_xattr(void *device, const char *name, const char *buf, size_t size free(null_terminated); ltfs_profiler_add_entry(priv->profiler, NULL, TAPEBEND_REQ_EXIT(REQ_TC_SETXATTR)); - return -LTFS_NO_XATTR; + /* ret is DEVICE_GOOD when one of the vendor attributes matched above; + * returning the hardcoded failure reported success as an error. */ + return ret; } #define BLOCKLEN_DATA_SIZE 6 @@ -3629,7 +3628,7 @@ static const char *_generate_product_name(const char *product_id) int iokit_get_device_list(struct tc_drive_info *buf, int count) { - int i, ret; + int i; int found = 0; int32_t devs = iokit_get_ssc_device_count(); int drive_type; @@ -3646,10 +3645,7 @@ int iokit_get_device_list(struct tc_drive_info *buf, int count) if( devs > 0 ) { for (i = 0; i < devs; i++) { if(iokit_find_ssc_device(iokit_device, i) != 0) - { - ret = -EDEV_DEVICE_UNOPENABLE; continue; - } drive_type = iokit_get_drive_identifier(iokit_device, &identifier); if (!drive_type) { if (found < count && buf) { @@ -3665,7 +3661,7 @@ int iokit_get_device_list(struct tc_drive_info *buf, int count) } found ++; } - ret = iokit_free_device(iokit_device); + iokit_free_device(iokit_device); } } From 7c014793014d3a975a67a6f15ad64750a34fa727 Mon Sep 17 00:00:00 2001 From: Alexandra Rangel Date: Wed, 29 Jul 2026 13:18:16 -0600 Subject: [PATCH 3/7] Revert "fix: correct inverted status checks in the SCSI tape backend (#626) --- src/tape_drivers/linux/sg/sg_tape.c | 9 +++------ src/tape_drivers/osx/iokit/iokit_tape.c | 16 ++++++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/tape_drivers/linux/sg/sg_tape.c b/src/tape_drivers/linux/sg/sg_tape.c index 47b60132..19f2beb8 100644 --- a/src/tape_drivers/linux/sg/sg_tape.c +++ b/src/tape_drivers/linux/sg/sg_tape.c @@ -4630,9 +4630,7 @@ static bool is_ame(void *device) unsigned char buf[TC_MP_READ_WRITE_CTRL_SIZE] = {0}; const int ret = sg_modesense(device, TC_MP_READ_WRITE_CTRL, TC_MP_PC_CURRENT, 0, buf, sizeof(buf)); - /* sg_modesense returns the transferred byte count (> 0) on success and a - * negative error code on failure. */ - if (ret < 0) { + if (ret != 0) { char message[100] = {0}; sprintf(message, "failed to get MP %02Xh (%d)", TC_MP_READ_WRITE_CTRL, ret); ltfsmsg(LTFS_DEBUG, 30392D, __FUNCTION__, message); @@ -4722,7 +4720,7 @@ int sg_set_key(void *device, const unsigned char *keyalias, const unsigned char unsigned char buf[TC_MP_READ_WRITE_CTRL_SIZE] = {0}; ret = sg_modesense(device, TC_MP_READ_WRITE_CTRL, TC_MP_PC_CURRENT, 0, buf, sizeof(buf)); - if (ret < 0) /* sg_modesense returns a byte count (> 0) on success */ + if (ret != DEVICE_GOOD) goto out; ltfs_u16tobe(buffer + 0, sps); @@ -4769,9 +4767,8 @@ int sg_set_key(void *device, const unsigned char *keyalias, const unsigned char memset(buf, 0, sizeof(buf)); ret = sg_modesense(device, TC_MP_READ_WRITE_CTRL, TC_MP_PC_CURRENT, 0, buf, sizeof(buf)); - if (ret < 0) /* sg_modesense returns a byte count (> 0) on success */ + if (ret != DEVICE_GOOD) goto out; - ret = DEVICE_GOOD; /* normalize the byte count to a success code */ free: free(buffer); diff --git a/src/tape_drivers/osx/iokit/iokit_tape.c b/src/tape_drivers/osx/iokit/iokit_tape.c index ea6b86bd..76f14628 100644 --- a/src/tape_drivers/osx/iokit/iokit_tape.c +++ b/src/tape_drivers/osx/iokit/iokit_tape.c @@ -285,7 +285,7 @@ static int _get_dump(struct iokit_data *priv, char *fname) long long data_length, buf_offset; int dumpfd = -1; int transfer_size, num_transfers, excess_transfer; - int bytes; + int i, bytes; unsigned char cap_buf[DUMP_HEADER_SIZE]; unsigned char *dump_buf; int buf_id; @@ -331,11 +331,14 @@ static int _get_dump(struct iokit_data *priv, char *fname) /* start to transfer data */ buf_offset = 0; + i = 0; ltfsmsg(LTFS_DEBUG, 30859D); while(num_transfers) { int length; + i++; + /* Allocation Length is transfer_size or excess_transfer*/ if(excess_transfer && num_transfers == 1) length = excess_transfer; @@ -3409,9 +3412,7 @@ int iokit_set_xattr(void *device, const char *name, const char *buf, size_t size free(null_terminated); ltfs_profiler_add_entry(priv->profiler, NULL, TAPEBEND_REQ_EXIT(REQ_TC_SETXATTR)); - /* ret is DEVICE_GOOD when one of the vendor attributes matched above; - * returning the hardcoded failure reported success as an error. */ - return ret; + return -LTFS_NO_XATTR; } #define BLOCKLEN_DATA_SIZE 6 @@ -3628,7 +3629,7 @@ static const char *_generate_product_name(const char *product_id) int iokit_get_device_list(struct tc_drive_info *buf, int count) { - int i; + int i, ret; int found = 0; int32_t devs = iokit_get_ssc_device_count(); int drive_type; @@ -3645,7 +3646,10 @@ int iokit_get_device_list(struct tc_drive_info *buf, int count) if( devs > 0 ) { for (i = 0; i < devs; i++) { if(iokit_find_ssc_device(iokit_device, i) != 0) + { + ret = -EDEV_DEVICE_UNOPENABLE; continue; + } drive_type = iokit_get_drive_identifier(iokit_device, &identifier); if (!drive_type) { if (found < count && buf) { @@ -3661,7 +3665,7 @@ int iokit_get_device_list(struct tc_drive_info *buf, int count) } found ++; } - iokit_free_device(iokit_device); + ret = iokit_free_device(iokit_device); } } From f76d4d98b244cf092794e5f07d32001f76fcbff4 Mon Sep 17 00:00:00 2001 From: Hugo Hurskainen Date: Thu, 6 Aug 2026 22:31:13 +0300 Subject: [PATCH 4/7] docs: drop obsolete icu-config workaround notes from README ICU is now detected via the icu-uc/icu-i18n pkg-config modules, so the dummy icu-config workaround (issue #153) is no longer needed. Remove the '(Need icu-config)' annotations from the Ubuntu 20.04 / Debian 10 build rows and the sentence pointing at the workaround. --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8d393ba8..a1843f4b 100644 --- a/README.md +++ b/README.md @@ -289,16 +289,14 @@ You need to add `--enable-lintape` as an argument of ./configure script if you w | Ubuntu 16.04 LTS | ppc64le | OK - Not checked automatically | | Ubuntu 18.04 LTS | x86\_64 | ![GH Action status](https://github.com/LinearTapeFileSystem/ltfs/actions/workflows/build-ubuntu-bionic.yml/badge.svg) | | Ubuntu 18.04 LTS | ppc64le | OK - Not checked automatically | - | Ubuntu 20.04 LTS (Need icu-config) | x86\_64 | ![GH Action status](https://github.com/LinearTapeFileSystem/ltfs/actions/workflows/build-ubuntu-focal.yml/badge.svg) | + | Ubuntu 20.04 LTS | x86\_64 | ![GH Action status](https://github.com/LinearTapeFileSystem/ltfs/actions/workflows/build-ubuntu-focal.yml/badge.svg) | | Debian 9 | x86\_64 | ![GH Action status](https://github.com/LinearTapeFileSystem/ltfs/actions/workflows/build-debian9.yml/badge.svg) | - | Debian 10 (Need icu-config) | x86\_64 | ![GH Action status](https://github.com/LinearTapeFileSystem/ltfs/actions/workflows/build-debian10.yml/badge.svg) | + | Debian 10 | x86\_64 | ![GH Action status](https://github.com/LinearTapeFileSystem/ltfs/actions/workflows/build-debian10.yml/badge.svg) | | ArchLinux 2018.08.01 | x86\_64 | OK - Not checked automatically | | ArchLinux 2018.12.31 (rolling) | x86\_64 | OK - Not checked automatically | Currently, automatic build checking is working on GitHub Actions and Travis CI. -For Ubuntu20.04 and Debian10, dummy `icu-config` is needed in the build machine. See Issue [#153](https://github.com/LinearTapeFileSystem/ltfs/issues/153). - ### Build and install on OSX (macOS) #### Recent Homedrew system setup From cd63eb38e9fb0ad325f58952be8b0365c18789db Mon Sep 17 00:00:00 2001 From: Hugo Hurskainen Date: Thu, 6 Aug 2026 22:31:32 +0300 Subject: [PATCH 5/7] ci: drop dummy icu-config copy from build.sh ICU is now found via pkg-config (icu-uc/icu-i18n), so copying the dummy icu-config into /usr/bin is no longer required to configure the build. --- build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sh b/build.sh index 8875035a..2d1a162b 100755 --- a/build.sh +++ b/build.sh @@ -6,7 +6,6 @@ sudo apt-get -q -y update sudo apt-get -q -y upgrade sudo apt-get -y install build-essential automake autoconf libtool pkg-config libicu66 icu-devtools libicu-dev libxml2-dev uuid-dev fuse libfuse-dev libsnmp-dev -sudo cp .github/workflows/icu-config /usr/bin/icu-config ./autogen.sh ./configure make From 24d92c72774072a8a99c8f6ece429dac9fd546b0 Mon Sep 17 00:00:00 2001 From: Hugo Hurskainen Date: Thu, 6 Aug 2026 22:31:57 +0300 Subject: [PATCH 6/7] ci: drop dummy icu-config copy from CodeQL workflow ICU is now found via pkg-config (icu-uc/icu-i18n), so the CodeQL build no longer needs the dummy icu-config copied into /usr/bin. --- .github/workflows/codeql-analysis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index affc7019..6c1b7cf4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -69,7 +69,6 @@ jobs: sudo apt-get -q -y update sudo apt-get -q -y upgrade sudo apt-get -y install build-essential automake autoconf libtool pkg-config icu-devtools libicu-dev libxml2-dev uuid-dev fuse libfuse-dev libsnmp-dev - sudo cp .github/workflows/icu-config /usr/bin/icu-config ./autogen.sh ./configure make From 3cb34aa45ea93b184dde67b850290931279898fd Mon Sep 17 00:00:00 2001 From: Hugo Hurskainen Date: Thu, 6 Aug 2026 22:32:14 +0300 Subject: [PATCH 7/7] ci: remove the now-unused dummy icu-config shim Nothing references .github/workflows/icu-config after the pkg-config-based ICU detection landed and the build.sh / CodeQL copies were removed. --- .github/workflows/icu-config | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100755 .github/workflows/icu-config diff --git a/.github/workflows/icu-config b/.github/workflows/icu-config deleted file mode 100755 index d5aed413..00000000 --- a/.github/workflows/icu-config +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -opts=$1 - -case $opts in - '--cppflags') - echo '' ;; - '--ldflags') - echo '-licuuc -licudata' ;; - *) - echo '/usr/lib/x86_64-linux-gnu/icu/pkgdata.inc' ;; -esac