Use user-specific temp directories to prevent permission conflicts (fixes #217)#245
Use user-specific temp directories to prevent permission conflicts (fixes #217)#245glenneth1 wants to merge 1 commit into
Conversation
|
It would be better to have atomically created randomly named temporary directories. |
…conflicts (fixes edicl#217) When multiple users run tests on the same machine, the shared /tmp/hunchentoot/ directory causes permission errors because it is owned by the first user who created it. This change creates unique temporary directories with random names using POSIX mkdtemp for atomic creation (e.g. /tmp/hunchentoot-sZYYDd/ instead of /tmp/hunchentoot/). - specials.lisp: Add make-tmp-directory function using sb-posix:mkdtemp on SBCL, with portable fallback for other implementations - test/test-handlers.lisp: Derive *tmp-test-directory* from *tmp-directory*
2bea217 to
79f13a8
Compare
|
Thanks @stassats, great suggestion. I've updated the PR to use atomically created, randomly named temporary directories. What changedInstead of a predictable user-specific path, SBCL (POSIX): Uses CCL (POSIX): Calls Portable fallback (other implementations / Windows): Generates a random base-36 name, checks it doesn't exist, and creates it. Retries up to 100 times.
|
Summary
Makes temporary directories user-specific to prevent permission conflicts when multiple users run Hunchentoot tests on the same machine.
Fixes #217
Problem
When user A runs tests, /tmp/hunchentoot/ is created and owned by user A. When user B subsequently runs tests, they get permission errors trying to write to the same directory.
Change
Temp directories now include the username in the path:
Uses portable
UIOP:GETENVto readUSER/USERNAMEenvironment variables, with an SBCL-specificsb-posix:getuidfallback.user-tmp-directoryfunction, used for*tmp-directory*user-tmp-test-directoryfunction, used for*tmp-test-directory*Testing
All existing tests pass on SBCL/Linux.