diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-12-22 11:12:57 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-12-22 11:12:57 +0100 |
commit | 6d391bf1a41e378e568cd148631b1beec7577e66 (patch) | |
tree | 34b57f47d051a48f9b47295b0974a94ea255b83c /test-suite | |
parent | 2c7d6031f3b334c3e0d6de9c8eb9961439c5166f (diff) |
Fix 'crypt' deadlock upon error.
* libguile/posix.c (scm_crypt): Take 'scm_i_misc_mutex' right before
calling 'crypt'. Move 'SCM_SYSERROR' call after 'scm_dynwind_end'.
* test-suite/tests/posix.test ("crypt"): New test prefix.
Diffstat (limited to 'test-suite')
-rw-r--r-- | test-suite/tests/posix.test | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test-suite/tests/posix.test b/test-suite/tests/posix.test index f57001a24..4dadd7784 100644 --- a/test-suite/tests/posix.test +++ b/test-suite/tests/posix.test @@ -1,7 +1,7 @@ ;;;; posix.test --- Test suite for Guile POSIX functions. -*- scheme -*- ;;;; ;;;; Copyright 2003, 2004, 2006, 2007, 2010, 2012, -;;;; 2015 Free Software Foundation, Inc. +;;;; 2015, 2017 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -222,3 +222,20 @@ (let ((me (getpid))) (and (not (zero? (system* "something-that-does-not-exist"))) (= me (getpid)))))) + +;; +;; crypt +;; + +(with-test-prefix "crypt" + + (pass-if "basic usage" + (string? (crypt "pass" "abcdefg"))) + + (pass-if-exception "glibc EINVAL" exception:system-error + ;; This used to deadlock while trying to throw to 'system-error'. + ;; This test uses the special interpretation of the salt that glibc + ;; does; specifically, we pass a syntactically invalid salt here. + (if (string-contains %host-type "-gnu") + (crypt "pass" "$X$abc") ;EINVAL + (throw 'unresolved)))) |