guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: gnu: tar: Fix sparse file detection on Btrfs file systems.


From: Mark H. Weaver
Subject: 01/01: gnu: tar: Fix sparse file detection on Btrfs file systems.
Date: Fri, 16 Mar 2018 09:32:04 -0400 (EDT)

mhw pushed a commit to branch core-updates
in repository guix.

commit 45413064c9db1712c845e5a1065aa81f66667abe
Author: Mark H Weaver <address@hidden>
Date:   Tue Jan 9 21:09:22 2018 -0500

    gnu: tar: Fix sparse file detection on Btrfs file systems.
    
    * gnu/packages/patches/tar-remove-wholesparse-check.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Add it.
    * gnu/packages/base.scm (tar)[source]: Add patch.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/base.scm                              |  3 +-
 .../patches/tar-remove-wholesparse-check.patch     | 68 ++++++++++++++++++++++
 3 files changed, 71 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index fe20ddd..c1df236 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1091,6 +1091,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/t1lib-CVE-2010-2642.patch               \
   %D%/packages/patches/t1lib-CVE-2011-0764.patch               \
   %D%/packages/patches/t1lib-CVE-2011-1552+.patch              \
+  %D%/packages/patches/tar-remove-wholesparse-check.patch      \
   %D%/packages/patches/tar-skip-unreliable-tests.patch         \
   %D%/packages/patches/tclxml-3.2-install.patch                        \
   %D%/packages/patches/tcsh-fix-autotest.patch                 \
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 7dd9474..892a416 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -177,7 +177,8 @@ implementation offers several extensions over the standard 
utility.")
             (sha256
              (base32
               "1lyjyk8z8hdddsxw0ikchrsfg3i0x3fsh7l63a8jgaz1n7dr5gzi"))
-            (patches (search-patches "tar-skip-unreliable-tests.patch"))))
+            (patches (search-patches "tar-skip-unreliable-tests.patch"
+                                     "tar-remove-wholesparse-check.patch"))))
    (build-system gnu-build-system)
    ;; Note: test suite requires ~1GiB of disk space.
    (arguments
diff --git a/gnu/packages/patches/tar-remove-wholesparse-check.patch 
b/gnu/packages/patches/tar-remove-wholesparse-check.patch
new file mode 100644
index 0000000..41f53e8
--- /dev/null
+++ b/gnu/packages/patches/tar-remove-wholesparse-check.patch
@@ -0,0 +1,68 @@
+This patch is needed in order to build Guix on a Btrfs file system.
+
+
+From da922703282b0d3b8837a99a9c7fdd32f1d20d49 Mon Sep 17 00:00:00 2001
+From: Mark H Weaver <address@hidden>
+Date: Tue, 9 Jan 2018 20:16:14 -0500
+Subject: [PATCH] Remove nonportable check for files containing only zeroes.
+
+This check benefitted only one unlikely case (large files containing
+only zeroes, on systems that do not support SEEK_HOLE) and was based
+on an assumption about file system behavior that is not mandated by
+POSIX and no longer holds in practice, namely that for sufficiently
+large files, (st_blocks == 0) implies that the file contains only
+zeroes.  Examples of file systems that violate this assumption include
+Linux's /proc file system and Btrfs.
+
+* src/sparse.c (sparse_scan_file_wholesparse): Remove this function.
+(sparse_scan_file_seek): Remove the initial check for files containing
+only zeroes.
+---
+ src/sparse.c | 24 ------------------------
+ 1 file changed, 24 deletions(-)
+
+diff --git a/src/sparse.c b/src/sparse.c
+index d41c0ea..3de6560 100644
+--- a/src/sparse.c
++++ b/src/sparse.c
+@@ -261,26 +261,6 @@ sparse_scan_file_raw (struct tar_sparse_file *file)
+   return tar_sparse_scan (file, scan_end, NULL);
+ }
+ 
+-static bool
+-sparse_scan_file_wholesparse (struct tar_sparse_file *file)
+-{
+-  struct tar_stat_info *st = file->stat_info;
+-  struct sp_array sp = {0, 0};
+-
+-  /* Note that this function is called only for truly sparse files of size >= 
1
+-     block size (checked via ST_IS_SPARSE before).  See the thread
+-     http://www.mail-archive.com/address@hidden/msg04209.html for more info */
+-  if (ST_NBLOCKS (st->stat) == 0)
+-    {
+-      st->archive_file_size = 0;
+-      sp.offset = st->stat.st_size;
+-      sparse_add_map (st, &sp);
+-      return true;
+-    }
+-
+-  return false;
+-}
+-
+ #ifdef SEEK_HOLE
+ /* Try to engage SEEK_HOLE/SEEK_DATA feature. */
+ static bool
+@@ -343,10 +323,6 @@ sparse_scan_file_seek (struct tar_sparse_file *file)
+ static bool
+ sparse_scan_file (struct tar_sparse_file *file)
+ {
+-  /* always check for completely sparse files */
+-  if (sparse_scan_file_wholesparse (file))
+-    return true;
+-
+   switch (hole_detection)
+     {
+     case HOLE_DETECTION_DEFAULT:
+-- 
+2.15.1
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]