Skip to contentSkip to conversation

musl: Fall back to VERSION when git describe finds nothing

PATCH New Khem Raj 1 participant 2 messages Sep 28

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 musl: Fall back to VERSION when git describe finds nothing

---
 ...-fall-back-to-VERSION-when-git-descr.patch | 43 +++++++++++++++++++
 meta/recipes-core/musl/musl_git.bb            |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 meta/recipes-core/musl/musl/0003-tools-version.sh-fall-back-to-VERSION-when-git-descr.patch
meta/recipes-core/musl/musl/0003-tools-version.sh-fall-back-to-VERSION-when-git-descr.patch new file +43 -0
new file mode 100644
index 0000000000..d77b29179e
@@ -0,0 +1,43 @@
+From 97bb653022ed04c076040ebe899c89d19ddab6bd Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sun, 27 Sep 2026 17:15:34 -0700
+Subject: [PATCH] tools/version.sh: fall back to VERSION when git describe
+ finds nothing
+
+When building from a git checkout, version.sh uses "git describe" and
+only falls back to the VERSION file when git itself is missing. In a
+clone that has no tags, such as the one a build system fetches at a
+fixed revision, git describe prints nothing and libc is built with an
+empty VERSION, so the dynamic linker reports just "Version ". Tools
+that identify musl by that string, e.g. Python's packaging (musllinux
+platform tags), then no longer recognise the system as musl.
+
+Use VERSION, suffixed with -git as before, whenever git describe gives
+no result.
+
+Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2026/09/28/1]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ tools/version.sh | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/tools/version.sh b/tools/version.sh
+index f1cc594..578ff46 100644
+--- a/tools/version.sh
++++ b/tools/version.sh
+@@ -2,8 +2,13 @@
+
+ if test -d .git ; then
+ if type git >/dev/null 2>&1 ; then
+-git describe --tags --match 'v[0-9]*' 2>/dev/null \
+-| sed -e 's/^v//' -e 's/-/-git-/'
++v=$(git describe --tags --match 'v[0-9]*' 2>/dev/null \
++| sed -e 's/^v//' -e 's/-/-git-/')
++fi
++# git describe finds nothing in a clone without tags (e.g. a build
++# system checkout); fall back to the VERSION file then too.
++if test -n "$v" ; then
++echo "$v"
+ else
+ sed 's/$/-git/' < VERSION
+ fi
meta/recipes-core/musl/musl_git.bb +1 -0
index 057113bf16..849b9e46ee 100644
@@ -13,6 +13,7 @@ PV = "${BASEVER}+git"
 SRC_URI = "git://git.musl-libc.org/musl;branch=master \
            file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \
            file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \
+           file://0003-tools-version.sh-fall-back-to-VERSION-when-git-descr.patch \
           "
 
 PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt"
author
#1 lore raw

PATCH 2/2 musl: Upgrade to latest tip of trunk

Brings following changes

* c4e1bb39 fnmatch: fix FNM_PERIOD failure of escaped '.' to match leading '.'
* be5ba569 asprintf: always clear the result pointer on failure
* 3594657b fix printf handling of indirect (asterisk) field width of INT_MIN
* 9ec8ef2c vfwscanf: consistently use MB_LEN_MAX instead of magic number 4
* c2541fd5 stdio: reserve multibyte space in allocated vfwscanf %c conversions
* 7d7b03b8 vf[w]scanf: fix integer overflow in %mlc allocation with large width
* 331cf270 wordexp: clear positional parameters
* 235f7289 wordexp: fix stderr redirection
* 15a1155e fix undefined pointer arithmetic in wcsrchr
* ba6961dd mntent: avoid undefined behavior on long lines
* 48a619ca math: fmaf rewrite
* a9764402 math: fix fmaf subnormal double rounding
* c0c6e62a time: fix TZif version parsing
* 4dad8af7 scandir: remove unused header
* 0270c6f0 scandir: fix qsort usage
* 0c34aa68 scandir: report ENOMEM and EOVERFLOW
* 187765a3 scandir: disable cancellation around cancellation points
* 194f3481 scandir: don't examine errno after closedir()
* b5934c40 scandir: hide that errno is set to 0
* a2985317 catgets: accept (nl_catd)-1 catalog descriptor
* 67e12dfc sprintf: fix one byte truncation when producing string of length INT_MAX
* 27b485a2 math: fix expl on x86
* ec9daea2 math: fix powl(x<0,oddint) for some over/underflow cases
* 38e04447 wordexp: free word on vector allocation failure
* 212926d1 powerpc: set up a proper stack frame in the parent thread in clone()
* 691ba934 riscv: clear fp and ra in _start like on other ports
* 208480aa x32: clone: fix read of stack slot containing ctid
* de5536d8 or1k: fix local-exec tls with large alignment
* c5e2f7e7 fix integer overflow in gai_strerror, hstrerror and regerror
* 47dd1f9c riscv32, riscv64: make alignment padding in ucontext_t explicit
* 89793723 dns: Avoid division-by-zero when zero attempts is specified in resolv.conf
* a0617d05 sys/types.h: add reclen_t
* aeeb7dd4 fix return type of CPU_ISSET[_S] macros
* c674d78f mipsn32: pass syscall arguments as long long instead of long
* 5e9972ea fix build regression in clock_nanosleep on 64-bit archs
* cb0cdc2e clock_nanosleep: don't assume nanosleep syscall exists
* 4a0406c8 ftello: report overflow in buffered stream position
* 30cc6422 fseeko: avoid overflow adjusting relative seek offset
* c2021b77 time: avoid overflow normalizing extreme tm_mday
* e9ac48d2 stdio: avoid invalid pointer arithmetic in fputwc
* 26c909bb math: make acoshf consistent with acosh
* 3e80328d math: fix acosh for x<0
* f21a9653 fix toctou race in popen children's closing of other popen pipes
* b306b16a riscv32: fix missing and extraneous items in syscall table
* 3cc477a2 fix linkage namespace violations in mallocng
* af839d43 math: include missing float.h in logbl
* 50979c5b fix rounding of hex floats in strtod/scanf on ld64 and ld128 archs
* bf96b52a mallocng: fix handling of allocations with extreme alignment
* 64f05291 ldso: fix missing errno code when reporting relro mprotect failure
* bb4b4102 fix fmemopen write-mode streams clobbering final byte with null
* 9086784b fix failure to report write error (ENOSPC) on fmemopen streams
* 5122f9f3 qsort: fix shift UB in shl and shr
* b3291b9a qsort: hard-preclude oob array writes independent of any invariants
* 228da39e qsort: fix leonardo heap corruption from bug in doubleword ctz primitive
* d2f20c49 adjust iswalnum to admit tail call to iswalpha
* 67219f01 fix pathological slowness & incorrect mappings in iconv gb18030 decoder
* 40acb04b regex: reject invalid \digit back reference in BRE
* 0572555d fix incorrect access to tzname[] by strptime %Z conversion specifier
* 3df932bc fix condition for riscv{32,64} non-stup fenv
* 19695004 riscv: don't define fenv macros for soft float
* 31b3ce53 remove non-generic __WORDSIZE definition
* 6f6bd4a1 dns: fix nameserver OOB read in IPv6-disabled fallback

---
 meta/recipes-core/musl/musl_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/musl/musl_git.bb +1 -1
index 849b9e46ee..212bda1f29 100644
@@ -4,7 +4,7 @@
 require musl.inc
 inherit linuxloader
 
-SRCREV = "9fa28ece75d8a2191de7c5bb53bed224c5947417"
+SRCREV = "c4e1bb3994c14ed5112c894d15a451bf00f0d501"
 
 BASEVER = "1.2.6"