local.dont-fail-tests-for-disabled-module-load.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Description: Don't fail test if cryptsetup fails for disabled module loading
  2. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  3. Date: 2017-11-20
  4. Forwarded: not-needed
  5. Bug-Debian: https://bugs.debian.org/881864
  6. On the Debian buildds and porter boxes, the crypt_format call in
  7. libcryptsetup fails:
  8. socket(AF_ALG, SOCK_SEQPACKET, 0) = -1 EAFNOSUPPORT (Address family not supported by protocol)
  9. Reproducer using command line (run as non-root):
  10. $ fallocate --length 8m test.img
  11. $ echo foo | /sbin/cryptsetup luksFormat test.img -
  12. The actual reason is DSA disabled automatic module loading by
  13. setting /proc/sys/kernel/modules_disabled to 1, for obvious reaons.
  14. Make the tests non-fatal if they fail at that place, by using the
  15. special exit code 77.
  16. --- a/test.c
  17. +++ b/test.c
  18. @@ -147,6 +147,10 @@
  19. r = crypt_format(cd, CRYPT_LUKS1, "aes", "xts-plain64",
  20. NULL, NULL, 32, NULL);
  21. + if (r == -5) {
  22. + fprintf(stderr, "crypt_format failed, assuming AF_ALG,SOCK_SEQPACKET failure\n");
  23. + exit(77);
  24. + }
  25. if (r < 0)
  26. error(EXIT_FAILURE, -r, "%s:%d", __FILE__, __LINE__);
  27. --- a/test-luksmeta
  28. +++ b/test-luksmeta
  29. @@ -11,7 +11,13 @@
  30. trap 'onexit' EXIT
  31. truncate -s 4M $tmp
  32. -echo -n foo | /sbin/cryptsetup luksFormat $tmp -
  33. +PRE="$(md5sum $tmp)"
  34. +echo -n foo | /sbin/cryptsetup luksFormat $tmp - || true
  35. +PST="$(md5sum $tmp)"
  36. +if [ "$PRE" = "$PST" ] ; then
  37. + echo 'cryptsetup failed, assuming AF_ALG,SOCK_SEQPACKET failure'
  38. + exit 77
  39. +fi
  40. ! ./luksmeta test -d $tmp