Merge lp:~tyhicks/ecryptfs/fix-build-system-for-lfs into lp:ecryptfs
- fix-build-system-for-lfs
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 799 |
Proposed branch: | lp:~tyhicks/ecryptfs/fix-build-system-for-lfs |
Merge into: | lp:ecryptfs |
Diff against target: |
899 lines (+170/-82) 41 files modified
configure.ac (+3/-0) debian/changelog (+22/-0) debian/rules (+0/-2) src/daemon/main.c (+0/-1) src/key_mod/ecryptfs_key_mod_gpg.c (+0/-1) src/key_mod/ecryptfs_key_mod_openssl.c (+0/-1) src/key_mod/ecryptfs_key_mod_passphrase.c (+0/-1) src/key_mod/ecryptfs_key_mod_pkcs11_helper.c (+0/-1) src/key_mod/ecryptfs_key_mod_tspi.c (+0/-1) src/libecryptfs/cmd_ln_parser.c (+0/-1) src/libecryptfs/decision_graph.c (+0/-1) src/libecryptfs/key_management.c (+0/-1) src/libecryptfs/key_mod.c (+0/-1) src/libecryptfs/main.c (+0/-1) src/libecryptfs/messaging.c (+0/-1) src/libecryptfs/miscdev.c (+0/-1) src/libecryptfs/module_mgr.c (+0/-1) src/libecryptfs/packets.c (+0/-1) src/libecryptfs/sysfs.c (+0/-1) src/pam_ecryptfs/pam_ecryptfs.c (+0/-1) src/utils/Makefile.am (+1/-1) src/utils/ecryptfs_add_passphrase.c (+0/-1) src/utils/ecryptfs_generate_tpm_key.c (+0/-1) src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.c (+0/-1) src/utils/ecryptfs_rewrap_passphrase.c (+0/-1) src/utils/ecryptfs_unwrap_passphrase.c (+0/-1) src/utils/ecryptfs_wrap_passphrase.c (+0/-1) src/utils/gen_key.c (+0/-1) src/utils/io.c (+0/-1) src/utils/manager.c (+0/-1) src/utils/mount.ecryptfs.c (+0/-2) src/utils/mount.ecryptfs_private.c (+0/-2) src/utils/plaintext_decision_graph.c (+0/-1) src/utils/test.c (+0/-1) tests/kernel/enospc/test.c (+6/-10) tests/kernel/extend-file-random/test.c (+16/-11) tests/kernel/llseek/test.c (+33/-22) tests/userspace/Makefile.am (+5/-3) tests/userspace/lfs.sh (+37/-0) tests/userspace/lfs/test.c (+46/-0) tests/userspace/tests.rc (+1/-1) |
To merge this branch: | bzr merge lp:~tyhicks/ecryptfs/fix-build-system-for-lfs |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Ian King (community) | Approve | ||
Review via email: mp+192772@code.launchpad.net |
Commit message
Description of the change
I originally set off to figure out why tests/kernel/
i386. It became obvious that it wasn't a filesystem bug. It turned out to be an
issue in the test case. The variable containing the file size was overflowing.
So I fixed the test up to use the proper type for file sizes (off_t). Still no
luck. I eventually figured out that I could force large file support using the
CFLAGS variable and get the test to pass.
So I was off to enable large filesystem support in our autoconf file. That
didn't work. After way too much time looking at the issue, less than half of
our source files were including config.h.
I forced the inclusion of config.h in all source files using our autoconf file.
Then I retried my enospc cleanups and everything worked!
I've built on amd64, i386, and armhf. I fixed up the new build warnings in i386
and armhf.
There's always a little concern about flipping on large file support. However,
I noticed that Debian and Ubuntu packages have been built with large file
support for some time now by overriding CFLAGS in the debian/rules file.
I've examined the build output changes between each revision on all three
architectures. I've also ran the regression tests on i386 and amd64 as well as
some manual testing. Everything should be good to. I'll push it to trunk once I
get an ACK. Thanks!
Update 1: I added r799 which includes a make check test that verifies that LFS
is enabled in the build.
- 799. By Tyler Hicks
-
* tests/userspace
/lfs.sh, tests/userspace /lfs/test. c:
- Add a test to verify that LFS is enabled. This test is run under the
make check target.
Preview Diff
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2013-07-05 15:50:00 +0000 |
3 | +++ configure.ac 2013-10-26 17:18:27 +0000 |
4 | @@ -16,6 +16,7 @@ |
5 | AM_INIT_AUTOMAKE([${PACKAGE_NAME}], [${PACKAGE_VERSION}]) |
6 | AC_CONFIG_SRCDIR([src/libecryptfs]) |
7 | AC_CONFIG_HEADERS([config.h]) |
8 | +AC_SUBST(AM_CPPFLAGS, '-include $(top_builddir)/config.h') |
9 | AC_CONFIG_MACRO_DIR([m4]) |
10 | |
11 | AC_DISABLE_STATIC |
12 | @@ -181,6 +182,8 @@ |
13 | [AC_PROG_LIBTOOL] |
14 | ) |
15 | |
16 | +AC_SYS_LARGEFILE |
17 | + |
18 | AC_PATH_PROGS([POD2MAN], [pod2man]) |
19 | test -z "${POD2MAN}" && AC_MSG_ERROR([I couldn't find pod2man; make sure it's installed and in your path]) |
20 | |
21 | |
22 | === modified file 'debian/changelog' |
23 | --- debian/changelog 2013-10-11 14:05:26 +0000 |
24 | +++ debian/changelog 2013-10-26 17:18:27 +0000 |
25 | @@ -29,6 +29,28 @@ |
26 | and the confirmation from stdin. Fixes a segfault (invalid memory read) |
27 | in ecryptfs-rewrap-passphrase if there was an error while reading either |
28 | of these passphrases. |
29 | + * configure.ac: |
30 | + - Set AM_CPPFLAGS to always include config.h as the first include file. |
31 | + Some .c files correctly included config.h before anything else. The |
32 | + majority of .c files got this wrong by including it after other header |
33 | + files, including it multiple times, or not including it at all. |
34 | + Including it in the AM_CPPFLAGS should solve these problems and keep |
35 | + future mistakes from happening in new source files. |
36 | + - Enable large file support (LFS) through the use of the AC_SYS_LARGEFILE |
37 | + autoconf macro. ecryptfs-utils has been well tested with LFS enabled |
38 | + because ecryptfs-utils is being built with |
39 | + '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' in Debian-based distros. |
40 | + This is mainly needed for some of the in-tree regression tests but |
41 | + ecryptfs-utils, in general, should be built with LFS enabled. |
42 | + * debian/rules: |
43 | + - Don't append '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' to the CFLAGS |
44 | + now that the upstream build enables LFS |
45 | + * tests/userspace/lfs.sh, tests/userspace/lfs/test.c: |
46 | + - Add a test to verify that LFS is enabled. This test is run under the |
47 | + make check target. |
48 | + * tests/kernel/enospc/test.c: |
49 | + - Fix test failures on 32 bit architectures due to large file sizes |
50 | + overflowing data types |
51 | |
52 | [ Dustin Kirkland ] |
53 | * src/utils/ecryptfs-setup-swap: LP: #1172014 |
54 | |
55 | === modified file 'debian/rules' |
56 | --- debian/rules 2013-02-20 16:58:26 +0000 |
57 | +++ debian/rules 2013-10-26 17:18:27 +0000 |
58 | @@ -6,8 +6,6 @@ |
59 | TPMFLAGS = --enable-opencryptoki |
60 | endif |
61 | |
62 | -export DEB_CFLAGS_MAINT_APPEND = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 |
63 | - |
64 | %: |
65 | dh ${@} --with autoreconf,python2 |
66 | |
67 | |
68 | === modified file 'src/daemon/main.c' |
69 | --- src/daemon/main.c 2013-07-05 14:52:47 +0000 |
70 | +++ src/daemon/main.c 2013-10-26 17:18:27 +0000 |
71 | @@ -35,7 +35,6 @@ |
72 | #include <sys/stat.h> |
73 | #include <sys/wait.h> |
74 | #include <sys/resource.h> |
75 | -#include "config.h" |
76 | #include "../include/ecryptfs.h" |
77 | |
78 | static char *pidfile = NULL; |
79 | |
80 | === modified file 'src/key_mod/ecryptfs_key_mod_gpg.c' |
81 | --- src/key_mod/ecryptfs_key_mod_gpg.c 2009-05-02 19:39:09 +0000 |
82 | +++ src/key_mod/ecryptfs_key_mod_gpg.c 2013-10-26 17:18:27 +0000 |
83 | @@ -18,7 +18,6 @@ |
84 | * 02111-1307, USA. |
85 | */ |
86 | |
87 | -#include "config.h" |
88 | #include <fcntl.h> |
89 | #include <pwd.h> |
90 | #include <stdio.h> |
91 | |
92 | === modified file 'src/key_mod/ecryptfs_key_mod_openssl.c' |
93 | --- src/key_mod/ecryptfs_key_mod_openssl.c 2013-10-04 10:04:36 +0000 |
94 | +++ src/key_mod/ecryptfs_key_mod_openssl.c 2013-10-26 17:18:27 +0000 |
95 | @@ -32,7 +32,6 @@ |
96 | * files in the program, then also delete it here. |
97 | */ |
98 | |
99 | -#include "config.h" |
100 | #include <fcntl.h> |
101 | #include <pwd.h> |
102 | #include <stdio.h> |
103 | |
104 | === modified file 'src/key_mod/ecryptfs_key_mod_passphrase.c' |
105 | --- src/key_mod/ecryptfs_key_mod_passphrase.c 2013-10-10 16:38:06 +0000 |
106 | +++ src/key_mod/ecryptfs_key_mod_passphrase.c 2013-10-26 17:18:27 +0000 |
107 | @@ -18,7 +18,6 @@ |
108 | * 02111-1307, USA. |
109 | */ |
110 | |
111 | -#include "config.h" |
112 | #include <sys/types.h> |
113 | #include <sys/stat.h> |
114 | #include <syslog.h> |
115 | |
116 | === modified file 'src/key_mod/ecryptfs_key_mod_pkcs11_helper.c' |
117 | --- src/key_mod/ecryptfs_key_mod_pkcs11_helper.c 2012-09-25 11:40:13 +0000 |
118 | +++ src/key_mod/ecryptfs_key_mod_pkcs11_helper.c 2013-10-26 17:18:27 +0000 |
119 | @@ -33,7 +33,6 @@ |
120 | * files in the program, then also delete it here. |
121 | */ |
122 | |
123 | -#include "config.h" |
124 | #include <fcntl.h> |
125 | #include <pwd.h> |
126 | #include <stdio.h> |
127 | |
128 | === modified file 'src/key_mod/ecryptfs_key_mod_tspi.c' |
129 | --- src/key_mod/ecryptfs_key_mod_tspi.c 2012-02-22 03:12:04 +0000 |
130 | +++ src/key_mod/ecryptfs_key_mod_tspi.c 2013-10-26 17:18:27 +0000 |
131 | @@ -32,7 +32,6 @@ |
132 | * files in the program, then also delete it here. |
133 | */ |
134 | |
135 | -#include "config.h" |
136 | #include <sys/types.h> |
137 | #include <sys/stat.h> |
138 | #include <fcntl.h> |
139 | |
140 | === modified file 'src/libecryptfs/cmd_ln_parser.c' |
141 | --- src/libecryptfs/cmd_ln_parser.c 2013-10-04 13:24:18 +0000 |
142 | +++ src/libecryptfs/cmd_ln_parser.c 2013-10-26 17:18:27 +0000 |
143 | @@ -19,7 +19,6 @@ |
144 | * 02111-1307, USA. |
145 | */ |
146 | |
147 | -#include "config.h" |
148 | #ifndef S_SPLINT_S |
149 | #include <sys/ioctl.h> |
150 | #include <sys/types.h> |
151 | |
152 | === modified file 'src/libecryptfs/decision_graph.c' |
153 | --- src/libecryptfs/decision_graph.c 2013-10-04 14:27:41 +0000 |
154 | +++ src/libecryptfs/decision_graph.c 2013-10-26 17:18:27 +0000 |
155 | @@ -19,7 +19,6 @@ |
156 | * 02111-1307, USA. |
157 | */ |
158 | |
159 | -#include "config.h" |
160 | #include <errno.h> |
161 | #include <stdint.h> |
162 | #ifndef S_SPLINT_S |
163 | |
164 | === modified file 'src/libecryptfs/key_management.c' |
165 | --- src/libecryptfs/key_management.c 2013-06-05 18:21:43 +0000 |
166 | +++ src/libecryptfs/key_management.c 2013-10-26 17:18:27 +0000 |
167 | @@ -20,7 +20,6 @@ |
168 | * 02111-1307, USA. |
169 | */ |
170 | |
171 | -#include "config.h" |
172 | #include <errno.h> |
173 | #include <nss.h> |
174 | #include <pk11func.h> |
175 | |
176 | === modified file 'src/libecryptfs/key_mod.c' |
177 | --- src/libecryptfs/key_mod.c 2013-10-04 11:13:30 +0000 |
178 | +++ src/libecryptfs/key_mod.c 2013-10-26 17:18:27 +0000 |
179 | @@ -18,7 +18,6 @@ |
180 | * 02111-1307, USA. |
181 | */ |
182 | |
183 | -#include "config.h" |
184 | #include <dirent.h> |
185 | #include <stdlib.h> |
186 | #include <string.h> |
187 | |
188 | === modified file 'src/libecryptfs/main.c' |
189 | --- src/libecryptfs/main.c 2013-10-10 17:18:37 +0000 |
190 | +++ src/libecryptfs/main.c 2013-10-26 17:18:27 +0000 |
191 | @@ -19,7 +19,6 @@ |
192 | * 02111-1307, USA. |
193 | */ |
194 | |
195 | -#include "config.h" |
196 | #include <errno.h> |
197 | #include <nss.h> |
198 | #include <pk11func.h> |
199 | |
200 | === modified file 'src/libecryptfs/messaging.c' |
201 | --- src/libecryptfs/messaging.c 2012-11-02 14:31:32 +0000 |
202 | +++ src/libecryptfs/messaging.c 2013-10-26 17:18:27 +0000 |
203 | @@ -24,7 +24,6 @@ |
204 | #include <syslog.h> |
205 | #include <string.h> |
206 | #include <sys/types.h> |
207 | -#include "config.h" |
208 | #include "../include/ecryptfs.h" |
209 | |
210 | /** |
211 | |
212 | === modified file 'src/libecryptfs/miscdev.c' |
213 | --- src/libecryptfs/miscdev.c 2013-10-04 10:33:17 +0000 |
214 | +++ src/libecryptfs/miscdev.c 2013-10-26 17:18:27 +0000 |
215 | @@ -35,7 +35,6 @@ |
216 | #include <sys/ioctl.h> |
217 | #include <sys/types.h> |
218 | #include <sys/stat.h> |
219 | -#include "config.h" |
220 | #include "../include/ecryptfs.h" |
221 | |
222 | int ecryptfs_send_miscdev(struct ecryptfs_miscdev_ctx *miscdev_ctx, |
223 | |
224 | === modified file 'src/libecryptfs/module_mgr.c' |
225 | --- src/libecryptfs/module_mgr.c 2013-06-06 09:49:57 +0000 |
226 | +++ src/libecryptfs/module_mgr.c 2013-10-26 17:18:27 +0000 |
227 | @@ -19,7 +19,6 @@ |
228 | * 02111-1307, USA. |
229 | */ |
230 | |
231 | -#include "config.h" |
232 | #include <errno.h> |
233 | #include <string.h> |
234 | #include <stdlib.h> |
235 | |
236 | === modified file 'src/libecryptfs/packets.c' |
237 | --- src/libecryptfs/packets.c 2009-02-09 15:33:25 +0000 |
238 | +++ src/libecryptfs/packets.c 2013-10-26 17:18:27 +0000 |
239 | @@ -29,7 +29,6 @@ |
240 | #include <unistd.h> |
241 | #include <keyutils.h> |
242 | #include <stdlib.h> |
243 | -#include "config.h" |
244 | #include "../include/ecryptfs.h" |
245 | |
246 | #define ECRYPTFS_PACKET_STATUS_GOOD 0 |
247 | |
248 | === modified file 'src/libecryptfs/sysfs.c' |
249 | --- src/libecryptfs/sysfs.c 2012-11-02 14:31:32 +0000 |
250 | +++ src/libecryptfs/sysfs.c 2013-10-26 17:18:27 +0000 |
251 | @@ -17,7 +17,6 @@ |
252 | * 02111-1307, USA. |
253 | */ |
254 | |
255 | -#include "config.h" |
256 | #include <sys/types.h> |
257 | #include <sys/stat.h> |
258 | #include <fcntl.h> |
259 | |
260 | === modified file 'src/pam_ecryptfs/pam_ecryptfs.c' |
261 | --- src/pam_ecryptfs/pam_ecryptfs.c 2013-10-10 16:35:57 +0000 |
262 | +++ src/pam_ecryptfs/pam_ecryptfs.c 2013-10-26 17:18:27 +0000 |
263 | @@ -23,7 +23,6 @@ |
264 | * 02111-1307, USA. |
265 | */ |
266 | |
267 | -#include "config.h" |
268 | #include <stdio.h> |
269 | #include <stdlib.h> |
270 | #include <stdint.h> |
271 | |
272 | === modified file 'src/utils/Makefile.am' |
273 | --- src/utils/Makefile.am 2013-01-25 18:11:23 +0000 |
274 | +++ src/utils/Makefile.am 2013-10-26 17:18:27 +0000 |
275 | @@ -32,7 +32,7 @@ |
276 | bin_PROGRAMS+=ecryptfs-generate-tpm-key |
277 | endif |
278 | |
279 | -INCLUDES = -I$(top_srcdir)/src/include |
280 | +AM_CPPFLAGS += -I$(top_srcdir)/src/include |
281 | |
282 | mount_ecryptfs_SOURCES = mount.ecryptfs.c io.c io.h gen_key.c plaintext_decision_graph.c |
283 | mount_ecryptfs_CFLAGS = $(AM_CFLAGS) $(KEYUTILS_CFLAGS) $(LIBGCRYPT_CFLAGS) |
284 | |
285 | === modified file 'src/utils/ecryptfs_add_passphrase.c' |
286 | --- src/utils/ecryptfs_add_passphrase.c 2011-12-13 20:51:40 +0000 |
287 | +++ src/utils/ecryptfs_add_passphrase.c 2013-10-26 17:18:27 +0000 |
288 | @@ -22,7 +22,6 @@ |
289 | #include <stdio.h> |
290 | #include <string.h> |
291 | #include <ecryptfs.h> |
292 | -#include "config.h" |
293 | |
294 | void usage(void) |
295 | { |
296 | |
297 | === modified file 'src/utils/ecryptfs_generate_tpm_key.c' |
298 | --- src/utils/ecryptfs_generate_tpm_key.c 2009-04-30 23:58:11 +0000 |
299 | +++ src/utils/ecryptfs_generate_tpm_key.c 2013-10-26 17:18:27 +0000 |
300 | @@ -43,7 +43,6 @@ |
301 | #include <errno.h> |
302 | #include <trousers/tss.h> |
303 | #include <trousers/trousers.h> |
304 | -#include "config.h" |
305 | |
306 | #define PRINT_ERR(x, ...) fprintf(stderr, "%s:%d Error: " x "\n", __FILE__, __LINE__, ##__VA_ARGS__) |
307 | #define PRINT_TSS_ERR(s,r) fprintf(stderr, "%s:%d: Error: %s failed: %s\n", __FILE__, __LINE__, s, \ |
308 | |
309 | === modified file 'src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.c' |
310 | --- src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.c 2011-12-13 20:51:40 +0000 |
311 | +++ src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.c 2013-10-26 17:18:27 +0000 |
312 | @@ -22,7 +22,6 @@ |
313 | #include <stdio.h> |
314 | #include <ecryptfs.h> |
315 | #include <string.h> |
316 | -#include "config.h" |
317 | |
318 | void usage(void) |
319 | { |
320 | |
321 | === modified file 'src/utils/ecryptfs_rewrap_passphrase.c' |
322 | --- src/utils/ecryptfs_rewrap_passphrase.c 2013-06-27 20:37:12 +0000 |
323 | +++ src/utils/ecryptfs_rewrap_passphrase.c 2013-10-26 17:18:27 +0000 |
324 | @@ -22,7 +22,6 @@ |
325 | #include <stdio.h> |
326 | #include <ecryptfs.h> |
327 | #include <string.h> |
328 | -#include "config.h" |
329 | |
330 | void usage(void) |
331 | { |
332 | |
333 | === modified file 'src/utils/ecryptfs_unwrap_passphrase.c' |
334 | --- src/utils/ecryptfs_unwrap_passphrase.c 2011-12-13 20:51:40 +0000 |
335 | +++ src/utils/ecryptfs_unwrap_passphrase.c 2013-10-26 17:18:27 +0000 |
336 | @@ -22,7 +22,6 @@ |
337 | #include <stdio.h> |
338 | #include <ecryptfs.h> |
339 | #include <string.h> |
340 | -#include "config.h" |
341 | |
342 | void usage(void) |
343 | { |
344 | |
345 | === modified file 'src/utils/ecryptfs_wrap_passphrase.c' |
346 | --- src/utils/ecryptfs_wrap_passphrase.c 2011-12-13 20:51:40 +0000 |
347 | +++ src/utils/ecryptfs_wrap_passphrase.c 2013-10-26 17:18:27 +0000 |
348 | @@ -23,7 +23,6 @@ |
349 | #include <stdlib.h> |
350 | #include <ecryptfs.h> |
351 | #include <string.h> |
352 | -#include "config.h" |
353 | |
354 | void usage(void) |
355 | { |
356 | |
357 | === modified file 'src/utils/gen_key.c' |
358 | --- src/utils/gen_key.c 2009-02-09 15:33:25 +0000 |
359 | +++ src/utils/gen_key.c 2013-10-26 17:18:27 +0000 |
360 | @@ -18,7 +18,6 @@ |
361 | * 02111-1307, USA. |
362 | */ |
363 | |
364 | -#include "config.h" |
365 | #include <unistd.h> |
366 | #include <sys/stat.h> |
367 | #include <sys/types.h> |
368 | |
369 | === modified file 'src/utils/io.c' |
370 | --- src/utils/io.c 2013-06-06 10:08:54 +0000 |
371 | +++ src/utils/io.c 2013-10-26 17:18:27 +0000 |
372 | @@ -28,7 +28,6 @@ |
373 | #include <stdlib.h> |
374 | #include <errno.h> |
375 | #include <sys/mman.h> |
376 | -#include "config.h" |
377 | #include "ecryptfs.h" |
378 | #include "io.h" |
379 | |
380 | |
381 | === modified file 'src/utils/manager.c' |
382 | --- src/utils/manager.c 2009-07-17 05:32:26 +0000 |
383 | +++ src/utils/manager.c 2013-10-26 17:18:27 +0000 |
384 | @@ -27,7 +27,6 @@ |
385 | #include <stdlib.h> |
386 | #include <string.h> |
387 | #include <sys/mman.h> |
388 | -#include "config.h" |
389 | #include "../include/ecryptfs.h" |
390 | #include "../include/decision_graph.h" |
391 | #include "io.h" |
392 | |
393 | === modified file 'src/utils/mount.ecryptfs.c' |
394 | --- src/utils/mount.ecryptfs.c 2013-10-04 14:06:57 +0000 |
395 | +++ src/utils/mount.ecryptfs.c 2013-10-26 17:18:27 +0000 |
396 | @@ -21,7 +21,6 @@ |
397 | * 02111-1307, USA. |
398 | */ |
399 | |
400 | -#include "config.h" |
401 | #include <errno.h> |
402 | #include <fcntl.h> |
403 | #include <getopt.h> |
404 | @@ -34,7 +33,6 @@ |
405 | #include <sys/mount.h> |
406 | #include <sys/stat.h> |
407 | #include <sys/types.h> |
408 | -#include "config.h" |
409 | #include "ecryptfs.h" |
410 | #include "decision_graph.h" |
411 | #include "io.h" |
412 | |
413 | === modified file 'src/utils/mount.ecryptfs_private.c' |
414 | --- src/utils/mount.ecryptfs_private.c 2013-06-07 13:13:23 +0000 |
415 | +++ src/utils/mount.ecryptfs_private.c 2013-10-26 17:18:27 +0000 |
416 | @@ -25,8 +25,6 @@ |
417 | * |
418 | */ |
419 | |
420 | -#define _GNU_SOURCE |
421 | - |
422 | #include <sys/file.h> |
423 | #include <sys/mount.h> |
424 | #include <sys/param.h> |
425 | |
426 | === modified file 'src/utils/plaintext_decision_graph.c' |
427 | --- src/utils/plaintext_decision_graph.c 2009-02-03 08:50:36 +0000 |
428 | +++ src/utils/plaintext_decision_graph.c 2013-10-26 17:18:27 +0000 |
429 | @@ -18,7 +18,6 @@ |
430 | * 02111-1307, USA. |
431 | */ |
432 | |
433 | -#include "config.h" |
434 | #include "../include/ecryptfs.h" |
435 | #include "../include/decision_graph.h" |
436 | |
437 | |
438 | === modified file 'src/utils/test.c' |
439 | --- src/utils/test.c 2009-02-03 08:50:36 +0000 |
440 | +++ src/utils/test.c 2013-10-26 17:18:27 +0000 |
441 | @@ -25,7 +25,6 @@ |
442 | #include <errno.h> |
443 | #include <sys/types.h> |
444 | #include <sys/stat.h> |
445 | -#include "config.h" |
446 | #include "ecryptfs.h" |
447 | |
448 | #define ASSERT(EX) \ |
449 | |
450 | === modified file 'tests/kernel/enospc/test.c' |
451 | --- tests/kernel/enospc/test.c 2012-07-19 17:18:25 +0000 |
452 | +++ tests/kernel/enospc/test.c 2013-10-26 17:18:27 +0000 |
453 | @@ -27,6 +27,7 @@ |
454 | #include <unistd.h> |
455 | #include <signal.h> |
456 | #include <limits.h> |
457 | +#include <inttypes.h> |
458 | |
459 | #define TEST_PASSED (0) |
460 | #define TEST_FAILED (1) |
461 | @@ -34,15 +35,11 @@ |
462 | |
463 | #define BUFF_SZ (65536) |
464 | |
465 | -int test_exercise(char *filename, ssize_t size) |
466 | +int test_exercise(char *filename, off_t size) |
467 | { |
468 | int fd; |
469 | - ssize_t i; |
470 | - ssize_t n; |
471 | struct stat statbuf; |
472 | - ssize_t nbytes = size; |
473 | int ret = TEST_FAILED; |
474 | - |
475 | unsigned char buff[BUFF_SZ]; |
476 | |
477 | unlink(filename); |
478 | @@ -53,17 +50,16 @@ |
479 | |
480 | memset(buff, 0, sizeof(buff)); |
481 | |
482 | - while (nbytes > 0) { |
483 | + while (size > 0) { |
484 | int rc; |
485 | - ssize_t n = (nbytes > BUFF_SZ) ? BUFF_SZ : nbytes; |
486 | |
487 | - rc = write(fd, buff, n); |
488 | + rc = write(fd, buff, (size > BUFF_SZ) ? BUFF_SZ : size); |
489 | if (rc < 0) { |
490 | if (errno == ENOSPC) |
491 | ret = TEST_PASSED; |
492 | break; |
493 | } |
494 | - nbytes -= n; |
495 | + size -= rc; |
496 | } |
497 | /* If we got here, we didn't get ENOSPC, so we've failed */ |
498 | |
499 | @@ -80,7 +76,7 @@ |
500 | |
501 | int main(int argc, char **argv) |
502 | { |
503 | - ssize_t len; |
504 | + off_t len; |
505 | |
506 | if (argc < 3) { |
507 | fprintf(stderr, "Syntax: %s filename size_in_K\n", argv[0]); |
508 | |
509 | === modified file 'tests/kernel/extend-file-random/test.c' |
510 | --- tests/kernel/extend-file-random/test.c 2013-03-13 14:55:11 +0000 |
511 | +++ tests/kernel/extend-file-random/test.c 2013-10-26 17:18:27 +0000 |
512 | @@ -26,6 +26,7 @@ |
513 | #include <fcntl.h> |
514 | #include <unistd.h> |
515 | #include <signal.h> |
516 | +#include <inttypes.h> |
517 | |
518 | #define TEST_PASSED (0) |
519 | #define TEST_FAILED (1) |
520 | @@ -42,14 +43,14 @@ |
521 | int test_write(int fd, char *buffer, size_t len, off_t offset) |
522 | { |
523 | if (lseek(fd, offset, SEEK_SET) < 0) { |
524 | - fprintf(stderr, "Failed to seek to position %lu: %s\n", |
525 | - offset, strerror(errno)); |
526 | + fprintf(stderr, "Failed to seek to position %jd: %s\n", |
527 | + (intmax_t)offset, strerror(errno)); |
528 | return TEST_FAILED; |
529 | } |
530 | |
531 | if (write(fd, buffer, len) != len) { |
532 | - fprintf(stderr, "Failed to write %zu bytes, position %lu: %s\n", |
533 | - len, offset, strerror(errno)); |
534 | + fprintf(stderr, "Failed to write %zu bytes, position %jd: %s\n", |
535 | + len, (intmax_t)offset, strerror(errno)); |
536 | return TEST_FAILED; |
537 | } |
538 | return TEST_PASSED; |
539 | @@ -58,14 +59,14 @@ |
540 | int test_read(int fd, char *buffer, size_t len, off_t offset) |
541 | { |
542 | if (lseek(fd, offset, SEEK_SET) < 0) { |
543 | - fprintf(stderr, "Failed to seek to position %lu: %s\n", |
544 | - offset, strerror(errno)); |
545 | + fprintf(stderr, "Failed to seek to position %jd: %s\n", |
546 | + (intmax_t)offset, strerror(errno)); |
547 | return TEST_FAILED; |
548 | } |
549 | |
550 | if (read(fd, buffer, len) != len) { |
551 | - fprintf(stderr, "Failed to read %zu bytes, position %lu: %s\n", |
552 | - len, offset, strerror(errno)); |
553 | + fprintf(stderr, "Failed to read %zu bytes, position %jd: %s\n", |
554 | + len, (intmax_t)offset, strerror(errno)); |
555 | return TEST_FAILED; |
556 | } |
557 | return TEST_PASSED; |
558 | @@ -85,7 +86,8 @@ |
559 | return ret; |
560 | |
561 | if (memcmp(buffer1, buffer2, BUF_SZ)) { |
562 | - fprintf(stderr, "Data read is not same as data written, offset = %lu", offset); |
563 | + fprintf(stderr, "Data read is not same as data written, offset = %jd", |
564 | + (intmax_t)offset); |
565 | return TEST_FAILED; |
566 | } |
567 | return TEST_PASSED; |
568 | @@ -131,7 +133,8 @@ |
569 | goto finish; |
570 | |
571 | if (memcmp(buffer1, buffer2, BUF_SZ)) { |
572 | - fprintf(stderr, "Data read is not same as data written, offset = %lu", offset); |
573 | + fprintf(stderr, "Data read is not same as data written, offset = %jd", |
574 | + (intmax_t)offset); |
575 | goto finish; |
576 | } |
577 | } |
578 | @@ -142,7 +145,9 @@ |
579 | } |
580 | |
581 | if (statbuf.st_size != max_offset + BUF_SZ) { |
582 | - fprintf(stderr, "Filesize was %lu and not %lu\n", statbuf.st_size, max_offset + BUF_SZ); |
583 | + fprintf(stderr, "Filesize was %jd and not %jd\n", |
584 | + (intmax_t)statbuf.st_size, |
585 | + (intmax_t)(max_offset + BUF_SZ)); |
586 | goto finish; |
587 | } |
588 | |
589 | |
590 | === modified file 'tests/kernel/llseek/test.c' |
591 | --- tests/kernel/llseek/test.c 2012-11-02 23:20:18 +0000 |
592 | +++ tests/kernel/llseek/test.c 2013-10-26 17:18:27 +0000 |
593 | @@ -14,6 +14,7 @@ |
594 | #include <stdlib.h> |
595 | #include <string.h> |
596 | #include <stdint.h> |
597 | +#include <inttypes.h> |
598 | |
599 | int main(int argc, char *argv[]) |
600 | { |
601 | @@ -43,7 +44,8 @@ |
602 | } |
603 | size = lseek(fd, 4096, SEEK_END); |
604 | if (size != 4096) { |
605 | - fprintf(stderr, "Expected 4096 from lseek; got [%ld]\n", size); |
606 | + fprintf(stderr, "Expected 4096 from lseek; got [%jd]\n", |
607 | + (intmax_t)size); |
608 | rc = 1; |
609 | goto out; |
610 | } |
611 | @@ -56,7 +58,8 @@ |
612 | goto out; |
613 | } |
614 | if (s.st_size != 0) { |
615 | - fprintf(stderr, "Filesize is [%ld]; expected 0\n", s.st_size); |
616 | + fprintf(stderr, "Filesize is [%jd]; expected 0\n", |
617 | + (intmax_t)s.st_size); |
618 | rc = 1; |
619 | goto out; |
620 | } |
621 | @@ -74,35 +77,38 @@ |
622 | goto out; |
623 | } |
624 | if ((size = lseek(fd, 4096, SEEK_END)) != 4096) { |
625 | - fprintf(stderr, "Expected 4096 from lseek; got [%ld]\n", size); |
626 | + fprintf(stderr, "Expected 4096 from lseek; got [%jd]\n", |
627 | + (intmax_t)size); |
628 | rc = 1; |
629 | goto out; |
630 | } |
631 | if ((size = write(fd, (char *)&deadbeef, 4)) != 4) { |
632 | - fprintf(stderr, "Expected a write of 4 bytes; got [%ld] " |
633 | - "instead\n", size); |
634 | + fprintf(stderr, "Expected a write of 4 bytes; got [%jd] " |
635 | + "instead\n", (intmax_t)size); |
636 | rc = 1; |
637 | goto out; |
638 | } |
639 | if ((size = lseek(fd, 5120, SEEK_SET)) != 5120) { |
640 | - fprintf(stderr, "Expected 5120 from lseek; got [%ld]\n", size); |
641 | + fprintf(stderr, "Expected 5120 from lseek; got [%jd]\n", |
642 | + (intmax_t)size); |
643 | rc = 1; |
644 | goto out; |
645 | } |
646 | if ((size = write(fd, (char *)&baadf00d, 4)) != 4) { |
647 | - fprintf(stderr, "Expected a write of 4 bytes; got [%ld] " |
648 | - "instead\n", size); |
649 | + fprintf(stderr, "Expected a write of 4 bytes; got [%jd] " |
650 | + "instead\n", (intmax_t)size); |
651 | rc = 1; |
652 | goto out; |
653 | } |
654 | if ((size = lseek(fd, 4096, SEEK_SET)) != 4096) { |
655 | - fprintf(stderr, "Expected 4096 from lseek; got [%ld]\n", size); |
656 | + fprintf(stderr, "Expected 4096 from lseek; got [%jd]\n", |
657 | + (intmax_t)size); |
658 | rc = 1; |
659 | goto out; |
660 | } |
661 | if ((size = read(fd, buf, 4)) != 4) { |
662 | fprintf(stderr, "Error attempting to read data. Expected " |
663 | - "[%d] bytes; read [%ld] instead\n", 4, size); |
664 | + "[%d] bytes; read [%jd] instead\n", 4, (intmax_t)size); |
665 | rc = 1; |
666 | goto out; |
667 | } |
668 | @@ -113,7 +119,8 @@ |
669 | } |
670 | if ((size = read(fd, buf, 1020)) != 1020) { |
671 | fprintf(stderr, "Error attempting to read data. Expected " |
672 | - "[%d] bytes; read [%ld] instead\n", 1020, size); |
673 | + "[%d] bytes; read [%jd] instead\n", 1020, |
674 | + (intmax_t)size); |
675 | rc = 1; |
676 | goto out; |
677 | } |
678 | @@ -126,7 +133,7 @@ |
679 | } |
680 | if ((size = read(fd, buf, 4)) != 4) { |
681 | fprintf(stderr, "Error attempting to read data. Expected " |
682 | - "[%d] bytes; read [%ld] instead\n", 4, size); |
683 | + "[%d] bytes; read [%jd] instead\n", 4, (intmax_t)size); |
684 | rc = 1; |
685 | goto out; |
686 | } |
687 | @@ -137,18 +144,20 @@ |
688 | } |
689 | if ((size = read(fd, buf, 1)) != 0) { |
690 | fprintf(stderr, "Error attempting to read data. Expected " |
691 | - "[%d] bytes; read [%ld] instead\n", 0, size); |
692 | + "[%d] bytes; read [%jd] instead\n", 0, (intmax_t)size); |
693 | rc = 1; |
694 | goto out; |
695 | } |
696 | if ((size = lseek(fd, 0, SEEK_SET)) != 0) { |
697 | - fprintf(stderr, "Expected 0 from lseek; got [%ld]\n", size); |
698 | + fprintf(stderr, "Expected 0 from lseek; got [%jd]\n", |
699 | + (intmax_t)size); |
700 | rc = 1; |
701 | goto out; |
702 | } |
703 | if ((size = read(fd, buf, 4096)) != 4096) { |
704 | fprintf(stderr, "Error attempting to read data. Expected " |
705 | - "[%d] bytes; read [%ld] instead\n", 4096, size); |
706 | + "[%d] bytes; read [%jd] instead\n", 4096, |
707 | + (intmax_t)size); |
708 | rc = 1; |
709 | goto out; |
710 | } |
711 | @@ -168,8 +177,8 @@ |
712 | goto out; |
713 | } |
714 | if (s.st_size != 5124) { |
715 | - fprintf(stderr, "Filesize is [%ld]; expected 5124\n", |
716 | - s.st_size); |
717 | + fprintf(stderr, "Filesize is [%jd]; expected 5124\n", |
718 | + (intmax_t)s.st_size); |
719 | rc = 1; |
720 | goto out; |
721 | } |
722 | @@ -182,7 +191,8 @@ |
723 | } |
724 | if ((size = read(fd, buf, 4096)) != 4096) { |
725 | fprintf(stderr, "Error attempting to read data. Expected " |
726 | - "[%d] bytes; read [%ld] instead\n", 4096, size); |
727 | + "[%d] bytes; read [%jd] instead\n", 4096, |
728 | + (intmax_t)size); |
729 | rc = 1; |
730 | goto out; |
731 | } |
732 | @@ -195,7 +205,7 @@ |
733 | } |
734 | if ((size = read(fd, buf, 4)) != 4) { |
735 | fprintf(stderr, "Error attempting to read data. Expected " |
736 | - "[%d] bytes; read [%ld] instead\n", 4, size); |
737 | + "[%d] bytes; read [%jd] instead\n", 4, (intmax_t)size); |
738 | rc = 1; |
739 | goto out; |
740 | } |
741 | @@ -206,7 +216,8 @@ |
742 | } |
743 | if ((size = read(fd, buf, 1020)) != 1020) { |
744 | fprintf(stderr, "Error attempting to read data. Expected " |
745 | - "[%d] bytes; read [%ld] instead\n", 1020, size); |
746 | + "[%d] bytes; read [%jd] instead\n", 1020, |
747 | + (intmax_t)size); |
748 | rc = 1; |
749 | goto out; |
750 | } |
751 | @@ -219,7 +230,7 @@ |
752 | } |
753 | if ((size = read(fd, buf, 4)) != 4) { |
754 | fprintf(stderr, "Error attempting to read data. Expected " |
755 | - "[%d] bytes; read [%ld] instead\n", 4, size); |
756 | + "[%d] bytes; read [%jd] instead\n", 4, (intmax_t)size); |
757 | rc = 1; |
758 | goto out; |
759 | } |
760 | @@ -230,7 +241,7 @@ |
761 | } |
762 | if ((size = read(fd, buf, 1)) != 0) { |
763 | fprintf(stderr, "Error attempting to read data. Expected " |
764 | - "[%d] bytes; read [%ld] instead\n", 0, size); |
765 | + "[%d] bytes; read [%jd] instead\n", 0, (intmax_t)size); |
766 | rc = 1; |
767 | goto out; |
768 | } |
769 | |
770 | === modified file 'tests/userspace/Makefile.am' |
771 | --- tests/userspace/Makefile.am 2012-11-03 18:51:43 +0000 |
772 | +++ tests/userspace/Makefile.am 2013-10-26 17:18:27 +0000 |
773 | @@ -1,8 +1,8 @@ |
774 | AUTOMAKE_OPTIONS = subdir-objects |
775 | |
776 | # Only place tests worth of 'make check' here. All other tests are noinst. |
777 | -dist_check_SCRIPTS = verify-passphrase-sig.sh |
778 | -check_PROGRAMS = verify-passphrase-sig/test |
779 | +dist_check_SCRIPTS = lfs.sh verify-passphrase-sig.sh |
780 | +check_PROGRAMS = lfs/test verify-passphrase-sig/test |
781 | |
782 | dist_noinst_DATA = tests.rc |
783 | |
784 | @@ -14,11 +14,13 @@ |
785 | wrap-unwrap/test |
786 | endif |
787 | |
788 | +lfs_test_SOURCES = lfs/test.c |
789 | + |
790 | verify_passphrase_sig_test_SOURCES = verify-passphrase-sig/test.c |
791 | verify_passphrase_sig_test_LDADD = $(top_builddir)/src/libecryptfs/libecryptfs.la |
792 | |
793 | wrap_unwrap_test_SOURCES = wrap-unwrap/test.c |
794 | wrap_unwrap_test_LDADD = $(top_builddir)/src/libecryptfs/libecryptfs.la |
795 | |
796 | -TESTS = verify-passphrase-sig.sh |
797 | +TESTS = lfs.sh verify-passphrase-sig.sh |
798 | |
799 | |
800 | === added directory 'tests/userspace/lfs' |
801 | === added file 'tests/userspace/lfs.sh' |
802 | --- tests/userspace/lfs.sh 1970-01-01 00:00:00 +0000 |
803 | +++ tests/userspace/lfs.sh 2013-10-26 17:18:27 +0000 |
804 | @@ -0,0 +1,37 @@ |
805 | +#!/bin/bash |
806 | +# |
807 | +# lfs.sh: Test for large file support enabled builds |
808 | +# Author: Tyler Hicks <tyhicks@canonical.com> |
809 | +# |
810 | +# Copyright (C) 2013 Canonical, Ltd. |
811 | +# |
812 | +# This program is free software; you can redistribute it and/or |
813 | +# modify it under the terms of the GNU General Public License |
814 | +# as published by the Free Software Foundation version 2 |
815 | +# of the License. |
816 | +# |
817 | +# This program is distributed in the hope that it will be useful, |
818 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
819 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
820 | +# GNU General Public License for more details. |
821 | +# |
822 | +# You should have received a copy of the GNU General Public License |
823 | +# along with this program; if not, write to the Free Software |
824 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
825 | + |
826 | +test_script_dir=$(dirname $0) |
827 | +rc=1 |
828 | + |
829 | +. ${test_script_dir}/../lib/etl_funcs.sh |
830 | + |
831 | +test_cleanup() |
832 | +{ |
833 | + exit $rc |
834 | +} |
835 | +trap test_cleanup 0 1 2 3 15 |
836 | + |
837 | +# Run the test program. See its source for the details of this test. |
838 | +${test_script_dir}/lfs/test |
839 | + |
840 | +rc=$? |
841 | +exit |
842 | |
843 | === added file 'tests/userspace/lfs/test.c' |
844 | --- tests/userspace/lfs/test.c 1970-01-01 00:00:00 +0000 |
845 | +++ tests/userspace/lfs/test.c 2013-10-26 17:18:27 +0000 |
846 | @@ -0,0 +1,46 @@ |
847 | +/* |
848 | + * Author: Tyler Hicks <tyhicks@canonical.com> |
849 | + * |
850 | + * Copyright (C) 2013 Canonical, Ltd. |
851 | + * |
852 | + * This program is free software; you can redistribute it and/or |
853 | + * modify it under the terms of the GNU General Public License |
854 | + * as published by the Free Software Foundation; either version 2 |
855 | + * of the License, or (at your option) any later version. |
856 | + * |
857 | + * This program is distributed in the hope that it will be useful, |
858 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
859 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
860 | + * GNU General Public License for more details. |
861 | + * |
862 | + * You should have received a copy of the GNU General Public License |
863 | + * along with this program; if not, write to the Free Software |
864 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
865 | + */ |
866 | + |
867 | +/* |
868 | + * This test is to ensure that off_t is the same size as off64_t in all |
869 | + * ecryptfs-utils builds. On 64 bit machines, this is the default. On 32 bit |
870 | + * machines, the build system must define special variables to enable what is |
871 | + * known as Large File Support (LFS). |
872 | + * |
873 | + * In configure.ac, we enable LFS by using the AC_SYS_LARGEFILE autoconf macro. |
874 | + * It defines _FILE_OFFSET_BITS=64, when needed by the target architecture, in |
875 | + * config.h. Also in configure.ac, we force all .c files to #include config.h |
876 | + * so the entire ecryptfs-utils build should always have LFS enabled. |
877 | + * |
878 | + * IMPORTANT: We intentionally do not include config.h in this file, because it |
879 | + * is expected that the build system automatically does it for us. This test |
880 | + * verifies that the inclusion on config.h happens. |
881 | + * |
882 | + * We must define _LARGEFILE64_SOURCE in this file so that off64_t is |
883 | + * available. However, defining it does not enable large file support. |
884 | + */ |
885 | + |
886 | +#define _LARGEFILE64_SOURCE 1 |
887 | +#include <sys/types.h> |
888 | + |
889 | +int main(void) |
890 | +{ |
891 | + return sizeof(off_t) == sizeof(off64_t) ? 0 : 1; |
892 | +} |
893 | |
894 | === modified file 'tests/userspace/tests.rc' |
895 | --- tests/userspace/tests.rc 2012-11-02 23:20:18 +0000 |
896 | +++ tests/userspace/tests.rc 2013-10-26 17:18:27 +0000 |
897 | @@ -1,1 +1,1 @@ |
898 | -safe="verify-passphrase-sig.sh wrap-unwrap.sh" |
899 | +safe="lfs.sh verify-passphrase-sig.sh wrap-unwrap.sh" |
Thanks for fixing up the issues in my tests.
I've reviewd the changes and also tested the ecryptfs tests on a 32 bit machine with a 12GB image and the enospc test works fine (as well as all the other tests). Also sanity check on a 64 bit machine.
Looks good to me. Thanks Tyler.