bug#71980: [3.0.10] posix.test uses depcrecated tmpnam
Tomas Volf <[email protected]>
| Newsgroups | gmane.lisp.guile.bugs |
|---|---|
| Message-ID | <ZorGcMfXZWYyj4fQ@ws> |
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, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmaKxnAACgkQL7/ufbZ/ wanGOQ//cVMT7/Y21eVTKxu8q6OaEllZaghcD2kasmHzJPbL428Mm02iDeR5sVDH beylRTk1qev8TNmIHt03joAQPZL0fkp9Px7hG0APNtdCBbUhuHMdGUPp7iQ8v6WZ ooqbFIfg00ZgbMgnBxKEZQBX2++H1BXUkTozz7dygXNOGoY/EudqxLhT6PmfWDM9 gbNwtPpqdU+ruimlPYSAbZtt3siSdr6hvnjVyWYT947U4o7/pdJddd82JUX03GCw 8eaaUyllJq2p/qXNZduKw0GwgsB6n+j8SHHrldG0hZ+WoKO2TRJ8rHT07I8MkUTm +hxCqPuZlAtWrkFEW0tNMMDx8Evdgq8urM1HJoSMwAnz/s8Kyzlz4N8ghfLqMdc5 K+THBgeIBnUzpq11CRR4cCFuUYd3uUyd3M1MGdcKEPJyuxxqanufJX0PXIe1E83q wo0//CHEv/gtcEmWX7y1DDlGiDo3NGwwQB06wNt4ewI3lE68HWSZtv5HWEwaT2PO obJ2Vxuy+117xoplb49fzrUX792WiGkZr71Ojx7o4VhDB2HZFS/eo9jZsa7MNLmI 4un0GY2+WWfzLBje3XDr9vrZ/B5fnzoQ8URP6LRcNlA8vtrg8JOS3xhc7tCz2nHB nDG4x0qYamaDBiL85FL1/DINSaijykHAadafQKHcOBrEN6tklNc= =wzwt -----END PGP SIGNATURE-----