gnu: Add kafs-client
[jackhill/guix/guix.git] / gnu / packages / patches / tar-remove-wholesparse-check.patch
CommitLineData
45413064
MW
1This patch is needed in order to build Guix on a Btrfs file system.
2
3
4From da922703282b0d3b8837a99a9c7fdd32f1d20d49 Mon Sep 17 00:00:00 2001
5From: Mark H Weaver <mhw@netris.org>
6Date: Tue, 9 Jan 2018 20:16:14 -0500
7Subject: [PATCH] Remove nonportable check for files containing only zeroes.
8
9This check benefitted only one unlikely case (large files containing
10only zeroes, on systems that do not support SEEK_HOLE) and was based
11on an assumption about file system behavior that is not mandated by
12POSIX and no longer holds in practice, namely that for sufficiently
13large files, (st_blocks == 0) implies that the file contains only
14zeroes. Examples of file systems that violate this assumption include
15Linux's /proc file system and Btrfs.
16
17* src/sparse.c (sparse_scan_file_wholesparse): Remove this function.
18(sparse_scan_file_seek): Remove the initial check for files containing
19only zeroes.
20---
21 src/sparse.c | 24 ------------------------
22 1 file changed, 24 deletions(-)
23
24diff --git a/src/sparse.c b/src/sparse.c
25index d41c0ea..3de6560 100644
26--- a/src/sparse.c
27+++ b/src/sparse.c
28@@ -261,26 +261,6 @@ sparse_scan_file_raw (struct tar_sparse_file *file)
29 return tar_sparse_scan (file, scan_end, NULL);
30 }
31
32-static bool
33-sparse_scan_file_wholesparse (struct tar_sparse_file *file)
34-{
35- struct tar_stat_info *st = file->stat_info;
36- struct sp_array sp = {0, 0};
37-
38- /* Note that this function is called only for truly sparse files of size >= 1
39- block size (checked via ST_IS_SPARSE before). See the thread
40- http://www.mail-archive.com/bug-tar@gnu.org/msg04209.html for more info */
41- if (ST_NBLOCKS (st->stat) == 0)
42- {
43- st->archive_file_size = 0;
44- sp.offset = st->stat.st_size;
45- sparse_add_map (st, &sp);
46- return true;
47- }
48-
49- return false;
50-}
51-
52 #ifdef SEEK_HOLE
53 /* Try to engage SEEK_HOLE/SEEK_DATA feature. */
54 static bool
55@@ -343,10 +323,6 @@ sparse_scan_file_seek (struct tar_sparse_file *file)
56 static bool
57 sparse_scan_file (struct tar_sparse_file *file)
58 {
59- /* always check for completely sparse files */
60- if (sparse_scan_file_wholesparse (file))
61- return true;
62-
63 switch (hole_detection)
64 {
65 case HOLE_DETECTION_DEFAULT:
66--
672.15.1
68