diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dd8faef --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/ntfs-3g-system-compression-1.0.tar.gz +SOURCES/ntfs-3g_ntfsprogs-2017.3.23.tgz diff --git a/.libguestfs-winsupport.metadata b/.libguestfs-winsupport.metadata new file mode 100644 index 0000000..6d824e9 --- /dev/null +++ b/.libguestfs-winsupport.metadata @@ -0,0 +1,2 @@ +a0c3bb13ac09fe6ac0307fd7a7e9d577099987e9 SOURCES/ntfs-3g-system-compression-1.0.tar.gz +160a836274c38d92e5c3a55256f404c8dd8f3cc1 SOURCES/ntfs-3g_ntfsprogs-2017.3.23.tgz diff --git a/SOURCES/0001-Fixed-reporting-an-error-when-failed-to-build-the-mo.patch b/SOURCES/0001-Fixed-reporting-an-error-when-failed-to-build-the-mo.patch new file mode 100644 index 0000000..1a90ba1 --- /dev/null +++ b/SOURCES/0001-Fixed-reporting-an-error-when-failed-to-build-the-mo.patch @@ -0,0 +1,63 @@ +From 85c1634a26faa572d3c558d4cf8aaaca5202d4e9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= +Date: Wed, 19 Dec 2018 15:57:50 +0100 +Subject: [PATCH] Fixed reporting an error when failed to build the mountpoint + +The size check was inefficient because getcwd() uses an unsigned int +argument. +--- + src/lowntfs-3g.c | 6 +++++- + src/ntfs-3g.c | 6 +++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c +index 993867fa..0660439b 100644 +--- a/src/lowntfs-3g.c ++++ b/src/lowntfs-3g.c +@@ -4411,7 +4411,8 @@ int main(int argc, char *argv[]) + else { + ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX); + if (ctx->abs_mnt_point) { +- if (getcwd(ctx->abs_mnt_point, ++ if ((strlen(opts.mnt_point) < PATH_MAX) ++ && getcwd(ctx->abs_mnt_point, + PATH_MAX - strlen(opts.mnt_point) - 1)) { + strcat(ctx->abs_mnt_point, "/"); + strcat(ctx->abs_mnt_point, opts.mnt_point); +@@ -4419,6 +4420,9 @@ int main(int argc, char *argv[]) + /* Solaris also wants the absolute mount point */ + opts.mnt_point = ctx->abs_mnt_point; + #endif /* defined(__sun) && defined (__SVR4) */ ++ } else { ++ free(ctx->abs_mnt_point); ++ ctx->abs_mnt_point = (char*)NULL; + } + } + } +diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c +index 6ce89fef..4e0912ae 100644 +--- a/src/ntfs-3g.c ++++ b/src/ntfs-3g.c +@@ -4148,7 +4148,8 @@ int main(int argc, char *argv[]) + else { + ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX); + if (ctx->abs_mnt_point) { +- if (getcwd(ctx->abs_mnt_point, ++ if ((strlen(opts.mnt_point) < PATH_MAX) ++ && getcwd(ctx->abs_mnt_point, + PATH_MAX - strlen(opts.mnt_point) - 1)) { + strcat(ctx->abs_mnt_point, "/"); + strcat(ctx->abs_mnt_point, opts.mnt_point); +@@ -4156,6 +4157,9 @@ int main(int argc, char *argv[]) + /* Solaris also wants the absolute mount point */ + opts.mnt_point = ctx->abs_mnt_point; + #endif /* defined(__sun) && defined (__SVR4) */ ++ } else { ++ free(ctx->abs_mnt_point); ++ ctx->abs_mnt_point = (char*)NULL; + } + } + } +-- +2.20.1 + diff --git a/SOURCES/check-mftmirr.patch b/SOURCES/check-mftmirr.patch new file mode 100644 index 0000000..666b244 --- /dev/null +++ b/SOURCES/check-mftmirr.patch @@ -0,0 +1,12 @@ +--- libntfs-3g/volume.c.ref 2017-03-23 10:42:44.000000000 +0100 ++++ libntfs-3g/volume.c 2017-12-20 08:11:51.842424300 +0100 +@@ -959,7 +959,8 @@ + vol->mftmirr_size = l; + } + ntfs_log_debug("Comparing $MFTMirr to $MFT...\n"); +- for (i = 0; i < vol->mftmirr_size; ++i) { ++ /* Windows 10 does not update the full $MFTMirr any more */ ++ for (i = 0; (i < vol->mftmirr_size) && (i < FILE_first_user); ++i) { + MFT_RECORD *mrec, *mrec2; + const char *ESTR[12] = { "$MFT", "$MFTMirr", "$LogFile", + "$Volume", "$AttrDef", "root directory", "$Bitmap", diff --git a/SOURCES/ntfs-3g-big-sectors.patch b/SOURCES/ntfs-3g-big-sectors.patch new file mode 100644 index 0000000..1f4c9c5 --- /dev/null +++ b/SOURCES/ntfs-3g-big-sectors.patch @@ -0,0 +1,379 @@ +--- libntfs-3g/bootsect.c.ref 2017-03-23 10:42:44.000000000 +0100 ++++ libntfs-3g/bootsect.c 2018-05-07 09:11:13.004710800 +0200 +@@ -38,6 +38,7 @@ + #include + #endif + ++#include "param.h" + #include "compat.h" + #include "bootsect.h" + #include "debug.h" +@@ -61,6 +62,7 @@ + { + u32 i; + BOOL ret = FALSE; ++ u16 sectors_per_cluster; + + ntfs_log_debug("Beginning bootsector check.\n"); + +@@ -83,15 +85,27 @@ + case 1: case 2: case 4: case 8: case 16: case 32: case 64: case 128: + break; + default: +- ntfs_log_error("Unexpected sectors per cluster value (%d).\n", +- b->bpb.sectors_per_cluster); +- goto not_ntfs; ++ if ((b->bpb.sectors_per_cluster < 240) ++ || (b->bpb.sectors_per_cluster > 249)) { ++ if (b->bpb.sectors_per_cluster > 128) ++ ntfs_log_error("Unexpected sectors" ++ " per cluster value (code 0x%x)\n", ++ b->bpb.sectors_per_cluster); ++ else ++ ntfs_log_error("Unexpected sectors" ++ " per cluster value (%d).\n", ++ b->bpb.sectors_per_cluster); ++ goto not_ntfs; ++ } + } + + ntfs_log_debug("Checking cluster size.\n"); +- i = (u32)le16_to_cpu(b->bpb.bytes_per_sector) * +- b->bpb.sectors_per_cluster; +- if (i > 65536) { ++ if (b->bpb.sectors_per_cluster > 128) ++ sectors_per_cluster = 1 << (256 - b->bpb.sectors_per_cluster); ++ else ++ sectors_per_cluster = b->bpb.sectors_per_cluster; ++ i = (u32)le16_to_cpu(b->bpb.bytes_per_sector) * sectors_per_cluster; ++ if (i > NTFS_MAX_CLUSTER_SIZE) { + ntfs_log_error("Unexpected cluster size (%d).\n", i); + goto not_ntfs; + } +@@ -171,7 +185,7 @@ + int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) + { + s64 sectors; +- u8 sectors_per_cluster; ++ u16 sectors_per_cluster; + s8 c; + + /* We return -1 with errno = EINVAL on error. */ +@@ -186,7 +200,10 @@ + * below or equal the number_of_clusters) really belong in the + * ntfs_boot_sector_is_ntfs but in this way we can just do this once. + */ +- sectors_per_cluster = bs->bpb.sectors_per_cluster; ++ if (bs->bpb.sectors_per_cluster > 128) ++ sectors_per_cluster = 1 << (256 - bs->bpb.sectors_per_cluster); ++ else ++ sectors_per_cluster = bs->bpb.sectors_per_cluster; + ntfs_log_debug("SectorsPerCluster = 0x%x\n", sectors_per_cluster); + if (sectors_per_cluster & (sectors_per_cluster - 1)) { + ntfs_log_error("sectors_per_cluster (%d) is not a power of 2." +--- ntfsprogs/mkntfs.8.in.ref 2017-03-23 10:42:44.000000000 +0100 ++++ ntfsprogs/mkntfs.8.in 2018-05-07 09:11:13.014132400 +0200 +@@ -132,7 +132,7 @@ + .TP + \fB\-c\fR, \fB\-\-cluster\-size\fR BYTES + Specify the size of clusters in bytes. Valid cluster size values are powers of +-two, with at least 256, and at most 65536 bytes per cluster. If omitted, ++two, with at least 256, and at most 2097152 bytes (2MB) per cluster. If omitted, + .B mkntfs + uses 4096 bytes as the default cluster size. + .sp +--- ntfsprogs/mkntfs.c.ref 2017-03-23 10:42:44.000000000 +0100 ++++ ntfsprogs/mkntfs.c 2018-05-07 09:11:13.035522300 +0200 +@@ -6,7 +6,7 @@ + * Copyright (c) 2002-2006 Szabolcs Szakacsits + * Copyright (c) 2005 Erik Sornes + * Copyright (c) 2007 Yura Pakhuchiy +- * Copyright (c) 2010-2014 Jean-Pierre Andre ++ * Copyright (c) 2010-2018 Jean-Pierre Andre + * + * This utility will create an NTFS 1.2 or 3.1 volume on a user + * specified (block) device. +@@ -119,6 +119,7 @@ + # endif + #endif + ++#include "param.h" + #include "security.h" + #include "types.h" + #include "attrib.h" +@@ -287,7 +288,7 @@ + ntfs_log_info("Copyright (c) 2002-2006 Szabolcs Szakacsits\n"); + ntfs_log_info("Copyright (c) 2005 Erik Sornes\n"); + ntfs_log_info("Copyright (c) 2007 Yura Pakhuchiy\n"); +- ntfs_log_info("Copyright (c) 2010-2014 Jean-Pierre Andre\n"); ++ ntfs_log_info("Copyright (c) 2010-2018 Jean-Pierre Andre\n"); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + } + +@@ -3719,11 +3720,11 @@ + /* + * For huge volumes, grow the cluster size until the number of + * clusters fits into 32 bits or the cluster size exceeds the +- * maximum limit of 64kiB. ++ * maximum limit of NTFS_MAX_CLUSTER_SIZE. + */ + while (volume_size >> (ffs(vol->cluster_size) - 1 + 32)) { + vol->cluster_size <<= 1; +- if (vol->cluster_size > 65535) { ++ if (vol->cluster_size >= NTFS_MAX_CLUSTER_SIZE) { + ntfs_log_error("Device is too large to hold an " + "NTFS volume (maximum size is " + "256TiB).\n"); +@@ -3744,15 +3745,18 @@ + "to, or larger than, the sector size.\n"); + return FALSE; + } +- if (vol->cluster_size > 128 * (u32)opts.sector_size) { ++ /* Before Windows 10 Creators, the limit was 128 */ ++ if (vol->cluster_size > 4096 * (u32)opts.sector_size) { + ntfs_log_error("The cluster size is invalid. It cannot be " +- "more that 128 times the size of the sector " ++ "more that 4096 times the size of the sector " + "size.\n"); + return FALSE; + } +- if (vol->cluster_size > 65536) { ++ if (vol->cluster_size > NTFS_MAX_CLUSTER_SIZE) { + ntfs_log_error("The cluster size is invalid. The maximum " +- "cluster size is 65536 bytes (64kiB).\n"); ++ "cluster size is %lu bytes (%lukiB).\n", ++ (unsigned long)NTFS_MAX_CLUSTER_SIZE, ++ (unsigned long)(NTFS_MAX_CLUSTER_SIZE >> 10)); + return FALSE; + } + vol->cluster_size_bits = ffs(vol->cluster_size) - 1; +@@ -4387,6 +4391,7 @@ + u8 *sd; + FILE_ATTR_FLAGS extend_flags; + VOLUME_FLAGS volume_flags = const_cpu_to_le16(0); ++ int sectors_per_cluster; + int nr_sysfiles; + int buf_sds_first_size; + char *buf_sds; +@@ -4639,8 +4644,11 @@ + * already inserted, so no need to worry about these things. + */ + bs->bpb.bytes_per_sector = cpu_to_le16(opts.sector_size); +- bs->bpb.sectors_per_cluster = (u8)(g_vol->cluster_size / +- opts.sector_size); ++ sectors_per_cluster = g_vol->cluster_size / opts.sector_size; ++ if (sectors_per_cluster > 128) ++ bs->bpb.sectors_per_cluster = 257 - ffs(sectors_per_cluster); ++ else ++ bs->bpb.sectors_per_cluster = sectors_per_cluster; + bs->bpb.media_type = 0xf8; /* hard disk */ + bs->bpb.sectors_per_track = cpu_to_le16(opts.sectors_per_track); + ntfs_log_debug("sectors per track = %ld (0x%lx)\n", +--- ntfsprogs/ntfsclone.c.ref 2017-03-23 10:42:44.000000000 +0100 ++++ ntfsprogs/ntfsclone.c 2018-05-07 09:11:38.245007100 +0200 +@@ -3,7 +3,7 @@ + * + * Copyright (c) 2003-2006 Szabolcs Szakacsits + * Copyright (c) 2004-2006 Anton Altaparmakov +- * Copyright (c) 2010-2016 Jean-Pierre Andre ++ * Copyright (c) 2010-2018 Jean-Pierre Andre + * Special image format support copyright (c) 2004 Per Olofsson + * + * Clone NTFS data and/or metadata to a sparse file, image, device or stdout. +@@ -71,6 +71,7 @@ + */ + #define NTFS_DO_NOT_CHECK_ENDIANS + ++#include "param.h" + #include "debug.h" + #include "types.h" + #include "support.h" +@@ -270,7 +271,6 @@ + + #define LAST_METADATA_INODE 11 + +-#define NTFS_MAX_CLUSTER_SIZE 65536 + #define NTFS_SECTOR_SIZE 512 + + #define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) +@@ -393,7 +393,7 @@ + "Efficiently clone, image, restore or rescue an NTFS Volume.\n\n" + "Copyright (c) 2003-2006 Szabolcs Szakacsits\n" + "Copyright (c) 2004-2006 Anton Altaparmakov\n" +- "Copyright (c) 2010-2016 Jean-Pierre Andre\n\n"); ++ "Copyright (c) 2010-2018 Jean-Pierre Andre\n\n"); + fprintf(stderr, "%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); + exit(0); + } +@@ -756,7 +756,7 @@ + + static void copy_cluster(int rescue, u64 rescue_lcn, u64 lcn) + { +- char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ ++ char *buff; + /* vol is NULL if opt.restore_image is set */ + s32 csize = le32_to_cpu(image_hdr.cluster_size); + BOOL backup_bootsector; +@@ -783,6 +783,10 @@ + } + } + ++ 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) { + +@@ -858,6 +862,7 @@ + perr_printf("Write failed"); + #endif + } ++ free(buff); + } + + static s64 lseek_out(int fd, s64 pos, int mode) +@@ -995,7 +1000,11 @@ + struct progress_bar *progress, u64 *p_counter) + { + s64 i; +- char buff[NTFS_MAX_CLUSTER_SIZE]; ++ char *buff; ++ ++ buff = (char*)ntfs_malloc(csize); ++ if (!buff) ++ err_exit("Not enough memory"); + + memset(buff, 0, csize); + +@@ -1004,6 +1013,7 @@ + perr_exit("write_all"); + progress_update(progress, ++(*p_counter)); + } ++ free(buff); + } + + static void restore_image(void) +@@ -1492,7 +1502,7 @@ + + static void copy_wipe_mft(ntfs_walk_clusters_ctx *image, runlist *rl) + { +- char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ ++ char *buff; + void *fd; + s64 mft_no; + u32 mft_record_size; +@@ -1522,6 +1532,10 @@ + clusters_per_set = mft_record_size/csize; + records_per_set = 1; + } ++ buff = (char*)ntfs_malloc(mft_record_size); ++ if (!buff) ++ err_exit("Not enough memory"); ++ + mft_no = 0; + ri = rj = 0; + wi = wj = 0; +@@ -1554,6 +1568,7 @@ + } + } + image->current_lcn = current_lcn; ++ free(buff); + } + + /* +@@ -1566,7 +1581,7 @@ + + static void copy_wipe_i30(ntfs_walk_clusters_ctx *image, runlist *rl) + { +- char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ ++ char *buff; + void *fd; + u32 indx_record_size; + u32 csize; +@@ -1595,6 +1610,10 @@ + clusters_per_set = indx_record_size/csize; + records_per_set = 1; + } ++ buff = (char*)ntfs_malloc(indx_record_size); ++ if (!buff) ++ err_exit("Not enough memory"); ++ + ri = rj = 0; + wi = wj = 0; + if (rl[ri].length) +@@ -1627,6 +1646,7 @@ + } + } + image->current_lcn = current_lcn; ++ free(buff); + } + + static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) +--- ntfsprogs/ntfsresize.c.ref 2017-03-23 10:42:44.000000000 +0100 ++++ ntfsprogs/ntfsresize.c 2018-05-07 09:11:13.076883400 +0200 +@@ -59,6 +59,7 @@ + #include + #endif + ++#include "param.h" + #include "debug.h" + #include "types.h" + #include "support.h" +@@ -243,8 +244,6 @@ + #define DIRTY_INODE (1) + #define DIRTY_ATTRIB (2) + +-#define NTFS_MAX_CLUSTER_SIZE (65536) +- + static s64 rounded_up_division(s64 numer, s64 denom) + { + return (numer + (denom - 1)) / denom; +@@ -404,7 +403,7 @@ + printf("Copyright (c) 2002-2005 Anton Altaparmakov\n"); + printf("Copyright (c) 2002-2003 Richard Russon\n"); + printf("Copyright (c) 2007 Yura Pakhuchiy\n"); +- printf("Copyright (c) 2011-2016 Jean-Pierre Andre\n"); ++ printf("Copyright (c) 2011-2018 Jean-Pierre Andre\n"); + printf("\n%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); + } + +@@ -1849,9 +1848,13 @@ + static void copy_clusters(ntfs_resize_t *resize, s64 dest, s64 src, s64 len) + { + s64 i; +- char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ ++ char *buff; + ntfs_volume *vol = resize->vol; + ++ buff = (char*)ntfs_malloc(vol->cluster_size); ++ if (!buff) ++ perr_exit("ntfs_malloc"); ++ + for (i = 0; i < len; i++) { + + lseek_to_cluster(vol, src + i); +@@ -1875,6 +1878,7 @@ + resize->relocations++; + progress_update(&resize->progress, resize->relocations); + } ++ free(buff); + } + + static void relocate_clusters(ntfs_resize_t *r, runlist *dest_rl, s64 src_lcn) +--- include/ntfs-3g/param.h.ref 2017-03-23 10:42:44.000000000 +0100 ++++ include/ntfs-3g/param.h 2018-05-07 09:11:13.088302600 +0200 +@@ -40,6 +40,13 @@ + }; + + /* ++ * Parameters for formatting ++ */ ++ ++ /* Up to Windows 10, the cluster size was limited to 64K */ ++#define NTFS_MAX_CLUSTER_SIZE 2097152 /* Windows 10 Creators allows 2MB */ ++ ++/* + * Parameters for compression + */ + diff --git a/SOURCES/ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch b/SOURCES/ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch new file mode 100644 index 0000000..8fd39c6 --- /dev/null +++ b/SOURCES/ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch @@ -0,0 +1,16 @@ +diff -up ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c.OLD ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c +--- ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c.OLD 2011-10-11 10:24:02.381335115 -0400 ++++ ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c 2011-10-11 10:26:41.513559206 -0400 +@@ -877,7 +877,11 @@ int main(int argc, char **argv) + if (errors) + return 2; + if (unsupported) +- return 1; ++ ntfs_log_info("ntfsck was unable to run properly.\n"); ++ // If we return 1 here, we fail for ntfs services fscking on boot just because ++ // ntfsck isn't smart enough to handle 99% of cases. So, we just return 0. ++ // return 1; ++ return 0; + return 0; + } + diff --git a/SOURCES/ntfsclone-full-clusters-bz1601146.patch b/SOURCES/ntfsclone-full-clusters-bz1601146.patch new file mode 100644 index 0000000..1161510 --- /dev/null +++ b/SOURCES/ntfsclone-full-clusters-bz1601146.patch @@ -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"); + diff --git a/SPECS/libguestfs-winsupport.spec b/SPECS/libguestfs-winsupport.spec new file mode 100644 index 0000000..4364968 --- /dev/null +++ b/SPECS/libguestfs-winsupport.spec @@ -0,0 +1,234 @@ +%global ntfs_version 2017.3.23 +%global compression_version 1.0 + +# debuginfo makes no sense for this package, so disable it +%global debug_package %{nil} + +Name: libguestfs-winsupport +Version: 8.2 +Release: 4%{?dist} +Summary: Add support for Windows guests to virt-v2v and virt-p2v + +URL: http://www.ntfs-3g.org/ +# and URL: https://github.com/ebiggers/ntfs-3g-system-compression +License: GPLv2+ + +# This package shouldn't be installed without installing the base +# libguestfs package. +Requires: libguestfs >= 1:1.38.2 + +# Source and patches for ntfs-3g and ntfs-3g-system-compression. +Source0: http://tuxera.com/opensource/ntfs-3g_ntfsprogs-%{ntfs_version}.tgz +Source1: https://github.com/ebiggers/ntfs-3g-system-compression/archive/v%{version}/ntfs-3g-system-compression-%{compression_version}.tar.gz + +Patch0: ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch +Patch1: check-mftmirr.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 +# CVE-2019-9755 (https://bugzilla.redhat.com/show_bug.cgi?id=1698502) +Patch4: 0001-Fixed-reporting-an-error-when-failed-to-build-the-mo.patch + +BuildRequires: gcc +BuildRequires: libtool, libattr-devel +BuildRequires: libconfig-devel, libgcrypt-devel, gnutls-devel, libuuid-devel +BuildRequires: autoconf, automake, libtool, fuse-devel + + +%description +This optional package adds support for Windows guests (NTFS) to the +virt-v2v and virt-p2v programs. + +This package also supports system compression ("Compact OS") using the +plugin from https://github.com/ebiggers/ntfs-3g-system-compression + + +%prep +%setup -q -n ntfs-3g_ntfsprogs-%{ntfs_version} +%setup -n ntfs-3g_ntfsprogs-%{ntfs_version} -T -D -a 1 +%patch0 -p1 -b .unsupported +%patch1 -p0 -b .check-mftmirr +%patch2 -p0 -b .big-sectors +%patch3 -p0 -b .ntfsclone +%patch4 -p1 + + +%build +CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64" +%configure \ + --disable-static \ + --disable-ldconfig \ + --exec-prefix=/ \ + --enable-posix-acls \ + --enable-xattr-mappings \ + --enable-crypto \ + --enable-extras \ + --enable-quarantined +make %{?_smp_mflags} LIBTOOL=%{_bindir}/libtool + +# Build ntfs-3g-system-compression plugin. +pushd ntfs-3g-system-compression-%{compression_version} +autoreconf -i +# Trick the plugin into using the just-compiled ntfs-3g. +cp ../libntfs-3g/libntfs-3g.pc . +sed -i \ + -e 's,^libdir=.*,libdir=../libntfs-3g,' \ + -e 's,^includedir=.*,includedir=../include,' \ + libntfs-3g.pc +export PKG_CONFIG_PATH=. +%configure +%make_build +popd + + +%install +# Build it into a destdir which is not the final buildroot. +mkdir destdir +make LIBTOOL=%{_bindir}/libtool DESTDIR=$(pwd)/destdir install +rm -rf destdir/%{_libdir}/*.la +rm -rf destdir/%{_libdir}/*.a + +rm -rf destdir/%{_sbindir}/mount.ntfs-3g +cp -a destdir/%{_bindir}/ntfs-3g destdir/%{_sbindir}/mount.ntfs-3g + +# Actually make some symlinks for simplicity... +# ... since we're obsoleting ntfsprogs-fuse +pushd destdir/%{_bindir} +ln -s ntfs-3g ntfsmount +popd +pushd destdir/%{_sbindir} +ln -s mount.ntfs-3g mount.ntfs-fuse +# And since there is no other package in Fedora that provides an ntfs +# mount... +ln -s mount.ntfs-3g mount.ntfs +# Need this for fsck to find it +ln -s ../bin/ntfsck fsck.ntfs +popd +mv destdir/sbin/* destdir/%{_sbindir} +rmdir destdir/sbin + +# We get this on our own, thanks. +rm -r destdir/%{_defaultdocdir} + +# Remove development files. +rm -r destdir/%{_includedir} +rm -r destdir/%{_libdir}/pkgconfig + +# Install ntfs-3g-system-compression plugin in the same place. +pushd ntfs-3g-system-compression-%{compression_version} +%make_install DESTDIR=$(pwd)/../destdir +popd +rm -rf destdir/%{_libdir}/ntfs-3g/*.la + +# Take the destdir and put it into a tarball for the libguestfs appliance. +mkdir -p %{buildroot}%{_libdir}/guestfs/supermin.d +pushd destdir +tar zvcf %{buildroot}%{_libdir}/guestfs/supermin.d/zz-winsupport.tar.gz . +popd + + +%files +%doc AUTHORS ChangeLog COPYING CREDITS NEWS README + +%{_libdir}/guestfs/supermin.d/zz-winsupport.tar.gz + + +%changelog +* Mon Aug 09 2021 Mohan Boddu - 8.2-4 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Wed Jun 02 2021 Richard W.M. Jones - 8.2-3 +- Add gating tests (for RHEL 9) + +* Fri Apr 16 2021 Mohan Boddu - 8.2-2 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Wed Jan 29 2020 Richard W.M. Jones - 8.2-1 +- Rebuild for RHEL AV 8.2. +- Include ntfs-3g-system-compression plugin. + resolves: rhbz#1705234, rhbz#1796073 + +* Fri Jun 28 2019 Danilo de Paula - 8.0-4 +- Rebuild all virt packages to fix RHEL's upgrade path +- Resolves: rhbz#1695587 + (Ensure modular RPM upgrade path) + +* Wed Apr 10 2019 Richard W.M. Jones - 8.0-3 +- Fix for CVE-2019-9755 + (heap-based buffer overflow leads to local root privilege escalation) + resolves: rhbz#1698503 + +* Mon Jul 16 2018 Richard W.M. Jones - 8.0-2 +- Fix for ntfsclone crash (RHBZ#1601146). + +* Wed Jul 11 2018 Richard W.M. Jones - 8.0-1 +- Rebase to 2017.3.23. +- Remove patches which are now upstream. +- Resynch with Fedora package. +- Enable all architectures for RHEL 8. + +* Wed Feb 22 2017 Richard W.M. Jones - 7.2-2 +- Fix for handling guest filenames with invalid or incomplete + multibyte or wide characters + resolves: rhbz#1301593 + +* Tue Jul 07 2015 Richard W.M. Jones - 7.2-1 +- Rebase and rebuild for RHEL 7.2 + resolves: rhbz#1240278 + +* Tue Jun 30 2015 Richard W.M. Jones - 7.1-6 +- Bump version and rebuild. + related: rhbz#1221583 + +* Fri May 15 2015 Richard W.M. Jones - 7.1-5 +- Enable aarch64 architecture. + resolves: rhbz#1221583 + +* Thu Aug 28 2014 Richard W.M. Jones - 7.1-4 +- Enable debuginfo support and stripping. + resolves: rhbz#1100319 + +* Thu Aug 28 2014 Richard W.M. Jones - 7.1-3 +- Add patches from Fedora package which add fstrim support. + resolves: rhbz#1100319 + +* Mon Jul 21 2014 Richard W.M. Jones - 7.1-2 +- New package for RHEL 7.1 +- Rebase to ntfs-3g 2014.2.15 + resolves: rhbz#1100319 +- Change the package so it works with supermin5. +- Remove dependency on external FUSE. + +* Wed Apr 3 2013 Richard W.M. Jones - 7.0-2 +- Resync against Rawhide package (ntfs-3g 2013.1.13). +- Drop HAL file since HAL is dead. + resolves: rhbz#819939 + +* Thu Dec 20 2012 Richard W.M. Jones - 7.0-1 +- New package for RHEL 7 + resolves: rhbz#819939 +- Resync against Rawhide package. + +* Mon Mar 28 2011 Richard W.M. Jones - 1.0-7 +- Disable debuginfo package. + resolves: RHBZ#691555. + +* Tue Mar 8 2011 Richard W.M. Jones - 1.0-6 +- Require libguestfs 1.7.17 (newer version in RHEL 6.1). +- Require febootstrap-supermin-helper instead of febootstrap + resolves: RHBZ#670299. + +* Thu Jul 1 2010 Richard W.M. Jones - 1.0-5 +- Make sure intermediate lib* directories are created in hostfiles (RHBZ#603429) + +* Thu Jun 3 2010 Richard W.M. Jones - 1.0-4 +- Requires fuse-libs (RHBZ#599300). + +* Fri May 21 2010 Richard W.M. Jones - 1.0-3 +- ExclusiveArch x86_64. + +* Tue May 18 2010 Richard W.M. Jones - 1.0-2 +- Package Windows support for libguestfs.