diff --git a/recipes/0001-50278-use-man-w-in-preference-to-manpath-fix-caching.patch b/recipes/0001-50278-use-man-w-in-preference-to-manpath-fix-caching.patch new file mode 100644 index 00000000..375f6819 --- /dev/null +++ b/recipes/0001-50278-use-man-w-in-preference-to-manpath-fix-caching.patch @@ -0,0 +1,84 @@ +From 1e52cd968d7ffd9da3249ef01f6c41f8b29e4df3 Mon Sep 17 00:00:00 2001 +From: Bart Schaefer +Date: Sun, 22 May 2022 15:50:45 -0700 +Subject: [PATCH] 50278: use `man -w` in preference to `manpath`; fix caching + and precedence of -M + +--- + ChangeLog | 5 ++++ + Completion/Unix/Command/_man | 45 ++++++++++++++++++++++-------------- + 2 files changed, 33 insertions(+), 17 deletions(-) + +diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man +index dba1d13dc..190811e41 100644 +--- a/Completion/Unix/Command/_man ++++ b/Completion/Unix/Command/_man +@@ -16,7 +16,7 @@ + _man() { + local dirs expl mrd awk variant noinsert + local -a context line state state_descr args modes +- local -aU sects ++ local -aU sects _manpath + local -A opt_args val_args sect_descs + + if [[ $service == man ]]; then +@@ -168,29 +168,40 @@ _man() { + _arguments -s -S : $args '*::: :->man' && return 0 + [[ -n $state ]] || return 1 + ++ # Override man path ++ [[ -n ${opt_args[-M]} ]] && ++ _manpath=( ${(s<:>)opt_args[-M]} ) ++ ++ # Restore cached man path to avoid $(manpath) if we can + if (( ! $#_manpath )); then +- local mp +- mp=( ${(s.:.)$(manpath 2>/dev/null)} ) +- [[ "$mp" == *:* ]] && mp=( ${(s.:.)mp} ) +- if (( $#mp )); then +- _manpath=( $mp ) +- elif (( $#manpath )); then +- _manpath=( $manpath ) ++ if (( ! $+_manpath_cache )); then ++ typeset -gHA _manpath_cache + fi ++ if [[ -z $_manpath_cache[$MANPATH] ]]; then ++ local mp ++ mp=( ${(s.:.)$({ command man -w || manpath } 2>/dev/null)} ) ++ [[ "$mp" == *:* ]] && mp=( ${(s.:.)mp} ) ++ if (( $#mp )); then ++ _manpath_cache[$MANPATH]=${(j.:.)mp} ++ elif (( $#manpath )); then ++ _manpath_cache[$MANPATH]=$MANPATH ++ fi ++ fi ++ _manpath=( ${(s.:.)_manpath_cache[$MANPATH]} ) ++ fi ++ ++ # Augment man path ++ if [[ -n ${opt_args[-m]} ]]; then ++ [[ $variant == (netbsd|openbsd)* ]] && ++ _manpath+=( ${(s<:>)opt_args[-m]} ) ++ elif [[ $variant == aix* ]]; then ++ # _manpath declared -U so no need to test ++ _manpath+=( /usr/share/man ) + fi + + (( $#_manpath )) || + _manpath=( /usr/man(-/) /(opt|usr)/(pkg|dt|share|X11R6|local)/(cat|)man(-/) ) + +- # Override man path +- [[ -n ${opt_args[-M]} ]] && +- _manpath=( ${(s<:>)opt_args[-M]} ) +- +- # Augment man path +- [[ $variant == (netbsd|openbsd)* ]] && +- [[ -n ${opt_args[-m]} ]] && +- _manpath+=( ${(s<:>)opt_args[-m]} ) +- + # `sman' is the SGML manual directory for Solaris 7. + # 1M is system administrator commands on SVR4 + +-- +2.48.1 + diff --git a/recipes/fix-gcc14-incompatible-pointer-types.patch b/recipes/fix-gcc14-incompatible-pointer-types.patch new file mode 100644 index 00000000..571ad0f2 --- /dev/null +++ b/recipes/fix-gcc14-incompatible-pointer-types.patch @@ -0,0 +1,38 @@ +diff --git a/configure.ac b/configure.ac +index 0760346..be5dbd9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1761,27 +1761,27 @@ if test x$zsh_cv_path_term_header != xnone; then + fi + + AC_MSG_CHECKING(if boolcodes is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = boolcodes; puts(*test);]])],[AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes],[boolcodes=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)boolcodes; puts(*test);]])],[AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes],[boolcodes=no]) + AC_MSG_RESULT($boolcodes) + + AC_MSG_CHECKING(if numcodes is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = numcodes; puts(*test);]])],[AC_DEFINE(HAVE_NUMCODES) numcodes=yes],[numcodes=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)numcodes; puts(*test);]])],[AC_DEFINE(HAVE_NUMCODES) numcodes=yes],[numcodes=no]) + AC_MSG_RESULT($numcodes) + + AC_MSG_CHECKING(if strcodes is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = strcodes; puts(*test);]])],[AC_DEFINE(HAVE_STRCODES) strcodes=yes],[strcodes=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)strcodes; puts(*test);]])],[AC_DEFINE(HAVE_STRCODES) strcodes=yes],[strcodes=no]) + AC_MSG_RESULT($strcodes) + + AC_MSG_CHECKING(if boolnames is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = boolnames; puts(*test);]])],[AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes],[boolnames=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)boolnames; puts(*test);]])],[AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes],[boolnames=no]) + AC_MSG_RESULT($boolnames) + + AC_MSG_CHECKING(if numnames is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = numnames; puts(*test);]])],[AC_DEFINE(HAVE_NUMNAMES) numnames=yes],[numnames=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)numnames; puts(*test);]])],[AC_DEFINE(HAVE_NUMNAMES) numnames=yes],[numnames=no]) + AC_MSG_RESULT($numnames) + + AC_MSG_CHECKING(if strnames is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = strnames; puts(*test);]])],[AC_DEFINE(HAVE_STRNAMES) strnames=yes],[strnames=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)strnames; puts(*test);]])],[AC_DEFINE(HAVE_STRNAMES) strnames=yes],[strnames=no]) + AC_MSG_RESULT($strnames) + + dnl There are apparently defective terminal library headers on some diff --git a/recipes/implicit.patch b/recipes/implicit.patch new file mode 100644 index 00000000..a840401b --- /dev/null +++ b/recipes/implicit.patch @@ -0,0 +1,550 @@ +https://bugs.gentoo.org/869539 +https://www.zsh.org/mla/workers/2022/msg00964.html +--- a/configure.ac ++++ b/configure.ac +@@ -583,11 +583,11 @@ if test x$zsh_cv_c_have_union_init = xye + fi + + dnl Checking if compiler correctly cast signed to unsigned. + AC_CACHE_CHECK(if signed to unsigned casting is broken, + zsh_cv_c_broken_signed_to_unsigned_casting, +-[AC_RUN_IFELSE([AC_LANG_SOURCE([[main(){return((int)(unsigned char)((char) -1) == 255);}]])],[zsh_cv_c_broken_signed_to_unsigned_casting=yes],[zsh_cv_c_broken_signed_to_unsigned_casting=no],[zsh_cv_c_broken_signed_to_unsigned_casting=no])]) ++[AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(){return((int)(unsigned char)((char) -1) == 255);}]])],[zsh_cv_c_broken_signed_to_unsigned_casting=yes],[zsh_cv_c_broken_signed_to_unsigned_casting=no],[zsh_cv_c_broken_signed_to_unsigned_casting=no])]) + AH_TEMPLATE([BROKEN_SIGNED_TO_UNSIGNED_CASTING], + [Define to 1 if compiler incorrectly cast signed to unsigned.]) + if test x$zsh_cv_c_broken_signed_to_unsigned_casting = xyes; then + AC_DEFINE(BROKEN_SIGNED_TO_UNSIGNED_CASTING) + fi +@@ -1044,21 +1044,21 @@ if test x$zsh_cv_long_is_64_bit = xyes; + else + AC_CACHE_CHECK(if off_t is 64 bit, zsh_cv_off_t_is_64_bit, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + +-main() { return sizeof(off_t) < 8; } ++int main() { return sizeof(off_t) < 8; } + ]])],[zsh_cv_off_t_is_64_bit=yes],[zsh_cv_off_t_is_64_bit=no],[zsh_cv_off_t_is_64_bit=no])]) + if test x$zsh_cv_off_t_is_64_bit = xyes; then + AC_DEFINE(OFF_T_IS_64_BIT) + fi + + AC_CACHE_CHECK(if ino_t is 64 bit, zsh_cv_ino_t_is_64_bit, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + +-main() { return sizeof(ino_t) < 8; } ++int main() { return sizeof(ino_t) < 8; } + ]])],[zsh_cv_ino_t_is_64_bit=yes],[zsh_cv_ino_t_is_64_bit=no],[zsh_cv_ino_t_is_64_bit=no])]) + if test x$zsh_cv_ino_t_is_64_bit = xyes; then + AC_DEFINE(INO_T_IS_64_BIT) + fi + +@@ -1394,22 +1394,22 @@ zsh_cv_func_tgetent_accepts_null, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #include + int tgetent(char *, char *); + char *tgetstr(char *, char **); +-main() ++int main() + { + char buf[4096]; + int r1 = tgetent(buf, "vt100"); + int r2 = tgetent((char*)0,"vt100"); + if (r1 >= 0 && r1 == r2) { + char tbuf[1024], *u; + u = tbuf; + tgetstr("cl", &u); + creat("conftest.tgetent", 0640); + } +- exit((r1 != r2) || r2 == -1); ++ return((r1 != r2) || r2 == -1); + } + ]])],[if test -f conftest.tgetent; then + zsh_cv_func_tgetent_accepts_null=yes + else + zsh_cv_func_tgetent_accepts_null=no +@@ -1422,22 +1422,22 @@ zsh_cv_func_tgetent_zero_success, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #include + int tgetent(char *, char*); + char *tgetstr(char *, char **); +-main() ++int main() + { + char buf[4096]; + int r1 = tgetent(buf, "!@#$%^&*"); + int r2 = tgetent(buf, "vt100"); + if (r1 < 0 && r2 == 0) { + char tbuf[1024], *u; + u = tbuf; + tgetstr("cl", &u); + creat("conftest.tgetent0", 0640); + } +- exit(r1 == r2); ++ return(r1 == r2); + } + ]])],[if test -f conftest.tgetent0; then + zsh_cv_func_tgetent_zero_success=yes + else + zsh_cv_func_tgetent_zero_success=no +@@ -1860,27 +1860,27 @@ zsh_cv_rlim_t_is_longer, + #ifdef HAVE_SYS_TIME_H + #include + #endif + #include + #include +-main(){struct rlimit r;exit(sizeof(r.rlim_cur) <= sizeof(long));}]])],[zsh_cv_rlim_t_is_longer=yes],[zsh_cv_rlim_t_is_longer=no],[zsh_cv_rlim_t_is_longer=yes])]) ++int main(){struct rlimit r;return(sizeof(r.rlim_cur) <= sizeof(long));}]])],[zsh_cv_rlim_t_is_longer=yes],[zsh_cv_rlim_t_is_longer=no],[zsh_cv_rlim_t_is_longer=yes])]) + if test x$zsh_cv_rlim_t_is_longer = xyes; then + AC_CACHE_CHECK(if rlim_t is a quad, + zsh_cv_rlim_t_is_quad_t, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #ifdef HAVE_SYS_TIME_H + #include + #endif + #include + #include + #include +-main() { ++int main() { + struct rlimit r; + char buf[20]; + r.rlim_cur = 0; + sprintf(buf, "%qd", r.rlim_cur); +- exit(strcmp(buf, "0")); ++ return(strcmp(buf, "0")); + }]])],[zsh_cv_rlim_t_is_quad_t=yes],[zsh_cv_rlim_t_is_quad_t=no],[zsh_cv_rlim_t_is_quad_t=no])]) + if test x$zsh_cv_rlim_t_is_quad_t = xyes; then + AC_DEFINE(RLIM_T_IS_QUAD_T) + DEFAULT_RLIM_T=quad_t + else +@@ -1894,11 +1894,11 @@ else + #ifdef HAVE_SYS_TIME_H + #include + #endif + #include + #include +- main(){struct rlimit r;r.rlim_cur=-1;exit(r.rlim_cur<0);}]])],[zsh_cv_type_rlim_t_is_unsigned=yes],[zsh_cv_type_rlim_t_is_unsigned=no],[zsh_cv_type_rlim_t_is_unsigned=no])]) ++ int main(){struct rlimit r;r.rlim_cur=-1;return(r.rlim_cur<0);}]])],[zsh_cv_type_rlim_t_is_unsigned=yes],[zsh_cv_type_rlim_t_is_unsigned=no],[zsh_cv_type_rlim_t_is_unsigned=no])]) + if test x$zsh_cv_type_rlim_t_is_unsigned = xyes; then + AC_DEFINE(RLIM_T_IS_UNSIGNED) + DEFAULT_RLIM_T="unsigned $DEFAULT_RLIM_T" + fi + fi +@@ -2175,11 +2175,11 @@ zsh_cv_sys_fifo, + #include + #include + #include + #include + #include +-main() ++int main() + { + char c; + int fd; + int pid, ret; + unlink("/tmp/fifo$$"); +@@ -2189,19 +2189,19 @@ main() + if(mknod("/tmp/fifo$$", 0010600, 0) < 0) + #endif + exit(1); + pid = fork(); + if(pid < 0) +- exit(1); ++ return(1); + if(pid) { + fd = open("/tmp/fifo$$", O_RDONLY); +- exit(fd < 0 || read(fd, &c, 1) != 1 || c != 'x'); ++ return(fd < 0 || read(fd, &c, 1) != 1 || c != 'x'); + } + fd = open("/tmp/fifo$$", O_WRONLY); + ret = (fd < 0 || write(fd, "x", 1) < 1); + unlink("/tmp/fifo$$"); +- exit(ret); ++ return(ret); + } + ]])],[zsh_cv_sys_fifo=yes],[zsh_cv_sys_fifo=no],[zsh_cv_sys_fifo=yes]) + ]) + AH_TEMPLATE([HAVE_FIFOS], + [Define to 1 if system has working FIFOs.]) +@@ -2276,24 +2276,24 @@ AC_CACHE_CHECK(if link() works, + zsh_cv_sys_link, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #include + #include +-main() ++int main() + { + int ret; + char *tmpfile, *newfile; + tmpfile="/tmp/zsh.linktest$$"; + newfile="/tmp/zsh.linktest2$$"; + unlink(tmpfile); + unlink(newfile); + if(creat(tmpfile, 0644) < 0) +- exit(1); ++ return(1); + ret = link(tmpfile, newfile); + unlink(tmpfile); + unlink(newfile); +- exit(ret<0); ++ return(ret<0); + } + ]])],[zsh_cv_sys_link=yes],[zsh_cv_sys_link=no],[zsh_cv_sys_link=yes])]) + AH_TEMPLATE([HAVE_LINK], + [Define to 1 if system has working link().]) + if test x$zsh_cv_sys_link = xyes; then +@@ -2309,15 +2309,15 @@ zsh_cv_sys_killesrch, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #include + #include + #include +-main() ++int main() + { + int pid = (getpid() + 10000) & 0xffffff; + while (pid && (kill(pid, 0) == 0 || errno != ESRCH)) pid >>= 1; +- exit(errno!=ESRCH); ++ return(errno!=ESRCH); + } + ]])],[zsh_cv_sys_killesrch=yes],[zsh_cv_sys_killesrch=no],[zsh_cv_sys_killesrch=yes])]) + AH_TEMPLATE([BROKEN_KILL_ESRCH], + [Define to 1 if kill(pid, 0) doesn't return ESRCH, ie BeOS R4.51.]) + if test x$zsh_cv_sys_killesrch = xno; then +@@ -2339,11 +2339,11 @@ if test x$signals_style = xPOSIX_SIGNALS + #include + int child=0; + void handler(sig) + int sig; + {if(sig==SIGCHLD) child=1;} +-main() { ++int main() { + struct sigaction act; + sigset_t set; + int pid, ret; + act.sa_handler = &handler; + sigfillset(&act.sa_mask); +@@ -2354,11 +2354,11 @@ main() { + pid=fork(); + if(pid==0) return 0; + if(pid>0) { + sigemptyset(&set); + ret=sigsuspend(&set); +- exit(child==0); ++ return(child==0); + } + } + ]])],[zsh_cv_sys_sigsuspend=yes],[zsh_cv_sys_sigsuspend=no],[zsh_cv_sys_sigsuspend=yes])]) + if test x$zsh_cv_sys_sigsuspend = xno; then + AC_DEFINE(BROKEN_POSIX_SIGSUSPEND) +@@ -2387,18 +2387,18 @@ case "x$zsh_working_tcsetpgrp" in + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #include + #include + #include +-main() { ++int main() { + int fd; + int ret; + fd=open("/dev/tty", O_RDWR); + if (fd < 0) exit(2); + ret=tcsetpgrp(fd, tcgetpgrp(fd)); + if (ret < 0) exit(1); +- exit(0); ++ return(0); + } + ]])],[zsh_cv_sys_tcsetpgrp=yes],[ + case $? in + 1) zsh_cv_sys_tcsetpgrp=no;; + 2) zsh_cv_sys_tcsetpgrp=notty;; +@@ -2434,19 +2434,19 @@ if test x$ac_cv_func_getpwnam = xyes; th + #include + #include + #include + #include + #include +-main() { ++int main() { + struct passwd *pw1, *pw2; + char buf[1024], name[1024]; + sprintf(buf, "%d:%d", getpid(), rand()); + pw1=getpwnam(buf); + if (pw1) strcpy(name, pw1->pw_name); + sprintf(buf, "%d:%d", rand(), getpid()); + pw2=getpwnam(buf); +- exit(pw1!=0 && pw2!=0 && !strcmp(name, pw2->pw_name)); ++ return(pw1!=0 && pw2!=0 && !strcmp(name, pw2->pw_name)); + } + ]])],[zsh_cv_sys_getpwnam_faked=no],[zsh_cv_sys_getpwnam_faked=yes],[zsh_cv_sys_getpwnam_faked=no])]) + if test x$zsh_cv_sys_getpwnam_faked = xyes; then + AC_DEFINE(GETPWNAM_FAKED) + fi +@@ -2763,22 +2763,20 @@ elif test "x$dynamic" = xyes; then + zsh_cv_sys_elf, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[/* Test for whether ELF binaries are produced */ + #include + #include + #include +-main(argc, argv) +-int argc; +-char *argv[]; ++int main(int argc, char *argv[]) + { + char b[4]; + int i = open(argv[0],O_RDONLY); + if(i == -1) + exit(1); /* fail */ + if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F') +- exit(0); /* succeed (yes, it's ELF) */ ++ return(0); /* succeed (yes, it's ELF) */ + else +- exit(1); /* fail */ ++ return(1); /* fail */ + }]])],[zsh_cv_sys_elf=yes],[zsh_cv_sys_elf=no],[zsh_cv_sys_elf=yes])]) + + # We use [0-9]* in case statements, so need to change quoting + changequote(, ) + +@@ -2908,11 +2908,11 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ + EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-rdynamic}"],[zsh_cvs_rdynamic_available=no]) + LDFLAGS="$old_LDFLAGS") + AC_CACHE_CHECK(if your dlsym() needs a leading underscore, + zsh_cv_func_dlsym_needs_underscore, + [echo failed >conftestval && cat >conftest.c <&AS_MESSAGE_LOG_FD) && + AC_TRY_COMMAND($DLLD $LDFLAGS $DLLDFLAGS -o conftest.$DL_EXT conftest.o 1>&AS_MESSAGE_LOG_FD) && + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include +@@ -2943,34 +2941,34 @@ char *zsh_gl_sym_addr ; + #define RTLD_LAZY 1 + #endif + + extern int fred() ; + +-main() ++int main() + { + void * handle ; + void * symbol ; + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + handle = dlopen("./conftest.$DL_EXT", RTLD_LAZY) ; + if (handle == NULL) { + fprintf (f, "dlopen failed") ; +- exit(1); ++ return(1); + } + symbol = dlsym(handle, "fred") ; + if (symbol == NULL) { + /* try putting a leading underscore */ + symbol = dlsym(handle, "_fred") ; + if (symbol == NULL) { + fprintf (f, "dlsym failed") ; +- exit(1); ++ return(1); + } + fprintf (f, "yes") ; + } + else + fprintf (f, "no") ; +- exit(0); ++ return(0); + }]])],[zsh_cv_func_dlsym_needs_underscore=`cat conftestval`],[zsh_cv_func_dlsym_needs_underscore=failed + dynamic=no],[zsh_cv_func_dlsym_needs_underscore=no])]) + if test "x$zsh_cv_func_dlsym_needs_underscore" = xyes; then + AC_DEFINE(DLSYM_NEEDS_UNDERSCORE) + elif test "x$zsh_cv_func_dlsym_needs_underscore" != xno; then +--- a/aczsh.m4.old ++++ b/aczsh.m4 +@@ -42,10 +42,11 @@ AC_DEFUN(zsh_64_BIT_TYPE, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #ifdef HAVE_SYS_TYPES_H + #include + #endif + ++int + main() + { + $1 foo = 0; + int bar = (int) foo; + return sizeof($1) != 8; +@@ -144,33 +145,34 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + ++int + main() + { + void *handle1, *handle2; + void *(*zsh_getaddr1)(), *(*zsh_getaddr2)(); + void *sym1, *sym2; + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle1) exit(1); ++ if(!handle1) return(1); + handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle2) exit(1); ++ if(!handle2) return(1); + zsh_getaddr1 = (void *(*)()) dlsym(handle1, "${us}zsh_getaddr1"); + zsh_getaddr2 = (void *(*)()) dlsym(handle2, "${us}zsh_getaddr2"); + sym1 = zsh_getaddr1(); + sym2 = zsh_getaddr2(); +- if(!sym1 || !sym2) exit(1); +- if(sym1 != sym2) exit(1); ++ if(!sym1 || !sym2) return(1); ++ if(sym1 != sym2) return(1); + dlclose(handle1); + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle1) exit(1); ++ if(!handle1) return(1); + zsh_getaddr1 = (void *(*)()) dlsym(handle1, "${us}zsh_getaddr1"); + sym1 = zsh_getaddr1(); +- if(!sym1) exit(1); +- if(sym1 != sym2) exit(1); +- exit(0); ++ if(!sym1) return(1); ++ if(sym1 != sym2) return(1); ++ return(0); + } + ]])],[zsh_cv_shared_$1=yes], + [zsh_cv_shared_$1=no], + [zsh_cv_shared_$1=no] + ) +@@ -226,23 +228,23 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + +- ++int + main() + { + void *handle1, *handle2; + int (*fred1)(), (*fred2)(); + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle1) exit(1); ++ if(!handle1) return(1); + handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle2) exit(1); ++ if(!handle2) return(1); + fred1 = (int (*)()) dlsym(handle1, "${us}fred"); + fred2 = (int (*)()) dlsym(handle2, "${us}fred"); +- if(!fred1 || !fred2) exit(1); +- exit((*fred1)() != 42 || (*fred2)() != 69); ++ if(!fred1 || !fred2) return(1); ++ return((*fred1)() != 42 || (*fred2)() != 69); + } + ]])],[zsh_cv_sys_dynamic_clash_ok=yes], + [zsh_cv_sys_dynamic_clash_ok=no], + [zsh_cv_sys_dynamic_clash_ok=no] + ) +@@ -302,21 +304,22 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + ++int + main() + { + void *handle; + int (*barneysym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle) exit(1); ++ if(!handle) return(1); + handle = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle) exit(1); ++ if(!handle) return(1); + barneysym = (int (*)()) dlsym(handle, "${us}barney"); +- if(!barneysym) exit(1); +- exit((*barneysym)() != 69); ++ if(!barneysym) return(1); ++ return((*barneysym)() != 69); + } + ]])],[zsh_cv_sys_dynamic_rtld_global=yes], + [zsh_cv_sys_dynamic_rtld_global=no], + [zsh_cv_sys_dynamic_rtld_global=no] + ) +@@ -372,19 +375,20 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + ++int + main() + { + void *handle; + int (*barneysym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle) exit(1); ++ if(!handle) return(1); + barneysym = (int (*)()) dlsym(handle, "${us}barney"); +- if(!barneysym) exit(1); +- exit((*barneysym)() != 69); ++ if(!barneysym) return(1); ++ return((*barneysym)() != 69); + } + + int fred () { return 42; } + ]])],[zsh_cv_sys_dynamic_execsyms=yes], + [zsh_cv_sys_dynamic_execsyms=no], +@@ -446,19 +450,20 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + ++int + main() + { + void *handle; + int (*barneysym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle) exit(1); ++ if(!handle) return(1); + barneysym = (int (*)()) dlsym(handle, "${us}barney"); +- if(!barneysym) exit(1); +- exit((*barneysym)() != 69); ++ if(!barneysym) return(1); ++ return((*barneysym)() != 69); + } + + int fred () { return 42; } + ]])],[zsh_cv_sys_dynamic_strip_exe=yes], + [zsh_cv_sys_dynamic_strip_exe=no], +@@ -514,19 +519,20 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + ++int + main() + { + void *handle; + int (*fredsym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle) exit(1); ++ if(!handle) return(1); + fredsym = (int (*)()) dlsym(handle, "${us}fred"); +- if(!fredsym) exit(1); +- exit((*fredsym)() != 42); ++ if(!fredsym) return(1); ++ return((*fredsym)() != 42); + } + ]])],[zsh_cv_sys_dynamic_strip_lib=yes], + [zsh_cv_sys_dynamic_strip_lib=no], + [zsh_cv_sys_dynamic_strip_lib=no] + ) + diff --git a/recipes/skip-test-failing-on-musl.patch b/recipes/skip-test-failing-on-musl.patch new file mode 100644 index 00000000..ba04ce21 --- /dev/null +++ b/recipes/skip-test-failing-on-musl.patch @@ -0,0 +1,25 @@ +From: Jakub Jirutka +Date: Sun, 03 Jul 2022 01:52:19 +0200 +Subject: Skip test case in E02xtrace failing on musl + +--- a/Test/E02xtrace.ztst ++++ b/Test/E02xtrace.ztst +@@ -150,7 +150,6 @@ + test_cases=( + f # baseline + foo-bar # Dash +- ヌ # Meta (the UTF-8 representation of this character has an 0x83 byte) + \$\'ba\\0z\' # Nul, escaped as though by ${(qqqq)} + ) + for 1 in "$test_cases[@]"; do +@@ -172,10 +171,6 @@ + > # traced + > echo inner + >} +->$'\M-c\M-\C-C\M-\C-L' () { +-> # traced +-> echo inner +->} + >$'ba\C-@z' () { + > # traced + > echo inner diff --git a/recipes/tests-user.patch b/recipes/tests-user.patch new file mode 100644 index 00000000..386a0d46 --- /dev/null +++ b/recipes/tests-user.patch @@ -0,0 +1,29 @@ +Fix tests on a system with a user called "user" + +--- a/Test/Y01completion.ztst ++++ b/Test/Y01completion.ztst +@@ -73,16 +73,16 @@ + >NO:{file2} + + comptesteval $'zstyle -d \'*\' glob' +- comptesteval '_users () { compadd user1 user2 }' ++ comptesteval '_users () { compadd zsh-test-user1 zsh-test-user2 }' + comptest $': ~\t\t\t\t\t' + 0:tilde +->line: {: ~user}{} +->line: {: ~user}{} +->NO:{user1} +->NO:{user2} +->line: {: ~user1}{} +->line: {: ~user2}{} +->line: {: ~user1}{} ++>line: {: ~zsh-test-user}{} ++>line: {: ~zsh-test-user}{} ++>NO:{zsh-test-user1} ++>NO:{zsh-test-user2} ++>line: {: ~zsh-test-user1}{} ++>line: {: ~zsh-test-user2}{} ++>line: {: ~zsh-test-user1}{} + + comptest $'echo ;:\C-b\C-b\t' + 0:directories and files before separator diff --git a/recipes/zsh-newuser-install-alpine.patch b/recipes/zsh-newuser-install-alpine.patch new file mode 100644 index 00000000..0436b5ec --- /dev/null +++ b/recipes/zsh-newuser-install-alpine.patch @@ -0,0 +1,17 @@ +From: Jakub Jirutka +Date: Sun, 13 Mar 2022 22:44:00 +0100 +Subject: [PATCH] Recommend alpine-zsh-config in zsh-newuser-install + +--- a/Functions/Newuser/zsh-newuser-install ++++ b/Functions/Newuser/zsh-newuser-install +@@ -959,6 +959,10 @@ + the file by hand, if so desired). + " + fi ++ print -r "Or you can install Alpine's system-wide Z Shell configuration, which provides ++sensible defaults for a great user experience right out of the box. ++To do this, press (q) and run this command as root: apk add alpine-zsh-config. ++" + + read -k key$longprompt + print diff --git a/recipes/zsh.toml b/recipes/zsh.toml new file mode 100644 index 00000000..2fe0cdac --- /dev/null +++ b/recipes/zsh.toml @@ -0,0 +1,98 @@ +# zsh 5.9 — **el shell del usuario**, y por eso entra al piso y no a los extras. +# +# ══ POR QUÉ ESTA RECETA EXISTE ═════════════════════════════════════════════════════════════════ +# Barrido del 2026-09-16 sobre la laptop del usuario: su shell de login es zsh (1611 `cd`, 1054 +# `cargo`, 134 `zellij` en el historial), y zsh **no tenía receta en el corpus ni en ninguna de las +# cuatro colas**. Una imagen de takana instalada en esa máquina la dejaba en `bash` — funciona, pero +# no es su máquina. Es el mismo hueco de RUNTIME que `bash-completion` en `[perfil.base]`: nadie lo +# alcanza por deps de build, así que ninguna métrica de deuda podía verlo. +# +# ⚠ **PUNTO DE PARTIDA, NO SELLADA.** Escrita en el laptop, que no tiene lab ni store (su +# `.dev-fs/alpine` tiene 104 paquetes contra los 110 de `lab-toolchain.lock`, así que ni siquiera +# calcula hashes comparables). El primer build va en el worker. Lo que sigue son las trampas +# conocidas de hermanos ya sellados, anotadas para que el primer build no las redescubra. +# +# ══ LOS SEIS PARCHES SON DE ALPINE, Y NO SON OPCIONALES ════════════════════════════════════════ +# Vienen de `main/zsh` de aports y son el trabajo de portabilidad a musl que un import de nix +# pierde. `implicit.patch` (16 K) es el gordo: declaraciones implícitas que gcc14/clang rechazan +# como error. Los otros cinco son tests que no aplican fuera de glibc, el instalador de usuario +# nuevo de Alpine, punteros incompatibles de gcc14 y el cacheo de `man -w`. +# +# ══ RIESGO CONOCIDO PARA EL PRIMER BUILD (heredado de bash.toml) ═══════════════════════════════ +# `link = "static"` puede salir DINÁMICO igual, como le pasó a bash: si el `configure` mete +# `-rdynamic` en la línea de enlace, el wrapper de cc del lab (`sandbox.rs:597`) tira el `-static` +# inyectado y el binario sale contra `libncursesw.so.6` — que **ningún artefacto del corpus +# provee**, así que arrancaría en el sandbox de Alpine y no dentro de una imagen de takana. El +# síntoma exacto a buscar es `Error relocating ... symbol not found`. Si pasa, el arreglo de bash +# fue `make LOCAL_LDFLAGS=` y vale acá igual. +# Verificar el primer artefacto con `file`: debe decir `statically linked`. +name = "zsh" +version = "5.9" +license = "MIT" + +[source] +tarball = "https://sourceforge.net/projects/zsh/files/zsh/5.9/zsh-5.9.tar.xz" +# sha256 calculado sobre el tarball bajado el 2026-09-16 (Alpine publica sha512, no sha256). +sha256 = "9b8d1ecedd5b5e81fbf1918e876752a7dd948e05c1a0dba10ab863842d45acd5" +patches = [ + "implicit.patch", + "fix-gcc14-incompatible-pointer-types.patch", + "zsh-newuser-install-alpine.patch", + "0001-50278-use-man-w-in-preference-to-manpath-fix-caching.patch", + "skip-test-failing-on-musl.patch", + "tests-user.patch", +] + +[build] +compiler = "zig-cc" +target = "x86_64-linux-musl" +link = "static" +# Split de la info de depuración (SDD 23 etapa 4). Entra en `hash_inputs`. +strip_debug = true +flags = [] + +[build.phases] +# de build() de Alpine (traducido; el lab provee $CBUILD/$CHOST). +# +# `--enable-function-subdirs` + `--enable-fndir`: zsh instala ~1200 ficheros de funciones en +# `/usr/share/zsh/functions`. NO se recortan: sin ellas no hay `compinit`, y un zsh sin completado +# es justamente lo que el usuario no tiene hoy. Es la lección de CLAUDE.md §3 al revés — acá el +# artefacto "completo" son los datos, no el binario. +# +# `--disable-gdbm` es deliberado: gdbm no está en el corpus y sólo aporta el módulo `zsh/db/gdbm`. +# Encenderlo pediría una receta más para una capacidad que nadie pidió. +compile = ''' +_abuild_phase() { + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --bindir=/bin \ + --enable-etcdir=/etc/zsh \ + --enable-pcre \ + --enable-cap \ + --enable-multibyte \ + --enable-function-subdirs \ + --enable-fndir=/usr/share/zsh/functions \ + --enable-zsh-secure-free \ + --disable-gdbm \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --with-tcsetpgrp + make +} +_abuild_phase +''' +# de package() de Alpine (traducido $pkgdir→/out). Sin locales: el corpus no los hidrata y pesan. +install = ''' +_abuild_phase() { + make DESTDIR="/out" install install.info + rm -rf "/out"/usr/share/locale + # `/etc/shells` no se escribe acá: es estado del sistema instalado, no del artefacto. +} +_abuild_phase +''' + +[deps] +build = ["binutils", "ncurses", "pcre2", "libcap", "linux-headers", "make"]