Skip to contentSkip to conversation

Patch to support latest buildroot environment

PATCH New Olivier Singla 3 participants 3 messages Aug 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Patch to support latest buildroot environment

From: Olivier <[email protected]>

Fixes:
- launcher.c: added include to <sys/ttydefaults.h> to avoid missing definitions
- launcher.c: do not include utmpx.h (since ptsname_r is already defined in stdlib.h)

---
 .../0002-launcher.c-fix-ttydef-utmpx.patch         | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 package/shellinabox/0002-launcher.c-fix-ttydef-utmpx.patch
package/shellinabox/0002-launcher.c-fix-ttydef-utmpx.patch new file +28 -0
new file mode 100644
index 0000000..54cb699
@@ -0,0 +1,28 @@
+launcher.c: added include to <sys/ttydefaults.h> to avoid missing definitions
+launcher.c: do not include utmpx.h (since ptsname_r is already defined in stdlib.h)
+
+Signed-off-by:  "Olivier Singla" <[email protected]>
+
+--- shellinabox-v2.19/shellinabox/launcher.c.orig	2016-08-01 18:43:01.628002777 -0400
++++ shellinabox-v2.19/shellinabox/launcher.c	2016-08-01 18:45:14.943444066 -0400
+@@ -81,6 +81,10 @@
+ #include <sys/uio.h>
+ #endif
+ 
++#ifndef TTYDEF_IFLAG
++#include <sys/ttydefaults.h>
++#endif
++
+ #ifdef HAVE_UTIL_H
+ #include <util.h>
+ #endif
+@@ -90,7 +94,8 @@
+ #endif
+ 
+ #ifdef HAVE_UTMPX_H
+-#include <utmpx.h>
++//#include <utmpx.h>
++#undef HAVE_UTMPX_H
+ #endif
+ 
+ #if defined(HAVE_SECURITY_PAM_APPL_H)
Signature · 1 line
2.5.5
#1 lore raw

PATCH 1/1 Patch to support latest buildroot environment

Quoted 8 lines · Olivier Singla

From: Olivier <[email protected]>

Fixes:
- launcher.c: added include to <sys/ttydefaults.h> to avoid missing definitions
- launcher.c: do not include utmpx.h (since ptsname_r is already defined in stdlib.h)

I hope -D_GNU_SOURCE is passed in CFLAGS for relevant source file as well.

Quoted 29 lines

---
.../0002-launcher.c-fix-ttydef-utmpx.patch | 28 ++++++++++++++++++++++

1 file changed, 28 insertions(+)

create mode 100644 package/shellinabox/0002-launcher.c-fix-ttydef-utmpx.patch

package/shellinabox/0002-launcher.c-fix-ttydef-utmpx.patch new file +16 -0
new file mode 100644
index 0000000..54cb699
@@ -0,0 +1,28 @@
+launcher.c: added include to <sys/ttydefaults.h> to avoid missing definitions
+launcher.c: do not include utmpx.h (since ptsname_r is already defined in stdlib.h)
+
+Signed-off-by:  "Olivier Singla" <[email protected]>
+
+--- shellinabox-v2.19/shellinabox/launcher.c.orig	2016-08-01 18:43:01.628002777 -0400
++++ shellinabox-v2.19/shellinabox/launcher.c	2016-08-01 18:45:14.943444066 -0400
+@@ -81,6 +81,10 @@
+ #include <sys/uio.h>
+ #endif
+
++#ifndef TTYDEF_IFLAG
++#include <sys/ttydefaults.h>
++#endif
++
+ #ifdef HAVE_UTIL_H

package/shellinabox/0002-launcher.c-fix-ttydef-utmpx.patch line 26

Quoted 10 lines
package/shellinabox/0002-launcher.c-fix-ttydef-utmpx.patch new file +10 -0
+ #include <util.h>
+ #endif
+@@ -90,7 +94,8 @@
+ #endif
+
+ #ifdef HAVE_UTMPX_H
+-#include <utmpx.h>
++//#include <utmpx.h>
++#undef HAVE_UTMPX_H
+ #endif

should the whole block be removed instead ?

Quoted 9 lines
package/shellinabox/0002-launcher.c-fix-ttydef-utmpx.patch new file +2 -1
+
+ #if defined(HAVE_SECURITY_PAM_APPL_H)
--

2.5.5

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160804/d9fff13e/attachment.asc>

#2 lore raw

PATCH 1/1 Patch to support latest buildroot environment

In reply to Olivier Singla

Hello,

Quoted 1 line · Olivier Singla

From: Olivier <[email protected]>

This should have been:

From: Olivier Singla <[email protected]>

Indeed your From: line must match the Signed-off-by line.

Also, the commit title, "Patch to support latest buildroot environment" is completely wrong. The patch has absolutely *nothing* to do with supporting the latest Buildroot environment. It is about making shellinabox to build with the musl C library. So the title should have been something like:

shellinabox: fix build with the musl C library

Quoted 3 lines

++#ifndef TTYDEF_IFLAG
++#include <sys/ttydefaults.h>
++#endif

The #ifndef test is completely unneeded. TTYDEF_* are available from <sys/ttydefaults.h>, so it should just be included.

Quoted 5 lines

+ #ifdef HAVE_UTMPX_H
+-#include <utmpx.h>
++//#include <utmpx.h>
++#undef HAVE_UTMPX_H
+ #endif

That's a complete hack and not the proper solution. The reason of the build failure is that musl does "#define utmp utmpx" which causes some symbol clash in launcher.c.

I have reported this problem to the musl developers:
http://www.openwall.com/lists/musl/2016/08/04/8. And in the mean time, I've just added a change to shellinabox.mk to pass an autoconf variable that makes the configure script believe that <utmpx.h> is not available when the toolchain uses the musl C library.

In the end, I did three patches:

1/ To turn the existing shellinabox patch to a Git formatted patch.

    https://git.buildroot.org/buildroot/commit/?id=99ed68487a83380cf00ba5c602746ada3f995bf7

2/ One to add the patch fixing the missing <sys/ttydefaults.h> include
and add the hack for <utmpx.h>

https://git.buildroot.org/buildroot/commit/?id=35ccd358b304413229fc2e32f1318426cbb23a20

3/ One to disable shellinabox for BR2_STATIC_LIBS builds, since it
uses <dlfcn.h>. This was also causing some other build failures.

https://git.buildroot.org/buildroot/commit/?id=1cad81f0fed3934449a28c35316684393d702a74

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com