GNU bug report logs - #71980
[3.0.10] posix.test uses depcrecated tmpnam

Previous Next

Package: guile;

Reported by: Matt Wette <matt.wette <at> gmail.com>

Date: Sun, 7 Jul 2024 16:28:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 71980 in the body.
You can then email your comments to 71980 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#71980; Package guile. (Sun, 07 Jul 2024 16:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matt Wette <matt.wette <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sun, 07 Jul 2024 16:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matt Wette <matt.wette <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: [3.0.10] posix.test uses depcrecated tmpnam
Date: Sun, 7 Jul 2024 09:27:14 -0700
[Message part 1 (text/plain, inline)]
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
[PATCH (text/plain, attachment)]

Information forwarded to bug-guile <at> gnu.org:
bug#71980; Package guile. (Sun, 07 Jul 2024 16:47:02 GMT) Full text and rfc822 format available.

Message #8 received at 71980 <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: Matt Wette <matt.wette <at> gmail.com>
Cc: 71980 <at> debbugs.gnu.org
Subject: Re: bug#71980: [3.0.10] posix.test uses depcrecated tmpnam
Date: Sun, 7 Jul 2024 18:46:40 +0200
[Message part 1 (text/plain, inline)]
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.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#71980; Package guile. (Sun, 07 Jul 2024 17:02:02 GMT) Full text and rfc822 format available.

Message #11 received at 71980 <at> debbugs.gnu.org (full text, mbox):

From: Matt Wette <matt.wette <at> gmail.com>
To: 71980 <at> debbugs.gnu.org
Subject: tmpnam
Date: Sun, 7 Jul 2024 10:00:20 -0700
See also bug #71796, which has smaller delta.





Information forwarded to bug-guile <at> gnu.org:
bug#71980; Package guile. (Sun, 07 Jul 2024 17:08:02 GMT) Full text and rfc822 format available.

Message #14 received at 71980 <at> debbugs.gnu.org (full text, mbox):

From: Matt Wette <matt.wette <at> gmail.com>
To: 71980 <at> debbugs.gnu.org
Subject: close
Date: Sun, 7 Jul 2024 10:06:20 -0700
close




Information forwarded to bug-guile <at> gnu.org:
bug#71980; Package guile. (Sun, 07 Jul 2024 17:15:02 GMT) Full text and rfc822 format available.

Message #17 received at 71980 <at> debbugs.gnu.org (full text, mbox):

From: Matt Wette <matt.wette <at> gmail.com>
To: 71980 <at> debbugs.gnu.org
Subject: close 71980
Date: Sun, 7 Jul 2024 10:12:56 -0700
close 71980





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 20 Oct 2024 19:28:03 GMT) Full text and rfc822 format available.

Notification sent to Matt Wette <matt.wette <at> gmail.com>:
bug acknowledged by developer. (Sun, 20 Oct 2024 19:28:03 GMT) Full text and rfc822 format available.

Message #22 received at 71980-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tomas Volf <~@wolfsden.cz>
Cc: 71980-done <at> debbugs.gnu.org, Matt Wette <matt.wette <at> gmail.com>
Subject: Re: bug#71980: [3.0.10] posix.test uses depcrecated tmpnam
Date: Sun, 20 Oct 2024 21:26:38 +0200
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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 18 Nov 2024 12:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 5 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.