Skip to contentSkip to conversation

squashfs-tools: Mark as incompatible with musl

PATCH In review Adrian Bunk 3 participants 3 messages May 22, 2019 – May 23, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 squashfs-tools: Mark as incompatible with musl

Silently ignoring FNM_EXTMATCH makes fnmatch()
behave different from what callers expect.

Mark as incompatible with musl instead of risking
broken runtime behaviour.

The practical consequences should be small since what is used in OE is mainly squashfs-tools-native.

---
 .../squashfs-tools/fix-compat.patch           | 46 -------------------
 .../squashfs-tools/squashfs-tools_git.bb      |  3 ++
 2 files changed, 3 insertions(+), 46 deletions(-)
meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch +0 -46
index 0ce7b4e8ce..87c1e8cac0 100644
@@ -1,39 +1,8 @@
-Define FNM_EXTMATCH if not defined its glibc specific define
 include missing sys/stat.h for stat* function declarations
 
 Upstream-Status: Pending
 Signed-off-by: Khem Raj <[email protected]>
 
-Index: squashfs-tools/action.c
-===================================================================
---- squashfs-tools.orig/action.c
-+++ squashfs-tools/action.c
-@@ -44,6 +44,10 @@
- #include "action.h"
- #include "error.h"
- 
-+#if !defined(FNM_EXTMATCH)
-+#define FNM_EXTMATCH 0
-+#endif
-+
- /*
-  * code to parse actions
-  */
-Index: squashfs-tools/mksquashfs.c
-===================================================================
---- squashfs-tools.orig/mksquashfs.c
-+++ squashfs-tools/mksquashfs.c
-@@ -1261,6 +1261,10 @@ void write_dir(squashfs_inode *inode, st
- 		dir_size + 3, directory_block, directory_offset, NULL, NULL,
- 		dir, 0);
- 
-+#if !defined(FNM_EXTMATCH)
-+#define FNM_EXTMATCH 0
-+#endif
-+
- #ifdef SQUASHFS_TRACE
- 	{
- 		unsigned char *dirp;
 Index: squashfs-tools/pseudo.c
 ===================================================================
 --- squashfs-tools.orig/pseudo.c
@@ -46,18 +15,3 @@ Index: squashfs-tools/pseudo.c
  #include <ctype.h>
  
  #include "pseudo.h"
-Index: squashfs-tools/unsquashfs.c
-===================================================================
---- squashfs-tools.orig/unsquashfs.c
-+++ squashfs-tools/unsquashfs.c
-@@ -42,6 +42,10 @@
- #include <sys/sysmacros.h>
- #endif
- 
-+#ifndef FNM_EXTMATCH
-+#define FNM_EXTMATCH 0
-+#endif
-+
- struct cache *fragment_cache, *data_cache;
- struct queue *to_reader, *to_inflate, *to_writer, *from_writer;
- pthread_t *thread, *inflator_thread;
meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb +3 -0
index 5a8b5f77bd..dc1568a77c 100644
@@ -19,6 +19,9 @@ SRC_URI[lzma.sha256sum] = "c935fd04dd8e0e8c688a3078f3675d699679a90be81c12686837e
 
 S = "${WORKDIR}/git/squashfs-tools"
 
+# needs FNM_EXTMATCH
+COMPATIBLE_HOST_libc-musl = 'null'
+
 EXTRA_OEMAKE = "${PACKAGECONFIG_CONFARGS}"
 
 PACKAGECONFIG ??= "gzip xz lzo lz4 lzma xattr"
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · Adrian Bunk

Silently ignoring FNM_EXTMATCH makes fnmatch()
behave different from what callers expect.

Mark as incompatible with musl instead of risking
broken runtime behaviour.

The practical consequences should be small since what is used in OE is mainly squashfs-tools-native.

This has been working fine on musl for a while ar runtime as well do you see issues ?

Quoted 91 lines
---
 .../squashfs-tools/fix-compat.patch           | 46 -------------------
 .../squashfs-tools/squashfs-tools_git.bb      |  3 ++
 2 files changed, 3 insertions(+), 46 deletions(-)
meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch +0 -46
index 0ce7b4e8ce..87c1e8cac0 100644
@@ -1,39 +1,8 @@
-Define FNM_EXTMATCH if not defined its glibc specific define
 include missing sys/stat.h for stat* function declarations
 
 Upstream-Status: Pending
 Signed-off-by: Khem Raj <[email protected]>
 
-Index: squashfs-tools/action.c
-===================================================================
---- squashfs-tools.orig/action.c
-+++ squashfs-tools/action.c
-@@ -44,6 +44,10 @@
- #include "action.h"
- #include "error.h"
-
-+#if !defined(FNM_EXTMATCH)
-+#define FNM_EXTMATCH 0
-+#endif
-+
- /*
-  * code to parse actions
-  */
-Index: squashfs-tools/mksquashfs.c
-===================================================================
---- squashfs-tools.orig/mksquashfs.c
-+++ squashfs-tools/mksquashfs.c
-@@ -1261,6 +1261,10 @@ void write_dir(squashfs_inode *inode, st
-               dir_size + 3, directory_block, directory_offset, NULL, NULL,
-               dir, 0);
-
-+#if !defined(FNM_EXTMATCH)
-+#define FNM_EXTMATCH 0
-+#endif
-+
- #ifdef SQUASHFS_TRACE
-       {
-               unsigned char *dirp;
 Index: squashfs-tools/pseudo.c
 ===================================================================
 --- squashfs-tools.orig/pseudo.c
@@ -46,18 +15,3 @@ Index: squashfs-tools/pseudo.c
  #include <ctype.h>
 
  #include "pseudo.h"
-Index: squashfs-tools/unsquashfs.c
-===================================================================
---- squashfs-tools.orig/unsquashfs.c
-+++ squashfs-tools/unsquashfs.c
-@@ -42,6 +42,10 @@
- #include <sys/sysmacros.h>
- #endif
-
-+#ifndef FNM_EXTMATCH
-+#define FNM_EXTMATCH 0
-+#endif
-+
- struct cache *fragment_cache, *data_cache;
- struct queue *to_reader, *to_inflate, *to_writer, *from_writer;
- pthread_t *thread, *inflator_thread;
meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb +3 -1
index 5a8b5f77bd..dc1568a77c 100644
@@ -19,6 +19,9 @@ SRC_URI[lzma.sha256sum] = "c935fd04dd8e0e8c688a3078f3675d699679a90be81c12686837e
 
 S = "${WORKDIR}/git/squashfs-tools"
 
+# needs FNM_EXTMATCH
+COMPATIBLE_HOST_libc-musl = 'null'
+
 EXTRA_OEMAKE = "${PACKAGECONFIG_CONFARGS}"
 
 PACKAGECONFIG ??= "gzip xz lzo lz4 lzma xattr"
--

2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 10 lines · Khem Raj
Quoted 9 lines · Adrian Bunk

Silently ignoring FNM_EXTMATCH makes fnmatch()
behave different from what callers expect.

Mark as incompatible with musl instead of risking
broken runtime behaviour.

The practical consequences should be small since what is used in OE is mainly squashfs-tools-native.

The OE patch seems to take the same approach as the (3 year old) upstream fix for the same issue, so if there are concerns maybe good to raise them with upstream...

https://github.com/plougher/squashfs-tools/commit/4280e74de14070869787a9166242f9ce2dafd82e

It does look dubious to me though... and since the patterns passed to fnmatch() look like they ultimately come from the command line, problems might only show up with more advanced usage of the squashfs tools.