[Pkg-zsh-devel] Bug#769450: Bug#769450: zsh-static unsets $USERNAME

Axel Beckert abe at debian.org
Fri Nov 14 00:46:40 UTC 2014


merge 769450 769448
kthxbye

Hi,

Vincent Lefevre wrote:
> zsh-static unsets $USERNAME:

It actually seems to not set it. From Src/init.c:

    969     /* We cache the uid so we know when to *
    970      * recheck the info for `USERNAME'     */
    971     cached_uid = getuid();
    972 
    973     /* Get password entry and set info for `USERNAME' */
    974 #ifdef USE_GETPWUID
    975     if ((pswd = getpwuid(cached_uid))) {
    976         if (EMULATION(EMULATE_ZSH))
    977             home = metafy(pswd->pw_dir, -1, META_DUP);
    978         cached_username = ztrdup(pswd->pw_name);
    979     }
    980     else
    981 #endif /* USE_GETPWUID */
    982     {
    983         if (EMULATION(EMULATE_ZSH))
    984             home = ztrdup("/");
    985         cached_username = ztrdup("");
    986     }

And USE_GETPWUID is not set in the static build. It's disabled in debian/rules:

   STATICFLAGS += --disable-dynamic-nss

This is probably the way how https://bugs.debian.org/207218 (changes
in libc cause zsh-static to immediately segfault) was fixed.

I wonder if #207218 would reappear nowadays, if we remove that line
above from debian/rules.

Removing that line definitely solves this issue, I just tried it.

Actually, removing that line also solves
https://bugs.debian.org/769448, so these two issues are actually the
same issue. The according code for this is probably in Src/glob.c:

   1469 #ifdef USE_GETGRNAM
   1470                             struct group *gr;
   1471                             sav = *tt;
   1472                             *tt = '\0';
   1473 
   1474                             if ((gr = getgrnam(s + arglen)))
   1475                                 data = gr->gr_gid;
   1476                             else {
   1477                                 zerr("unknown group");
   1478                                 data = 0;
   1479                             }
   1480                             *tt = sav;
   1481 #else /* !USE_GETGRNAM */
   1482                             sav = *tt;
   1483                             zerr("unknown group");
   1484                             data = 0;
   1485 #endif /* !USE_GETGRNAM */

		Regards, Axel
-- 
 ,''`.  |  Axel Beckert <abe at debian.org>, http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE
  `-    |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5



More information about the Pkg-zsh-devel mailing list