Fix ESP conversion if C:\Windows\Temp has alternate case

resolves: RHEL-125117
This commit is contained in:
Richard W.M. Jones 2025-10-30 11:30:24 +00:00
parent f2622e03ce
commit 398d4a7e71
2 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,70 @@
From 7f4e6125495f309190b8205c759d198228d8a7d6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 28 Oct 2025 11:34:22 +0000
Subject: [PATCH] convert: windows: Fix ESP conversion if C:\Windows\Temp has
alternate case
We found a Windows guest which had the expected C:\Windows\Temp path,
but the actual name was TEMP rather than Temp. It's unclear if this
had been renamed, or if Windows can create this normally. In any
case, the unexpected casing caused this failure:
virt-v2v: error: libguestfs error: mkdtemp: /Windows/Temp/ESP_XXXXXX: No such file or directory
We have to use g#case_sensitive_path here since the directory is on
NTFS.
I also removed the hard-coded "\Windows" in favour of %systemroot%,
and fixed the indentation.
Fixes: https://issues.redhat.com/browse/RHEL-124569
Reported-by: Ulhas Surse
(cherry picked from commit 277ddd1a9b84d9c1b1fa93ef9a2e7f52b68d7930)
(cherry picked from commit 0b1c9ccf4c5808db323554c5d55ded2c345ebcb9)
---
convert/convert_windows.ml | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
index d5a57d6e..b80128a7 100644
--- a/convert/convert_windows.ml
+++ b/convert/convert_windows.ml
@@ -961,21 +961,25 @@ let convert (g : G.guestfs) source inspect i_firmware
match i_firmware with
| Firmware.I_BIOS -> ()
| I_UEFI esp_list ->
- let esp_temp_path = g#mkdtemp "/Windows/Temp/ESP_XXXXXX" in
- let uefi_arch = get_uefi_arch_suffix inspect.i_arch in
+ let esp_temp_path =
+ let temp = inspect.i_windows_systemroot ^ "/Temp" in
+ let mp = g#case_sensitive_path temp in
+ let template = mp ^ "/ESP_XXXXXX" in
+ g#mkdtemp template in
+ let uefi_arch = get_uefi_arch_suffix inspect.i_arch in
- List.iter (
- fun dev_path ->
- g#mount dev_path esp_temp_path;
- fix_win_uefi_bcd esp_temp_path;
- (match uefi_arch with
- | Some uefi_arch -> fix_win_uefi_fallback esp_temp_path uefi_arch
- | None -> ()
- );
- g#umount esp_temp_path;
- ) esp_list;
+ List.iter (
+ fun dev_path ->
+ g#mount dev_path esp_temp_path;
+ fix_win_uefi_bcd esp_temp_path;
+ (match uefi_arch with
+ | Some uefi_arch -> fix_win_uefi_fallback esp_temp_path uefi_arch
+ | None -> ()
+ );
+ g#umount esp_temp_path;
+ ) esp_list;
- g#rmdir esp_temp_path
+ g#rmdir esp_temp_path
in
do_convert ()

View File

@ -8,7 +8,7 @@
Name: virt-v2v
Epoch: 1
Version: 2.7.1
Release: 16%{?dist}
Release: 17%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPL-2.0-or-later AND LGPL-2.0-or-later
@ -87,6 +87,7 @@ Patch0056: 0056-vddk-Remove-io-vddk-noextents-option.patch
Patch0057: 0057-Modify-configure_pnputil_install-script-to-check.patch
Patch0058: 0058-Ignore-ERROR_NO_MORE_ITEMS-status-from-PnPUtil.patch
Patch0059: 0059-remove-timeout-before-installing-virtio-win-drivers.patch
Patch0060: 0060-convert-windows-Fix-ESP-conversion-if-C-Windows-Temp.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -390,6 +391,10 @@ make -C tests TESTS=test-fedora-luks-on-lvm-conversion.sh check
%changelog
* Thu Oct 30 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.7.1-17
- Fix ESP conversion if C:\Windows\Temp has alternate case
resolves: RHEL-125117
* Fri Jul 18 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.7.1-16
- mlcustomize: Remove dnf --verbose option
resolves: RHEL-83289