summaryrefslogtreecommitdiff
path: root/sys-fs/ntfs3g
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-03-24 17:22:19 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-03-24 17:22:19 +0000
commitaa3411e241a201d53a2689766fe419f2756819f3 (patch)
treecc19adfde0a10aab1ab566c8dfe3c1616e5cc390 /sys-fs/ntfs3g
parentb7b97785ebbb2f11d24d14dab8b81ed274f4ce6a (diff)
gentoo resync : 24.03.2019
Diffstat (limited to 'sys-fs/ntfs3g')
-rw-r--r--sys-fs/ntfs3g/Manifest4
-rw-r--r--sys-fs/ntfs3g/files/ntfs3g-2017.3.23-big-sectors.patch379
-rw-r--r--sys-fs/ntfs3g/files/ntfs3g-2017.3.23-check-mftmirr.patch12
-rw-r--r--sys-fs/ntfs3g/files/ntfs3g-2017.3.23-full-clusters.patch81
-rw-r--r--sys-fs/ntfs3g/ntfs3g-2017.3.23-r2.ebuild103
5 files changed, 579 insertions, 0 deletions
diff --git a/sys-fs/ntfs3g/Manifest b/sys-fs/ntfs3g/Manifest
index 4f5e657a26b3..1c21d207202f 100644
--- a/sys-fs/ntfs3g/Manifest
+++ b/sys-fs/ntfs3g/Manifest
@@ -2,8 +2,12 @@ AUX 99-ntfs3g.rules 51 BLAKE2B 11dd7b3deb9276b38be508ec3de5bdb79ceb5e272e24d5dab
AUX ntfs3g-2014.2.15-no-split-usr.patch 1322 BLAKE2B efc71e28913d649484c1cf0d51dc34d8515cfba484a6a36a7cf158b142346255d403457ce0418148bbaa9e3e6e2cd494a509aa0c205ae944609844f4b9a04bc1 SHA512 232a1a7b84339c86758365564fce2058c3e652f833c6908245aa5f6f0e91d5c09cedcb978a1ebe62897c7288df4fe8671ba7085af403056742d897181e479e05
AUX ntfs3g-2016.2.22-CVE-2017-0358.patch 1169 BLAKE2B 47ee2ae7724f77d6c50e4eb816a4558fc296990c2f65e56d40f71db642e75e2bb35aeb2d6880e3faf21f61d9c51619de003903dba93cb742170bf4df56d6e744 SHA512 223f7b4fcd962d3c2499787f9a32c09f35705de98d3d1c96677cea18c67f77f5a086b7839892cb25b62c9145b2543c02d5abca89a82cda2345d5f993d6a60131
AUX ntfs3g-2016.2.22-sysmacros.patch 911 BLAKE2B a53765dc5cd4ae8320584167fbf202b50827e07f4599ab8572d434cc61110bb190854b24e567b210843002b74245e5a7f271ea4548cc52a0d3d893eb622702b2 SHA512 34768ef1ebf42b125cdc4d86937042f21b7146c4c76c1ed37e66e59a4bfaa863b54f7dbcca14a9d842782113e6ac70b2a96e62022dc2c8f717ec43c9985bf79f
+AUX ntfs3g-2017.3.23-big-sectors.patch 11378 BLAKE2B 47e47a6c1370af864aa7e700e56c8db1c190ae80bd3ed1ceeeb6952a143c2c7d640580d3586a088c7307893f3509884401cf2b7c4395ce8e536246ae3ae923e5 SHA512 e23b1e3eeeb3397e42c1a09afe8b261d5193df3fd521434b64aad80fe0c6fbbf78199b92659cbd76b6c802d77e708a81e86f1d2d97b464a5c854ef821ac722a1
+AUX ntfs3g-2017.3.23-check-mftmirr.patch 554 BLAKE2B 9c7ab2b705df38089dc0413b8132ea08ccfec34001470dfc8fb926ccdaddece6f7047cef29a9073a59f7a63da8f86e01dde9f8c9e482ae932a1dd860b940bffd SHA512 b6b4eb4c6c71b944a8a30b5da69fed97eec3b3e404c180f2c3434c402d3cf5b68aa7a4deaf74b74c11230c02ffd0ce41c96fa49f9874a0105e3219821431647f
+AUX ntfs3g-2017.3.23-full-clusters.patch 2206 BLAKE2B 5e11e3a1f3e51cf46c09c2e83033429d3ca900b4531dee419afe742efa2285793a57f968a042725d06cd139980010f99e2e7e240d892838fb7ea67682fa834dc SHA512 dbcc69018fea460882d644b3c1b794eaf1580ca6e9edbdd9a9590bbb6333dae0fedb50878c010908e3e7c7a08e0d443e95f0f7144aad78f2f89c51e92d777523
DIST ntfs-3g_ntfsprogs-2016.2.22.tgz 1264364 BLAKE2B 6028048d676372c062cda1cf9ee43f2c1f035d080dde1201746d994e705756ab219de8359b1f8708e83e11c0036cdc33339e54299aa433f383e698e425ff2fed SHA512 dbd36fadd2881db1d17fdbf5d2b4e50bbe11dc9dd0ad4917e7f8bc4032c2287346143756ce8754df0d46ce9209f2c0c41b626cad929d76a9bc881712c7101c15
DIST ntfs-3g_ntfsprogs-2017.3.23.tgz 1259054 BLAKE2B 4f12a6061ef0c116f26225eb3fb5cb84e469b63710115fbfb54fa3802ea94192afa973a553742818ff6849b72919069ec92aca2d4d6f58d8cabca1b0fefa3abe SHA512 3a607f0d7be35204c992d8931de0404fbc52032c13b4240d2c5e6f285c318a28eb2a385d7cf5ac4cd445876aee5baa5753bb636ada0d870d84a9d3fdbce794ef
EBUILD ntfs3g-2016.2.22-r2.ebuild 2450 BLAKE2B 8178b192162c011703272b7876b6b0b56a13698f2c673862789998b09f316c4cb06370a63a9cff9ab367562220284dfc38e614e80e27085a3e26615f4913cb14 SHA512 7a06505e8ca1d54b78bbe6da8975a69fcea297c36a74092bcd3259eacf3fd4cbaedceec5184c0b0e560f13141d6ca62692dc4a7a4e454090c844454a74adca0a
EBUILD ntfs3g-2017.3.23-r1.ebuild 2360 BLAKE2B 4929f0847741acef18f7078d0f62246aada50f35312398e068ceb2438751aa34245dc0af5ddd1d06a85da8e8f084fd35c7beaf1380efd24fe6ce3f9b94d0a85d SHA512 3760806c53d47b38cd1b5416d76c1bdeb2854b1b831139ca86ef1de64de0933c8804e78a333f55751812c4a8bb1cc8c8757f002b3aa36181fba5ee43db7a5041
+EBUILD ntfs3g-2017.3.23-r2.ebuild 2794 BLAKE2B 00c1b7e33e335b1ce3a325f14b80650be7adca757b9574f17689cca3460dcdd7d5223987048830076c23de3c318ae0eb0a78c23837568214f1677814de9ee52a SHA512 528946f6a0fbec94fe8aa07e6a8add8c53aff6820c9b2d002c0a5dcba091509ddf1370bbcc388b5f393786da5d5861f59ae63b0a9e9b48562b9b831e01752581
MISC metadata.xml 1188 BLAKE2B cd693b8b1281d056a5e75baeb04019684a67033607e16479c58830fbf9a19b88ba6e263c5e0637b5501cd5fe2fd000f92e8212354576242fa31c513158b38774 SHA512 6d9aa23202090132c37fe6915aa300597f2c88474065749de36143b8a47090c5bdb2e6449dffbb3843c9b7d30254fdde849b1aa230641910189d00134bd88c85
diff --git a/sys-fs/ntfs3g/files/ntfs3g-2017.3.23-big-sectors.patch b/sys-fs/ntfs3g/files/ntfs3g-2017.3.23-big-sectors.patch
new file mode 100644
index 000000000000..1cb8bb6c46c0
--- /dev/null
+++ b/sys-fs/ntfs3g/files/ntfs3g-2017.3.23-big-sectors.patch
@@ -0,0 +1,379 @@
+--- a/libntfs-3g/bootsect.c.ref 2017-03-23 10:42:44.000000000 +0100
++++ b/libntfs-3g/bootsect.c 2018-05-07 09:11:13.004710800 +0200
+@@ -38,6 +38,7 @@
+ #include <errno.h>
+ #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."
+--- a/ntfsprogs/mkntfs.8.in.ref 2017-03-23 10:42:44.000000000 +0100
++++ b/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
+--- a/ntfsprogs/mkntfs.c.ref 2017-03-23 10:42:44.000000000 +0100
++++ b/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",
+--- a/ntfsprogs/ntfsclone.c.ref 2017-03-23 10:42:44.000000000 +0100
++++ b/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)
+--- a/ntfsprogs/ntfsresize.c.ref 2017-03-23 10:42:44.000000000 +0100
++++ b/ntfsprogs/ntfsresize.c 2018-05-07 09:11:13.076883400 +0200
+@@ -59,6 +59,7 @@
+ #include <fcntl.h>
+ #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)
+--- a/include/ntfs-3g/param.h.ref 2017-03-23 10:42:44.000000000 +0100
++++ b/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/sys-fs/ntfs3g/files/ntfs3g-2017.3.23-check-mftmirr.patch b/sys-fs/ntfs3g/files/ntfs3g-2017.3.23-check-mftmirr.patch
new file mode 100644
index 000000000000..f56eadc882f9
--- /dev/null
+++ b/sys-fs/ntfs3g/files/ntfs3g-2017.3.23-check-mftmirr.patch
@@ -0,0 +1,12 @@
+--- a/libntfs-3g/volume.c.ref 2017-03-23 10:42:44.000000000 +0100
++++ b/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/sys-fs/ntfs3g/files/ntfs3g-2017.3.23-full-clusters.patch b/sys-fs/ntfs3g/files/ntfs3g-2017.3.23-full-clusters.patch
new file mode 100644
index 000000000000..7d2496d372d5
--- /dev/null
+++ b/sys-fs/ntfs3g/files/ntfs3g-2017.3.23-full-clusters.patch
@@ -0,0 +1,81 @@
+--- a/ntfsprogs/ntfsclone.c 2018-05-16 18:46:47.114964000 +0200
++++ b/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/sys-fs/ntfs3g/ntfs3g-2017.3.23-r2.ebuild b/sys-fs/ntfs3g/ntfs3g-2017.3.23-r2.ebuild
new file mode 100644
index 000000000000..fb67e549b9c8
--- /dev/null
+++ b/sys-fs/ntfs3g/ntfs3g-2017.3.23-r2.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit linux-info udev toolchain-funcs libtool
+
+MY_PN=${PN/3g/-3g}
+MY_P=${MY_PN}_ntfsprogs-${PV}
+
+DESCRIPTION="Open source read-write NTFS driver that runs under FUSE"
+HOMEPAGE="http://www.tuxera.com/community/ntfs-3g-download/"
+SRC_URI="http://tuxera.com/opensource/${MY_P}.tgz"
+
+LICENSE="GPL-2"
+# The subslot matches the SONAME major #.
+SLOT="0/88"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="acl debug +external-fuse ntfsdecrypt +ntfsprogs static-libs suid xattr"
+
+RDEPEND="!<sys-apps/util-linux-2.20.1-r2
+ !sys-fs/ntfsprogs
+ ntfsdecrypt? (
+ >=dev-libs/libgcrypt-1.2.2:0
+ >=net-libs/gnutls-1.4.4
+ )
+ external-fuse? (
+ >=sys-fs/fuse-2.8.0:0
+ )
+"
+DEPEND="${RDEPEND}
+ sys-apps/attr
+ virtual/pkgconfig
+"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS="AUTHORS ChangeLog CREDITS README"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2014.2.15-no-split-usr.patch
+ "${FILESDIR}"/${PN}-2016.2.22-sysmacros.patch #580136
+ # Fedora fixes
+ "${FILESDIR}"/${PN}-2017.3.23-check-mftmirr.patch
+ "${FILESDIR}"/${PN}-2017.3.23-big-sectors.patch
+ "${FILESDIR}"/${PN}-2017.3.23-full-clusters.patch
+)
+
+pkg_setup() {
+ if use external-fuse && use kernel_linux; then
+ if kernel_is lt 2 6 9; then
+ die "Your kernel is too old."
+ fi
+ CONFIG_CHECK="~FUSE_FS"
+ FUSE_FS_WARNING="You need to have FUSE module built to use ntfs-3g"
+ linux-info_pkg_setup
+ fi
+}
+
+src_prepare() {
+ default
+ # Keep the symlinks in the same place we put the main binaries.
+ # Having them in / when all the progs are in /usr is pointless.
+ sed -i \
+ -e 's:/sbin:$(sbindir):g' \
+ {ntfsprogs,src}/Makefile.in || die #578336
+ # Note: patches apply to Makefile.in, so don't run autotools here.
+ elibtoolize
+}
+
+src_configure() {
+ # disable hd library until we have the right library in the tree and
+ # don't links to hwinfo one causing issues like bug #602360
+ tc-ld-disable-gold
+ econf \
+ --prefix="${EPREFIX}"/usr \
+ --exec-prefix="${EPREFIX}"/usr \
+ --docdir="${EPREFIX}"/usr/share/doc/${PF} \
+ $(use_enable debug) \
+ --enable-ldscript \
+ --disable-ldconfig \
+ $(use_enable acl posix-acls) \
+ $(use_enable xattr xattr-mappings) \
+ $(use_enable ntfsdecrypt crypto) \
+ $(use_enable ntfsprogs) \
+ $(use_enable ntfsprogs quarantined) \
+ --without-uuid \
+ --without-hd \
+ --enable-extras \
+ $(use_enable static-libs static) \
+ --with-fuse=$(usex external-fuse external internal)
+}
+
+src_install() {
+ default
+
+ use suid && fperms u+s /usr/bin/${MY_PN}
+ # Not needed with the link of mount.ntfs being created, causes
+ # issues like bug #635080
+# udev_dorules "${FILESDIR}"/99-ntfs3g.rules
+ dosym mount.ntfs-3g /usr/sbin/mount.ntfs #374197
+
+ find "${D}" -name '*.la' -type f -delete || die
+}