remove non-used patches
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
This commit is contained in:
parent
7b90ebd606
commit
64c31bb96d
|
@ -1,22 +0,0 @@
|
|||
--- fakechroot-2.8/src/libfakechroot.c.init 2008-10-05 10:18:21.000000000 +0200
|
||||
+++ fakechroot-2.8/src/libfakechroot.c 2008-10-05 10:21:45.000000000 +0200
|
||||
@@ -1778,7 +1778,8 @@
|
||||
char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
|
||||
|
||||
if (next_getpeername == NULL) fakechroot_init();
|
||||
- memset(&newname, 0, sizeof(struct sockaddr_un));
|
||||
+ newnamelen = sizeof(struct sockaddr_un);
|
||||
+ memset(&newname, 0, newnamelen);
|
||||
status = next_getpeername(s, (struct sockaddr *)&newname, &newnamelen);
|
||||
if (status != 0) {
|
||||
return status;
|
||||
@@ -1806,7 +1807,8 @@
|
||||
char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
|
||||
|
||||
if (next_getsockname == NULL) fakechroot_init();
|
||||
- memset(&newname, 0, sizeof(struct sockaddr_un));
|
||||
+ newnamelen = sizeof(struct sockaddr_un);
|
||||
+ memset(&newname, 0, newnamelen);
|
||||
status = next_getsockname(s, (struct sockaddr *)&newname, &newnamelen);
|
||||
if (status != 0) {
|
||||
return status;
|
|
@ -1,262 +0,0 @@
|
|||
Index: test/t/cmd-subst-pwd.sh
|
||||
===================================================================
|
||||
--- test/t/cmd-subst-pwd.sh (revision 0)
|
||||
+++ test/t/cmd-subst-pwd.sh (revision 0)
|
||||
@@ -0,0 +1,3 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+echo substituted
|
||||
|
||||
Property changes on: test/t/cmd-subst-pwd.sh
|
||||
___________________________________________________________________
|
||||
Added: svn:executable
|
||||
+ *
|
||||
|
||||
Index: test/t/cmd-subst.t
|
||||
===================================================================
|
||||
--- test/t/cmd-subst.t (revision 0)
|
||||
+++ test/t/cmd-subst.t (revision 0)
|
||||
@@ -0,0 +1,37 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+. ./tap.sh
|
||||
+
|
||||
+plan 5
|
||||
+
|
||||
+rm -rf testtree
|
||||
+
|
||||
+./testtree.sh testtree
|
||||
+test "`cat testtree/CHROOT`" = "testtree" || not
|
||||
+ok "testtree"
|
||||
+
|
||||
+t=`./fakechroot.sh testtree /bin/pwd`
|
||||
+test "$t" = "/" || not
|
||||
+ok "fakechroot pwd is /"
|
||||
+
|
||||
+export FAKECHROOT_CMD_SUBST="/bin/pwd=$(pwd)/t/cmd-subst-pwd.sh"
|
||||
+
|
||||
+t=`./fakechroot.sh testtree /bin/pwd`
|
||||
+test "$t" = "substituted" || not
|
||||
+ok "fakechroot substituted pwd (1)"
|
||||
+
|
||||
+export FAKECHROOT_CMD_SUBST="/no/file=foo:/bin/pwd=$(pwd)/t/cmd-subst-pwd.sh"
|
||||
+
|
||||
+t=`./fakechroot.sh testtree /bin/pwd`
|
||||
+test "$t" = "substituted" || not
|
||||
+ok "fakechroot substituted pwd (2)"
|
||||
+
|
||||
+export FAKECHROOT_CMD_SUBST="/no/file=foo:/other/file=bar"
|
||||
+
|
||||
+t=`./fakechroot.sh testtree /bin/pwd`
|
||||
+test "$t" = "/" || not
|
||||
+ok "fakechroot not substituted pwd is /"
|
||||
+
|
||||
+rm -rf testtree
|
||||
+
|
||||
+end
|
||||
|
||||
Property changes on: test/t/cmd-subst.t
|
||||
___________________________________________________________________
|
||||
Added: svn:executable
|
||||
+ *
|
||||
|
||||
Index: test/Makefile.am
|
||||
===================================================================
|
||||
--- test/Makefile.am (revision 334)
|
||||
+++ test/Makefile.am (working copy)
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
TESTS = \
|
||||
t/chroot.t \
|
||||
+ t/cmd-subst.t \
|
||||
t/escape-nested-chroot.t \
|
||||
t/pwd.t \
|
||||
t/touch.t \
|
||||
Index: src/libfakechroot.c
|
||||
===================================================================
|
||||
--- src/libfakechroot.c (revision 334)
|
||||
+++ src/libfakechroot.c (working copy)
|
||||
@@ -1467,7 +1467,38 @@
|
||||
return execve (path, argv, environ);
|
||||
}
|
||||
|
||||
+/* Parse the FAKECHROOT_CMD_SUBST environment variable (the first
|
||||
+ * parameter) and if there is a match with filename, return the
|
||||
+ * substitution in cmd_subst. Returns non-zero if there was a match.
|
||||
+ *
|
||||
+ * FAKECHROOT_CMD_SUBST=cmd=subst:cmd=subst:...
|
||||
+ */
|
||||
+static int
|
||||
+try_cmd_subst (char *env, const char *filename, char *cmd_subst)
|
||||
+{
|
||||
+ int len = strlen (filename), len2;
|
||||
+ char *p;
|
||||
|
||||
+ if (env == NULL) return 0;
|
||||
+
|
||||
+ do {
|
||||
+ p = strchrnul (env, ':');
|
||||
+
|
||||
+ if (strncmp (env, filename, len) == 0 && env[len] == '=') {
|
||||
+ len2 = p - &env[len+1];
|
||||
+ if (len2 >= FAKECHROOT_MAXPATH)
|
||||
+ len2 = FAKECHROOT_MAXPATH - 1;
|
||||
+ strncpy (cmd_subst, &env[len+1], len2);
|
||||
+ cmd_subst[len2] = '\0';
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ env = p;
|
||||
+ } while (*env++ != '\0');
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* #include <unistd.h> */
|
||||
int execve (const char *filename, char *const argv [], char *const envp[])
|
||||
{
|
||||
@@ -1479,32 +1510,16 @@
|
||||
char *env;
|
||||
char tmp[FAKECHROOT_MAXPATH], newfilename[FAKECHROOT_MAXPATH], argv0[FAKECHROOT_MAXPATH];
|
||||
char *ptr;
|
||||
- unsigned int i, j, n, len;
|
||||
+ unsigned int i, j, n, len, r, newenvppos;
|
||||
size_t sizeenvp;
|
||||
char c;
|
||||
char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
|
||||
char *envkey[] = { "FAKECHROOT", "FAKECHROOT_BASE",
|
||||
"FAKECHROOT_VERSION", "FAKECHROOT_EXCLUDE_PATH",
|
||||
+ "FAKECHROOT_CMD_SUBST",
|
||||
"LD_LIBRARY_PATH", "LD_PRELOAD" };
|
||||
+ const int nr_envkey = sizeof envkey / sizeof envkey[0];
|
||||
|
||||
- strncpy(argv0, filename, FAKECHROOT_MAXPATH);
|
||||
-
|
||||
- expand_chroot_path(filename, fakechroot_path, fakechroot_ptr, fakechroot_buf);
|
||||
- strcpy(tmp, filename);
|
||||
- filename = tmp;
|
||||
-
|
||||
- if ((file = open(filename, O_RDONLY)) == -1) {
|
||||
- errno = ENOENT;
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- i = read(file, hashbang, FAKECHROOT_MAXPATH-2);
|
||||
- close(file);
|
||||
- if (i == -1) {
|
||||
- errno = ENOENT;
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
if (next_execve == NULL) fakechroot_init();
|
||||
|
||||
/* Scan envp and check its size */
|
||||
@@ -1514,39 +1529,69 @@
|
||||
}
|
||||
|
||||
/* Copy envp to newenvp */
|
||||
- newenvp = malloc( sizeenvp * sizeof (char *) + sizeof(envkey) );
|
||||
+ newenvp = malloc( (sizeenvp + 1) * sizeof (char *) );
|
||||
if (newenvp == NULL) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
- for (ep = (char **)envp, i = 0; *ep != NULL; ++ep) {
|
||||
- for (j = 0; j < sizeof (envkey) / sizeof (char *); j++) {
|
||||
+ for (ep = (char **) envp, newenvppos = 0; *ep != NULL; ++ep) {
|
||||
+ for (j = 0; j < nr_envkey; j++) {
|
||||
len = strlen (envkey[j]);
|
||||
if (strncmp (*ep, envkey[j], len) == 0 && (*ep)[len] == '=')
|
||||
goto skip;
|
||||
}
|
||||
- newenvp[i] = *ep;
|
||||
- i++;
|
||||
+ newenvp[newenvppos] = *ep;
|
||||
+ newenvppos++;
|
||||
skip: ;
|
||||
}
|
||||
+ newenvp[newenvppos] = NULL;
|
||||
|
||||
+ strncpy(argv0, filename, FAKECHROOT_MAXPATH);
|
||||
+
|
||||
+ r = try_cmd_subst (getenv ("FAKECHROOT_CMD_SUBST"), filename, tmp);
|
||||
+ if (r) {
|
||||
+ filename = tmp;
|
||||
+
|
||||
+ /* FAKECHROOT_CMD_SUBST escapes the chroot. newenvp here does
|
||||
+ * not contain LD_PRELOAD and the other special environment
|
||||
+ * variables.
|
||||
+ */
|
||||
+ return next_execve(filename, argv, newenvp);
|
||||
+ }
|
||||
+
|
||||
+ expand_chroot_path(filename, fakechroot_path, fakechroot_ptr, fakechroot_buf);
|
||||
+ strcpy(tmp, filename);
|
||||
+ filename = tmp;
|
||||
+
|
||||
+ if ((file = open(filename, O_RDONLY)) == -1) {
|
||||
+ errno = ENOENT;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ i = read(file, hashbang, FAKECHROOT_MAXPATH-2);
|
||||
+ close(file);
|
||||
+ if (i == -1) {
|
||||
+ errno = ENOENT;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
/* Add our variables to newenvp */
|
||||
- newenvp = realloc( newenvp, i * sizeof(char *) + sizeof(envkey) );
|
||||
+ newenvp = realloc( newenvp, (newenvppos + nr_envkey + 1) * sizeof(char *) );
|
||||
if (newenvp == NULL) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
- for (j = 0; j < sizeof(envkey) / sizeof(char *); j++) {
|
||||
+ for (j = 0; j < nr_envkey; j++) {
|
||||
env = getenv(envkey[j]);
|
||||
if (env != NULL) {
|
||||
- newenvp[i] = malloc(strlen(envkey[j]) + strlen(env) + 3);
|
||||
- strcpy(newenvp[i], envkey[j]);
|
||||
- strcat(newenvp[i], "=");
|
||||
- strcat(newenvp[i], env);
|
||||
- i++;
|
||||
+ newenvp[newenvppos] = malloc(strlen(envkey[j]) + strlen(env) + 3);
|
||||
+ strcpy(newenvp[newenvppos], envkey[j]);
|
||||
+ strcat(newenvp[newenvppos], "=");
|
||||
+ strcat(newenvp[newenvppos], env);
|
||||
+ newenvppos++;
|
||||
}
|
||||
}
|
||||
- newenvp[i] = NULL;
|
||||
+ newenvp[newenvppos] = NULL;
|
||||
|
||||
/* No hashbang in argv */
|
||||
if (hashbang[0] != '#' || hashbang[1] != '!')
|
||||
Index: man/fakechroot.pod
|
||||
===================================================================
|
||||
--- man/fakechroot.pod (revision 334)
|
||||
+++ man/fakechroot.pod (working copy)
|
||||
@@ -139,6 +139,21 @@
|
||||
The list of directories which are excluded from being chrooted. The elements
|
||||
of list are separated with colon.
|
||||
|
||||
+=item B<FAKECHROOT_CMD_SUBST>
|
||||
+
|
||||
+A list of command substitutions. If a program tries to execute one of
|
||||
+the commands given (path relative to the chroot) then the substitute
|
||||
+command runs instead (path to substitute command is not chrooted).
|
||||
+
|
||||
+For example:
|
||||
+
|
||||
+ FAKECHROOT_CMD_SUBST=/sbin/ldconfig=/tmp/ldconfig-wrapper
|
||||
+
|
||||
+will substitute C</tmp/ldconfig-wrapper> for C</sbin/ldconfig>.
|
||||
+
|
||||
+Give as many substitute commands as you want, separated by C<:>
|
||||
+(colon) characters.
|
||||
+
|
||||
=item B<LD_LIBRARY_PATH>, B<LD_PRELOAD>
|
||||
|
||||
Fakechroot is implemented by wrapping system calls. This is accomplished by
|
|
@ -1,25 +0,0 @@
|
|||
diff -ur fakechroot-2.9/autogen.sh fakechroot-2.9-no-automake-version/autogen.sh
|
||||
--- fakechroot-2.9/autogen.sh 2009-03-19 14:43:19.000000000 +0000
|
||||
+++ fakechroot-2.9-no-automake-version/autogen.sh 2009-06-12 10:03:49.897687490 +0100
|
||||
@@ -5,18 +5,16 @@
|
||||
set -e
|
||||
|
||||
autogen () {
|
||||
- automake_version=1.10
|
||||
-
|
||||
rm -f Makefile Makefile.in aclocal.m4
|
||||
rm -f config.guess config.h config.h.in config.log
|
||||
rm -f config.status config.sub configure
|
||||
rm -f depcomp install-sh libtool ltmain.sh missing stamp-h1
|
||||
rm -rf autom4te.cache
|
||||
|
||||
- aclocal-${automake_version} "$@"
|
||||
+ aclocal "$@"
|
||||
autoheader
|
||||
libtoolize --force --copy
|
||||
- automake-${automake_version} --add-missing --copy
|
||||
+ automake --add-missing --copy
|
||||
autoconf
|
||||
|
||||
rm -rf autom4te.cache
|
||||
Only in fakechroot-2.9-no-automake-version: autogen.sh~
|
|
@ -1,113 +0,0 @@
|
|||
Index: m4/scandir_argtypes.m4
|
||||
===================================================================
|
||||
--- m4/scandir_argtypes.m4 (revision 334)
|
||||
+++ m4/scandir_argtypes.m4 (working copy)
|
||||
@@ -12,7 +12,7 @@
|
||||
for ac_arg1 in 'const char *dir'; do
|
||||
for ac_arg2 in 'struct dirent ***namelist'; do
|
||||
for ac_arg3 in 'int(*filter)(const struct dirent *)' 'int(*filter)(struct dirent *)'; do
|
||||
- for ac_arg4 in 'int(*compar)(const void *,const void *)'; do
|
||||
+ for ac_arg4 in 'int(*compar)(const void *,const void *)' 'int(*compar)(const struct dirent **, const struct dirent **)'; do
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[AC_INCLUDES_DEFAULT
|
||||
@@ -46,3 +46,52 @@
|
||||
[Define to the type of arg 4 for `scandir'.])
|
||||
rm -f conftest*
|
||||
])
|
||||
+
|
||||
+dnl AC_FUNC_SCANDIR64_ARGTYPES
|
||||
+dnl -------------------------
|
||||
+dnl Determine the correct type to be passed to each of the `scandir64'
|
||||
+dnl function's arguments, and define those types in `SCANDIR64_TYPE_ARG1',
|
||||
+dnl `SCANDIR64_TYPE_ARG2', `SCANDIR64_TYPE_ARG3' and `SCANDIR64_TYPE_ARG4'.
|
||||
+AN_FUNCTION([scandir64], [AC_FUNC_SCANDIR64_ARGTYPES])
|
||||
+AC_DEFUN([AC_FUNC_SCANDIR64_ARGTYPES],
|
||||
+[AC_CHECK_HEADERS(dirent.h)
|
||||
+AC_CACHE_CHECK([types of arguments for scandir64],
|
||||
+[ac_cv_func_scandir64_args],
|
||||
+[for ac_return in 'int'; do
|
||||
+ for ac_arg1 in 'const char *dir'; do
|
||||
+ for ac_arg2 in 'struct dirent64 ***namelist'; do
|
||||
+ for ac_arg3 in 'int(*filter)(const struct dirent64 *)' 'int(*filter)(struct dirent64 *)'; do
|
||||
+ for ac_arg4 in 'int(*compar)(const void *,const void *)' 'int(*compar)(const struct dirent64 **, const struct dirent64 **)'; do
|
||||
+ AC_COMPILE_IFELSE(
|
||||
+ [AC_LANG_PROGRAM(
|
||||
+[AC_INCLUDES_DEFAULT
|
||||
+#ifdef HAVE_UNISTD_H
|
||||
+#include <dirent.h>
|
||||
+#endif
|
||||
+],
|
||||
+ [extern $ac_return scandir64 ($ac_arg1, $ac_arg2, $ac_arg3, $ac_arg4);])],
|
||||
+ [ac_cv_func_scandir64_args="$ac_return;$ac_arg1;$ac_arg2;$ac_arg3;$ac_arg4"; break 5])
|
||||
+ done
|
||||
+ done
|
||||
+ done
|
||||
+ done
|
||||
+done
|
||||
+# Provide a safe default value.
|
||||
+: ${ac_cv_func_scandir64_args='(default) int;const char *dir;struct dirent64 ***namelist;int(*filter)(const struct dirent64 *);int(*compar)(const void *,const void *)'}
|
||||
+])
|
||||
+ac_save_IFS=$IFS; IFS=';'
|
||||
+set dummy `echo "$ac_cv_func_scandir64_args" | sed 's/^(default) //' | sed 's/\*/\*/g'`
|
||||
+IFS=$ac_save_IFS
|
||||
+shift
|
||||
+AC_DEFINE_UNQUOTED(SCANDIR64_TYPE_RETURN, $[1],
|
||||
+ [Define to the type of return value for `scandir64'.])
|
||||
+AC_DEFINE_UNQUOTED(SCANDIR64_TYPE_ARG1, $[2],
|
||||
+ [Define to the type of arg 1 for `scandir64'.])
|
||||
+AC_DEFINE_UNQUOTED(SCANDIR64_TYPE_ARG2, $[3],
|
||||
+ [Define to the type of arg 2 for `scandir64'.])
|
||||
+AC_DEFINE_UNQUOTED(SCANDIR64_TYPE_ARG3, $[4],
|
||||
+ [Define to the type of arg 3 for `scandir64'.])
|
||||
+AC_DEFINE_UNQUOTED(SCANDIR64_TYPE_ARG4, $[5],
|
||||
+ [Define to the type of arg 4 for `scandir64'.])
|
||||
+rm -f conftest*
|
||||
+])
|
||||
Index: src/libfakechroot.c
|
||||
===================================================================
|
||||
--- src/libfakechroot.c (revision 334)
|
||||
+++ src/libfakechroot.c (working copy)
|
||||
@@ -512,10 +512,10 @@
|
||||
#endif
|
||||
static int (*next_rmdir) (const char *pathname) = NULL;
|
||||
#ifdef HAVE_SCANDIR
|
||||
-static int (*next_scandir) (const char *dir, struct dirent ***namelist, SCANDIR_TYPE_ARG3, int(*compar)(const void *, const void *)) = NULL;
|
||||
+static int (*next_scandir) (SCANDIR_TYPE_ARG1, SCANDIR_TYPE_ARG2, SCANDIR_TYPE_ARG3, SCANDIR_TYPE_ARG4) = NULL;
|
||||
#endif
|
||||
#ifdef HAVE_SCANDIR64
|
||||
-static int (*next_scandir64) (const char *dir, struct dirent64 ***namelist, int(*filter)(const struct dirent64 *), int(*compar)(const void *, const void *)) = NULL;
|
||||
+static int (*next_scandir64) (SCANDIR64_TYPE_ARG1, SCANDIR64_TYPE_ARG2, SCANDIR64_TYPE_ARG3, SCANDIR64_TYPE_ARG4) = NULL;
|
||||
#endif
|
||||
#ifdef HAVE_SETXATTR
|
||||
static int (*next_setxattr) (const char *path, const char *name, const void *value, size_t size, int flags) = NULL;
|
||||
@@ -2619,7 +2619,7 @@
|
||||
|
||||
#ifdef HAVE_SCANDIR
|
||||
/* #include <dirent.h> */
|
||||
-int scandir (const char *dir, struct dirent ***namelist, SCANDIR_TYPE_ARG3, int(*compar)(const void *, const void *))
|
||||
+int scandir (SCANDIR_TYPE_ARG1, SCANDIR_TYPE_ARG2, SCANDIR_TYPE_ARG3, SCANDIR_TYPE_ARG4)
|
||||
{
|
||||
char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
|
||||
expand_chroot_path(dir, fakechroot_path, fakechroot_ptr, fakechroot_buf);
|
||||
@@ -2631,7 +2631,7 @@
|
||||
|
||||
#ifdef HAVE_SCANDIR64
|
||||
/* #include <dirent.h> */
|
||||
-int scandir64 (const char *dir, struct dirent64 ***namelist, int(*filter)(const struct dirent64 *), int(*compar)(const void *, const void *))
|
||||
+int scandir64 (SCANDIR64_TYPE_ARG1, SCANDIR64_TYPE_ARG2, SCANDIR64_TYPE_ARG3, SCANDIR64_TYPE_ARG4)
|
||||
{
|
||||
char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
|
||||
expand_chroot_path(dir, fakechroot_path, fakechroot_ptr, fakechroot_buf);
|
||||
Index: configure.ac
|
||||
===================================================================
|
||||
--- configure.ac (revision 334)
|
||||
+++ configure.ac (working copy)
|
||||
@@ -177,6 +177,7 @@
|
||||
|
||||
AC_FUNC_READLINK_ARGTYPES
|
||||
AC_FUNC_SCANDIR_ARGTYPES
|
||||
+AC_FUNC_SCANDIR64_ARGTYPES
|
||||
|
||||
AC_CONFIG_FILES([ \
|
||||
Makefile \
|
Loading…
Reference in New Issue