-
1091de2a
by Raymond Toy at 2025-01-31T22:01:28-08:00
Fix #375: Return the name of the temp file or directory
The functions `unix-mkstemp` and `unix-mkdtemp` are supposed to return
the name of the temporary file or directory. They weren't.
Fix these functions so that they do.
Also add a new file, tests/unix.lisp, that tests these functions.
Finally, update the pot file for the updated docstrings.
-
15501db4
by Raymond Toy at 2025-02-01T09:11:11-08:00
Update bad template tests for Darwin
Darwin seems to require at least one X in the template, unlike Linux
which requires 6. Update the test for bad templates for both mkstemp
and mkdtemp to have no X's in the template.
-
544a6787
by Raymond Toy at 2025-02-01T15:59:09-08:00
Simplify mkdtemp and fix error in mkstemp
Since mkdtemp returns a pointer to the resulting directory name, we
can convert that to the desired lisp string.
In mkstemp, we were converting the resulting buffer to a string but we
had `:end (1- length)`. It should be `:end length` to get all the
characters.
-
0111bb50
by Raymond Toy at 2025-02-01T16:34:20-08:00
Add tests with template with non-ascii char
Add a test for mkstemp and mkdtemp where the template name contains a
non-ascii char (lower case alpha) to test the we convert the returned
name to a Lisp string correctly.
-
6e0378ea
by Raymond Toy at 2025-02-01T16:35:27-08:00
Need to convert the return result of mkdtemp
Forgot that we need to encode the result to a proper UTF-16 Lisp
string.
-
7275edf3
by Raymond Toy at 2025-02-02T16:01:15-08:00
Disable bad template tests on Darwin
Darwin bizarrely allows 0(!) or more X's in the template, so our test
for a bad template can't work on Darwin. Disable them.
-
3b6909fe
by Raymond Toy at 2025-02-03T07:26:09-08:00
Enforce 6 X's in template for mkstemp/mkdtemp
Our API enforces the template to have exactly 6 X's at the end of the
template. This is only a problem on Darwin which allows 0 or more
X's.
Also re-enable the tests for too few X's on Darwin and add tests for
too many X's.
-
2759e80f
by Raymond Toy at 2025-02-03T07:28:50-08:00
Add tests for template that doesn't end in X's.
-
144065ee
by Raymond Toy at 2025-02-03T10:16:16-08:00
Fix typo in unix-mkdtemp
We were returning from `unix-mkstemp` instead of `unix-mkdtemp`.
-
e9f2fd2d
by Raymond Toy at 2025-02-07T10:06:23-08:00
Remove check on template
As discussed, we remove the check on the template format.
Update the tests because Darwin allows any number of X's in the
string. This tests won't be run on Darwin.
-
5814e20d
by Raymond Toy at 2025-02-07T12:50:18-08:00
Remove invalid tests and update pot file
On linux, the only requirement on the template is the last 6 chars are
X's. There could be more. Hence remove these tests.
Update the pot file for the changed docstrings.
-
7698e84e
by Raymond Toy at 2025-02-07T17:57:05-08:00
Disable some tests on Darwin
I tested these on Darwin, and the templates "test-" and
""test-XXXXXXa" succeed by returning exactly these files. Another
call would then generate an error since we can't create new files.
So it seems on Darwin, any template will work but the only time we get
a filename different from the template is if the template ends in X's.
-
e9f4ca93
by Raymond Toy at 2025-02-13T20:27:27-08:00
Fix #373: Add macros for temporary streams, files, and directories
Add `with-temporary-stream` to create a stream to temp file.
Add `with-temporary-directory` to create a temporary directory using a
template as a prefix for the name of the directory. The directory and
all its contents are removed afterwards.
-
7aa502a1
by Raymond Toy at 2025-02-14T06:45:51-08:00
Update according to review
Use an alien array to hold the C string needed by mkstemp and mkdtemp.
-
284722c5
by Raymond Toy at 2025-02-14T10:25:16-08:00
Merge branch 'issue-375-mkstemp-return-filename' into issue-373-handle-temp-files
-
25077d5b
by Raymond Toy at 2025-02-14T12:11:38-08:00
Fix with-temporarry-stream so it actually works.
Lots of little stupid things were needed to make it actually work
instead of producing compilation errors or runtime errors (unknown
var).
-
5979379f
by Raymond Toy at 2025-02-14T12:12:56-08:00
Add pprinter for with-temporary-{stream,directory}
-
eddbb928
by Raymond Toy at 2025-02-14T12:13:24-08:00
Modify test trac.36 to use with-temporary-stream.
Original left in, but commented out, for reference.
-
0eb4531e
by Raymond Toy at 2025-02-14T12:41:40-08:00
Make with-temporary-directory actuall work.
Minor fixups to make with-temporary-directory actually work.
-
b3fde57b
by Raymond Toy at 2025-02-14T14:35:56-08:00
Append a "/" to the resulting dirname
Append a "/" to make the returned string a directory. Thus, calling
`pathname` on the result returns a pathname that is a directory,
instead of a (possible) directory and a pathname-name.
-
578efc93
by Raymond Toy at 2025-02-17T17:48:37-08:00
Add with-temporary-file to create a temporary file
Use mkstemp to create a file and return the file name. On completion,
the file is deleted.
-
b7ca3635
by Raymond Toy at 2025-02-17T18:55:33-08:00
Merge branch 'master' into issue-373-handle-temp-files
-
9da10f58
by Raymond Toy at 2025-02-18T05:54:18-08:00
Update from HEAD to fix incorrect merge
Just update tests/unix.lisp from HEAD because we messed up the merge
previously and left some unmerged diffs in by accident.
-
7a2eeb73
by Raymond Toy at 2025-02-19T07:16:22-08:00
Export the new temp file/stream/dir macros
These are public interfaces.
-
4411d4ef
by Raymond Toy at 2025-02-19T07:16:53-08:00
Add :prefix keyword arg and more error checking
For `with-temporary-{file,directory}`, add a `:prefix` keyword arg to
allow the user to specify a prefix for the name of the temporary file
or directory.
Add sume error checking if `mkstemp` or `mkdtemp` fail to create the
requested object. We just throw an error with a message with the
template and the reason (from errno).
Finally, in for the temporary stream, don't add the name of the file
to the fd-stream object. The name, by default, ends up being
"descriptor n" where n is the fd used.
-
823351a2
by Raymond Toy at 2025-02-19T07:21:27-08:00
Change test trac.43 to use with-temporary-file
Tests still passes.
-
ade0813f
by Raymond Toy at 2025-02-19T13:24:19-08:00
First cut at adding os_temp_path
Add os_temp_path to os-common.c to return an appropriate location
where temporary files can be placed, depending on the OS. Currently,
MacOS, has a special method to return a secure per-user temp
directory.
For everywhere else, we look at the TMP envvar. If it's not set, we
just use "/tmp".
Add get-os-temp-path in extensions.lisp to get the temporary path.
This is used in the macros, but get-os-temp-path doesn't yet call
`os_temp_path`.
-
aef4de54
by Raymond Toy at 2025-02-19T18:30:00-08:00
Define PATH_MAX on Macos
-
1f465c57
by Raymond Toy at 2025-02-19T18:32:19-08:00
Use limits.h instead
-
19b21612
by Raymond Toy at 2025-02-19T19:10:27-08:00
Remove unused variable.
-
1a051ff3
by Raymond Toy at 2025-02-19T19:10:44-08:00
Update get-os-temp-path to call os_temp_path
Directly call os_temp_path in get-os-temp-path. We take care to free
the string that was returned. We also throw an error if NULL is
returned.
The path returned is made to end with a slash so that creating a
CL pathname from it only has directory components.
-
921b2043
by Raymond Toy at 2025-02-20T19:01:54-08:00
Add some comments for os_temp_path.
-
221fa0ae
by Raymond Toy at 2025-02-20T19:02:31-08:00
Fix error in creating default template name; clarify docstrings
If the prefix arg is no supplied, we choose a default value for the
template. It was previously incorrectly computed so make it right.
Clarify some docstrings.
-
6698b2c1
by Raymond Toy at 2025-02-20T19:47:44-08:00
Add function to create the template from the prefix or a default name.
All of the temporary file/stream/directory macros had common code to
create the actual template. Move this into a common function so that
we do it the same for everyone.
-
63fdbf0b
by Raymond Toy at 2025-02-21T06:14:57-08:00
Convert more tests to use with-temporary-foo
-
c8b9082b
by Raymond Toy at 2025-02-21T06:21:49-08:00
Convert test to use with-temporary-file
-
087eb17f
by Raymond Toy at 2025-02-21T17:54:57-08:00
Fix a typo and use exported symbols
Fix a typo in a comment in os_temp_path.
`with-temporary-stream` is an exported symbol, so just use "ext:"
insteadof "ext::".
[SKIP-CI]
-
b37ed3a9
by Raymond Toy at 2025-05-10T08:30:16-07:00
Merge branch 'master' into issue-373-handle-temp-files
-
0b748144
by Raymond Toy at 2025-05-26T13:22:35-07:00
Merge branch 'master' into issue-373-handle-temp-files
-
bf280b99
by Raymond Toy at 2025-05-26T13:24:11-07:00
Clean up and remove extraneous trailing blanks before EOL
-
ce5f05f5
by Raymond Toy at 2025-06-02T07:20:32-07:00
Rename os_temp_path to os_temporary_directory
Also, remove the implementation from os-common.c and place it in the
various foo-os.c files since the original implementation in
os-common.c used some OS-specific features.
Update pot file with the new docstrings.
-
ee9111e6
by Raymond Toy at 2025-06-02T07:28:56-07:00
Don't use camel case
`pathSize` -> `path_size`
-
2beeead3
by Raymond Toy at 2025-06-02T08:48:39-07:00
Darwin needs unistd.h to define confstr
Forgot this when we moved os_temporary_directory to here.
-
c5c80aef
by Raymond Toy at 2025-11-06T06:38:25-08:00
21f is not a WIP
Remove the heading from the release notes for 21f. Forgot to fix this
when doing the 21f release.
[skip-ci]
-
b764d014
by Raymond Toy at 2025-11-06T07:20:10-08:00
Fix #437: Use realpath to find the executable
-
2a9edb1f
by Raymond Toy at 2025-11-06T07:20:11-08:00
Merge branch 'issue-437-find-self' into 'master'
Fix #437: Use realpath to find the executable
Closes #437
See merge request cmucl/cmucl!329
-
c1904aaa
by Raymond Toy at 2025-11-06T08:37:30-08:00
Fix #446: Use C compiler to get errno values and generate UNIX defpackage for errno
-
f6df759b
by Raymond Toy at 2025-11-06T08:37:30-08:00
Merge branch 'issue-446-use-cc-to-get-errno' into 'master'
Fix #446: Use C compiler to get errno values and generate UNIX defpackage for errno
Closes #446
See merge request cmucl/cmucl!327
-
b61d6e17
by Raymond Toy at 2025-11-06T17:28:00-08:00
Fix #452: Move bin/errno-foo.lisp to src/tools/
-
8508d11e
by Raymond Toy at 2025-11-06T17:28:00-08:00
Merge branch 'issue-452-move-errno-ref-files' into 'master'
Fix #452: Move bin/errno-foo.lisp to src/tools/
Closes #452
See merge request cmucl/cmucl!330
-
0789a95b
by Raymond Toy at 2025-11-07T09:37:01-08:00
Merge branch 'master' into issue-373-handle-temp-files
-
346db6a8
by Raymond Toy at 2025-11-07T10:27:52-08:00
Return pathname objects instead of strings for temp files and dirs
`with-temporary-file` and `with-temporary-directory` now produce a
pathname object instead of a namestring.
This change required updating a couple of tests in trac.lisp to
convert the pathname to a namestring for use by `run-program`.
-
c9181e31
by Raymond Toy at 2025-11-07T10:37:51-08:00
Remove with-temporary-stream
As mentioned in the review, we probably don't want this. Hence,
remove it.
-
ef79c4ec
by Raymond Toy at 2025-11-07T10:38:26-08:00
Convert clear-output-1 test to use with-temporary-file
-
cc969535
by Raymond Toy at 2025-11-07T10:53:07-08:00
Really remove WITH-TEMPORARY-STREAM
Forgot to remove `with-temporary-stream` from exports.lisp an
pprint.lisp.
Remove the test from trac.lisp and use the `with-temporary-file`
version instead.
-
ec60199f
by Raymond Toy at 2025-11-09T11:30:40-08:00
Address #453: Save analyzer logs even if analyzer fails
-
23ef5ca7
by Raymond Toy at 2025-11-09T11:30:40-08:00
Merge branch 'issue-453-save-analyzer-results' into 'master'
Address #453: Save analyzer logs even if analyzer fails
See merge request cmucl/cmucl!331
-
2072ca19
by Raymond Toy at 2025-11-10T05:07:47-08:00
Fix #453: Use correct flags when running the analyzer
-
671d8973
by Raymond Toy at 2025-11-10T05:07:47-08:00
Merge branch 'issue-453-update-make-options-for-analyzer' into 'master'
Fix #453: Use correct flags when running the analyzer
Closes #453
See merge request cmucl/cmucl!332
-
32f4adb8
by Raymond Toy at 2025-11-10T09:32:05-08:00
Allow specifying a directory for the temp file or directory
Add a new keyword arg :directory that specifies a directory where the
temporary file or directory is. If not provided an OS-dependent
directory is used.
This applies to both `with-temporary-file` and
`with-temporary-directory`.
-
14902acd
by Raymond Toy at 2025-11-10T10:09:12-08:00
Implement "rm -r" in Lisp
Instead of using "rm -rf" to delete the temporary directory produced
by `with-temporary-directory`, do the deletion in lisp so we don't
have to fork/exec.
The new function `recursively-delete-directory` recursively deletes a
directory and all its contents.
-
fef970d5
by Raymond Toy at 2025-11-10T10:14:36-08:00
Remove nil'ed out test code.
The original clear-output-1 test has been replaced with a version that
uses with-temporary-file.
-
def9886b
by Raymond Toy at 2025-11-10T11:25:06-08:00
Minor tweak to with-temporary-directory
Call `recursive-delete-directory` with the temp directory pathname
object instead of the namestring.
Update pot file for new docstrings.
-
78dc0983
by Raymond Toy at 2025-11-10T16:37:11-08:00
Remove old nil'ed out tests
Really remove these old tests that were updated to use
with-temporary-file to get a temp file for testing.
-
71b5e795
by Raymond Toy at 2025-11-11T18:37:08-08:00
Let os_temporary_directory append a slash if needed.
Update ext::get-os-temp-path so that it doesn't append a slash since
os_temporary_directory does.
Update pot file for new docstring too.
-
a96bdc2e
by Raymond Toy at 2025-11-13T07:24:54-08:00
Apply 3 suggestion(s) to 3 file(s)
Co-authored-by: Carl Shapiro <cshapiro@panix.com>
-
19dec394
by Raymond Toy at 2025-11-13T07:25:30-08:00
Remove old function recursive-delete-directory
This was replaced by `delete-directory`.
-
196dd6cf
by Raymond Toy at 2025-11-13T08:08:42-08:00
Fixed typo and remove extra closing brace
-
f544c481
by Raymond Toy at 2025-11-13T08:09:02-08:00
Update these files to match Linux
These OSes use the same method as used on Linux to get the temp
directory so update them to match what Linux is doing now.
-
2ef1bd43
by Raymond Toy at 2025-11-13T08:39:23-08:00
Update pot file for changed docstring
-
aca11a4b
by Raymond Toy at 2025-11-13T10:56:53-08:00
Fix #373: Add macros to handle temporary files, streams, and directories
-
f5484369
by Raymond Toy at 2025-11-13T10:56:53-08:00
Merge branch 'issue-373-handle-temp-files' into 'master'
Fix #373: Add macros to handle temporary files, streams, and directories
Closes #373 and #375
See merge request cmucl/cmucl!269
-
9feac3a0
by Raymond Toy at 2025-11-13T12:07:18-08:00
Merge branch 'issue-373-handle-temp-files' into issue-408-get-user-name-and-homedir
-
df529110
by Raymond Toy at 2025-11-13T12:07:32-08:00
Merge branch 'master' into issue-408-get-user-name-and-homedir