public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/rear] rawhide: Fix EXCLUDE_COMPONENTS being ignored for partition tables unsupported by ReaR
Date: Thu, 01 Oct 2026 08:48:01 GMT	[thread overview]
Message-ID: <179084448158.1.15277985922492404615.rpms-rear-461d5d0edaef@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/rear
            Branch : rawhide
            Commit : 461d5d0edaef0a8efea1dd7ee5f456830a59454d
            Author : Lukáš Zaoral <lzaoral@redhat.com>
            Date   : 2026-10-01T10:45:02+02:00
            Stats  : +161/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/rear/c/461d5d0edaef0a8efea1dd7ee5f456830a59454d?branch=rawhide

            Log:
            Fix EXCLUDE_COMPONENTS being ignored for partition tables unsupported by ReaR

Resolves: RHEL-235767

---
diff --git a/rear-respect-EXCLUDE_COMPONENTS-in-extract_partitions-RHEL-235767.patch b/rear-respect-EXCLUDE_COMPONENTS-in-extract_partitions-RHEL-235767.patch
new file mode 100644
index 0000000..2ae7ffd
--- /dev/null
+++ b/rear-respect-EXCLUDE_COMPONENTS-in-extract_partitions-RHEL-235767.patch
@@ -0,0 +1,157 @@
+From 626701843a32070080856c960b9e4202102b81d1 Mon Sep 17 00:00:00 2001
+From: Johannes Meixner <jsmeix@suse.com>
+Date: Fri, 25 Apr 2025 13:27:41 +0200
+Subject: [PATCH] EXCLUDE_COMPONENTS in 200_partition_layout.sh (#3455)
+
+In layout/save/GNU/Linux/200_partition_layout.sh
+do not Error() exit but only DebugPrint
+when extract_partitions() is called for a disk
+which is specified in EXCLUDE_COMPONENTS
+see https://github.com/rear/rear/pull/3455#issuecomment-2821188937
+In default.conf describe how EXCLUDE_COMPONENTS
+could be used to exclude unneeded normal disks
+and even unneeded problematic disks
+when the disk or things on it cannot be recognized properly,
+e.g. if 'parted' fails to recognize the partition table
+as in https://github.com/rear/rear/issues/3433
+and https://github.com/rear/rear/issues/2995
+Also describe generically how to exclude a problematic disk
+with higher level storage objects on it.
+---
+ usr/share/rear/conf/default.conf              | 43 +++++++++++++------
+ .../save/GNU/Linux/200_partition_layout.sh    | 30 +++++++++++--
+ 2 files changed, 56 insertions(+), 17 deletions(-)
+
+diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
+index 8cddbb72a5..7f5a959984 100644
+--- a/usr/share/rear/conf/default.conf
++++ b/usr/share/rear/conf/default.conf
+@@ -3483,22 +3483,25 @@ DIRECTORY_ENTRIES_TO_RECOVER=()
+ ####
+ # How to exclude something ----- EXCLUDES -------
+ #
+-# You cannot exclude a device (e.g. /dev/sdg) directly. Instead you have to exclude everything
+-# ON that device and then the dependency tracker will automatically exclude the device from the
+-# recovery (because there won't be any recovery information for that "unnecessary" device).
+-#
+-# Furthermore, you have to exclude MD devices and LVM2 volume groups separately
++# Normally a whole device (e.g. a disk device /dev/sdX) is not excluded directly
++# (for exceptional cases see EXCLUDE_COMPONENTS below).
++# Instead specific things on a device are excluded.
++# When everything on a device is excluded then via the dependency tracker
++# the whole device gets automatically excluded from the recovery
++# because there is no recovery information left for that device.
++#
++# You have to exclude MD devices and LVM2 volume groups separately
+ # as there is no automatic detection of these dependencies.
+ #
+-# Exclude filesystems by specifying their mountpoints. Will be automatically added to the
+-# $BACKUP_PROG_EXCLUDE array during backup to prevent the excluded filesystems' data to
+-# be backed up
+-# examples: /tmp
++# Exclude filesystems by specifying their mountpoints.
++# Will be automatically added to the $BACKUP_PROG_EXCLUDE array during backup
++# to prevent the excluded filesystems' data to be backed up.
++# Examples: /tmp
+ #           /media/bigdisk
+ EXCLUDE_MOUNTPOINTS=()
+ #
+ # Exclude MD devices
+-# examples: /dev/md0
++# Examples: /dev/md0
+ #           /dev/md/0
+ EXCLUDE_MD=()
+ #
+@@ -3508,13 +3511,27 @@ EXCLUDE_MD=()
+ # otherwise "rear recover" would try to recreate the filesystems onto non-existing LVs.
+ EXCLUDE_VG=()
+ #
+-# Exclude any component from the recovery image.
++# EXCLUDE_COMPONENTS: Exclude any component from the recovery.
+ # Some component types need a prefix:
+ # - filesystems: "fs:/var/cache"
+ # - physical volumes: "pv:/dev/sda2"
+ # - swap: "swap:/dev/mapper/system-swap"
+ # Volume groups look like: "/dev/system".
+-# If in doubt about the correct syntax, consult /var/lib/rear/layout/disktodo.conf
++# See /var/lib/rear/layout/disktodo.conf for the correct syntax of a specific component.
++# Because EXCLUDE_COMPONENTS excludes any component from the recovery
++# it can be used in exceptional cases to exclude unwanted whole disks.
++# For example EXCLUDE_COMPONENTS+=( /dev/sdX ) excludes the disk /dev/sdX
++# and via the dependency tracker usually also partitions and filesystems on it
++# provided the diks behaves normally (i.e. the disk and things on it can be recognized properly).
++# To exclude an unneeded problematic disk when the disk or things on it cannot be recognized properly
++# EXCLUDE_COMPONENTS+=( /dev/sdX ) may work to exclude the disk with its partitions and filesystems.
++# To exclude a problematic disk with higher level storage objects on it
++# its matching components may have to be specified separately for example like
++# EXCLUDE_COMPONENTS+=( /dev/sdX fs:/mountpoint pv:/dev/sdXN ) or similar as needed.
++# Verify that all what belongs to /dev/sdX is marked as 'done' in /var/lib/rear/layout/disktodo.conf
++# and that all what belongs to /dev/sdX is commented out in /var/lib/rear/layout/disklayout.conf
++# to ensure there is no recovery information left as 'todo' or not commented out
++# for a disk which should be excluded from the recovery.
+ EXCLUDE_COMPONENTS=()
+ #
+ # Only include LVM2 volume groups - the opposite of EXCLUDE_VG (handy if you only want vg00 to be included)
+@@ -3549,7 +3566,7 @@ AUTOEXCLUDE_AUTOFS=
+ # Excluding files in the /tmp directory when an internal backup method is used
+ # is achieved via a different default setting:
+ # BACKUP_PROG_EXCLUDE=( '/tmp/*' ... ) above
+-# so that /tmp filesystem will be recreated as an empty filesystem
++# so a /tmp filesystem will be recreated as an empty filesystem
+ # cf. https://github.com/rear/rear/pull/2261
+ AUTOEXCLUDE_PATH=( /media /run /mnt /tmp )
+ #
+diff --git a/usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh b/usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh
+index ec67541e6d..f6b7fdd914 100644
+--- a/usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh
++++ b/usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh
+@@ -122,7 +122,11 @@ extract_partitions() {
+     # does not work with partition types that are not in the supported list
+     # cf. https://github.com/rear/rear/pull/2803#issuecomment-1124800884
+     if ! [[ "$disk_label" = "msdos" || "$disk_label" = "gpt" || "$disk_label" = "gpt_sync_mbr" || "$disk_label" = "dasd" ]] ; then
+-        Error "Unsupported partition table '$disk_label' on $device (must be one of 'msdos' 'gpt' 'gpt_sync_mbr' 'dasd')"
++        if IsInArray "$device" "${EXCLUDE_COMPONENTS[@]}" ; then
++            DebugPrint "Unsupported partition table '$disk_label' on $device (must be one of 'msdos' 'gpt' 'gpt_sync_mbr' 'dasd')"
++        else
++            Error "Unsupported partition table '$disk_label' on $device (must be one of 'msdos' 'gpt' 'gpt_sync_mbr' 'dasd')"
++        fi
+     fi
+ 
+ 
+@@ -357,14 +361,32 @@ extract_partitions() {
+         # device=/dev/mapper/mpathbp1 ; partition_prefix=mpathbp
+         partition_name="${device%/*}/${partition_prefix#*/}$partition_nr"
+         partition_device="$( get_device_name $partition_name )"
+-        test -b "$partition_device" || Error "Invalid 'part $device' entry (partition device '$partition_device' is no block device)"
++        if ! test -b "$partition_device" ; then
++            if IsInArray "$device" "${EXCLUDE_COMPONENTS[@]}" ; then
++                DebugPrint "Invalid 'part $device' entry (partition device '$partition_device' is no block device)"
++            else
++                Error "Invalid 'part $device' entry (partition device '$partition_device' is no block device)"
++            fi
++        fi
+         # Ensure syntactically correct 'part' entries of the form
+         #   part disk_device partition_size start_byte partition_label flags partition_device
+         # Each value must exist and each value must be a single non-blank word.
+         # When $junk contains something one of the values before was more than a single word:
+-        test "$junk" && Error "Invalid 'part $device' entry (some value is more than a single word)"
++        if test "$junk" ; then
++            if IsInArray "$device" "${EXCLUDE_COMPONENTS[@]}" ; then
++                DebugPrint "Invalid 'part $device' entry (some value is more than a single word)"
++            else
++                Error "Invalid 'part $device' entry (some value is more than a single word)"
++            fi
++        fi
+         # When $flags is empty at least one value is missing:
+-        test "$flags" || Error "Invalid 'part $device' entry (at least one value is missing)"
++        if ! test "$flags" ; then
++            if IsInArray "$device" "${EXCLUDE_COMPONENTS[@]}" ; then
++                DebugPrint "Invalid 'part $device' entry (at least one value is missing)"
++            else
++                Error "Invalid 'part $device' entry (at least one value is missing)"
++            fi
++        fi
+         # Some basic checks on the values happen in layout/save/default/950_verify_disklayout_file.sh
+         echo "part $device $size $start $type $flags $partition_device"
+     done < $TMP_DIR/partitions
+

diff --git a/rear.spec b/rear.spec
index 0f928ca..66858b4 100644
--- a/rear.spec
+++ b/rear.spec
@@ -77,6 +77,10 @@ Patch132: rear-dbus-broker-RHEL-134213.patch
 # Patch135:
 # Patch136:
 
+# fix EXCLUDE_COMPONENTS being ignored for partition tables unsupported by ReaR
+# https://github.com/rear/rear/commit/626701843a32070080856c960b9e4202102b81d1
+Patch137: rear-respect-EXCLUDE_COMPONENTS-in-extract_partitions-RHEL-235767.patch
+
 ######################
 # downstream patches #
 ######################

                 reply	other threads:[~2026-10-01  8:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179084448158.1.15277985922492404615.rpms-rear-461d5d0edaef@fedoraproject.org \
    --to=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox