Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Ismael Luceno (ee96168acaade40de7c063086d559284225464cb)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (ee96168acaade40de7c063086d559284225464cb)
  • Date: Fri, 9 Jun 2023 20:58:06 +0000

GIT changes to master grimoire by Ismael Luceno <ismael AT sourcemage.org>:

libs/musl/DETAILS
| 4
libs/musl/HISTORY
| 8
libs/musl/patches/0001-glob-introduce-context-struct-for-do_glob.patch
| 148 ++++++++

libs/musl/patches/0005-add-internal-aliases-__opendir-__readdir-and-__close.patch
| 89 -----
libs/musl/patches/0006-glob-implement-GLOB_ALTDIRFUNC-et-al.patch
| 173 ----------
5 files changed, 158 insertions(+), 264 deletions(-)

New commits:
commit ee96168acaade40de7c063086d559284225464cb
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

musl 1.2.4

diff --git a/libs/musl/DETAILS b/libs/musl/DETAILS
index 04c4685..cf531dc 100755
--- a/libs/musl/DETAILS
+++ b/libs/musl/DETAILS
@@ -1,11 +1,11 @@
SPELL=musl
- VERSION=1.2.3
+ VERSION=1.2.4
SECURITY_PATCH=1
SOURCE="$SPELL-$VERSION.tar.gz"
WEB_SITE="https://musl.libc.org";
# Watch: https://musl.libc.org
SOURCE_URL[0]="$WEB_SITE/releases/${SOURCE}"
-
SOURCE_HASH=sha512:9332f713d3eb7de4369bc0327d99252275ee52abf523ee34b894b24a387f67579787f7c72a46cf652e090cffdb0bc3719a4e7b84dca66890b6a37f12e8ad089c
+
SOURCE_HASH=sha512:498ec5d7941194a8806f4d42f0f6d218c862996ef1398b737d0d06995e0b7a6574b240a48088f6b84016b14b2776fe463f829dcb11149cdfc1023d496b235c55
SOURCE_DIRECTORY="$BUILD_DIRECTORY/$SPELL-$VERSION"
STAGED_INSTALL=off
LICENSE[0]="MIT"
diff --git a/libs/musl/HISTORY b/libs/musl/HISTORY
index 90f766f..497959c 100644
--- a/libs/musl/HISTORY
+++ b/libs/musl/HISTORY
@@ -1,3 +1,11 @@
+2023-06-09 Ismael Luceno <ismael AT sourcemage.org>
+ *
patches/0005-add-internal-aliases-__opendir-__readdir-and-__close.patch,
+ patches/0006-glob-implement-GLOB_ALTDIRFUNC-et-al.patch:
+ dropped patches
+ * patches/0001-glob-introduce-context-struct-for-do_glob.patch:
+ added footprint optimization patch
+ * DETAILS: updated spell to 1.2.4
+
2022-05-06 Ismael Luceno <ismael AT sourcemage.org>
* DETAILS: updated spell to 1.2.3

