BCF-6552: [REAR] REAR tries to map the disk that has been commented in the disklayout.conf file on the source machine#83
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts ReaR’s migration-mode layout mapping step to avoid aborting recovery when df.txt contains references to disks that were excluded/commented out in the source layout, while keeping strict failures for core layout/config files.
Changes:
- Treat failures applying layout mappings to
$VAR_DIR/layout/config/df.txtas a warning (do not fail the overall mapping step). - Keep hard-failure behavior for
disklayout.conf($LAYOUT_FILE) and/etc/rear/rescue.conf.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| LogPrintError "Failed to apply disk layout mappings to $file_to_migrate" | ||
| applied_mappings_to_all_files="no" | ||
| if [ "$file_to_migrate" = "$original_disk_space_usage_file" ] ; then | ||
| LogPrint "Warning: Failed to apply disk layout mappings to $file_to_migrate (likely due to unmapped excluded disks)." |
There was a problem hiding this comment.
The codebase consistently prefixes warning-level user messages with "WARNING:" (often using LogPrint), but this message uses "Warning:". Consider changing it to match existing wording/format (e.g., "WARNING: Failed …"), to keep log scanning/grep behavior consistent.
| LogPrint "Warning: Failed to apply disk layout mappings to $file_to_migrate (likely due to unmapped excluded disks)." | |
| LogPrint "WARNING: Failed to apply disk layout mappings to $file_to_migrate (likely due to unmapped excluded disks)." |
| LogPrintError "Failed to apply disk layout mappings to $file_to_migrate" | ||
| applied_mappings_to_all_files="no" | ||
| if [ "$file_to_migrate" = "$original_disk_space_usage_file" ] ; then | ||
| LogPrint "Warning: Failed to apply disk layout mappings to $file_to_migrate (likely due to unmapped excluded disks)." |
There was a problem hiding this comment.
The warning text asserts a specific root cause ("likely due to unmapped excluded disks"), but this isn't actually checked here and could mislead troubleshooting if apply_layout_mappings failed for another reason. Consider rephrasing to a more factual message (e.g., that failure is being ignored for df.txt because it may include excluded devices).
| LogPrint "Warning: Failed to apply disk layout mappings to $file_to_migrate (likely due to unmapped excluded disks)." | |
| LogPrint "Warning: Failed to apply disk layout mappings to $file_to_migrate; continuing without mappings for this file (it may include excluded devices)." |
3b293ff to
4eb5952
Compare
|
It means that disk layout mapping must be applied to What does E.g. the original system has |
|
The issue is related to Steps to reproduce:
Note,
Likely |
4eb5952 to
a0bc56a
Compare
| if [ "$file_to_migrate" = "$original_disk_space_usage_file" ] ; then | ||
| LogPrint "WARNING: Failed to apply disk layout mappings to $file_to_migrate (likely due to unmapped excluded disks)." | ||
| else | ||
| LogPrintError "Failed to apply disk layout mappings to $file_to_migrate" | ||
| applied_mappings_to_all_files="no" | ||
| fi |
There was a problem hiding this comment.
Do we still need this change?
There was a problem hiding this comment.
The answer was - yes, we need it for backup sessions done earlier (without the fix in the PR).
a0bc56a to
1130ac6
Compare
BCF-6552: [REAR] REAR tries to map the disk that has been commented in the disklayout.conf file on the source machine
1130ac6 to
742f4f1
Compare
BCF-6552: [REAR] REAR tries to map the disk that has been commented in the disklayout.conf file on the source machine
| DebugPrint "Automatically excluding $mountpoint from $original_disk_space_usage_file (belongs to $exclude in AUTOEXCLUDE_PATH)" | ||
| local mp_pattern | ||
| # Escape the mountpoint for use in the subsequent sed command | ||
| mp_pattern=$( echo "$mountpoint" | sed 's/[]\/$*.^[],]/\\&/g' ) |
There was a problem hiding this comment.
It is a broken sed expression.
You are using sed s/search/replace/flags form here.
[] in the search part is the bracket expression, see Classes and Bracket Expressions.
If you want to use it correctly, you need to use [][\/$*.^,] in the search part.
See How do i replace [] brackets using SED for more detail.
| mp_pattern=$( echo "$mountpoint" | sed 's/[]\/$*.^[],]/\\&/g' ) | |
| mp_pattern=$( echo "$mountpoint" | sed 's/[][\/$*.^,]/\\&/g' ) |
* fix sed regexpr BCF-6552: [REAR] REAR tries to map the disk that has been commented in the disklayout.conf file on the source machine
prevent failure when mapping excluded disks in df.txt