diff --git a/0001-Verbose-file-allocation-printout-showed-broken-filen.patch b/0001-Verbose-file-allocation-printout-showed-broken-filen.patch index 96e3aff..77c3c99 100644 --- a/0001-Verbose-file-allocation-printout-showed-broken-filen.patch +++ b/0001-Verbose-file-allocation-printout-showed-broken-filen.patch @@ -1,7 +1,8 @@ From 6b4265ee3c7a5b5d04628fd1043cf73da622721c Mon Sep 17 00:00:00 2001 From: Claus Date: Sat, 19 Nov 2022 10:57:57 +0100 -Subject: [PATCH 1/2] Verbose file allocation printout showed broken filenames +Subject: [PATCH 01/23] Verbose file allocation printout showed broken + filenames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0002-Another-fix-for-the-file-allocation-table-printing.patch b/0002-Another-fix-for-the-file-allocation-table-printing.patch index 61e4f78..786cd55 100644 --- a/0002-Another-fix-for-the-file-allocation-table-printing.patch +++ b/0002-Another-fix-for-the-file-allocation-table-printing.patch @@ -1,7 +1,7 @@ From ba69664346a04ad1f1c9380503034e6f5a02afb2 Mon Sep 17 00:00:00 2001 From: Claus Date: Fri, 2 Dec 2022 18:01:30 +0100 -Subject: [PATCH 2/2] Another fix for the file allocation table printing +Subject: [PATCH 02/23] Another fix for the file allocation table printing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0018-track-was-not-reset-after-writing-transwarp-files-re.patch b/0018-track-was-not-reset-after-writing-transwarp-files-re.patch new file mode 100644 index 0000000..beff9c6 --- /dev/null +++ b/0018-track-was-not-reset-after-writing-transwarp-files-re.patch @@ -0,0 +1,47 @@ +From f62f34eadfac1791dd9e43a54e986e35080e8121 Mon Sep 17 00:00:00 2001 +From: Claus +Date: Wed, 8 Feb 2023 21:04:24 +0100 +Subject: [PATCH 18/23] track was not reset after writing transwarp files, + resulting in parts of the disk not being allocated when mixing transwarp and + non-transwarp files in one call. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Björn Esser +--- + cc1541.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/cc1541.c b/cc1541.c +index f66d9cd..c83fa26 100644 +--- a/cc1541.c ++++ b/cc1541.c +@@ -2937,13 +2937,12 @@ write_transwarp_file(image_type type, unsigned char *image, imagefile *file, uns + static void + write_files(image_type type, unsigned char *image, imagefile *files, int num_files, int usedirtrack, int dirtracksplit, int shadowdirtrack, int numdirblocks, int dir_sector_interleave) + { +- unsigned char track = 1; + unsigned char sector = 0; + int bytes_to_write = 0; +- int lastTrack = track; ++ int lastTrack = 1; + int lastSector = sector; + int lastOffset = linear_sector(type, lastTrack, lastSector) * BLOCKSIZE; +- int lastMinTrack = track; ++ int lastMinTrack = 1; + bool transwarp_bootfile_fits_on_dir_track = false; + + /* make sure the first file already takes first sector per track into account */ +@@ -2978,6 +2977,8 @@ write_files(image_type type, unsigned char *image, imagefile *files, int num_fil + + for (int i = 0; i < num_files; i++) { + imagefile *file = files + i; ++ unsigned char track = 1; /* reset start search track for every file, as Transwarp files are allocated differently */ ++ + if (type == IMAGE_D81) { + file->sectorInterleave = 1; /* caught in command line parsing anyway, but does not hurt */ + } +-- +2.39.1 + diff --git a/0019-Makefile-Increase-automatic-line-wraps-to-76-charact.patch b/0019-Makefile-Increase-automatic-line-wraps-to-76-charact.patch new file mode 100644 index 0000000..88e2154 --- /dev/null +++ b/0019-Makefile-Increase-automatic-line-wraps-to-76-charact.patch @@ -0,0 +1,30 @@ +From 0b5a346dc014537e99f16f8aaf06da1d59c6585c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Mon, 15 Aug 2022 15:42:04 +0200 +Subject: [PATCH 19/23] Makefile: Increase automatic line-wraps to 76 + characters. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Björn Esser +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 7fd703a..4fd2df2 100644 +--- a/Makefile ++++ b/Makefile +@@ -90,7 +90,7 @@ codestyle: cc1541.c test_cc1541.c + + wrap: cc1541.1.txt.in LICENSE.txt README.md + for f in $^; do \ +- fold -s -w 70 < $$f | perl -pe 's/[\t\040]+$$//' > $$f.T; \ ++ fold -s -w 76 < $$f | perl -pe 's/[\t\040]+$$//' > $$f.T; \ + mv -f $$f.T $$f; \ + done + +-- +2.39.1 + diff --git a/0020-Makefile-Improve-all-targets-to-be-thread-safe.patch b/0020-Makefile-Improve-all-targets-to-be-thread-safe.patch new file mode 100644 index 0000000..48c43ce --- /dev/null +++ b/0020-Makefile-Improve-all-targets-to-be-thread-safe.patch @@ -0,0 +1,79 @@ +From c297a40f3237e0f895568bcb06803988a5659009 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Sat, 28 Jan 2023 21:49:06 +0100 +Subject: [PATCH 20/23] Makefile: Improve all targets to be thread-safe. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Björn Esser +--- + Makefile | 34 +++++++++++++++++++--------------- + 1 file changed, 19 insertions(+), 15 deletions(-) + +diff --git a/Makefile b/Makefile +index 4fd2df2..ac39ca6 100644 +--- a/Makefile ++++ b/Makefile +@@ -49,11 +49,12 @@ endif + + cc1541-$(VERSION).tar: $(CC1541_SRC) + rm -rf cc1541-$(VERSION)/ *~ README.md.T +- mkdir -p cc1541-$(VERSION) +- cp -a $(CC1541_SRC) cc1541-$(VERSION)/ +- chmod 0644 cc1541-$(VERSION)/* +- tar cf cc1541-$(VERSION).tar cc1541-$(VERSION)/ +- rm -rf cc1541-$(VERSION)/ ++ $(eval $@_TMP := $(shell mktemp -d)) ++ mkdir -p $($@_TMP)/cc1541-$(VERSION) ++ cp -a $(CC1541_SRC) $($@_TMP)/cc1541-$(VERSION)/ ++ chmod 0644 $($@_TMP)/cc1541-$(VERSION)/* ++ tar cf cc1541-$(VERSION).tar -C$($@_TMP) cc1541-$(VERSION)/ ++ rm -rf $($@_TMP) + + cc1541-$(VERSION).tar.bz2: cc1541-$(VERSION).tar + bzip2 -9cz < cc1541-$(VERSION).tar > cc1541-$(VERSION).tar.bz2 +@@ -66,11 +67,14 @@ cc1541-$(VERSION).tar.xz: cc1541-$(VERSION).tar + + cc1541-$(VERSION).zip: $(CC1541_SRC) + rm -rf cc1541-$(VERSION)/ *~ README.md.T +- mkdir -p cc1541-$(VERSION) +- cp -a $(CC1541_SRC) cc1541-$(VERSION)/ +- chmod 0644 cc1541-$(VERSION)/* +- zip -9r cc1541-$(VERSION).zip cc1541-$(VERSION)/ +- rm -rf cc1541-$(VERSION)/ ++ $(eval $@_SRC := $(shell pwd)) ++ $(eval $@_TMP := $(shell mktemp -d)) ++ mkdir -p $($@_TMP)/cc1541-$(VERSION) ++ cp -a $(CC1541_SRC) $($@_TMP)/cc1541-$(VERSION)/ ++ chmod 0644 $($@_TMP)/cc1541-$(VERSION)/* ++ cd $($@_TMP) && \ ++ zip -9qr $($@_SRC)/cc1541-$(VERSION).zip cc1541-$(VERSION)/ ++ rm -rf $($@_TMP) + + dist-bz2: cc1541-$(VERSION).tar.bz2 + dist-gz: cc1541-$(VERSION).tar.gz +@@ -81,9 +85,11 @@ dist-all: dist-bz2 dist-gz dist-xz dist-zip + dist: dist-gz dist-zip + + dist-check: dist +- tar xf cc1541-$(VERSION).tar.gz +- $(MAKE) -C cc1541-$(VERSION)/ all check +- rm -rf cc1541-$(VERSION)/ ++ $(eval $@_TMP := $(shell mktemp -d)) ++ mkdir -p $($@_TMP) ++ tar xf cc1541-$(VERSION).tar.gz -C $($@_TMP) ++ $(MAKE) -C $($@_TMP)/cc1541-$(VERSION)/ all check ++ rm -rf $($@_TMP) + + codestyle: cc1541.c test_cc1541.c + astyle --style=kr -n -s -z2 cc1541.c test_cc1541.c +@@ -98,5 +104,3 @@ clean: + rm -rf cc1541-$(VERSION)/ *~ README.md.T *.o *.orig cc1541 test_cc1541 cc1541-$(VERSION).* cc1541.1 cc1541.1.txt + + .PHONY: all check clean codestyle dist dist-all dist-bz2 dist-check dist-gz dist-xz dist-zip install man test wrap +- +-.NOTPARALLEL: cc1541-$(VERSION).tar cc1541-$(VERSION).zip +-- +2.39.1 + diff --git a/0021-Makefile-Pass-environment-to-sub-make-invokation.patch b/0021-Makefile-Pass-environment-to-sub-make-invokation.patch new file mode 100644 index 0000000..fc0b3cf --- /dev/null +++ b/0021-Makefile-Pass-environment-to-sub-make-invokation.patch @@ -0,0 +1,26 @@ +From c4eb6ab1e7fb277f5ffd4fe282eee530c55e83f4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Sat, 28 Jan 2023 21:50:49 +0100 +Subject: [PATCH 21/23] Makefile: Pass environment to sub-make invokation. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Björn Esser +--- + Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Makefile b/Makefile +index ac39ca6..8718285 100644 +--- a/Makefile ++++ b/Makefile +@@ -104,3 +104,5 @@ clean: + rm -rf cc1541-$(VERSION)/ *~ README.md.T *.o *.orig cc1541 test_cc1541 cc1541-$(VERSION).* cc1541.1 cc1541.1.txt + + .PHONY: all check clean codestyle dist dist-all dist-bz2 dist-check dist-gz dist-xz dist-zip install man test wrap ++ ++.EXPORT_ALL_VARIABLES: +-- +2.39.1 + diff --git a/0022-README-Clean-trailing-white-space.patch b/0022-README-Clean-trailing-white-space.patch new file mode 100644 index 0000000..4f56287 --- /dev/null +++ b/0022-README-Clean-trailing-white-space.patch @@ -0,0 +1,57 @@ +From 560abdd7674f5893167dc8389e92f6817e9d35dd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Sat, 28 Jan 2023 21:51:57 +0100 +Subject: [PATCH 22/23] README: Clean trailing white-space. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Björn Esser +--- + README.md | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/README.md b/README.md +index bcf816c..db03091 100644 +--- a/README.md ++++ b/README.md +@@ -31,7 +31,7 @@ https://bitbucket.org/PTV_Claus/cc1541/src/master/ + * "cc1541 -f game -W game.prg -f 'transwarp v0.86' -w transwarp.prg + Transwarp-Game.d64" creates a Transwarp disk image with the + required boot file. +-* "cc1541 -T DEL -f ---------------- -L image.d64" creates a DEL ++* "cc1541 -T DEL -f ---------------- -L image.d64" creates a DEL + entry as separator. + + ## Version history ## +@@ -40,15 +40,15 @@ v4.0 + + * The default handling for large tail gaps has been removed, as it + does not provide any advantage and was only there to be as close +- as possible to CBM DOS behaviour. In fact, it actually slows down ++ as possible to CBM DOS behaviour. In fact, it actually slows down + fast loaders. This warrants a major version number increase. + * -H switch added to set BAM messages at BAM offset $ab + * -F with negative values now specifies a track skew + * -B cannot be used with transwarp files anymore, as the loader + relies on correct block sizes in the directory +-* Bugfix: the BAM allocation for SPEED DOS and DOLPHIN DOS was ++* Bugfix: the BAM allocation for SPEED DOS and DOLPHIN DOS was + wrong (mixed up between the two and also shifted by 4 bytes) +-* Bugfix: Data from unused blocks could leak into the last block ++* Bugfix: Data from unused blocks could leak into the last block + of a new file behind the actual file data + + v3.4 +@@ -56,7 +56,7 @@ v3.4 + * Support for Transwarp 0.86 and later + * Commandline option -R added for restoring deleted or formatted + files +-* -L switch added to create directory entries without writing a ++* -L switch added to create directory entries without writing a + file + * -a switch added to print a cc1541 command line that re-creates + the directory art of the given disk image +-- +2.39.1 + diff --git a/0023-Adding-tests-for-the-bugfix-related-to-allocation-fo.patch b/0023-Adding-tests-for-the-bugfix-related-to-allocation-fo.patch new file mode 100644 index 0000000..ecf27e4 --- /dev/null +++ b/0023-Adding-tests-for-the-bugfix-related-to-allocation-fo.patch @@ -0,0 +1,77 @@ +From fe384f8b1e6b36796219838784ed1c00ff28fc5b Mon Sep 17 00:00:00 2001 +From: Claus +Date: Thu, 9 Feb 2023 17:07:43 +0100 +Subject: [PATCH 23/23] Adding tests for the bugfix related to allocation for + mixed transwarp/non-transwarp files and -r +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Björn Esser +--- + cc1541.c | 2 +- + test_cc1541.c | 28 ++++++++++++++++++++++++++++ + 2 files changed, 29 insertions(+), 1 deletion(-) + +diff --git a/cc1541.c b/cc1541.c +index c83fa26..71a566a 100644 +--- a/cc1541.c ++++ b/cc1541.c +@@ -2977,7 +2977,7 @@ write_files(image_type type, unsigned char *image, imagefile *files, int num_fil + + for (int i = 0; i < num_files; i++) { + imagefile *file = files + i; +- unsigned char track = 1; /* reset start search track for every file, as Transwarp files are allocated differently */ ++ unsigned char track = 1; /* reset start search track for every file, as Transwarp and -r might leave free blocks below */ + + if (type == IMAGE_D81) { + file->sectorInterleave = 1; /* caught in command line parsing anyway, but does not hurt */ +diff --git a/test_cc1541.c b/test_cc1541.c +index 60e4671..bda1b8d 100644 +--- a/test_cc1541.c ++++ b/test_cc1541.c +@@ -646,6 +646,20 @@ main(int argc, char* argv[]) + printf("%0*d: %s: %s\n", test_pad, test, result_str[result], description); + remove("1.prg"); + ++ description = "Next file should be allocated in track 0 after -r"; ++ ++test; ++ create_value_file("1.prg", 254, 1); ++ if (run_binary_cleanup(binary, "-r 13 -f 1 -w 1.prg -f 2 -w 1.prg", "image.d64", &image, &size, false) != NO_ERROR) { ++ result = TEST_UNRESOLVED; ++ } else if (block_is_filled(image, track_offset[0] / 256 + 10, 1)) { ++ result = TEST_PASS; ++ ++passed; ++ } else { ++ result = TEST_FAIL; ++ } ++ printf("%0*d: %s: %s\n", test_pad, test, result_str[result], description); ++ remove("1.prg"); ++ + description = "File should start on sector 14 for -b"; + ++test; + create_value_file("1.prg", 254, 1); +@@ -1925,6 +1939,20 @@ main(int argc, char* argv[]) + printf("%0*d: %s: %s\n", test_pad, test, result_str[result], description); + remove("1.prg"); + ++ description = "Standard file should be allocated in track 0 for transwarp image"; ++ ++test; ++ create_value_file("1.prg", 1 * 254, 1); ++ if (run_binary_cleanup(binary, "-b 0 -f file1 -w 1.prg -w \"transwarp v0.86.prg\"", "image.d64", &image, &size, false) != NO_ERROR) { ++ result = TEST_UNRESOLVED; ++ } else if (block_is_filled(image, track_offset[0] / 256 + 0, 1)) { ++ result = TEST_PASS; ++ ++passed; ++ } else { ++ result = TEST_FAIL; ++ } ++ printf("%0*d: %s: %s\n", test_pad, test, result_str[result], description); ++ remove("1.prg"); ++ + description = "Sector on new track should not be limited to number of sectors on old track"; + ++test; + create_value_file("1.prg", 254 * 20, 1); /* track 24 has 19 blocks, track 25 only 18 */ +-- +2.39.1 + diff --git a/cc1541-4.0-Makefile.patch b/cc1541-4.0-Makefile.patch deleted file mode 100644 index a86c887..0000000 --- a/cc1541-4.0-Makefile.patch +++ /dev/null @@ -1,71 +0,0 @@ -Index: cc1541-4.0/Makefile -=================================================================== ---- cc1541-4.0.orig/Makefile -+++ cc1541-4.0/Makefile -@@ -49,11 +49,12 @@ endif - - cc1541-$(VERSION).tar: $(CC1541_SRC) - rm -rf cc1541-$(VERSION)/ *~ README.md.T -- mkdir -p cc1541-$(VERSION) -- cp -a $(CC1541_SRC) cc1541-$(VERSION)/ -- chmod 0644 cc1541-$(VERSION)/* -- tar cf cc1541-$(VERSION).tar cc1541-$(VERSION)/ -- rm -rf cc1541-$(VERSION)/ -+ $(eval $@_TMP := $(shell mktemp -d)) -+ mkdir -p $($@_TMP)/cc1541-$(VERSION) -+ cp -a $(CC1541_SRC) $($@_TMP)/cc1541-$(VERSION)/ -+ chmod 0644 $($@_TMP)/cc1541-$(VERSION)/* -+ tar cf cc1541-$(VERSION).tar -C$($@_TMP) cc1541-$(VERSION)/ -+ rm -rf $($@_TMP) - - cc1541-$(VERSION).tar.bz2: cc1541-$(VERSION).tar - bzip2 -9cz < cc1541-$(VERSION).tar > cc1541-$(VERSION).tar.bz2 -@@ -66,11 +67,14 @@ cc1541-$(VERSION).tar.xz: cc1541-$(VERSI - - cc1541-$(VERSION).zip: $(CC1541_SRC) - rm -rf cc1541-$(VERSION)/ *~ README.md.T -- mkdir -p cc1541-$(VERSION) -- cp -a $(CC1541_SRC) cc1541-$(VERSION)/ -- chmod 0644 cc1541-$(VERSION)/* -- zip -9r cc1541-$(VERSION).zip cc1541-$(VERSION)/ -- rm -rf cc1541-$(VERSION)/ -+ $(eval $@_SRC := $(shell pwd)) -+ $(eval $@_TMP := $(shell mktemp -d)) -+ mkdir -p $($@_TMP)/cc1541-$(VERSION) -+ cp -a $(CC1541_SRC) $($@_TMP)/cc1541-$(VERSION)/ -+ chmod 0644 $($@_TMP)/cc1541-$(VERSION)/* -+ cd $($@_TMP) && \ -+ zip -9qr $($@_SRC)/cc1541-$(VERSION).zip cc1541-$(VERSION)/ -+ rm -rf $($@_TMP) - - dist-bz2: cc1541-$(VERSION).tar.bz2 - dist-gz: cc1541-$(VERSION).tar.gz -@@ -81,16 +85,18 @@ dist-all: dist-bz2 dist-gz dist-xz dist- - dist: dist-gz dist-zip - - dist-check: dist -- tar xf cc1541-$(VERSION).tar.gz -- $(MAKE) -C cc1541-$(VERSION)/ all check -- rm -rf cc1541-$(VERSION)/ -+ $(eval $@_TMP := $(shell mktemp -d)) -+ mkdir -p $($@_TMP) -+ tar xf cc1541-$(VERSION).tar.gz -C $($@_TMP) -+ $(MAKE) -C $($@_TMP)/cc1541-$(VERSION)/ all check -+ rm -rf $($@_TMP) - - codestyle: cc1541.c test_cc1541.c - astyle --style=kr -n -s -z2 cc1541.c test_cc1541.c - - wrap: cc1541.1.txt.in LICENSE.txt README.md - for f in $^; do \ -- fold -s -w 70 < $$f | perl -pe 's/[\t\040]+$$//' > $$f.T; \ -+ fold -s -w 76 < $$f | perl -pe 's/[\t\040]+$$//' > $$f.T; \ - mv -f $$f.T $$f; \ - done - -@@ -99,4 +105,4 @@ clean: - - .PHONY: all check clean codestyle dist dist-all dist-bz2 dist-check dist-gz dist-xz dist-zip install man test wrap - --.NOTPARALLEL: cc1541-$(VERSION).tar cc1541-$(VERSION).zip -+.EXPORT_ALL_VARIABLES: diff --git a/cc1541.spec b/cc1541.spec index 6e5d2b0..7acd4b5 100644 --- a/cc1541.spec +++ b/cc1541.spec @@ -5,16 +5,21 @@ CC=%{__cc} CFLAGS="%{build_cflags}" LDFLAGS="%{build_ldflags}" ENABLE_MAN=1 Name: cc1541 Version: 4.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tool for creating Commodore Floppy disk images in D64, G64, D71 or D81 format License: MIT URL: https://bitbucket.org/PTV_Claus/%{name} Source0: %{url}/downloads/%{name}-%{version}.tar.gz -Patch0000: %{name}-4.0-Makefile.patch Patch0001: 0001-Verbose-file-allocation-printout-showed-broken-filen.patch Patch0002: 0002-Another-fix-for-the-file-allocation-table-printing.patch +Patch0018: 0018-track-was-not-reset-after-writing-transwarp-files-re.patch +Patch0019: 0019-Makefile-Increase-automatic-line-wraps-to-76-charact.patch +Patch0020: 0020-Makefile-Improve-all-targets-to-be-thread-safe.patch +Patch0021: 0021-Makefile-Pass-environment-to-sub-make-invokation.patch +Patch0022: 0022-README-Clean-trailing-white-space.patch +Patch0023: 0023-Adding-tests-for-the-bugfix-related-to-allocation-fo.patch BuildRequires: asciidoc BuildRequires: gcc @@ -29,7 +34,6 @@ using either SPEED DOS or DOLPHIN DOS BAM-formatting. %prep %autosetup -p 1 -sed -i -e 's![ \t]*$!!g' *.c %{name}.1* LICENSE.txt README.md %build @@ -52,6 +56,9 @@ sed -i -e 's![ \t]*$!!g' *.c %{name}.1* LICENSE.txt README.md %changelog +* Sat Feb 11 2023 Björn Esser - 4.0-5 +- Update patches from upstream git + * Sun Jan 29 2023 Björn Esser - 4.0-4 - Patch Makefile to be thread-safe on all targets - Clean trailing white-space in some files during %%prep