Merged
genisoimage: Fix -no-bak ignoring filenames containing '~' #69
zhangqiumiaoAdd on Aug 17
genisoimage: Fix -no-bak ignoring filenames containing '~' #69
Merged
Merged fromzhangqiumiao/cdrkitmasterintosrc-openeuler/cdrkitmaster
Total: 2 files changed+60-1
| @@ -1,6 +1,6 @@ | |||
| 1 | Name: cdrkit | 1 | Name: cdrkit |
| 2 | Version: 1.1.11 | 2 | Version: 1.1.11 |
| 3 | -Release: 54 | 3 | +Release: 55 |
| 4 | Summary: A collection of CD/DVD utilities | 4 | Summary: A collection of CD/DVD utilities |
| 5 | License: GPL-2.0-only | 5 | License: GPL-2.0-only |
| 6 | URL: https://cdrkit.org/ | 6 | URL: https://cdrkit.org/ |
| @@ -32,6 +32,7 @@ Patch21: cdrkit-1.1.11-devname.patch | |||
| 32 | Patch22: cdrkit-1.1.11-sysmacros.patch | 32 | Patch22: cdrkit-1.1.11-sysmacros.patch |
| 33 | Patch23: cdrkit-1.1.11-gcc10.patch | 33 | Patch23: cdrkit-1.1.11-gcc10.patch |
| 34 | Patch24: cdrkit-1.1.11-sw.patch | 34 | Patch24: cdrkit-1.1.11-sw.patch |
| 35 | +Patch9000: genisoimage-Fix-no-bak-ignoring-filenames-containing.patch | ||
| 35 | 36 | ||
| 36 | BuildRequires: gcc cmake libcap-devel zlib-devel perl-interpreter | 37 | BuildRequires: gcc cmake libcap-devel zlib-devel perl-interpreter |
| 37 | BuildRequires: perl-generators file-devel bzip2-devel | 38 | BuildRequires: perl-generators file-devel bzip2-devel |
| @@ -213,6 +214,12 @@ fi | |||
| 213 | %{_includedir}/usal | 214 | %{_includedir}/usal |
| 214 | 215 | ||
| 215 | %changelog | 216 | %changelog |
| 217 | +* Mon Aug 17 2026 zhangqiumiao <zhangqiumiao1@h-partners.com> - 1.1.11-55 | ||
| 218 | +- Type:bugfix | ||
| 219 | +- ID:NA | ||
| 220 | +- SUG:NA | ||
| 221 | +- DESC:genisoimage: Fix -no-bak ignoring filenames containing '~' | ||
| 222 | + | ||
| 216 | * Sun Mar 02 2025 Funda Wang <fundawang@yeah.net> - 1.1.11-54 | 223 | * Sun Mar 02 2025 Funda Wang <fundawang@yeah.net> - 1.1.11-54 |
| 217 | - try build with cmake 4.0 | 224 | - try build with cmake 4.0 |
| 218 | 225 | ||
| @@ -0,0 +1,52 @@ | |||
| 1 | +From 69af6e5a6c66a80582344b9e225390b186be4494 Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: Qiumiao Zhang <zhangqiumiao1@h-partners.com> | ||
| 3 | +Date: Mon, 17 Aug 2026 07:18:37 +0000 | ||
| 4 | +Subject: [PATCH] genisoimage: Fix -no-bak ignoring filenames containing '~' | ||
| 5 | + | ||
| 6 | +The -no-bak option uses strchr(d_entry->d_name, '~') to detect backup | ||
| 7 | +files. This matches any filename that contains '~' anywhere, causing | ||
| 8 | +legitimate files such as package versions like foo_1.0~rc1.rpm to be | ||
| 9 | +silently excluded from the ISO. | ||
| 10 | + | ||
| 11 | +Change the check to use rstr(d_entry->d_name, "~") so that only | ||
| 12 | +filenames ending with '~' are treated as backup files. This preserves | ||
| 13 | +the intended filtering of editor/backup files while allowing '~' to | ||
| 14 | +appear inside valid filenames. | ||
| 15 | + | ||
| 16 | +Signed-off-by: Qiumiao Zhang <zhangqiumiao1@h-partners.com> | ||
| 17 | +--- | ||
| 18 | + genisoimage/genisoimage.1 | 4 ++-- | ||
| 19 | + genisoimage/tree.c | 2 +- | ||
| 20 | + 2 files changed, 3 insertions(+), 3 deletions(-) | ||
| 21 | + | ||
| 22 | +diff --git a/genisoimage/genisoimage.1 b/genisoimage/genisoimage.1 | ||
| 23 | +index 69d7043..9aee7a4 100644 | ||
| 24 | +--- a/genisoimage/genisoimage.1 | ||
| 25 | ++++ b/genisoimage/genisoimage.1 | ||
| 26 | +@@ -917,8 +917,8 @@ default is 0555. | ||
| 27 | + .B \-nobak | ||
| 28 | + .TP | ||
| 29 | + .B \-no\-bak | ||
| 30 | +-Exclude backup files files on the ISO9660 filesystem; that is, | ||
| 31 | +-filenames that contain the characters `~' or `#' or end in | ||
| 32 | ++Exclude backup files on the ISO9660 filesystem; that is, | ||
| 33 | ++filenames that end with the character `~' or contain the character `#' or end in | ||
| 34 | + .IR .bak . | ||
| 35 | + These are typically backup files for Unix text editors. | ||
| 36 | + .TP | ||
| 37 | +diff --git a/genisoimage/tree.c b/genisoimage/tree.c | ||
| 38 | +index ccde863..bec5e66 100644 | ||
| 39 | +--- a/genisoimage/tree.c | ||
| 40 | ++++ b/genisoimage/tree.c | ||
| 41 | +@@ -1267,7 +1267,7 @@ scan_directory_tree(struct directory *this_dir, char *path, | ||
| 42 | + | ||
| 43 | + /* If we do not want all files, then pitch the backups. */ | ||
| 44 | + if (!all_files) { | ||
| 45 | +- if (strchr(d_entry->d_name, '~') || | ||
| 46 | ++ if (rstr(d_entry->d_name, "~") || | ||
| 47 | + strchr(d_entry->d_name, '#') || | ||
| 48 | + rstr(d_entry->d_name, ".bak")) { | ||
| 49 | + if (verbose > 0) { | ||
| 50 | +-- | ||
| 51 | +2.43.0 | ||
| 52 | + | ||