]> arthur.barton.de Git - bup.git/blob - t/test-meta.sh
800a3cbd10ecbeb9ce5832e19b709599c0cde4f6
[bup.git] / t / test-meta.sh
1 #!/usr/bin/env bash
2 . wvtest.sh
3
4 TOP="$(pwd)"
5 export BUP_DIR="$TOP/buptest.tmp"
6
7 bup()
8 {
9     "$TOP/bup" "$@"
10 }
11
12 hardlink-sets()
13 {
14     "$TOP/t/hardlink-sets" "$@"
15 }
16
17 # Very simple metadata tests -- create a test tree then check that bup
18 # meta can reproduce the metadata correctly (according to bup xstat)
19 # via create, extract, start-extract, and finish-extract.  The current
20 # tests are crude, and this does not fully test devices, varying
21 # users/groups, acls, attrs, etc.
22
23 genstat()
24 {
25     (
26         export PATH="$TOP:$PATH" # pick up bup
27         # Skip atime (test elsewhere) to avoid the observer effect.
28         find . | sort | xargs bup xstat --exclude-fields ctime,atime,size
29     )
30 }
31
32 actually-root()
33 {
34     test "$(whoami)" == root -a -z "$FAKEROOTKEY"
35 }
36
37 force-delete()
38 {
39     if ! actually-root; then
40         rm -rf "$@"
41     else
42         # Go to greater lengths to deal with any test detritus.
43         for f in "$@"; do
44             test -e "$@" || continue
45             chattr -fR = "$@" || true
46             setfacl -Rb "$@"
47             rm -r "$@"
48         done
49     fi
50 }
51
52 compare-trees()
53 {
54     (
55         set -e
56         set -o pipefail
57         tmpfile="$(mktemp)"
58         trap "rm -rf '${tmpfile}'" EXIT
59         rsync -ni -aHAX "$1" "$2" > "${tmpfile}"
60         if test $(wc -l < "${tmpfile}") != 0; then
61             echo "ERROR: detected differences between $1 and $2"
62             cat "${tmpfile}"
63             false
64         fi
65     )
66 }
67
68 test-src-create-extract()
69 {
70     # Test bup meta create/extract for ./src -> ./src-restore.
71     # Also writes to ./src-stat and ./src-restore-stat.
72     (
73         (cd src && WVPASS genstat) > src-stat
74         WVPASS bup meta --create --recurse --file src.meta src
75         # Test extract.
76         force-delete src-restore
77         mkdir src-restore
78         cd src-restore
79         WVPASS bup meta --extract --file ../src.meta
80         WVPASS test -d src
81         (cd src && genstat >../../src-restore-stat) || WVFAIL
82         WVPASS diff -U5 ../src-stat ../src-restore-stat
83         # Test start/finish extract.
84         force-delete src
85         WVPASS bup meta --start-extract --file ../src.meta
86         WVPASS test -d src
87         WVPASS bup meta --finish-extract --file ../src.meta
88         (cd src && genstat >../../src-restore-stat) || WVFAIL
89         WVPASS diff -U5 ../src-stat ../src-restore-stat
90     )
91 }
92
93 test-src-save-restore()
94 {
95     # Test bup save/restore metadata for ./src -> ./src-restore.  Also
96     # writes to ./src.bup.  Note that for now this just tests the
97     # restore below src/, in order to avoid having to worry about
98     # operations that require root (like chown /home).
99     (
100         set -x
101         rm -rf src.bup
102         mkdir src.bup
103         export BUP_DIR=$(pwd)/src.bup
104         WVPASS bup init
105         WVPASS bup index src
106         WVPASS bup save -t -n src src
107         # Test extract.
108         force-delete src-restore
109         mkdir src-restore
110         WVPASS bup restore -C src-restore "/src/latest$(pwd)/"
111         WVPASS test -d src-restore/src
112         WVPASS compare-trees src/ src-restore/src/
113         rm -rf src.bup
114         set +x
115     )
116 }
117
118 universal-cleanup()
119 {
120     if ! actually-root; then return 0; fi
121     cd "$TOP"
122     umount "$TOP/bupmeta.tmp/testfs" || true
123     umount "$TOP/bupmeta.tmp/testfs-limited" || true
124 }
125
126 universal-cleanup
127 trap universal-cleanup EXIT
128
129 setup-test-tree()
130 (
131     set -e
132     force-delete "$BUP_DIR"
133     force-delete "$TOP/bupmeta.tmp"
134     mkdir -p "$TOP/bupmeta.tmp/src"
135     cp -pPR Documentation cmd lib t "$TOP/bupmeta.tmp"/src
136
137     # Add some hard links for the general tests.
138     (
139         cd "$TOP/bupmeta.tmp"/src
140         touch hardlink-target
141         ln hardlink-target hardlink-1
142         ln hardlink-target hardlink-2
143         ln hardlink-target hardlink-3
144     )
145
146     # Regression test for metadata sort order.  Previously, these two
147     # entries would sort in the wrong order because the metadata
148     # entries were being sorted by mangled name, but the index isn't.
149     dd if=/dev/zero of="$TOP/bupmeta.tmp"/src/foo bs=1k count=33
150     touch -d 2011-11-11 "$TOP/bupmeta.tmp"/src/foo
151     touch -d 2011-12-12 "$TOP/bupmeta.tmp"/src/foo-bar
152
153     t/mksock "$TOP/bupmeta.tmp/src/test-socket" || true
154 ) || WVFAIL
155
156 # Use the test tree to check bup meta.
157 WVSTART 'meta --create/--extract'
158 (
159     setup-test-tree
160     cd "$TOP/bupmeta.tmp"
161     test-src-create-extract
162
163     # Test a top-level file (not dir).
164     touch src-file
165     WVPASS bup meta -cf src-file.meta src-file
166     mkdir dest
167     cd dest
168     WVPASS bup meta -xf ../src-file.meta
169 )
170
171 # Use the test tree to check bup save/restore metadata.
172 WVSTART 'metadata save/restore (general)'
173 (
174     setup-test-tree
175     cd "$TOP/bupmeta.tmp"
176     test-src-save-restore
177 )
178
179 setup-hardlink-test()
180 {
181     (
182         cd "$TOP/bupmeta.tmp"
183         rm -rf src src.bup
184         mkdir src src.bup
185         WVPASS bup init
186     )
187 }
188
189 hardlink-test-run-restore()
190 {
191     force-delete src-restore
192     mkdir src-restore
193     WVPASS bup restore -C src-restore "/src/latest$(pwd)/"
194     WVPASS test -d src-restore/src
195 }
196
197 # Test hardlinks more carefully.
198 WVSTART 'metadata save/restore (hardlinks)'
199 (
200     set -e
201     set -x
202     export BUP_DIR="$TOP/bupmeta.tmp/src.bup"
203     force-delete "$TOP/bupmeta.tmp"
204     mkdir -p "$TOP/bupmeta.tmp"
205
206     cd "$TOP/bupmeta.tmp"
207
208     # Test trivial case - single hardlink.
209     setup-hardlink-test
210     (
211         cd "$TOP/bupmeta.tmp"/src
212         touch hardlink-target
213         ln hardlink-target hardlink-1
214     )
215     WVPASS bup index src
216     WVPASS bup save -t -n src src
217     hardlink-test-run-restore
218     WVPASS compare-trees src/ src-restore/src/
219
220     # Test hardlink changes between index runs.
221     #
222     setup-hardlink-test
223     cd "$TOP/bupmeta.tmp"/src
224     touch hardlink-target-a
225     touch hardlink-target-b
226     ln hardlink-target-a hardlink-b-1
227     ln hardlink-target-a hardlink-a-1
228     cd ..
229     WVPASS bup index -vv src
230     rm src/hardlink-b-1
231     ln src/hardlink-target-b src/hardlink-b-1
232     WVPASS bup index -vv src
233     WVPASS bup save -t -n src src
234     hardlink-test-run-restore
235     echo ./src/hardlink-a-1 > hardlink-sets.expected
236     echo ./src/hardlink-target-a >> hardlink-sets.expected
237     echo >> hardlink-sets.expected
238     echo ./src/hardlink-b-1 >> hardlink-sets.expected
239     echo ./src/hardlink-target-b >> hardlink-sets.expected
240     (cd src-restore && hardlink-sets .) > hardlink-sets.restored
241     WVPASS diff -u hardlink-sets.expected hardlink-sets.restored
242
243     # Test hardlink changes between index and save -- hardlink set [a
244     # b c d] changes to [a b] [c d].  At least right now bup should
245     # notice and recreate the latter.
246     setup-hardlink-test
247     cd "$TOP/bupmeta.tmp"/src
248     touch a
249     ln a b
250     ln a c
251     ln a d
252     cd ..
253     WVPASS bup index -vv src
254     rm src/c src/d
255     touch src/c
256     ln src/c src/d
257     WVPASS bup save -t -n src src
258     hardlink-test-run-restore
259     echo ./src/a > hardlink-sets.expected
260     echo ./src/b >> hardlink-sets.expected
261     echo >> hardlink-sets.expected
262     echo ./src/c >> hardlink-sets.expected
263     echo ./src/d >> hardlink-sets.expected
264     (cd src-restore && hardlink-sets .) > hardlink-sets.restored
265     WVPASS diff -u hardlink-sets.expected hardlink-sets.restored
266
267     # Test that we don't link outside restore tree.
268     setup-hardlink-test
269     cd "$TOP/bupmeta.tmp"
270     mkdir src/a src/b
271     touch src/a/1
272     ln src/a/1 src/b/1
273     WVPASS bup index -vv src
274     WVPASS bup save -t -n src src
275     force-delete src-restore
276     mkdir src-restore
277     WVPASS bup restore -C src-restore "/src/latest$(pwd)/src/a/"
278     WVPASS test -e src-restore/1
279     echo -n > hardlink-sets.expected
280     (cd src-restore && hardlink-sets .) > hardlink-sets.restored
281     WVPASS diff -u hardlink-sets.expected hardlink-sets.restored
282
283     # Test that we do link within separate sub-trees.
284     setup-hardlink-test
285     cd "$TOP/bupmeta.tmp"
286     mkdir src/a src/b
287     touch src/a/1
288     ln src/a/1 src/b/1
289     WVPASS bup index -vv src/a src/b
290     WVPASS bup save -t -n src src/a src/b
291     hardlink-test-run-restore
292     echo ./src/a/1 > hardlink-sets.expected
293     echo ./src/b/1 >> hardlink-sets.expected
294     (cd src-restore && hardlink-sets .) > hardlink-sets.restored
295     WVPASS diff -u hardlink-sets.expected hardlink-sets.restored
296 )
297
298 WVSTART 'meta --edit'
299 (
300     force-delete "$TOP/bupmeta.tmp"
301     mkdir "$TOP/bupmeta.tmp"
302     cd "$TOP/bupmeta.tmp"
303     mkdir src
304     WVPASS bup meta -cf src.meta src
305
306     WVPASS bup meta --edit --set-uid 0 src.meta | WVPASS bup meta -tvvf - \
307         | WVPASS grep -qE '^uid: 0'
308     WVPASS bup meta --edit --set-uid 1000 src.meta | WVPASS bup meta -tvvf - \
309         | WVPASS grep -qE '^uid: 1000'
310
311     WVPASS bup meta --edit --set-gid 0 src.meta | WVPASS bup meta -tvvf - \
312         | WVPASS grep -qE '^gid: 0'
313     WVPASS bup meta --edit --set-gid 1000 src.meta | WVPASS bup meta -tvvf - \
314         | WVPASS grep -qE '^gid: 1000'
315
316     WVPASS bup meta --edit --set-user foo src.meta | WVPASS bup meta -tvvf - \
317         | WVPASS grep -qE '^user: foo'
318     WVPASS bup meta --edit --set-user bar src.meta | WVPASS bup meta -tvvf - \
319         | WVPASS grep -qE '^user: bar'
320     WVPASS bup meta --edit --unset-user src.meta | WVPASS bup meta -tvvf - \
321         | WVPASS grep -qE '^user:'
322     WVPASS bup meta --edit --set-user bar --unset-user src.meta \
323         | WVPASS bup meta -tvvf - | WVPASS grep -qE '^user:'
324     WVPASS bup meta --edit --unset-user --set-user bar src.meta \
325         | WVPASS bup meta -tvvf - | WVPASS grep -qE '^user: bar'
326
327     WVPASS bup meta --edit --set-group foo src.meta | WVPASS bup meta -tvvf - \
328         | WVPASS grep -qE '^group: foo'
329     WVPASS bup meta --edit --set-group bar src.meta | WVPASS bup meta -tvvf - \
330         | WVPASS grep -qE '^group: bar'
331     WVPASS bup meta --edit --unset-group src.meta | WVPASS bup meta -tvvf - \
332         | WVPASS grep -qE '^group:'
333     WVPASS bup meta --edit --set-group bar --unset-group src.meta \
334         | WVPASS bup meta -tvvf - | WVPASS grep -qE '^group:'
335     WVPASS bup meta --edit --unset-group --set-group bar src.meta \
336         | WVPASS bup meta -tvvf - | grep -qE '^group: bar'
337 )
338
339 # Test ownership restoration (when not root or fakeroot).
340 (
341     if test "$(whoami)" == root; then
342         exit 0
343     fi
344
345     WVSTART 'metadata (restoration of ownership)'
346     force-delete "$TOP/bupmeta.tmp"
347     mkdir "$TOP/bupmeta.tmp"
348     cd "$TOP/bupmeta.tmp"
349     touch src
350     WVPASS bup meta -cf src.meta src
351
352     mkdir dest
353     cd dest
354     # Make sure we don't change (or try to change) the user when not root.
355     WVPASS bup meta --edit --set-user root ../src.meta | WVPASS bup meta -x
356     WVPASS bup xstat src | WVPASS grep -qvE '^user: root'
357     rm -rf src
358     WVPASS bup meta --edit --unset-user --set-uid 0 ../src.meta \
359         | WVPASS bup meta -x
360     WVPASS bup xstat src | grep -qvE '^user: root'
361
362     # Make sure we can restore one of the user's groups.
363     last_group="$(python -c 'import os,grp; \
364       print grp.getgrgid(os.getgroups()[0])[0]')"
365     rm -rf src
366     WVPASS bup meta --edit --set-group "$last_group" ../src.meta \
367         | WVPASS bup meta -x
368     WVPASS bup xstat src | WVPASS grep -qE "^group: $last_group"
369
370     # Make sure we can restore one of the user's gids.
371     user_gids="$(id -G)"
372     last_gid="$(echo ${user_gids/* /})"
373     rm -rf src
374     WVPASS bup meta --edit --unset-group --set-gid "$last_gid" ../src.meta \
375         | WVPASS bup meta -x
376     WVPASS bup xstat src | WVPASS grep -qE "^gid: $last_gid"
377
378     # Test --numeric-ids (gid).
379     rm -rf src
380     current_gidx=$(bup meta -tvvf ../src.meta | grep -e '^gid:')
381     WVPASS bup meta --edit --set-group "$last_group" ../src.meta \
382         | WVPASS bup meta -x --numeric-ids
383     new_gidx=$(bup xstat src | grep -e '^gid:')
384     WVPASSEQ "$current_gidx" "$new_gidx"
385
386     # Test that restoring an unknown user works.
387     unknown_user=$("$TOP"/t/unknown-owner --user)
388     rm -rf src
389     current_uidx=$(bup meta -tvvf ../src.meta | grep -e '^uid:')
390     WVPASS bup meta --edit --set-user "$unknown_user" ../src.meta \
391         | WVPASS bup meta -x
392     new_uidx=$(bup xstat src | grep -e '^uid:')
393     WVPASSEQ "$current_uidx" "$new_uidx"
394
395     # Test that restoring an unknown group works.
396     unknown_group=$("$TOP"/t/unknown-owner --group)
397     rm -rf src
398     current_gidx=$(bup meta -tvvf ../src.meta | grep -e '^gid:')
399     WVPASS bup meta --edit --set-group "$unknown_group" ../src.meta \
400         | WVPASS bup meta -x
401     new_gidx=$(bup xstat src | grep -e '^gid:')
402     WVPASSEQ "$current_gidx" "$new_gidx"
403 )
404
405 # Test ownership restoration (when root or fakeroot).
406 (
407     if test "$(whoami)" != root; then
408         exit 0
409     fi
410
411     WVSTART 'metadata (restoration of ownership as root)'
412     force-delete "$TOP/bupmeta.tmp"
413     mkdir "$TOP/bupmeta.tmp"
414     cd "$TOP/bupmeta.tmp"
415     touch src
416     chown 0:0 src # In case the parent dir is sgid, etc.
417     WVPASS bup meta -cf src.meta src
418
419     mkdir dest
420     chmod 700 dest # so we can't accidentally do something insecure
421     cd dest
422
423     # Make sure we can restore a uid.
424     WVPASS bup meta --edit --unset-user --set-uid 42 ../src.meta \
425         | WVPASS bup meta -x
426     WVPASS bup xstat src | WVPASS grep -qE '^uid: 42'
427
428     # Make sure we can restore a gid.
429     WVPASS bup meta --edit --unset-group --set-gid 42 ../src.meta \
430         | WVPASS bup meta -x
431     WVPASS bup xstat src | WVPASS grep -qE '^gid: 42'
432
433     some_user=$("$TOP"/t/some-owner --user)
434     some_group=$("$TOP"/t/some-owner --group)
435
436     # Try to restore a user (and see that user trumps uid when uid is not 0).
437     WVPASS bup meta --edit --set-uid 42 --set-user "$some_user" ../src.meta \
438         | WVPASS bup meta -x
439     WVPASS bup xstat src | WVPASS grep -qE "^user: $some_user"
440
441     # Try to restore a group (and see that group trumps gid when gid is not 0).
442     WVPASS bup meta --edit --set-gid 42 --set-group "$some_group" ../src.meta \
443         | WVPASS bup meta -x
444     WVPASS bup xstat src | WVPASS grep -qE "^group: $some_user"
445
446     # Make sure a uid of 0 trumps a non-root user.
447     WVPASS bup meta --edit --set-user "$some_user" ../src.meta \
448         | WVPASS bup meta -x
449     WVPASS bup xstat src | WVPASS grep -qvE "^user: $some_user"
450     WVPASS bup xstat src | WVPASS grep -qE "^uid: 0"
451
452     # Make sure a gid of 0 trumps a non-root group.
453     WVPASS bup meta --edit --set-group "$some_user" ../src.meta \
454         | WVPASS bup meta -x
455     WVPASS bup xstat src | WVPASS grep -qvE "^group: $some_group"
456     WVPASS bup xstat src | WVPASS grep -qE "^gid: 0"
457
458     # Test --numeric-ids (gid).  Note the name 'root' is not handled
459     # specially, so we use that here as the test group name.  We
460     # assume that the root group's gid is never 42.
461     rm -rf src
462     WVPASS bup meta --edit --set-group root --set-gid 42 ../src.meta \
463         | WVPASS bup meta -x --numeric-ids
464     new_gidx=$(bup xstat src | grep -e '^gid:')
465     WVPASSEQ "$new_gidx" 'gid: 42'
466
467     # Test --numeric-ids (uid).  Note the name 'root' is not handled
468     # specially, so we use that here as the test user name.  We assume
469     # that the root user's uid is never 42.
470     rm -rf src
471     WVPASS bup meta --edit --set-user root --set-uid 42 ../src.meta \
472         | WVPASS bup meta -x --numeric-ids
473     new_uidx=$(bup xstat src | grep -e '^uid:')
474     WVPASSEQ "$new_uidx" 'uid: 42'
475
476     # Test that restoring an unknown user works.
477     unknown_user=$("$TOP"/t/unknown-owners --user)
478     rm -rf src
479     WVPASS bup meta --edit --set-uid 42 --set-user "$unknown_user" ../src.meta \
480         | WVPASS bup meta -x
481     new_uidx=$(bup xstat src | grep -e '^uid:')
482     WVPASSEQ "$new_uidx" 'uid: 42'
483
484     # Test that restoring an unknown group works.
485     unknown_group=$("$TOP"/t/unknown-owners --group)
486     rm -rf src
487     WVPASS bup meta --edit \
488         --set-gid 42 --set-group "$unknown_group" ../src.meta \
489         | WVPASS bup meta -x
490     new_gidx=$(bup xstat src | grep -e '^gid:')
491     WVPASSEQ "$new_gidx" 'gid: 42'
492 )
493
494 # Root-only tests that require an FS with all the trimmings: ACLs,
495 # Linux attr, Linux xattr, etc.
496 if actually-root; then
497     (
498         set -e
499         # Some cleanup handled in universal-cleanup() above.
500         # These tests are only likely to work under Linux for now
501         # (patches welcome).
502         [[ $(uname) =~ Linux ]] || exit 0
503
504         WVSTART 'meta - general (as root)'
505         setup-test-tree
506         cd "$TOP/bupmeta.tmp"
507
508         umount testfs || true
509         dd if=/dev/zero of=testfs.img bs=1M count=32
510         mke2fs -F -j -m 0 testfs.img
511         mkdir testfs
512         mount -o loop,acl,user_xattr testfs.img testfs
513         # Hide, so that tests can't create risks.
514         chown root:root testfs
515         chmod 0700 testfs
516
517         umount testfs-limited || true
518         dd if=/dev/zero of=testfs-limited.img bs=1M count=32
519         mkfs -t vfat testfs-limited.img
520         mkdir testfs-limited
521         mount -o loop,uid=root,gid=root,umask=0077 \
522             testfs-limited.img testfs-limited
523
524         #cp -a src testfs/src
525         cp -pPR src testfs/src
526         (cd testfs && test-src-create-extract)
527
528         WVSTART 'meta - atime (as root)'
529         force-delete testfs/src
530         mkdir testfs/src
531         (
532             mkdir testfs/src/foo
533             touch testfs/src/bar
534             PYTHONPATH="$TOP/lib" \
535                 python -c "from bup import xstat; \
536                 x = xstat.timespec_to_nsecs((42, 0));\
537                    xstat.utime('testfs/src/foo', (x, x));\
538                    xstat.utime('testfs/src/bar', (x, x));"
539             cd testfs
540             WVPASS bup meta -v --create --recurse --file src.meta src
541             bup meta -tvf src.meta
542             # Test extract.
543             force-delete src-restore
544             mkdir src-restore
545             cd src-restore
546             WVPASS bup meta --extract --file ../src.meta
547             WVPASSEQ "$(bup xstat --include-fields=atime src/foo)" "atime: 42"
548             WVPASSEQ "$(bup xstat --include-fields=atime src/bar)" "atime: 42"
549             # Test start/finish extract.
550             force-delete src
551             WVPASS bup meta --start-extract --file ../src.meta
552             WVPASS test -d src
553             WVPASS bup meta --finish-extract --file ../src.meta
554             WVPASSEQ "$(bup xstat --include-fields=atime src/foo)" "atime: 42"
555             WVPASSEQ "$(bup xstat --include-fields=atime src/bar)" "atime: 42"
556         )
557
558         WVSTART 'meta - Linux attr (as root)'
559         force-delete testfs/src
560         mkdir testfs/src
561         (
562             touch testfs/src/foo
563             mkdir testfs/src/bar
564             chattr +acdeijstuADST testfs/src/foo
565             chattr +acdeijstuADST testfs/src/bar
566             (cd testfs && test-src-create-extract)
567             # Test restoration to a limited filesystem (vfat).
568             (
569                 WVPASS bup meta --create --recurse --file testfs/src.meta \
570                     testfs/src
571                 force-delete testfs-limited/src-restore
572                 mkdir testfs-limited/src-restore
573                 cd testfs-limited/src-restore
574                 WVFAIL bup meta --extract --file ../../testfs/src.meta 2>&1 \
575                     | WVPASS grep -e '^Linux chattr:' \
576                     | WVPASS python -c \
577                       'import sys; exit(not len(sys.stdin.readlines()) == 2)'
578             )
579         )
580
581         WVSTART 'meta - Linux xattr (as root)'
582         force-delete testfs/src
583         mkdir testfs/src
584         (
585             touch testfs/src/foo
586             mkdir testfs/src/bar
587             attr -s foo -V bar testfs/src/foo
588             attr -s foo -V bar testfs/src/bar
589             (cd testfs && test-src-create-extract)
590
591             # Test restoration to a limited filesystem (vfat).
592             (
593                 WVPASS bup meta --create --recurse --file testfs/src.meta \
594                     testfs/src
595                 force-delete testfs-limited/src-restore
596                 mkdir testfs-limited/src-restore
597                 cd testfs-limited/src-restore
598                 WVFAIL bup meta --extract --file ../../testfs/src.meta 2>&1 \
599                     | WVPASS grep -e '^xattr\.set:' \
600                     | WVPASS python -c \
601                       'import sys; exit(not len(sys.stdin.readlines()) == 2)'
602             )
603         )
604
605         WVSTART 'meta - POSIX.1e ACLs (as root)'
606         force-delete testfs/src
607         mkdir testfs/src
608         (
609             touch testfs/src/foo
610             mkdir testfs/src/bar
611             setfacl -m u:root:r testfs/src/foo
612             setfacl -m u:root:r testfs/src/bar
613             (cd testfs && test-src-create-extract)
614
615             # Test restoration to a limited filesystem (vfat).
616             (
617                 WVPASS bup meta --create --recurse --file testfs/src.meta \
618                     testfs/src
619                 force-delete testfs-limited/src-restore
620                 mkdir testfs-limited/src-restore
621                 cd testfs-limited/src-restore
622                 WVFAIL bup meta --extract --file ../../testfs/src.meta 2>&1 \
623                     | WVPASS grep -e '^POSIX1e ACL applyto:' \
624                     | WVPASS python -c \
625                       'import sys; exit(not len(sys.stdin.readlines()) == 2)'
626             )
627         )
628     )
629 fi
630
631 exit 0