[med-svn] [Git][med-team/canu][master] 2 commits: Fix more instances of not trusting errno
Andreas Tille (@tille)
gitlab at salsa.debian.org
Wed Nov 4 16:43:26 GMT 2026
Andreas Tille pushed to branch master at Debian Med / canu
Commits:
0d20000e by Andreas Tille at 2026-11-04T16:44:57+01:00
Fix more instances of not trusting errno
- - - - -
4d9b7e41 by Andreas Tille at 2026-11-04T17:29:39+01:00
Upload to unstable
- - - - -
2 changed files:
- debian/changelog
- debian/patches/do-not-trust-errno-on-success.patch
Changes:
=====================================
debian/changelog
=====================================
@@ -1,4 +1,4 @@
-canu (2.3+dfsg-2) UNRELEASED; urgency=medium
+canu (2.3+dfsg-2) unstable; urgency=medium
* Team upload.
* d/watch: version=5
@@ -9,7 +9,7 @@ canu (2.3+dfsg-2) UNRELEASED; urgency=medium
* 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
+ -- Andreas Tille <tille at debian.org> Wed, 04 Nov 2026 16:46:09 +0100
canu (2.3+dfsg-1) unstable; urgency=medium
=====================================
debian/patches/do-not-trust-errno-on-success.patch
=====================================
@@ -17,14 +17,16 @@ Description: Do not infer I/O failure from a non-zero errno
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().
+ and compressedFileWriter::open()/close(), and the same pattern in
+ tgStore::openDB() and in the fopen() callers in correction/ and
+ overlapInCore/.
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
+--- a/src/utility/src/files/accessing-v1.C
++++ b/src/utility/src/files/accessing-v1.C
@@ -512,11 +512,12 @@ ftell(FILE *stream) {
errno = 0;
off_t pos = ::ftello(stream);
@@ -59,7 +61,7 @@ Assisted-By: aim2balance/a2b-code
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
+@@ -633,13 +634,11 @@ closeFile(FILE *&F, char const *prefix,
fprintf(stderr, "closeFile()-- Closing (anonymous file).\n");
#endif
@@ -75,8 +77,8 @@ Assisted-By: aim2balance/a2b-code
return;
if ((prefix) && (suffix))
---- canu.orig/src/utility/src/files/buffered-v1-writing.C
-+++ canu/src/utility/src/files/buffered-v1-writing.C
+--- a/src/utility/src/files/buffered-v1-writing.C
++++ b/src/utility/src/files/buffered-v1-writing.C
@@ -251,9 +251,8 @@ writeBuffer::open(void) {
if (_file != nullptr)
return;
@@ -88,9 +90,9 @@ Assisted-By: aim2balance/a2b-code
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() {
+--- a/src/utility/src/files/compressed-v1-reading.C
++++ b/src/utility/src/files/compressed-v1-reading.C
+@@ -46,13 +46,12 @@ compressedFileReader::~compressedFileRea
void
compressedFileReader::close(void) {
@@ -108,9 +110,9 @@ Assisted-By: aim2balance/a2b-code
_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,
+--- a/src/utility/src/files/compressed-v1-writing.C
++++ b/src/utility/src/files/compressed-v1-writing.C
+@@ -87,7 +87,7 @@ compressedFileWriter::compressedFileWrit
break;
}
@@ -119,7 +121,7 @@ Assisted-By: aim2balance/a2b-code
fprintf(stderr, "ERROR: Failed to open output file '%s': %s\n", _filename, strerror(errno)), exit(1);
}
-@@ -101,13 +101,12 @@ compressedFileWriter::~compressedFileWriter() {
+@@ -101,13 +101,12 @@ compressedFileWriter::~compressedFileWri
void
compressedFileWriter::close(void) {
@@ -137,3 +139,97 @@ Assisted-By: aim2balance/a2b-code
_file = nullptr;
}
+--- a/src/stores/tgStore.C
++++ b/src/stores/tgStore.C
+@@ -689,7 +689,7 @@ tgStore::openDB(uint32 version) {
+ _dataFile[version].atEOF = false;
+ }
+
+- if (errno)
++ if (_dataFile[version].FP == NULL)
+ fprintf(stderr, "tgStore::openDB()-- Failed to open '%s': %s\n", _name, strerror(errno)), exit(1);
+
+ return(_dataFile[version].FP);
+--- a/src/correction/errorEstimate.C
++++ b/src/correction/errorEstimate.C
+@@ -68,7 +68,7 @@
+
+ errno = 0;
+ FILE *scoreFile = (scoreFileName == NULL) ? NULL : (scoreFileName[0] == '-' ? stdin : fopen(scoreFileName, "r"));
+- if (errno)
++ if ((scoreFileName != NULL) && (scoreFile == NULL))
+ fprintf(stderr, "ERROR: failed to open '%s' for reading: %s\n", scoreFileName, strerror(errno)), exit(1);
+
+ // read the file and store best hits
+--- a/src/correction/filterCorrectionOverlaps.C
++++ b/src/correction/filterCorrectionOverlaps.C
+@@ -37,7 +37,7 @@
+
+ FILE *F = fopen(fileName, "w");
+
+- if (errno)
++ if (F == NULL)
+ fprintf(stderr, "ERROR: failed to open '%s' for writing: %s\n", fileName, strerror(errno)), exit(1);
+
+ return(F);
+--- a/src/overlapInCore/liboverlap/prefixEditDistance-matchLimitGenerate.C
++++ b/src/overlapInCore/liboverlap/prefixEditDistance-matchLimitGenerate.C
+@@ -106,7 +106,7 @@
+
+ errno = 0;
+ FILE *F = fopen(N, "r");
+- if (errno)
++ if (F == NULL)
+ fprintf(stderr, "Failed to open '%s' for reading: %s\n", N, strerror(errno)), exit(1);
+
+ int32 me = 0;
+@@ -138,7 +138,7 @@
+
+ errno = 0;
+ FILE *F = fopen(O, "w");
+- if (errno)
++ if (F == NULL)
+ fprintf(stderr, "Failed to open '%s' for writing: %s\n", N, strerror(errno)), exit(1);
+
+ fwrite(&MAX_ERRORS, sizeof(int32), 1, F);
+@@ -155,7 +155,7 @@
+
+ errno = 0;
+ FILE *F = fopen(O, "w");
+- if (errno)
++ if (F == NULL)
+ fprintf(stderr, "Failed to open '%s' for writing: %s\n", N, strerror(errno)), exit(1);
+
+ fprintf(F, "#length limit slope0toX slopeXtoMAX for erate=%0.4f MAX_ERRORS=%d\n", erate, MAX_ERRORS);
+@@ -177,7 +177,7 @@
+
+ errno = 0;
+ FILE *F = fopen(O, "w");
+- if (errno)
++ if (F == NULL)
+ fprintf(stderr, "Failed to open '%s' for writing: %s\n", N, strerror(errno)), exit(1);
+
+ fprintf(F, "//\n");
+--- a/src/overlapInCore/overlapInCore.C
++++ b/src/overlapInCore/overlapInCore.C
+@@ -541,7 +541,7 @@
+ if (G.Outstat_Name != NULL) {
+ errno = 0;
+ stats = fopen(G.Outstat_Name, "w");
+- if (errno) {
++ if (stats == NULL) {
+ fprintf(stderr, "WARNING: failed to open '%s' for writing: %s\n", G.Outstat_Name, strerror(errno));
+ stats = stderr;
+ }
+--- a/src/overlapInCore/overlapInCorePartition.C
++++ b/src/overlapInCore/overlapInCorePartition.C
+@@ -268,7 +268,7 @@
+
+ FILE *F = fopen(A, "w");
+
+- if (errno)
++ if (F == NULL)
+ fprintf(stderr, "Failed to open '%s': %s\n", A, strerror(errno)), exit(1);
+
+ return(F);
+
View it on GitLab: https://salsa.debian.org/med-team/canu/-/compare/e21807f5c043fa4f440a41193b33583bb4299ef0...4d9b7e41754c61491486e83af7edaddb32be54b4
--
View it on GitLab: https://salsa.debian.org/med-team/canu/-/compare/e21807f5c043fa4f440a41193b33583bb4299ef0...4d9b7e41754c61491486e83af7edaddb32be54b4
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/0fc4bbcf/attachment-0001.htm>
More information about the debian-med-commit
mailing list