Skip to contentSkip to conversation

mbedtls: Test programs with unfortunate names

Buildroot Andreas Düring via buildroot 1 participant 3 messages Sep 15, 2024 – Sep 19, 2024

lore
Share & tools
lore
#0 lore raw

Hello Fabrice, Hello mailing list,

the mbedtls package has a config option BR2_PACKAGE_MBEDTLS_PROGRAMS, which enables some (test) programs to be built and installed. When I scrolled through the build log , I noticed "hello" (programs/hash/hello.c) and "strerror" (programs/util/strerror.c) standing out, which strike me as weird appearing in /usr/bin/.

Therefore I propose to add the following patch file package/mbedtls/0001-install-programs-to-subdirectory.patch

(or do I need to send in a git format-patch adding the patch file? I just used quilt.)

Best regards,
Andreas Düring
--

Install mbedtls test programs to a subdirectory

This is to avoid collisions (e.g. "hello").

programs/aes/CMakeLists.txt +1 -1
Index: mbedtls-2.28.8/programs/aes/CMakeLists.txt
===================================================================
@@ -8,5 +8,5 @@ foreach(exe IN LISTS executables)
 endforeach()
 
 install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
programs/hash/CMakeLists.txt +1 -1
Index: mbedtls-2.28.8/programs/hash/CMakeLists.txt
===================================================================
@@ -9,5 +9,5 @@ foreach(exe IN LISTS executables)
 endforeach()
 
 install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
