[Openvpn-devel,v1] test_tls_crypt: Fix issue with temp file name on big endian systems

Message ID 20260702074746.3129-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] test_tls_crypt: Fix issue with temp file name on big endian systems |

Commit Message

Gert Doering July 2, 2026, 7:47 a.m. UTC
  From: Frank Lichtenheld <frank@lichtenheld.com>

Encountered by Fedora s390x build instances.

Change-Id: Iba577d662b389de539b81034735e437199cb495d
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1761
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1761
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <arne-openvpn@rfc2549.org>
  

Comments

Gert Doering July 2, 2026, 9:38 a.m. UTC | #1
Thanks.  Confirm that it works on FreeBSD/64.  Couldn't test on AIX,
as that test needs working ld --wrap and it wouldn't work "as is" for
me on that platform.

Your patch has been applied to the master and release/2.7 branch.

commit 7141f625c6114e08e40696464bfc36d5c5743683 (master)
commit c3d929cbfde012fbacae7d447e1755b07f64b464 (release/2.7)
Author: Frank Lichtenheld
Date:   Thu Jul 2 09:47:40 2026 +0200

     test_tls_crypt: Fix issue with temp file name on big endian systems

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1761
     Message-Id: <20260702074746.3129-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg37454.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
  

Patch

diff --git a/tests/unit_tests/openvpn/test_tls_crypt.c b/tests/unit_tests/openvpn/test_tls_crypt.c
index 82b1dc8..1d8ac25 100644
--- a/tests/unit_tests/openvpn/test_tls_crypt.c
+++ b/tests/unit_tests/openvpn/test_tls_crypt.c
@@ -722,8 +722,13 @@ 
 
     tls_options.tmp_dir = "/tmp";
 
-    /* Since we override rand_bytes the tmpfile name is non-random as well */
-    const char *non_random_tmpfile = "/tmp/openvpn_tls_crypt_v2_metadata__706050403020100706050403020100.tmp";
+    /* Since we override rand_bytes the tmpfile name is non-random as well.
+     * Build the expected name via the same code path as
+     * platform_create_temp_file() */
+    char non_random_tmpfile[128];
+    snprintf(non_random_tmpfile, sizeof(non_random_tmpfile),
+             "%s/" PACKAGE "_tls_crypt_v2_metadata__%08" PRIx64 "%08" PRIx64 ".tmp",
+             tls_options.tmp_dir, get_random(), get_random());
     unlink(non_random_tmpfile);
 
     expect_string(__wrap_buffer_write_file, filename, non_random_tmpfile);