1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

Fix crypt-on-glibc test error

* test-suite/tests/posix.test ("crypt"): Allow for the given salt being
  valid.  Thanks to Jonathan Brielmaier for the report and debugging!
This commit is contained in:
Andy Wingo 2019-02-01 17:18:50 +01:00 committed by Andy Wingo
parent 78468baa11
commit 27ffbfb023

View file

@ -262,10 +262,17 @@
(pass-if "basic usage" (pass-if "basic usage"
(string? (crypt "pass" "abcdefg"))) (string? (crypt "pass" "abcdefg")))
(pass-if-exception "glibc EINVAL" exception:system-error (pass-if "crypt invalid salt on glibc"
;; This used to deadlock while trying to throw to 'system-error'. (begin
;; This test uses the special interpretation of the salt that glibc (unless (string-contains %host-type "-gnu")
;; does; specifically, we pass a syntactically invalid salt here. (throw 'unresolved))
(if (string-contains %host-type "-gnu") (catch 'system-error
(crypt "pass" "$X$abc") ;EINVAL (lambda ()
(throw 'unresolved)))) ;; This used to deadlock on glibc while trying to throw to
;; 'system-error'. This test uses the special
;; interpretation of the salt that glibc does;
;; specifically, we pass a salt that's probably
;; syntactically invalid here. Note, whether it's invalid
;; or not is system-defined, so it's possible it just works.
(string? (crypt "pass" "$X$abc")))
(lambda _ #t)))))