programs/pkey/CMakeLists.txt +1 -1
Index: mbedtls-2.28.8/programs/pkey/CMakeLists.txt
===================================================================
@@ -35,5 +35,5 @@ foreach(exe IN LISTS executables_mbedcry
 endforeach()
 
 install(TARGETS ${executables_mbedtls} ${executables_mbedcrypto}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
programs/psa/CMakeLists.txt +1 -1
Index: mbedtls-2.28.8/programs/psa/CMakeLists.txt
===================================================================
@@ -18,4 +18,4 @@ install(TARGETS ${executables}
 
 install(PROGRAMS
             key_ladder_demo.sh
-        DESTINATION "bin")
+        DESTINATION "bin/mbedtls")
programs/random/CMakeLists.txt +1 -1
Index: mbedtls-2.28.8/programs/random/CMakeLists.txt
===================================================================
@@ -10,5 +10,5 @@ foreach(exe IN LISTS executables)
 endforeach()
 
 install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
programs/ssl/CMakeLists.txt +1 -1
Index: mbedtls-2.28.8/programs/ssl/CMakeLists.txt
===================================================================
@@ -50,5 +50,5 @@ if(THREADS_FOUND)
 endif(THREADS_FOUND)
 
 install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
programs/test/CMakeLists.txt +1 -1
Index: mbedtls-2.28.8/programs/test/CMakeLists.txt
===================================================================
@@ -64,5 +64,5 @@ foreach(exe IN LISTS executables_libs ex
 endforeach()
 
 install(TARGETS ${executables_libs} ${executables_mbedcrypto}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
programs/util/CMakeLists.txt +1 -1
Index: mbedtls-2.28.8/programs/util/CMakeLists.txt
===================================================================
@@ -13,5 +13,5 @@ foreach(exe IN LISTS executables)
 endforeach()
 
 install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
programs/x509/CMakeLists.txt +1 -1
Index: mbedtls-2.28.8/programs/x509/CMakeLists.txt
===================================================================
@@ -27,5 +27,5 @@ endforeach()
 target_link_libraries(cert_app ${mbedtls_target})
 
 install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw

Hi Andreas,

Quoted 7 lines · Andreas Düring via buildroot

Hello Fabrice, Hello mailing list,

the mbedtls package has a config option BR2_PACKAGE_MBEDTLS_PROGRAMS, which enables some (test) programs to be built and installed. When I scrolled through the build log , I noticed "hello" (programs/hash/hello.c) and "strerror" (programs/util/strerror.c) standing out, which strike me as weird appearing in /usr/bin/.

Why are those names weird? They pretty much do what is mentioned on the tin,
right? And it's optional so I guess you expect these small programs to be installed when you enable the option.

Quoted 2 lines

Therefore I propose to add the following patch file package/mbedtls/0001-install-programs-to-subdirectory.patch

Please take this upstream first. We don't want to maintain a patch like this
indefinitely. And we want to hear upstream's opinion on the idea.

Quoted 2 lines

(or do I need to send in a git format-patch adding the patch file? I just used quilt.)

Since upstream is git, we pretty much require it to be git format-patched,
yes. Also it should be wrapped in a patch to the Buildroot repository so we can just do 'git am' to apply it to Buildroot.

Regards,
Arnout

Quoted 109 lines

Best regards,
Andreas Düring
--

Install mbedtls test programs to a subdirectory

This is to avoid collisions (e.g. "hello").

Index: mbedtls-2.28.8/programs/aes/CMakeLists.txt
===================================================================

programs/aes/CMakeLists.txt +1 -1
@@ -8,5 +8,5 @@ foreach(exe IN LISTS executables)
  endforeach()
 
  install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
          PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

Index: mbedtls-2.28.8/programs/hash/CMakeLists.txt
===================================================================

programs/hash/CMakeLists.txt +1 -1
@@ -9,5 +9,5 @@ foreach(exe IN LISTS executables)
  endforeach()
 
  install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
          PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

Index: mbedtls-2.28.8/programs/pkey/CMakeLists.txt
===================================================================

programs/pkey/CMakeLists.txt +1 -1
@@ -35,5 +35,5 @@ foreach(exe IN LISTS executables_mbedcry
  endforeach()
 
  install(TARGETS ${executables_mbedtls} ${executables_mbedcrypto}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
          PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

Index: mbedtls-2.28.8/programs/psa/CMakeLists.txt
===================================================================

programs/psa/CMakeLists.txt +1 -1
@@ -18,4 +18,4 @@ install(TARGETS ${executables}
 
  install(PROGRAMS
              key_ladder_demo.sh
-        DESTINATION "bin")
+        DESTINATION "bin/mbedtls")

Index: mbedtls-2.28.8/programs/random/CMakeLists.txt
===================================================================

programs/random/CMakeLists.txt +1 -1
@@ -10,5 +10,5 @@ foreach(exe IN LISTS executables)
  endforeach()
 
  install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
          PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

Index: mbedtls-2.28.8/programs/ssl/CMakeLists.txt
===================================================================

programs/ssl/CMakeLists.txt +1 -1
@@ -50,5 +50,5 @@ if(THREADS_FOUND)
  endif(THREADS_FOUND)
 
  install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
          PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

Index: mbedtls-2.28.8/programs/test/CMakeLists.txt
===================================================================

programs/test/CMakeLists.txt +1 -1
@@ -64,5 +64,5 @@ foreach(exe IN LISTS executables_libs ex
  endforeach()
 
  install(TARGETS ${executables_libs} ${executables_mbedcrypto}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
          PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

Index: mbedtls-2.28.8/programs/util/CMakeLists.txt
===================================================================

programs/util/CMakeLists.txt +1 -1
@@ -13,5 +13,5 @@ foreach(exe IN LISTS executables)
  endforeach()
 
  install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
          PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

Index: mbedtls-2.28.8/programs/x509/CMakeLists.txt
===================================================================

programs/x509/CMakeLists.txt +1 -1
@@ -27,5 +27,5 @@ endforeach()
  target_link_libraries(cert_app ${mbedtls_target})
 
  install(TARGETS ${executables}
-        DESTINATION "bin"
+        DESTINATION "bin/mbedtls"
          PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hello Arnout,

Quoted 1 line

Why are those names weird? [...] And it's optional [...]

I did not actually expect a program "hello" to be installed, but I get your point.
I briefly thought of it, but I don't adding think an exhaustive list of the programs in the Config description would be appropriate either (maintenance effort, and those who are curious can actually look it up in the mbedtls source archive, after all).

Quoted 2 lines

Please take this upstream first. We don't want to maintain a patch like this indefinitely.

That's a good point, especially since the patch would have to be maintained / updated in case programs (or rather, subdirectories) are added or removed by mbedtls.

Best regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot