* bug#71980: [3.0.10] posix.test uses depcrecated tmpnam
@ 2024-07-07 16:27 Matt Wette
2024-07-07 16:46 ` Tomas Volf
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Matt Wette @ 2024-07-07 16:27 UTC (permalink / raw)
To: 71980
[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]
With `--disable-tmpnam' argument to configure, posix.test fails:
missing `tmpnam`.
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] 6+ messages in thread
* bug#71980: [3.0.10] posix.test uses depcrecated tmpnam
2024-07-07 16:27 bug#71980: [3.0.10] posix.test uses depcrecated tmpnam Matt Wette
@ 2024-07-07 16:46 ` Tomas Volf
2024-10-20 19:26 ` Ludovic Courtès
2024-07-07 17:00 ` bug#71980: tmpnam Matt Wette
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Tomas Volf @ 2024-07-07 16:46 UTC (permalink / raw)
To: Matt Wette; +Cc: 71980
[-- Attachment #1: Type: text/plain, Size: 3114 bytes --]
On 2024-07-07 09:27:14 -0700, Matt Wette wrote:
> With `--disable-tmpnam' argument to configure, posix.test fails: missing
> `tmpnam`.
>
> patch attached
There also is #71796 as a possible patch (since June 27th), which is arguably
bit smaller (albeit I am biased since I am the author over there ^_^ ).
>
> --- 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))))
Interesting. Does this clean up the temporary file somehow or will it stay
around?
>
> (pass-if-equal "https://bugs.gnu.org/63024"
> 0
> --- 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
Have a nice day,
Tomas Volf
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#71980: [3.0.10] posix.test uses depcrecated tmpnam
2024-07-07 16:46 ` Tomas Volf
@ 2024-10-20 19:26 ` Ludovic Courtès
0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2024-10-20 19:26 UTC (permalink / raw)
To: Tomas Volf; +Cc: 71980-done, Matt Wette
Tomas Volf <~@wolfsden.cz> skribis:
> On 2024-07-07 09:27:14 -0700, Matt Wette wrote:
>> With `--disable-tmpnam' argument to configure, posix.test fails: missing
>> `tmpnam`.
>>
>> patch attached
>
> There also is #71796 as a possible patch (since June 27th), which is arguably
> bit smaller (albeit I am biased since I am the author over there ^_^ ).
Yes, I’ve just pushed it as ff256c356be9327c24a2d7fc0f007722422e6604.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#71980: tmpnam
2024-07-07 16:27 bug#71980: [3.0.10] posix.test uses depcrecated tmpnam Matt Wette
2024-07-07 16:46 ` Tomas Volf
@ 2024-07-07 17:00 ` Matt Wette
2024-07-07 17:06 ` bug#71980: close Matt Wette
2024-07-07 17:12 ` bug#71980: close 71980 Matt Wette
3 siblings, 0 replies; 6+ messages in thread
From: Matt Wette @ 2024-07-07 17:00 UTC (permalink / raw)
To: 71980
See also bug #71796, which has smaller delta.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#71980: close
2024-07-07 16:27 bug#71980: [3.0.10] posix.test uses depcrecated tmpnam Matt Wette
2024-07-07 16:46 ` Tomas Volf
2024-07-07 17:00 ` bug#71980: tmpnam Matt Wette
@ 2024-07-07 17:06 ` Matt Wette
2024-07-07 17:12 ` bug#71980: close 71980 Matt Wette
3 siblings, 0 replies; 6+ messages in thread
From: Matt Wette @ 2024-07-07 17:06 UTC (permalink / raw)
To: 71980
close
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#71980: close 71980
2024-07-07 16:27 bug#71980: [3.0.10] posix.test uses depcrecated tmpnam Matt Wette
` (2 preceding siblings ...)
2024-07-07 17:06 ` bug#71980: close Matt Wette
@ 2024-07-07 17:12 ` Matt Wette
3 siblings, 0 replies; 6+ messages in thread
From: Matt Wette @ 2024-07-07 17:12 UTC (permalink / raw)
To: 71980
close 71980
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-20 19:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-07 16:27 bug#71980: [3.0.10] posix.test uses depcrecated tmpnam Matt Wette
2024-07-07 16:46 ` Tomas Volf
2024-10-20 19:26 ` Ludovic Courtès
2024-07-07 17:00 ` bug#71980: tmpnam Matt Wette
2024-07-07 17:06 ` bug#71980: close Matt Wette
2024-07-07 17:12 ` bug#71980: close 71980 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).