From: rjones Date: Mon, 23 Mar 2009 15:57:23 +0000 (+0000) Subject: Updated the fakechroot patches. X-Git-Tag: 1.5~22 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=a1687222cb9f33b2055d4f06a4583315edec9acc;p=febootstrap.git Updated the fakechroot patches. --- diff --git a/fakechroot-2.8-relchroot.patch b/fakechroot-2.8-relchroot.patch index 9ba4d80..beddabe 100644 --- a/fakechroot-2.8-relchroot.patch +++ b/fakechroot-2.8-relchroot.patch @@ -1,9 +1,11 @@ -This patch must be applied to fakeroot 2.8 in order to +This patch must be applied to fakeroot 2.8 or SVN in order to enable correct handling of relative chroots, for rpm and yum. ---- fakechroot-2.8.orig/src/libfakechroot.c 2009-03-18 11:39:33.000000000 +0000 -+++ fakechroot-2.8.rpm/src/libfakechroot.c 2009-03-18 12:43:51.000000000 +0000 -@@ -1110,7 +1110,7 @@ int chroot (const char *path) +Index: src/libfakechroot.c +=================================================================== +--- src/libfakechroot.c (revision 311) ++++ src/libfakechroot.c (working copy) +@@ -1147,7 +1147,7 @@ { char *ptr, *ld_library_path, *tmp, *fakechroot_path; int status, len; @@ -12,7 +14,18 @@ enable correct handling of relative chroots, for rpm and yum. #if !defined(HAVE_SETENV) char *envbuf; #endif -@@ -1134,23 +1134,21 @@ int chroot (const char *path) +@@ -1162,7 +1162,9 @@ + return -1; + } + if (*path != '/') { +- if (getcwd(cwd, FAKECHROOT_MAXPATH) == NULL) { ++ if (next_getcwd == NULL) fakechroot_init(); ++ ++ if (next_getcwd(cwd, FAKECHROOT_MAXPATH) == NULL) { + errno = ENAMETOOLONG; + return -1; + } +@@ -1171,24 +1173,22 @@ return -1; } if (strcmp(cwd, "/") == 0) { @@ -27,15 +40,12 @@ enable correct handling of relative chroots, for rpm and yum. else { - snprintf(full_path, FAKECHROOT_MAXPATH, "%s", path); - } -- -- fakechroot_path = getenv("FAKECHROOT_BASE"); + fakechroot_path = getenv("FAKECHROOT_BASE"); +- fakechroot_path = getenv("FAKECHROOT_BASE"); +- - if (fakechroot_path != NULL) { - snprintf(dir, FAKECHROOT_MAXPATH, "%s%s", fakechroot_path, full_path); -- } -- else { -- snprintf(dir, FAKECHROOT_MAXPATH, "%s", full_path); + if (fakechroot_path != NULL) { + snprintf(dir, FAKECHROOT_MAXPATH, "%s%s", fakechroot_path, path); + } @@ -43,5 +53,9 @@ enable correct handling of relative chroots, for rpm and yum. + snprintf(dir, FAKECHROOT_MAXPATH, "%s", path); + } } +- else { +- snprintf(dir, FAKECHROOT_MAXPATH, "%s", full_path); +- } #if defined(HAVE___XSTAT) && defined(_STAT_VER) + if ((status = next___xstat(_STAT_VER, dir, &sb)) != 0) { diff --git a/fakechroot-svn-no-dup-envs.patch b/fakechroot-svn-no-dup-envs.patch new file mode 100644 index 0000000..72b33a9 --- /dev/null +++ b/fakechroot-svn-no-dup-envs.patch @@ -0,0 +1,40 @@ +This patch must be applied to fakechroot SVN in order to +stop it from passing duplicated environment variables to +child processes. It is not necessary for fakechroot <= 2.8. + +Index: src/libfakechroot.c +=================================================================== +--- src/libfakechroot.c (revision 311) ++++ src/libfakechroot.c (working copy) +@@ -1479,7 +1479,7 @@ + char *env; + char tmp[FAKECHROOT_MAXPATH], newfilename[FAKECHROOT_MAXPATH], argv0[FAKECHROOT_MAXPATH]; + char *ptr; +- unsigned int i, j, n; ++ unsigned int i, j, n, len; + size_t sizeenvp; + char c; + char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH]; +@@ -1519,12 +1519,19 @@ + errno = ENOMEM; + return -1; + } +- for (ep = envp, i = 0; *ep != NULL; ++ep, ++i) { +- newenvp[i] = *ep; ++ for (ep = envp, i = 0; *ep != NULL; ++ep) { ++ for (j = 0; j < sizeof (envkey) / sizeof (char *); j++) { ++ len = strlen (envkey[j]); ++ if (strncmp (*ep, envkey[j], len) == 0 && (*ep)[len] == '=') ++ goto skip; ++ } ++ newenvp[i] = *ep; ++ i++; ++ skip: ; + } + + /* Add our variables to newenvp */ +- newenvp = realloc( newenvp, ((sizeenvp + 1) * sizeof(char *) + sizeof(envkey)) ); ++ newenvp = realloc( newenvp, i * sizeof(char *) + sizeof(envkey) ); + if (newenvp == NULL) { + errno = ENOMEM; + return -1;