Fix for ntfsclone crash (RHBZ#1601146).
(cherry picked from commit b581507257543d3228a3cb8f4e08d4a67f2c3e64)
This commit is contained in:
parent
7ca90a0318
commit
d0e0c9fec0
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
Name: libguestfs-winsupport
|
Name: libguestfs-winsupport
|
||||||
Version: 8.0
|
Version: 8.0
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Add support for Windows guests to virt-v2v and virt-p2v
|
Summary: Add support for Windows guests to virt-v2v and virt-p2v
|
||||||
|
|
||||||
URL: http://www.ntfs-3g.org/
|
URL: http://www.ntfs-3g.org/
|
||||||
@ -21,6 +21,10 @@ Source0: http://tuxera.com/opensource/ntfs-3g_ntfsprogs-%{ntfs_version}.t
|
|||||||
Patch0: ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch
|
Patch0: ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch
|
||||||
Patch1: check-mftmirr.patch
|
Patch1: check-mftmirr.patch
|
||||||
Patch2: ntfs-3g-big-sectors.patch
|
Patch2: ntfs-3g-big-sectors.patch
|
||||||
|
# Fix for ntfsclone crash.
|
||||||
|
# Discussed with upstream developer but not upstream yet, see:
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1601146#c4
|
||||||
|
Patch3: ntfsclone-full-clusters-bz1601146.patch
|
||||||
BuildRequires: libtool, libattr-devel
|
BuildRequires: libtool, libattr-devel
|
||||||
BuildRequires: libconfig-devel, libgcrypt-devel, gnutls-devel, libuuid-devel
|
BuildRequires: libconfig-devel, libgcrypt-devel, gnutls-devel, libuuid-devel
|
||||||
|
|
||||||
@ -35,6 +39,7 @@ virt-v2v and virt-p2v programs.
|
|||||||
%patch0 -p1 -b .unsupported
|
%patch0 -p1 -b .unsupported
|
||||||
%patch1 -p0 -b .check-mftmirr
|
%patch1 -p0 -b .check-mftmirr
|
||||||
%patch2 -p0 -b .big-sectors
|
%patch2 -p0 -b .big-sectors
|
||||||
|
%patch3 -p0 -b .ntfsclone
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -98,6 +103,9 @@ popd
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jul 16 2018 Richard W.M. Jones <rjones@redhat.com> - 8.0-2
|
||||||
|
- Fix for ntfsclone crash (RHBZ#1601146).
|
||||||
|
|
||||||
* Wed Jul 11 2018 Richard W.M. Jones <rjones@redhat.com> - 8.0-1
|
* Wed Jul 11 2018 Richard W.M. Jones <rjones@redhat.com> - 8.0-1
|
||||||
- Rebase to 2017.3.23.
|
- Rebase to 2017.3.23.
|
||||||
- Remove patches which are now upstream.
|
- Remove patches which are now upstream.
|
||||||
|
|||||||
81
ntfsclone-full-clusters-bz1601146.patch
Normal file
81
ntfsclone-full-clusters-bz1601146.patch
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
--- ntfsprogs/ntfsclone.c 2018-05-16 18:46:47.114964000 +0200
|
||||||
|
+++ ntfsprogs/ntfsclone.c 2018-07-16 14:03:20.273809100 +0200
|
||||||
|
@@ -776,6 +776,10 @@
|
||||||
|
|
||||||
|
/* possible partial cluster holding the backup boot sector */
|
||||||
|
backup_bootsector = (lcn + 1)*csize >= full_device_size;
|
||||||
|
+ buff = (char*)ntfs_malloc(csize);
|
||||||
|
+ if (!buff)
|
||||||
|
+ err_exit("Not enough memory");
|
||||||
|
+
|
||||||
|
if (backup_bootsector) {
|
||||||
|
csize = full_device_size - lcn*csize;
|
||||||
|
if (csize < 0) {
|
||||||
|
@@ -783,10 +787,6 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- buff = (char*)ntfs_malloc(csize);
|
||||||
|
- if (!buff)
|
||||||
|
- err_exit("Not enough memory");
|
||||||
|
-
|
||||||
|
// need reading when not about to write ?
|
||||||
|
if (read_all(fd, buff, csize) == -1) {
|
||||||
|
|
||||||
|
@@ -1507,6 +1507,7 @@
|
||||||
|
s64 mft_no;
|
||||||
|
u32 mft_record_size;
|
||||||
|
u32 csize;
|
||||||
|
+ u32 buff_size;
|
||||||
|
u32 bytes_per_sector;
|
||||||
|
u32 records_per_set;
|
||||||
|
u32 clusters_per_set;
|
||||||
|
@@ -1524,15 +1525,18 @@
|
||||||
|
/*
|
||||||
|
* Depending on the sizes, there may be several records
|
||||||
|
* per cluster, or several clusters per record.
|
||||||
|
+ * Anyway, full clusters are needed for rescuing bad ones.
|
||||||
|
*/
|
||||||
|
if (csize >= mft_record_size) {
|
||||||
|
records_per_set = csize/mft_record_size;
|
||||||
|
clusters_per_set = 1;
|
||||||
|
+ buff_size = csize;
|
||||||
|
} else {
|
||||||
|
clusters_per_set = mft_record_size/csize;
|
||||||
|
records_per_set = 1;
|
||||||
|
+ buff_size = mft_record_size;
|
||||||
|
}
|
||||||
|
- buff = (char*)ntfs_malloc(mft_record_size);
|
||||||
|
+ buff = (char*)ntfs_malloc(buff_size);
|
||||||
|
if (!buff)
|
||||||
|
err_exit("Not enough memory");
|
||||||
|
|
||||||
|
@@ -1585,6 +1589,7 @@
|
||||||
|
void *fd;
|
||||||
|
u32 indx_record_size;
|
||||||
|
u32 csize;
|
||||||
|
+ u32 buff_size;
|
||||||
|
u32 bytes_per_sector;
|
||||||
|
u32 records_per_set;
|
||||||
|
u32 clusters_per_set;
|
||||||
|
@@ -1601,16 +1606,19 @@
|
||||||
|
/*
|
||||||
|
* Depending on the sizes, there may be several records
|
||||||
|
* per cluster, or several clusters per record.
|
||||||
|
+ * Anyway, full clusters are needed for rescuing bad ones.
|
||||||
|
*/
|
||||||
|
indx_record_size = image->ni->vol->indx_record_size;
|
||||||
|
if (csize >= indx_record_size) {
|
||||||
|
records_per_set = csize/indx_record_size;
|
||||||
|
clusters_per_set = 1;
|
||||||
|
+ buff_size = csize;
|
||||||
|
} else {
|
||||||
|
clusters_per_set = indx_record_size/csize;
|
||||||
|
records_per_set = 1;
|
||||||
|
+ buff_size = indx_record_size;
|
||||||
|
}
|
||||||
|
- buff = (char*)ntfs_malloc(indx_record_size);
|
||||||
|
+ buff = (char*)ntfs_malloc(buff_size);
|
||||||
|
if (!buff)
|
||||||
|
err_exit("Not enough memory");
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user