summaryrefslogtreecommitdiff
path: root/debian/patches/make-zsh-static-really-static-#993843.patch
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2021-09-17 15:32:20 +0200
committerAxel Beckert <abe@deuxchevaux.org>2021-09-17 15:32:20 +0200
commit92b60e43aafd586cf84d01e61841b69288cf9063 (patch)
tree87059ffa4df5fb01299da2d9d98562b3471a4944 /debian/patches/make-zsh-static-really-static-#993843.patch
parent130801d28602b9500b721758ff435c83cfe06abc (diff)
downloadzsh-92b60e43aafd586cf84d01e61841b69288cf9063.tar.gz
zsh-92b60e43aafd586cf84d01e61841b69288cf9063.zip
Extend patch for #993843 by Jun T's version from https://zsh.org/workers/49422
Diffstat (limited to 'debian/patches/make-zsh-static-really-static-#993843.patch')
-rw-r--r--debian/patches/make-zsh-static-really-static-#993843.patch180
1 files changed, 82 insertions, 98 deletions
diff --git a/debian/patches/make-zsh-static-really-static-#993843.patch b/debian/patches/make-zsh-static-really-static-#993843.patch
index 1b58b3a1c..04025477e 100644
--- a/debian/patches/make-zsh-static-really-static-#993843.patch
+++ b/debian/patches/make-zsh-static-really-static-#993843.patch
@@ -1,11 +1,61 @@
Description: Try to fix dynamic linking with zsh-static and resulting segfaults on libc updates
+Origin: https://zsh.org/workers/49422
Bug-Debian: https://bugs.debian.org/993843
Bug: https://zsh.org/workers/49392
Author: Axel Beckert <abe@debian.org>
+Author: Jun T <takimoto-j@kba.biglobe.ne.jp>
+diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
+index ef9148d7b..b44555323 100644
+--- a/Src/Modules/parameter.c
++++ b/Src/Modules/parameter.c
+@@ -2011,6 +2011,9 @@ scanpmdissaliases(HashTable ht, ScanFunc func, int flags)
+ /**/
+ static Groupset get_all_groups(void)
+ {
++#ifdef DISABLE_DYNAMIC_NSS
++ return NULL;
++#else
+ Groupset gs = zhalloc(sizeof(*gs));
+ Groupmap gaptr;
+ gid_t *list, *lptr, egid;
+@@ -2063,6 +2066,7 @@ static Groupset get_all_groups(void)
+ }
+
+ return gs;
++#endif /* DISABLE_DYNAMIC_NSS */
+ }
+
+ /* Standard hash element lookup. */
+@@ -2081,7 +2085,11 @@ getpmusergroups(UNUSED(HashTable ht), const char *name)
+ pm->gsu.s = &nullsetscalar_gsu;
+
+ if (!gs) {
++#ifdef DISABLE_DYNAMIC_NSS
++ zerr("parameter 'usergroups' not available: NSS is disabled");
++#else
+ zerr("failed to retrieve groups for user: %e", errno);
++#endif
+ pm->u.str = dupstring("");
+ pm->node.flags |= (PM_UNSET|PM_SPECIAL);
+ return &pm->node;
+@@ -2113,7 +2121,11 @@ scanpmusergroups(UNUSED(HashTable ht), ScanFunc func, int flags)
+ Groupmap gaptr;
+
+ if (!gs) {
++#ifdef DISABLE_DYNAMIC_NSS
++ zerr("parameter 'usergroups' not available: NSS is disabled");
++#else
+ zerr("failed to retrieve groups for user: %e", errno);
++#endif
+ return;
+ }
+
+diff --git a/Src/hashnameddir.c b/Src/hashnameddir.c
+index bed43d025..cbd1344ef 100644
--- a/Src/hashnameddir.c
+++ b/Src/hashnameddir.c
-@@ -178,7 +178,7 @@
+@@ -178,7 +178,7 @@ fillnameddirtable(UNUSED(HashTable ht))
/* Using NIS or NIS+ didn't add any user directories. This seems
* fishy, so we fall back to using getpwent(). If we don't have
* that, we only use the passwd file. */
@@ -14,7 +64,7 @@ Author: Axel Beckert <abe@debian.org>
struct passwd *pw;
setpwent();
-@@ -190,7 +190,7 @@
+@@ -190,7 +190,7 @@ fillnameddirtable(UNUSED(HashTable ht))
endpwent();
usepwf = 0;
@@ -23,7 +73,7 @@ Author: Axel Beckert <abe@debian.org>
}
if (usepwf) {
/* Don't forget the non-NIS matches from the flat passwd file */
-@@ -229,7 +229,7 @@
+@@ -229,7 +229,7 @@ fillnameddirtable(UNUSED(HashTable ht))
adduserdir(pw->pw_name, pw->pw_dir, ND_USERNAME, 1);
endpwent();
@@ -32,9 +82,11 @@ Author: Axel Beckert <abe@debian.org>
#endif
allusersadded = 1;
}
+diff --git a/Src/options.c b/Src/options.c
+index 783022591..a1fe918fc 100644
--- a/Src/options.c
+++ b/Src/options.c
-@@ -807,7 +807,7 @@
+@@ -811,7 +811,7 @@ dosetopt(int optno, int value, int force, char *new_opts)
return -1;
}
@@ -43,9 +95,27 @@ Author: Axel Beckert <abe@debian.org>
/* Set the supplementary groups list.
*
* Note that on macOS, FreeBSD, and possibly some other platforms,
+diff --git a/Src/params.c b/Src/params.c
+index 4f6b361f9..704aad588 100644
--- a/Src/params.c
+++ b/Src/params.c
-@@ -4414,7 +4414,7 @@
+@@ -843,9 +843,12 @@ createparamtable(void)
+ setsparam("HOST", ztrdup_metafy(hostnam));
+ zfree(hostnam, 256);
+
+- setsparam("LOGNAME",
+- ztrdup_metafy((str = getlogin()) && *str ?
+- str : cached_username));
++ setsparam("LOGNAME", ztrdup_metafy(
++#ifndef DISABLE_DYNAMIC_NSS
++ (str = getlogin()) && *str ? str :
++#endif
++ cached_username
++ ));
+
+ #if !defined(HAVE_PUTENV) && !defined(USE_SET_UNSET_ENV)
+ /* Copy the environment variables we are inheriting to dynamic *
+@@ -4430,7 +4433,7 @@ usernamegetfn(UNUSED(Param pm))
void
usernamesetfn(UNUSED(Param pm), char *x)
{
@@ -54,7 +124,7 @@ Author: Axel Beckert <abe@debian.org>
struct passwd *pswd;
if (x && (pswd = getpwnam(x)) && (pswd->pw_uid != cached_uid)) {
-@@ -4431,7 +4431,7 @@
+@@ -4447,7 +4450,7 @@ usernamesetfn(UNUSED(Param pm), char *x)
cached_uid = pswd->pw_uid;
}
}
@@ -63,9 +133,11 @@ Author: Axel Beckert <abe@debian.org>
zsfree(x);
}
+diff --git a/Src/utils.c b/Src/utils.c
+index c32741ca7..a74c8bd2c 100644
--- a/Src/utils.c
+++ b/Src/utils.c
-@@ -1115,7 +1115,7 @@
+@@ -1119,7 +1119,7 @@ char *cached_username;
char *
get_username(void)
{
@@ -74,7 +146,7 @@ Author: Axel Beckert <abe@debian.org>
struct passwd *pswd;
uid_t current_uid;
-@@ -1128,9 +1128,9 @@
+@@ -1132,9 +1132,9 @@ get_username(void)
else
cached_username = ztrdup("");
}
@@ -86,7 +158,7 @@ Author: Axel Beckert <abe@debian.org>
return cached_username;
}
-@@ -1306,7 +1306,7 @@
+@@ -1310,7 +1310,7 @@ getnameddir(char *name)
return str;
}
@@ -95,7 +167,7 @@ Author: Axel Beckert <abe@debian.org>
{
/* Retrieve an entry from the password table/database for this user. */
struct passwd *pw;
-@@ -1322,7 +1322,7 @@
+@@ -1326,7 +1326,7 @@ getnameddir(char *name)
return dupstring(pw->pw_dir);
}
}
@@ -104,91 +176,3 @@ Author: Axel Beckert <abe@debian.org>
/* There are no more possible sources of directory names, so give up. */
return NULL;
---- a/Src/Modules/stat.c
-+++ b/Src/Modules/stat.c
-@@ -137,13 +137,13 @@
- strcat(outbuf, " (");
- }
- if (flags & STF_STRING) {
--#ifdef HAVE_GETPWUID
-+#ifdef USE_GETPWUID
- struct passwd *pwd;
- pwd = getpwuid(uid);
- if (pwd)
- strcat(outbuf, pwd->pw_name);
- else
--#endif /* !HAVE_GETPWUID */
-+#endif /* !USE_GETPWUID */
- {
- char *optr;
- for (optr = outbuf; *optr; optr++)
---- a/Src/Modules/parameter.c
-+++ b/Src/Modules/parameter.c
-@@ -2055,7 +2055,9 @@
-
- /* Get group names */
- for (gaptr = gs->array; gaptr < gs->array + gs->num; gaptr++) {
-+#ifdef USE_GETGRGID
- grptr = getgrgid(gaptr->gid);
-+#endif /* USE_GETGRGID */
- if (!grptr) {
- return NULL;
- }
---- a/Src/Modules/files.c
-+++ b/Src/Modules/files.c
-@@ -734,6 +734,7 @@
- struct passwd *pwd;
- if(end)
- *end = 0;
-+#ifdef USE_GETPWNAM
- pwd = getpwnam(p);
- if(pwd)
- chm.uid = pwd->pw_uid;
-@@ -746,20 +747,35 @@
- return 1;
- }
- }
-+#else /* !USE_GETPWNAM */
-+ zwarnnam(nam, "%s: getpwnam not usable in static build", p);
-+ free(uspec);
-+ return 1;
-+#endif /* !USE_GETPWNAM */
- if(end) {
- p = end+1;
- if(!*p) {
-+#ifdef USE_GETPWUID
- if(!pwd && !(pwd = getpwuid(chm.uid))) {
- zwarnnam(nam, "%s: no such user", uspec);
- free(uspec);
- return 1;
- }
-+#else /* !USE_GETPWUID */
-+ if(!pwd) {
-+ zwarnnam(nam, "%s: getpwuid not usable in static build",
-+ uspec);
-+ free(uspec);
-+ return 1;
-+ }
-+#endif /* !USE_GETPWUID */
- chm.gid = pwd->pw_gid;
- } else if(p[0] == ':' && !p[1]) {
- chm.gid = -1;
- } else {
- struct group *grp;
- dogroup:
-+#ifdef USE_GETGRNAM
- grp = getgrnam(p);
- if(grp)
- chm.gid = grp->gr_gid;
-@@ -772,6 +788,11 @@
- return 1;
- }
- }
-+#else /* !USE_GETGRNAM */
-+ zwarnnam(nam, "%s: getgrnam not usable in static build", p);
-+ free(uspec);
-+ return 1;
-+#endif /* !USE_GETGRNAM */
- }
- } else
- chm.gid = -1;