From: Bdale Garbee Date: Fri, 27 Sep 2024 02:48:49 +0000 (-0600) Subject: patch to fix libdsk interaction problem X-Git-Tag: debian/2.23-6 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=HEAD;p=debian%2Fcpmtools patch to fix libdsk interaction problem --- diff --git a/debian/changelog b/debian/changelog index dd009df..2ff3c21 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +cpmtools (2.23-6) unstable; urgency=low + + * patch from Jacob Nevins for libdsk probe robustness expected to be in + 2.24 when released, closes: #1079619 + + -- Bdale Garbee Thu, 26 Sep 2024 20:46:26 -0600 + cpmtools (2.23-5) unstable; urgency=low * elide processed man pages from repo, ensure they're removed in diff --git a/debian/patches/cpmtools-libdsk-probe-robustness.patch b/debian/patches/cpmtools-libdsk-probe-robustness.patch new file mode 100644 index 0000000..915007b --- /dev/null +++ b/debian/patches/cpmtools-libdsk-probe-robustness.patch @@ -0,0 +1,54 @@ +Subject: libdsk: reset geometry if autoprobe isn't sane + +So that weirdness from any misfiring auto-geometry heuristic in LibDsk +doesn't cause trouble later. (We were overwriting the most common +parameters, but not all of them.) +(Triggered by Debian bug #1079619, where a spurious dg_sidedness caused +trouble after LibDsk's Opus Discovery heuristic misfired -- that +heuristic has been improved in libdsk 1.5.20, but this change provides +defence in depth.) +--- + device_libdsk.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +diff --git a/device_libdsk.c b/device_libdsk.c +index 7baaed4..82b79d1 100644 +--- a/device_libdsk.c ++++ b/device_libdsk.c +@@ -72,6 +72,7 @@ const char *Device_open(struct Device *this, const char *filename, int mode, con + const char *Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset, const char *libdskGeometry) + { + char *boo; ++ int probeOk; + + this->secLength=secLength; + this->sectrk=sectrk; +@@ -85,11 +86,22 @@ const char *Device_setGeometry(struct Device *this, int secLength, int sectrk, i + return lookupFormat(&this->geom, libdskGeometry); + } + ++ /* Did the autoprobe guess right about the number of sectors & cylinders? */ ++ if (this->geom.dg_cylinders * this->geom.dg_heads == tracks) ++ { ++ probeOk = 1; ++ } ++ else ++ { ++ /* If not, reset to a minimal geometry (to undo any randomness from ++ * a failed autoprobe), and guess some parameters */ ++ probeOk = 0; ++ dg_stdformat(&this->geom, FMT_180K, NULL, NULL); ++ } + this->geom.dg_secsize = secLength; + this->geom.dg_sectors = sectrk; +- /* Did the autoprobe guess right about the number of sectors & cylinders? */ +- if (this->geom.dg_cylinders * this->geom.dg_heads == tracks) return NULL; +- /* Otherwise we guess: <= 43 tracks: single-sided. Else double. This ++ if (probeOk) return NULL; ++ /* We guess: <= 43 tracks: single-sided. Else double. This + * fails for 80-track single-sided if there are any such beasts */ + if (tracks <= 43) + { +-- +2.30.2 + diff --git a/debian/patches/series b/debian/patches/series index 36ff2b3..383978c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ man-page-typos.diff man-page-font.diff +cpmtools-libdsk-probe-robustness.patch