[med-svn] [Git][med-team/canu][master] 3 commits: d/p/do-not-trust-errno-on-success.patch: do not consider a non-zero errno an I/O failure
Andreas Tille (@tille)
gitlab at salsa.debian.org
Wed Nov 4 15:17:58 GMT 2026
Andreas Tille pushed to branch master at Debian Med / canu
Commits:
43a52407 by Andreas Tille at 2026-11-04T15:44:03+01:00
d/p/do-not-trust-errno-on-success.patch: do not consider a non-zero errno an I/O failure
- - - - -
112c654c by Andreas Tille at 2026-11-04T15:45:33+01:00
d/p/mhap-needs-commons-io.patch: Put commons-io on mhap's classpath
- - - - -
e21807f5 by Andreas Tille at 2026-11-04T15:46:32+01:00
d/tests/run-unit-test: do not fail when no artifact matches a glob.
- - - - -
5 changed files:
- debian/changelog
- + debian/patches/do-not-trust-errno-on-success.patch
- + debian/patches/mhap-needs-commons-io.patch
- debian/patches/series
- debian/tests/run-unit-test
Changes:
=====================================
debian/changelog
=====================================
@@ -4,6 +4,10 @@ canu (2.3+dfsg-2) UNRELEASED; urgency=medium
* d/watch: version=5
* Standards-Version: 4.7.4 (routine-update)
* Remove redundant Priority: optional from source stanza.
+ * d/p/do-not-trust-errno-on-success.patch: do not consider a non-zero errno
+ an I/O failure
+ * d/p/mhap-needs-commons-io.patch: Put commons-io on mhap's classpath
+ * d/tests/run-unit-test: do not fail when no artifact matches a glob.
-- Andreas Tille <tille at debian.org> Wed, 04 Nov 2026 12:32:40 +0100
=====================================
debian/patches/do-not-trust-errno-on-success.patch
=====================================
@@ -0,0 +1,139 @@
+Description: Do not infer I/O failure from a non-zero errno
+ POSIX only guarantees that errno is set when a call fails; it is never
+ cleared on success and may be set spuriously by any successful call.
+ Since glibc 2.43 malloc() can set errno (e.g. ENOENT) even when the
+ allocation succeeds. meryl-utility instead decides that fopen(), ftello()
+ and fclose() failed whenever errno is non-zero after the call:
+ .
+ errno = 0;
+ FILE *F = fopen(pathname, "w");
+ if (errno)
+ fprintf(stderr, "Failed to open '%s' for writing: %s\n", ...), exit(1);
+ .
+ so on such systems 'canu -pacbio ...' dies immediately while creating the
+ seqStore, with "Failed to open './ecoli.seqStore.BUILDING/errorLog' for
+ writing: No such file or directory" even though the file was created.
+ .
+ Check the return value of the call instead, as done upstream in
+ meryl-utility commit 7b9d71f. Affects openInputFile(), openOutputFile(),
+ ftell(), closeFile(), writeBuffer::open(), compressedFileReader::close()
+ and compressedFileWriter::open()/close().
+Author: Andreas Tille <tille at debian.org>
+Forwarded: https://github.com/marbl/meryl-utility/commit/7b9d71feda5f54605e2d4d98338c0c0fcc00f01f
+Last-Update: 2026-11-04
+Assisted-By: aim2balance/a2b-code
+
+--- canu.orig/src/utility/src/files/accessing-v1.C
++++ canu/src/utility/src/files/accessing-v1.C
+@@ -512,11 +512,12 @@ ftell(FILE *stream) {
+ errno = 0;
+ off_t pos = ::ftello(stream);
+
+- if ((errno == ESPIPE) || (errno == EBADF)) // Not a seekable stream.
+- return(((off_t)1) < 42); // Return some goofy big number.
++ if (pos == -1) {
++ if ((errno == ESPIPE) || (errno == EBADF)) // Not a seekable stream.
++ return(((off_t)1) < 42); // Return some goofy big number.
+
+- if (errno)
+ fprintf(stderr, "ftell()-- Failed with %s.\n", strerror(errno)), exit(1);
++ }
+
+ return(pos);
+ }
+@@ -567,7 +568,7 @@ openInputFile(char const *prefix,
+ errno = 0;
+
+ FILE *F = fopen(pathname, "r");
+- if (errno)
++ if (F == nullptr)
+ fprintf(stderr, "Failed to open '%s' for reading: %s\n", pathname, strerror(errno)), exit(1);
+
+ delete [] pathname;
+@@ -610,7 +611,7 @@ openOutputFile(char const *prefix,
+ errno = 0;
+
+ FILE *F = fopen(pathname, "w");
+- if (errno)
++ if (F == nullptr)
+ fprintf(stderr, "Failed to open '%s' for writing: %s\n", pathname, strerror(errno)), exit(1);
+
+ delete [] pathname;
+@@ -633,13 +634,11 @@ closeFile(FILE *&F, char const *prefix, char separator, char const *suffix, bool
+ fprintf(stderr, "closeFile()-- Closing (anonymous file).\n");
+ #endif
+
+- errno = 0;
+-
+- fclose(F);
++ int err = fclose(F);
+
+ F = nullptr;
+
+- if ((critical == false) || (errno == 0))
++ if ((critical == false) || (err == 0))
+ return;
+
+ if ((prefix) && (suffix))
+--- canu.orig/src/utility/src/files/buffered-v1-writing.C
++++ canu/src/utility/src/files/buffered-v1-writing.C
+@@ -251,9 +251,8 @@ writeBuffer::open(void) {
+ if (_file != nullptr)
+ return;
+
+- errno = 0;
+ _file = fopen(_filename, _filemode);
+- if (errno)
++ if (_file == nullptr)
+ fprintf(stderr, "writeBuffer()-- Failed to open file '%s' with mode '%s': %s\n",
+ _filename, _filemode, strerror(errno)), exit(1);
+
+--- canu.orig/src/utility/src/files/compressed-v1-reading.C
++++ canu/src/utility/src/files/compressed-v1-reading.C
+@@ -46,13 +46,12 @@ compressedFileReader::~compressedFileReader() {
+ void
+ compressedFileReader::close(void) {
+
+- errno = 0;
++ if ((_file) && (_stdi == false) && (_pipe == true) && (pclose(_file) == -1))
++ fprintf(stderr, "WARNING: Failed to cleanly close input file '%s': %s\n", _filename, strerror(errno));
+
+- if ((_file) && (_stdi == false) && (_pipe == true)) pclose(_file);
+- if ((_file) && (_stdi == false) && (_pipe == false)) closeFile(_file, _filename);
++ if ((_file) && (_stdi == false) && (_pipe == false))
++ closeFile(_file, _filename);
+
+- if (errno)
+- fprintf(stderr, "WARNING: Failed to cleanly close input file '%s': %s\n", _filename, strerror(errno));
+
+ _file = nullptr;
+ }
+--- canu.orig/src/utility/src/files/compressed-v1-writing.C
++++ canu/src/utility/src/files/compressed-v1-writing.C
+@@ -87,7 +87,7 @@ compressedFileWriter::compressedFileWriter(const char *filename, uint32 cLevel,
+ break;
+ }
+
+- if (errno)
++ if (_file == nullptr)
+ fprintf(stderr, "ERROR: Failed to open output file '%s': %s\n", _filename, strerror(errno)), exit(1);
+ }
+
+@@ -101,13 +101,12 @@ compressedFileWriter::~compressedFileWriter() {
+ void
+ compressedFileWriter::close(void) {
+
+- errno = 0;
++ if ((_file) && (_stdi == false) && (_pipe == true) && (pclose(_file) == -1))
++ fprintf(stderr, "ERROR: Failed to cleanly close output file '%s': %s\n", _filename, strerror(errno)), exit(1);
+
+- if ((_file) && (_stdi == false) && (_pipe == true)) pclose(_file);
+- if ((_file) && (_stdi == false) && (_pipe == false)) closeFile(_file, _filename);
++ if ((_file) && (_stdi == false) && (_pipe == false))
++ closeFile(_file, _filename);
+
+- if (errno)
+- fprintf(stderr, "ERROR: Failed to cleanly close output file '%s': %s\n", _filename, strerror(errno)), exit(1);
+
+ _file = nullptr;
+ }
=====================================
debian/patches/mhap-needs-commons-io.patch
=====================================
@@ -0,0 +1,38 @@
+Description: Put commons-io on mhap's classpath
+ The mhap jar is started with -jar, so only the jars listed in its manifest
+ Class-Path are available. That list has no commons-io, but mhap reads the
+ k-mer filter (and any other compressed input) through commons-compress,
+ which since 1.27 extends commons-io's BoundedInputStream. The mhap
+ precompute step therefore dies with
+ .
+ NoClassDefFoundError: org/apache/commons/io/input/BoundedInputStream
+ .
+ and canu aborts with "Mhap precompute jobs failed". Invoke the main class
+ with an explicit classpath instead so commons-io is resolvable.
+Author: Andreas Tille <tille at debian.org>
+Forwarded: not-needed
+Last-Update: 2026-11-04
+Assisted-By: aim2balance/a2b-code
+
+--- canu.orig/src/pipelines/canu/OverlapMhap.pm
++++ canu/src/pipelines/canu/OverlapMhap.pm
+@@ -344,7 +344,8 @@
+ print F "cd ./blocks\n";
+ print F "\n";
+ print F "\$je $javaOpt -XX:ParallelGCThreads=", getGlobal("${tag}mhapThreads"), " -server -Xms", $javaMemory, "m -Xmx", $javaMemory, "m \\\n";
+- print F " -jar $cygA /usr/share/java/mhap.jar $cygB \\\n";
++ print F " -cp $cygA /usr/share/java/mhap.jar:/usr/share/java/commons-io.jar $cygB \\\n";
++ print F " edu.umd.marbl.mhap.main.MhapMain \\\n";
+ print F " --repeat-weight 0.9 --repeat-idf-scale 10 -k $merSize \\\n";
+ print F " --supress-noise 2 \\\n" if (defined(getGlobal("${tag}MhapFilterUnique")) && getGlobal("${tag}MhapFilterUnique") == 1);
+ print F " --no-tf \\\n" if (defined(getGlobal("${tag}MhapNoTf")) && getGlobal("${tag}MhapNoTf") == 1);
+@@ -467,7 +468,8 @@
+
+ print F " # Start up the producer.\n";
+ print F " \$je $javaOpt -XX:ParallelGCThreads=", getGlobal("${tag}mhapThreads"), " -server -Xms", $javaMemory, "m -Xmx", $javaMemory, "m \\\n";
+- print F " -jar $cygA /usr/share/java/mhap.jar $cygB \\\n";
++ print F " -cp $cygA /usr/share/java/mhap.jar:/usr/share/java/commons-io.jar $cygB \\\n";
++ print F " edu.umd.marbl.mhap.main.MhapMain \\\n";
+ print F " --repeat-weight 0.9 --repeat-idf-scale 10 -k $merSize \\\n";
+ print F " --supress-noise 2 \\\n" if (defined(getGlobal("${tag}MhapFilterUnique")) && getGlobal("${tag}MhapFilterUnique") == 1);
+ print F " --no-tf \\\n" if (defined(getGlobal("${tag}MhapNoTf")) && getGlobal("${tag}MhapNoTf") == 1);
=====================================
debian/patches/series
=====================================
@@ -2,3 +2,5 @@ use-debian-mhap-at-runtime.patch
libsnappy
stacktrace
spelling
+do-not-trust-errno-on-success.patch
+mhap-needs-commons-io.patch
=====================================
debian/tests/run-unit-test
=====================================
@@ -46,9 +46,9 @@ canu -p ecoli -d ecoli-pacbio \
-pacbio "${AUTOPKGTEST_TMP}"/pacbio.fastq ; result=$?
if [ ! "${AUTOPKGTEST_ARTIFACTS}" = "" ] ; then
- cp ecoli-pacbio/*.report ecoli-pacbio/*.err "${AUTOPKGTEST_ARTIFACTS}/"
- cp $(find ecoli-pacbio -name "*\.out") "${AUTOPKGTEST_ARTIFACTS}/"
- cp -r ecoli-pacbio/canu-logs "${AUTOPKGTEST_ARTIFACTS}/"
+ cp ecoli-pacbio/*.report ecoli-pacbio/*.err "${AUTOPKGTEST_ARTIFACTS}/" || true
+ find ecoli-pacbio -name '*.out' -exec cp -t "${AUTOPKGTEST_ARTIFACTS}/" {} +
+ cp -r ecoli-pacbio/canu-logs "${AUTOPKGTEST_ARTIFACTS}/" || true
fi
exit ${result}
View it on GitLab: https://salsa.debian.org/med-team/canu/-/compare/b5b06b6d31ec0e7bab8cb4ff0827c852bd5c043a...e21807f5c043fa4f440a41193b33583bb4299ef0
--
View it on GitLab: https://salsa.debian.org/med-team/canu/-/compare/b5b06b6d31ec0e7bab8cb4ff0827c852bd5c043a...e21807f5c043fa4f440a41193b33583bb4299ef0
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20261104/22790569/attachment-0001.htm>
More information about the debian-med-commit
mailing list