From c6375343615ac20cc8bc8abd953093f7ebaaa401 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 3 Sep 2023 11:58:58 -0700 Subject: crypt: detect error tokens more weakly; drop some tests. It has been reported by user cielesti that some of our crypt tests fail on the Musl library. Musl has some additional agorithms so it yields a meaningful hash for a "$0$" salt, as well as for "$9$". Musl uses "*" and "x" as error tokens rather than "*0" and "*1". We need to change how we detect error tokens. * sysif.c (crypt_wrap): Detect error tokens only by their length: if a string emerges from crypt or crypt_r, whose length is less than 13, it's an error token. * tests/018/crypt.tl: Drop the tests that require :error for salts "$0$" and "$9$", replacing them with a test for a salt that is almost certainly invalid in all C libraries on Linux. * txr.1: Document that crypt throws an error exception and under what circumstances (when the C library function does what). --- tests/018/crypt.tl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/018/crypt.tl b/tests/018/crypt.tl index 33fd0ac5..7e68d6c7 100644 --- a/tests/018/crypt.tl +++ b/tests/018/crypt.tl @@ -11,8 +11,7 @@ (if (eq :linux (os-symbol)) (mtest (crypt "a" "b") :error - (crypt "a" "$0$") :error - (crypt "a" "$9$") :error + (crypt "a" "*$") :error (crypt "a" "$1$") "$1$$Ij31LCAysPM23KuPlm1wA/" (crypt "a" "$1$bcd$") "$1$bcd$cgz778Ks3pkbWfyW.CWae/" (crypt "a" "$5$") "$5$$QG6CCM7eJAxpUPcBpn0Z2K29NHtaI6Mk1fCpPrpjdj3" -- cgit v1.2.3