]>
Commit | Line | Data |
---|---|---|
9190f00f AM |
1 | commit c2b707cf506c83ad4ab38c97c11cf358cc0bec88 |
2 | Author: Christoph Hellwig <hch@lst.de> | |
3 | Date: Fri Feb 5 08:52:52 2010 +0100 | |
4 | ||
5 | mkfs.xfs: fix detection of empty devices | |
6 | ||
7 | We currently fail to detect that a device does indeed not contain any | |
8 | signature and we are indeed fine to proceed with it due to mishandling | |
9 | the return value of blkid_do_fullprobe. Fix that up and add some | |
10 | better diagnostics of the blkid detection. | |
11 | ||
12 | from RH bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=561870 | |
13 | ||
14 | # dd if=/dev/zero of=k bs=1MB count=2 seek=20; mkfs.xfs k | |
15 | # mkfs.xfs: probe of k failed, cannot detect existing filesystem. | |
16 | # mkfs.xfs: Use the -f option to force overwrite | |
17 | ||
18 | Signed-off-by: Christoph Hellwig <hch@lst.de> | |
19 | Reviewed-by: Eric Sandeen <sandeen@sandeen.net> | |
20 | ||
21 | diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c | |
22 | index 9baf116..2d09e36 100644 | |
23 | --- a/mkfs/xfs_mkfs.c | |
24 | +++ b/mkfs/xfs_mkfs.c | |
25 | @@ -322,24 +322,40 @@ check_overwrite( | |
26 | if (!pr) | |
27 | goto out; | |
28 | ||
29 | - if (blkid_probe_enable_partitions(pr, 1)) | |
30 | + ret = blkid_probe_enable_partitions(pr, 1); | |
31 | + if (ret < 0) | |
32 | goto out; | |
33 | ||
34 | - if (blkid_do_fullprobe(pr)) | |
35 | + ret = blkid_do_fullprobe(pr); | |
36 | + if (ret < 0) | |
37 | goto out; | |
38 | ||
39 | - ret = 0; | |
40 | + /* | |
41 | + * Blkid returns 1 for nothing found and 0 when it finds a signature, | |
42 | + * but we want the exact opposite, so reverse the return value here. | |
43 | + * | |
44 | + * In addition print some useful diagnostics about what actually is | |
45 | + * on the device. | |
46 | + */ | |
47 | + if (ret) { | |
48 | + ret = 0; | |
49 | + goto out; | |
50 | + } | |
51 | + | |
52 | if (!blkid_probe_lookup_value(pr, "TYPE", &type, NULL)) { | |
53 | fprintf(stderr, | |
54 | _("%s: %s appears to contain an existing " | |
55 | "filesystem (%s).\n"), progname, device, type); | |
56 | - ret = 1; | |
57 | } else if (!blkid_probe_lookup_value(pr, "PTTYPE", &type, NULL)) { | |
58 | fprintf(stderr, | |
59 | _("%s: %s appears to contain a partition " | |
60 | "table (%s).\n"), progname, device, type); | |
61 | - ret = 1; | |
62 | + } else { | |
63 | + fprintf(stderr, | |
64 | + _("%s: %s appears to contain something weird " | |
65 | + "according to blkid\n"), progname, device); | |
66 | } | |
67 | + ret = 1; | |
68 | ||
69 | out: | |
70 | if (pr) | |
71 | commit 66210ef2f6aa5821a4c9cebc28414a265ee16019 | |
72 | Author: Eric Sandeen <sandeen@sandeen.net> | |
73 | Date: Mon Feb 1 10:13:36 2010 -0600 | |
74 | ||
75 | xfsprogs: fix build with latest glibc headers | |
76 | ||
77 | glibc in rawhide has some changes... | |
78 | ||
79 | * Tue Jan 12 2010 Andreas Schwab <schwab@redhat.com> - 2.11.90-8 | |
80 | - Update from master. | |
81 | - More POSIX conformance fixes. | |
82 | ||
83 | * Mon Jan 11 2010 Andreas Schwab <schwab@redhat.com> - 2.11.90-6 | |
84 | - Update from master. | |
85 | - POSIX conformance fixes (BZ#11125). | |
86 | ||
87 | which seem to break the xfsprogs build. I'm no feature test macro | |
88 | guru, but the following gets it going again for me. | |
89 | ||
90 | Signed-off-by: Eric Sandeen <sandeen@redhat.com> | |
91 | Reviewed-by: Christoph Hellwig <hch@lst.de> | |
92 | ||
93 | diff --git a/include/builddefs.in b/include/builddefs.in | |
94 | index ca8f172..cc75b5d 100644 | |
95 | --- a/include/builddefs.in | |
96 | +++ b/include/builddefs.in | |
97 | @@ -102,7 +102,7 @@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall | |
98 | # -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl | |
99 | ||
100 | ifeq ($(PKG_PLATFORM),linux) | |
101 | -PCFLAGS = -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(GCCFLAGS) | |
102 | +PCFLAGS = -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -D_FILE_OFFSET_BITS=64 $(GCCFLAGS) | |
103 | DEPENDFLAGS = -D__linux__ | |
104 | endif | |
105 | ifeq ($(PKG_PLATFORM),darwin) | |
106 | diff --git a/include/linux.h b/include/linux.h | |
107 | index dbfb4cf..b342e55 100644 | |
108 | --- a/include/linux.h | |
109 | +++ b/include/linux.h | |
110 | @@ -22,6 +22,7 @@ | |
111 | #include <sys/ioctl.h> | |
112 | #include <sys/param.h> | |
113 | #include <sys/sysmacros.h> | |
114 | +#include <sys/stat.h> | |
115 | #include <malloc.h> | |
116 | #include <getopt.h> | |
117 | #include <endian.h> |