diff --git
a/libs/musl/patches/0001-glob-introduce-context-struct-for-do_glob.patch
b/libs/musl/patches/0001-glob-introduce-context-struct-for-do_glob.patch
new file mode 100644
index 0000000..b90bab3
--- /dev/null
+++ b/libs/musl/patches/0001-glob-introduce-context-struct-for-do_glob.patch
@@ -0,0 +1,148 @@
+From 0285118ef8f42e0b134eb30354f6bc1b0890fe9c Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Fri, 27 Aug 2021 19:10:25 +0200
+Subject: [PATCH] glob: introduce context struct for do_glob
+
+this reduces the function frame by sharing more state in the recursion,
+and produces a slightly smaller object file with GCC 10.3 on x86_64:
+
+ text data bss dec hex filename
+ 2303 0 0 2303 8ff glob-ctx.lo
+ 2356 0 0 2356 934 glob-noctx.lo
+
+Signed-off-by: Ismael Luceno <ismael AT iodev.co.uk>
+---
+
+Notes:
+ Changes since v1:
+
+ - Make context struct constant
+
+ src/regex/glob.c | 42 +++++++++++++++++++++++++++---------------
+ 1 file changed, 27 insertions(+), 15 deletions(-)
+
+diff --git a/src/regex/glob.c b/src/regex/glob.c
+index a490644653a9..d8377f35d7d3 100644
+--- a/src/regex/glob.c
++++ b/src/regex/glob.c
+@@ -32,10 +32,16 @@ static int append(struct match **tail, const char *name,
size_t len, int mark)
+ return 0;
+ }
+
+-static int do_glob(char *buf, size_t pos, int type, char *pat, int flags,
int (*errfunc)(const char *path, int err), struct match **tail)
++struct glob_ctx {
++ struct match **tail;
++ int flags;
++ int (*errfunc)(const char *path, int err);
++};
++
++static int do_glob(char *buf, size_t pos, int type, char *pat, const struct
glob_ctx *restrict ctx)
+ {
+ /* If GLOB_MARK is unused, we don't care about type. */
+- if (!type && !(flags & GLOB_MARK)) type = DT_REG;
++ if (!type && !(ctx->flags & GLOB_MARK)) type = DT_REG;
+
+ /* Special-case the remaining pattern being all slashes, in
+ * which case we can use caller-passed type if it's a dir. */
+@@ -55,7 +61,7 @@ static int do_glob(char *buf, size_t pos, int type, char
*pat, int flags, int (*
+ break;
+ } else if (pat[i] == '[') {
+ in_bracket = 1;
+- } else if (pat[i] == '\\' && !(flags & GLOB_NOESCAPE)) {
++ } else if (pat[i] == '\\' && !(ctx->flags & GLOB_NOESCAPE)) {
+ /* Backslashes inside a bracket are (at least by
+ * our interpretation) non-special, so if next
+ * char is ']' we have a complete expression. */
+@@ -100,23 +106,23 @@ static int do_glob(char *buf, size_t pos, int type,
char *pat, int flags, int (*
+ * or if that fails, use lstat for determining existence to
+ * avoid false negatives in the case of broken symlinks. */
+ struct stat st;
+- if ((flags & GLOB_MARK) && (!type||type==DT_LNK) &&
!stat(buf, &st)) {
++ if ((ctx->flags & GLOB_MARK) && (!type||type==DT_LNK) &&
!stat(buf, &st)) {
+ if (S_ISDIR(st.st_mode)) type = DT_DIR;
+ else type = DT_REG;
+ }
+ if (!type && lstat(buf, &st)) {
+- if (errno!=ENOENT && (errfunc(buf, errno) || (flags &
GLOB_ERR)))
++ if (errno!=ENOENT && (ctx->errfunc(buf, errno) ||
(ctx->flags & GLOB_ERR)))
+ return GLOB_ABORTED;
+ return 0;
+ }
+- if (append(tail, buf, pos, (flags & GLOB_MARK) &&
type==DT_DIR))
++ if (append(ctx->tail, buf, pos, (ctx->flags & GLOB_MARK) &&
type==DT_DIR))
+ return GLOB_NOSPACE;
+ return 0;
+ }
+ char *p2 = strchr(pat, '/'), saved_sep = '/';
+ /* Check if the '/' was escaped and, if so, remove the escape char
+ * so that it will not be unpaired when passed to fnmatch. */
+- if (p2 && !(flags & GLOB_NOESCAPE)) {
++ if (p2 && !(ctx->flags & GLOB_NOESCAPE)) {
+ char *p;
+ for (p=p2; p>pat && p[-1]=='\\'; p--);
+ if ((p2-p)%2) {
+@@ -126,7 +132,7 @@ static int do_glob(char *buf, size_t pos, int type, char
*pat, int flags, int (*
+ }
+ DIR *dir = opendir(pos ? buf : ".");
+ if (!dir) {
+- if (errfunc(buf, errno) || (flags & GLOB_ERR))
++ if (ctx->errfunc(buf, errno) || (ctx->flags & GLOB_ERR))
+ return GLOB_ABORTED;
+ return 0;
+ }
+@@ -142,22 +148,22 @@ static int do_glob(char *buf, size_t pos, int type,
char *pat, int flags, int (*
+
+ if (p2) *p2 = 0;
+
+- int fnm_flags= ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
+- | ((!(flags & GLOB_PERIOD)) ? FNM_PERIOD : 0);
++ int fnm_flags= ((ctx->flags & GLOB_NOESCAPE) ? FNM_NOESCAPE :
0)
++ | ((!(ctx->flags & GLOB_PERIOD)) ? FNM_PERIOD : 0);
+
+ if (fnmatch(pat, de->d_name, fnm_flags))
+ continue;
+
+ /* With GLOB_PERIOD, don't allow matching . or .. unless
+ * fnmatch would match them with FNM_PERIOD rules in effect.
*/
+- if (p2 && (flags & GLOB_PERIOD) && de->d_name[0]=='.'
++ if (p2 && (ctx->flags & GLOB_PERIOD) && de->d_name[0]=='.'
+ && (!de->d_name[1] || de->d_name[1]=='.' &&
!de->d_name[2])
+ && fnmatch(pat, de->d_name, fnm_flags | FNM_PERIOD))
+ continue;
+
+ memcpy(buf+pos, de->d_name, l+1);
+ if (p2) *p2 = saved_sep;
+- int r = do_glob(buf, pos+l, de->d_type, p2 ? p2 : "", flags,
errfunc, tail);
++ int r = do_glob(buf, pos+l, de->d_type, p2 ? p2 : "", ctx);
+ if (r) {
+ closedir(dir);
+ return r;
+@@ -166,7 +172,7 @@ static int do_glob(char *buf, size_t pos, int type, char
*pat, int flags, int (*
+ int readerr = errno;
+ if (p2) *p2 = saved_sep;
+ closedir(dir);
+- if (readerr && (errfunc(buf, errno) || (flags & GLOB_ERR)))
++ if (readerr && (ctx->errfunc(buf, errno) || (ctx->flags & GLOB_ERR)))
+ return GLOB_ABORTED;
+ errno = old_errno;
+ return 0;
+@@ -248,8 +254,14 @@ int glob(const char *restrict pat, int flags, int
(*errfunc)(const char *path, i
+ char *s = p;
+ if ((flags & (GLOB_TILDE | GLOB_TILDE_CHECK)) && *p == '~')
+ error = expand_tilde(&s, buf, &pos);
+- if (!error)
+- error = do_glob(buf, pos, 0, s, flags, errfunc,
&tail);
++ if (!error) {
++ const struct glob_ctx ctx = {
++ .tail = &tail,
++ .flags = flags,
++ .errfunc = errfunc,
++ };
++ error = do_glob(buf, pos, 0, s, &ctx);
++ }
+ free(p);
+ }
+
+--
+2.40.1
+
diff --git
a/libs/musl/patches/0005-add-internal-aliases-__opendir-__readdir-and-__close.patch

b/libs/musl/patches/0005-add-internal-aliases-__opendir-__readdir-and-__close.patch
deleted file mode 100644
index 9049d18..0000000
---
a/libs/musl/patches/0005-add-internal-aliases-__opendir-__readdir-and-__close.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-From d660a4f71cb5a4cbfbdce6ffc0f8ffdbe80db7d5 Mon Sep 17 00:00:00 2001
-From: Ismael Luceno <ismael AT iodev.co.uk>
-Date: Thu, 1 Aug 2019 15:26:46 +0200
-Subject: [PATCH 5/6] add internal aliases __opendir, __readdir and __closedir
-
-Signed-off-by: Ismael Luceno <ismael AT iodev.co.uk>
----
- src/dirent/closedir.c | 4 +++-
- src/dirent/opendir.c | 4 +++-
- src/dirent/readdir.c | 5 +++--
- src/include/dirent.h | 10 ++++++++++
- 4 files changed, 19 insertions(+), 4 deletions(-)
- create mode 100644 src/include/dirent.h
-
-diff --git a/src/dirent/closedir.c b/src/dirent/closedir.c
-index e794ae9ca44b..f4249f56e210 100644
---- a/src/dirent/closedir.c
-+++ b/src/dirent/closedir.c
-@@ -3,9 +3,11 @@
- #include <stdlib.h>
- #include "__dirent.h"
-
--int closedir(DIR *dir)
-+int __closedir(DIR *dir)
- {
- int ret = close(dir->fd);
- free(dir);
- return ret;
- }
-+
-+weak_alias(__closedir, closedir);
-diff --git a/src/dirent/opendir.c b/src/dirent/opendir.c
-index 5cb84e303fee..4123c81994cd 100644
---- a/src/dirent/opendir.c
-+++ b/src/dirent/opendir.c
-@@ -5,7 +5,7 @@
- #include "__dirent.h"
- #include "syscall.h"
-
--DIR *opendir(const char *name)
-+DIR *__opendir(const char *name)
- {
- int fd;
- DIR *dir;
-@@ -19,3 +19,5 @@ DIR *opendir(const char *name)
- dir->fd = fd;
- return dir;
- }
-+
-+weak_alias(__opendir, opendir);
-diff --git a/src/dirent/readdir.c b/src/dirent/readdir.c
-index 569fc7057737..cb34a258569c 100644
---- a/src/dirent/readdir.c
-+++ b/src/dirent/readdir.c
-@@ -7,7 +7,7 @@
- typedef char dirstream_buf_alignment_check[1-2*(int)(
- offsetof(struct __dirstream, buf) % sizeof(off_t))];
-
--struct dirent *readdir(DIR *dir)
-+struct dirent *__readdir(DIR *dir)
- {
- struct dirent *de;
-
-@@ -26,4 +26,5 @@ struct dirent *readdir(DIR *dir)
- return de;
- }
-
--weak_alias(readdir, readdir64);
-+weak_alias(__readdir, readdir64);
-+weak_alias(__readdir, readdir);
-diff --git a/src/include/dirent.h b/src/include/dirent.h
-new file mode 100644
-index 000000000000..918e123566d4
---- /dev/null
-+++ b/src/include/dirent.h
-@@ -0,0 +1,10 @@
-+#ifndef DIRENT_H
-+#define DIRENT_H
-+
-+#include "../../include/dirent.h"
-+
-+hidden int __closedir(DIR *);
-+hidden DIR *__opendir(const char *);
-+hidden struct dirent *__readdir(DIR *);
-+
-+#endif
---
-2.22.0
-
diff --git
a/libs/musl/patches/0006-glob-implement-GLOB_ALTDIRFUNC-et-al.patch
b/libs/musl/patches/0006-glob-implement-GLOB_ALTDIRFUNC-et-al.patch
deleted file mode 100644
index 0372778..0000000
--- a/libs/musl/patches/0006-glob-implement-GLOB_ALTDIRFUNC-et-al.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-From a0d46379e577a3a9cf4d3fc3582bb6000f43c058 Mon Sep 17 00:00:00 2001
-From: Ismael Luceno <ismael AT iodev.co.uk>
-Date: Tue, 30 Jul 2019 21:48:31 +0200
-Subject: [PATCH 6/6] glob: implement GLOB_ALTDIRFUNC et al
-
-Signed-off-by: Ismael Luceno <ismael AT iodev.co.uk>
----
- include/glob.h | 8 +++++++-
- src/regex/glob.c | 47 +++++++++++++++++++++++++++++++++++++----------
- 2 files changed, 44 insertions(+), 11 deletions(-)
-
-diff --git a/include/glob.h b/include/glob.h
-index 0ff70bdfeef2..0db4780f6a00 100644
---- a/include/glob.h
-+++ b/include/glob.h
-@@ -16,7 +16,12 @@ typedef struct {
- char **gl_pathv;
- size_t gl_offs;
- int __dummy1;
-- void *__dummy2[5];
-+
-+ void (*gl_closedir)(void *);
-+ struct dirent *(*gl_readdir)(void *);
-+ void *(*gl_opendir)(const char *);
-+ int (*gl_lstat)(const char *__restrict, struct stat *__restrict);
-+ int (*gl_stat)(const char *__restrict, struct stat *__restrict);
- } glob_t;
-
- int glob(const char *__restrict, int, int (*)(const char *, int), glob_t
*__restrict);
-@@ -31,6 +36,7 @@ void globfree(glob_t *);
- #define GLOB_NOESCAPE 0x40
- #define GLOB_PERIOD 0x80
-
-+#define GLOB_ALTDIRFUNC 0x0200
- #define GLOB_NOMAGIC 0x0800
- #define GLOB_TILDE 0x1000
- #define GLOB_TILDE_CHECK 0x4000
-diff --git a/src/regex/glob.c b/src/regex/glob.c
-index 7780e21ee113..4f329f053fe0 100644
---- a/src/regex/glob.c
-+++ b/src/regex/glob.c
-@@ -1,7 +1,7 @@
- #define _BSD_SOURCE
-+#include <sys/stat.h>
- #include <glob.h>
- #include <fnmatch.h>
--#include <sys/stat.h>
- #include <dirent.h>
- #include <limits.h>
- #include <string.h>
-@@ -11,6 +11,14 @@
- #include <unistd.h>
- #include <pwd.h>
-
-+struct dirfn {
-+ void (*closedir)(void *);
-+ struct dirent *(*readdir)(void *);
-+ void *(*opendir)(const char *);
-+ int (*lstat)(const char *restrict, struct stat *restrict);
-+ int (*stat)(const char *restrict, struct stat *restrict);
-+};
-+
- struct match
- {
- struct match *next;
-@@ -32,7 +40,7 @@ static int append(struct match **tail, const char *name,
size_t len, int mark)
- return 0;
- }
-
--static int do_glob(char *buf, size_t pos, int type, char *pat, int flags,
int (*errfunc)(const char *path, int err), struct match **tail)
-+static int do_glob(char *buf, size_t pos, int type, char *pat, int flags,
int (*errfunc)(const char *path, int err), const struct dirfn * const
restrict dirfn, struct match **tail)
- {
- /* If GLOB_MARK is unused, we don't care about type. */
- if (!type && !(flags & GLOB_MARK)) type = DT_REG;
-@@ -100,11 +108,11 @@ static int do_glob(char *buf, size_t pos, int type,
char *pat, int flags, int (*
- * or if that fails, use lstat for determining existence to
- * avoid false negatives in the case of broken symlinks. */
- struct stat st;
-- if ((flags & GLOB_MARK) && (!type||type==DT_LNK) &&
!stat(buf, &st)) {
-+ if ((flags & GLOB_MARK) && (!type||type==DT_LNK) &&
!dirfn->stat(buf, &st)) {
- if (S_ISDIR(st.st_mode)) type = DT_DIR;
- else type = DT_REG;
- }
-- if (!type && lstat(buf, &st)) {
-+ if (!type && dirfn->lstat(buf, &st)) {
- if (errno!=ENOENT && (errfunc(buf, errno) || (flags &
GLOB_ERR)))
- return GLOB_ABORTED;
- return 0;
-@@ -124,7 +132,7 @@ static int do_glob(char *buf, size_t pos, int type, char
*pat, int flags, int (*
- saved_sep = '\\';
- }
- }
-- DIR *dir = opendir(pos ? buf : ".");
-+ DIR *dir = dirfn->opendir(pos ? buf : ".");
- if (!dir) {
- if (errfunc(buf, errno) || (flags & GLOB_ERR))
- return GLOB_ABORTED;
-@@ -132,7 +140,7 @@ static int do_glob(char *buf, size_t pos, int type, char
*pat, int flags, int (*
- }
- int old_errno = errno;
- struct dirent *de;
-- while (errno=0, de=readdir(dir)) {
-+ while (errno=0, de=dirfn->readdir(dir)) {
- /* Quickly skip non-directories when there's pattern left. */
- if (p2 && de->d_type && de->d_type!=DT_DIR &&
de->d_type!=DT_LNK)
- continue;
-@@ -157,15 +165,15 @@ static int do_glob(char *buf, size_t pos, int type,
char *pat, int flags, int (*
-
- memcpy(buf+pos, de->d_name, l+1);
- if (p2) *p2 = saved_sep;
-- int r = do_glob(buf, pos+l, de->d_type, p2 ? p2 : "", flags,
errfunc, tail);
-+ int r = do_glob(buf, pos+l, de->d_type, p2 ? p2 : "", flags,
errfunc, dirfn, tail);
- if (r) {
-- closedir(dir);
-+ dirfn->closedir(dir);
- return r;
- }
- }
- int readerr = errno;
- if (p2) *p2 = saved_sep;
-- closedir(dir);
-+ dirfn->closedir(dir);
- if (readerr && (errfunc(buf, errno) || (flags & GLOB_ERR)))
- return GLOB_ABORTED;
- errno = old_errno;
-@@ -224,6 +232,10 @@ static int expand_tilde(char **pat, char *buf, size_t
*pos)
- return 0;
- }
-
-+static void wrap_closedir(void *p) { __closedir(p); }
-+static struct dirent *wrap_readdir(void *d) { return __readdir(d); }
-+static void *wrap_opendir(const char *path) { return __opendir(path); }
-+
- int glob(const char *restrict pat, int flags, int (*errfunc)(const char
*path, int err), glob_t *restrict g)
- {
- struct match head = { .next = NULL }, *tail = &head;
-@@ -231,9 +243,24 @@ int glob(const char *restrict pat, int flags, int
(*errfunc)(const char *path, i
- size_t offs = (flags & GLOB_DOOFFS) ? g->gl_offs : 0;
- int error = 0;
- char buf[PATH_MAX];
-+ struct dirfn dirfn;
-
- if (!errfunc) errfunc = ignore_err;
-
-+ if (flags & GLOB_ALTDIRFUNC) {
-+ dirfn.closedir = g->gl_closedir;
-+ dirfn.readdir = g->gl_readdir;
-+ dirfn.opendir = g->gl_opendir;
-+ dirfn.lstat = g->gl_lstat;
-+ dirfn.stat = g->gl_stat;
-+ } else {
-+ dirfn.closedir = wrap_closedir;
-+ dirfn.readdir = wrap_readdir;
-+ dirfn.opendir = wrap_opendir;
-+ dirfn.lstat = lstat;
-+ dirfn.stat = stat;
-+ }
-+
- if (!(flags & GLOB_APPEND)) {
- g->gl_offs = offs;
- g->gl_pathc = 0;
-@@ -249,7 +276,7 @@ int glob(const char *restrict pat, int flags, int
(*errfunc)(const char *path, i
- if ((flags & (GLOB_TILDE | GLOB_TILDE_CHECK)) && *p == '~')
- error = expand_tilde(&s, buf, &pos);
- if (!error)
-- error = do_glob(buf, pos, 0, s, flags, errfunc,
&tail);
-+ error = do_glob(buf, pos, 0, s, flags, errfunc,
&dirfn, &tail);
- free(p);
- }
-
---
-2.22.0
-



  • [SM-Commit] GIT changes to master grimoire by Ismael Luceno (ee96168acaade40de7c063086d559284225464cb), Ismael Luceno, 06/09/2023

Archive powered by MHonArc 2.6.24.

Top of Page