* [3.0.10] posix.test uses depcrecated tmpnam
[not found] <cb7271f9-96d5-415c-bac7-c5963d411bd5@gmail.com>
@ 2024-07-07 16:34 ` Matt Wette
0 siblings, 0 replies; only message in thread
From: Matt Wette @ 2024-07-07 16:34 UTC (permalink / raw)
To: guile-devel
[-- Attachment #1: Type: text/plain, Size: 1699 bytes --]
FYI,
I'm not getting responses from bug-guile@gnu.org
With `--disable-tmpnam' argument to configure, posix.test fails:
missing `tmpnam`.
I think this works. It passes the test and using the let in the repl
generated the
intended result.
patch attached
--- test-suite/tests/posix.test-orig 2024-07-03 15:45:16.352132881 -0700
+++ test-suite/tests/posix.test 2024-07-07 09:21:53.342855356 -0700
@@ -361,20 +361,21 @@
(status:exit-val (system* "something-that-does-not-exist"))))
(pass-if-equal "https://bugs.gnu.org/52835"
- "bong\n"
- (let ((file (tmpnam)))
+ "bong\n"
+ (let ((port (mkstemp "T-XXXXXX")))
;; Redirect stdout and stderr to FILE.
(define status
- (call-with-output-file file
- (lambda (port)
- (with-output-to-port port
+ (with-output-to-port port
+ (lambda ()
+ (with-error-to-port port
(lambda ()
- (with-error-to-port port
- (lambda ()
- (system* "sh" "-c" "echo bong >&2"))))))))
+ (system* "sh" "-c" "echo bong >&2"))))))
(and (zero? (status:exit-val status))
- (call-with-input-file file get-string-all))))
+ (zero? (seek port 0 SEEK_SET))
+ (let ((contents (get-string-all port)))
+ (close-port port)
+ contents))))
(pass-if-equal "https://bugs.gnu.org/63024"
0
[-- Attachment #2: PATCH --]
[-- Type: text/plain, Size: 1181 bytes --]
--- test-suite/tests/posix.test-orig 2024-07-03 15:45:16.352132881 -0700
+++ test-suite/tests/posix.test 2024-07-07 09:21:53.342855356 -0700
@@ -361,20 +361,21 @@
(status:exit-val (system* "something-that-does-not-exist"))))
(pass-if-equal "https://bugs.gnu.org/52835"
- "bong\n"
- (let ((file (tmpnam)))
+ "bong\n"
+ (let ((port (mkstemp "T-XXXXXX")))
;; Redirect stdout and stderr to FILE.
(define status
- (call-with-output-file file
- (lambda (port)
- (with-output-to-port port
+ (with-output-to-port port
+ (lambda ()
+ (with-error-to-port port
(lambda ()
- (with-error-to-port port
- (lambda ()
- (system* "sh" "-c" "echo bong >&2"))))))))
+ (system* "sh" "-c" "echo bong >&2"))))))
(and (zero? (status:exit-val status))
- (call-with-input-file file get-string-all))))
+ (zero? (seek port 0 SEEK_SET))
+ (let ((contents (get-string-all port)))
+ (close-port port)
+ contents))))
(pass-if-equal "https://bugs.gnu.org/63024"
0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-07-07 16:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cb7271f9-96d5-415c-bac7-c5963d411bd5@gmail.com>
2024-07-07 16:34 ` [3.0.10] posix.test uses depcrecated tmpnam Matt Wette
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).