Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1492223
 поиск   регистрация   авторизация 
 
Группа :: Разработка/Прочее
Пакет: fakeroot

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: fakeroot-1.2-alt-versioning.patch


diff -uprk.orig fakeroot-1.2.orig/configure.ac fakeroot-1.2/configure.ac
--- fakeroot-1.2.orig/configure.ac	2004-11-27 20:54:37 +0300
+++ fakeroot-1.2/configure.ac	2005-02-14 03:17:14 +0300
@@ -341,9 +341,10 @@ case $target_cpu:$target_os in
 esac
 
 AC_DEFINE_UNQUOTED([LIBCPATH], "$libcpath", [path to libc shared object])
+AC_SUBST([LIBCPATH], [$libcpath])
 
 dnl Checks for library functions.
-AC_CHECK_FUNCS(strdup strstr getresuid setresuid getresgid setresgid setfsuid setfsgid)
+AC_CHECK_FUNCS(strdup strstr getresuid setresuid getresgid setresgid setfsuid setfsgid dlvsym)
 
 dnl kludge
 AH_VERBATIM([WRAP_STAT],
diff -uprk.orig fakeroot-1.2.orig/libfakeroot.c fakeroot-1.2/libfakeroot.c
--- fakeroot-1.2.orig/libfakeroot.c	2004-11-27 20:54:37 +0300
+++ fakeroot-1.2/libfakeroot.c	2005-02-14 03:39:35 +0300
@@ -70,6 +70,7 @@
 struct next_wrap_st{
   void **doit;
   char *name;
+  char *vers;
 };
 
 void *get_libc(){
@@ -95,6 +96,7 @@ int fakeroot_disabled = 0;
 #include "wrapped.h"
 #include "wraptmpf.h"
 #include "wrapdef.h"
+#include "symver.h"
 #include "wrapstruct.h"
 
 
@@ -117,6 +119,10 @@ void load_library_symbols(void){
   
   if(!done){
     for(i=0; next_wrap[i].doit; i++){
+#if HAVE_DLVSYM
+      *(next_wrap[i].doit)=dlvsym(get_libc(), next_wrap[i].name, next_wrap[i].vers);
+      if ( (msg = dlerror()) != NULL)
+#endif
       *(next_wrap[i].doit)=dlsym(get_libc(), next_wrap[i].name);
       if ( (msg = dlerror()) != NULL){
 	fprintf (stderr, "dlsym(%s): %s\n", next_wrap[i].name, msg);
@@ -610,7 +616,7 @@ int chown(const char *path, uid_t owner,
   st.st_gid=group;
   send_stat(&st,chown_func);
   if(!dont_try_chown())
-    r=next_lchown(path,owner,group);
+    r=next_chown(path,owner,group);
   else
     r=0;
   if(r&&(errno==EPERM))
diff -uprk.orig fakeroot-1.2.orig/Makefile.am fakeroot-1.2/Makefile.am
--- fakeroot-1.2.orig/Makefile.am	2004-06-18 23:42:10 +0400
+++ fakeroot-1.2/Makefile.am	2005-02-14 03:17:14 +0300
@@ -18,10 +18,10 @@ faked_LDADD = libcommunicate.la
 simple_SOURCES=simple.c
 noinst_PROGRAMS=simple
 
-CLEANFILES= wrapdef.h wrapstruct.h wrapped.h wraptmpf.h
+CLEANFILES= wrapdef.h wrapstruct.h wrapped.h wraptmpf.h symver.h
 DISTCLEANFILES = fakerootconfig.h
 
-EXTRA_DIST=wrapawk wrapfunc.inp                        \
+EXTRA_DIST=wrapawk wrapfunc.inp symver.awk             \
            debian/rules debian/changelog debian/control  \
 	   message.h \
 	   DEBUG BUGS
@@ -31,7 +31,10 @@ CLEAN_FILES=fakerootconfig.h
 wrapped.h wrapdef.h wrapstruct.h wraptmpf.h:wrapawk wrapfunc.inp
 	awk -f $(srcdir)/wrapawk < $(srcdir)/wrapfunc.inp  
 
-libfakeroot.lo:libfakeroot.c wrapdef.h wrapstruct.h wraptmpf.h 
+symver.h: symver.awk
+	readelf -Ws $(LIBCPATH) |awk -f $(srcdir)/symver.awk > $@
+
+libfakeroot.lo:libfakeroot.c wrapdef.h wrapstruct.h wraptmpf.h symver.h
 
 fakerootconfig.h: ./config.status
 	CONFIG_FILES= CONFIG_HEADERS= /bin/sh ./config.status
diff -uprk.orig fakeroot-1.2.orig/symver.awk fakeroot-1.2/symver.awk
--- fakeroot-1.2.orig/symver.awk	1970-01-01 03:00:00 +0300
+++ fakeroot-1.2/symver.awk	2005-02-14 03:17:14 +0300
@@ -0,0 +1,21 @@
+#!/bin/awk
+BEGIN {
+	print "/* Automatically generated file. Do not edit. See symver.awk. */";
+	print ""
+}
+$4 == "FUNC" && $6 == "DEFAULT" && $8 ~ /@@/ {
+	sym=$8;
+	name=gensub("@@.*", "", 1, sym);
+	vers=gensub("^[^@]*@@", "", 1, sym);
+	printf("#define sym_%s_ver \"%s\"\n", name, vers);
+}
+END {
+	print ""
+	print "#define sym_wrap_lstat_ver sym___lxstat_ver";
+	print "#define sym_wrap_stat_ver sym___xstat_ver";
+	print "#define sym_wrap_fstat_ver sym___fxstat_ver";
+	print "#define sym_wrap_lstat64_ver sym___lxstat64_ver";
+	print "#define sym_wrap_stat64_ver sym___xstat64_ver";
+	print "#define sym_wrap_fstat64_ver sym___fxstat64_ver";
+	print "#define sym_wrap_mknod_ver sym___xmknod_ver";
+}
diff -uprk.orig fakeroot-1.2.orig/wrapawk fakeroot-1.2/wrapawk
--- fakeroot-1.2.orig/wrapawk	2004-06-18 23:42:10 +0400
+++ fakeroot-1.2/wrapawk	2005-02-14 03:17:14 +0300
@@ -38,7 +38,7 @@ BEGIN{
   argname=$4;
   MACRO=$5;
   if(MACRO){
-    print "  {(void(*))&NEXT_" MACRO "_NOARG, " name "_QUOTE},"  > structfile;
+    print "  {(void(*))&NEXT_" MACRO "_NOARG, " name "_QUOTE, sym_" tolower(name) "_ver},"  > structfile;
     print "extern " ret " (*NEXT_" MACRO "_NOARG)" argtype ";" > headerfile;
     print ret " (*NEXT_" MACRO "_NOARG)" argtype "=TMP_" MACRO ";"> deffile;
     
@@ -48,7 +48,7 @@ BEGIN{
     print "}"                                           > tmpffile;
     print ""                                            > tmpffile;
   } else {
-    print "  {(void(*))&next_" name ", \"" name "\"},"  > structfile;
+    print "  {(void(*))&next_" name ", \"" name "\", sym_" name "_ver},"  > structfile;
     print "extern " ret " (*next_" name ")" argtype ";" > headerfile;
     print ret " (*next_" name ")" argtype "=tmp_" name ";"> deffile;
     
 
design & coding: Vladimir Lettiev aka crux © 2004-2005