[Fakeroot-commits] [SCM] fakeroot branch, upstream, updated. 08ed00124d8b6b445d3b91a9aa15eec638b02f05
Clint Adams
schizo at debian.org
Sun Nov 15 03:17:06 UTC 2009
The following commit has been merged in the upstream branch:
commit 17671b917a5a8def8d2dc3e17163c26ec1de4859
Author: Clint Adams <schizo at debian.org>
Date: Sun Sep 4 18:14:29 2005 +0000
alpha stat conversion hackery; closes: #324571.
git-archimport-id: fakeroot at packages.debian.org--fakeroot/fakeroot--main--0.0--patch-83
diff --git a/Makefile.am b/Makefile.am
index db04706..ac7c99b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,7 @@ noinst_LTLIBRARIES = libcommunicate.la
libcommunicate_la_SOURCES = communicate.c
lib_LTLIBRARIES=libfakeroot.la
-libfakeroot_la_SOURCES=libfakeroot.c wrapdef.h wrapstruct.h communicate.h
+libfakeroot_la_SOURCES=libfakeroot.c statconv/glibc/linux/alpha/stats.h wrapdef.h wrapstruct.h communicate.h
libfakeroot_la_LDFLAGS=-version-info 0:1:0
#libfakeroot_la_LDFLAGS=-version-info 4:0:4
libfakeroot_la_DEPENDENCIES=wrapdef.h wrapstruct.h libcommunicate.la
diff --git a/communicate.c b/communicate.c
index cc30978..070d8d2 100644
--- a/communicate.c
+++ b/communicate.c
@@ -37,6 +37,9 @@
# include <sys/socket.h>
#endif
+#ifdef STUPID_ALPHA_HACK
+#include "stats.h"
+#endif
#ifndef _UTSNAME_LENGTH
/* for LINUX libc5 */
@@ -77,9 +80,13 @@ const char *env_var_set(const char *env){
return NULL;
}
-void cpyfakemstat(struct fake_msg *f,
- const struct stat *st){
+void cpyfakemstat(struct fake_msg *f, const struct stat *st
+#ifdef STUPID_ALPHA_HACK
+ , int ver
+#endif
+ ){
+#ifndef STUPID_ALPHA_HACK
f->st.mode =st->st_mode;
f->st.ino =st->st_ino ;
f->st.uid =st->st_uid ;
@@ -96,10 +103,54 @@ void cpyfakemstat(struct fake_msg *f,
to occur in practical fakeroot conditions. */
f->st.nlink=st->st_nlink;
+#else
+ switch(ver) {
+ case _STAT_VER_KERNEL:
+ f->st.mode = ((struct fakeroot_kernel_stat *)st)->st_mode;
+ f->st.ino = ((struct fakeroot_kernel_stat *)st)->st_ino;
+ f->st.uid = ((struct fakeroot_kernel_stat *)st)->st_uid;
+ f->st.gid = ((struct fakeroot_kernel_stat *)st)->st_gid;
+ f->st.dev = ((struct fakeroot_kernel_stat *)st)->st_dev;
+ f->st.rdev = ((struct fakeroot_kernel_stat *)st)->st_rdev;
+ f->st.nlink = ((struct fakeroot_kernel_stat *)st)->st_nlink;
+ break;
+ case _STAT_VER_GLIBC2:
+ f->st.mode = ((struct fakeroot_glibc2_stat *)st)->st_mode;
+ f->st.ino = ((struct fakeroot_glibc2_stat *)st)->st_ino;
+ f->st.uid = ((struct fakeroot_glibc2_stat *)st)->st_uid;
+ f->st.gid = ((struct fakeroot_glibc2_stat *)st)->st_gid;
+ f->st.dev = ((struct fakeroot_glibc2_stat *)st)->st_dev;
+ f->st.rdev = ((struct fakeroot_glibc2_stat *)st)->st_rdev;
+ f->st.nlink = ((struct fakeroot_glibc2_stat *)st)->st_nlink;
+ break;
+ case _STAT_VER_GLIBC2_1:
+ f->st.mode = ((struct fakeroot_glibc21_stat *)st)->st_mode;
+ f->st.ino = ((struct fakeroot_glibc21_stat *)st)->st_ino;
+ f->st.uid = ((struct fakeroot_glibc21_stat *)st)->st_uid;
+ f->st.gid = ((struct fakeroot_glibc21_stat *)st)->st_gid;
+ f->st.dev = ((struct fakeroot_glibc21_stat *)st)->st_dev;
+ f->st.rdev = ((struct fakeroot_glibc21_stat *)st)->st_rdev;
+ f->st.nlink = ((struct fakeroot_glibc21_stat *)st)->st_nlink;
+ break;
+ default:
+ f->st.mode = st->st_mode;
+ f->st.ino = st->st_ino;
+ f->st.uid = st->st_uid;
+ f->st.gid = st->st_gid;
+ f->st.dev = st->st_dev;
+ f->st.rdev = st->st_rdev;
+ f->st.nlink = st->st_nlink;
+ break;
+ }
+#endif
}
-void cpystatfakem(struct stat *st,
- const struct fake_msg *f){
+void cpystatfakem(struct stat *st, const struct fake_msg *f
+#ifdef STUPID_ALPHA_HACK
+ , int ver
+#endif
+ ){
+#ifndef STUPID_ALPHA_HACK
st->st_mode =f->st.mode;
st->st_ino =f->st.ino ;
st->st_uid =f->st.uid ;
@@ -109,6 +160,42 @@ void cpystatfakem(struct stat *st,
/* DON'T copy the nlink count! The system always knows
this one better! */
/* st->st_nlink=f->st.nlink;*/
+#else
+ switch(ver) {
+ case _STAT_VER_KERNEL:
+ ((struct fakeroot_kernel_stat *)st)->st_mode = f->st.mode;
+ ((struct fakeroot_kernel_stat *)st)->st_ino = f->st.ino;
+ ((struct fakeroot_kernel_stat *)st)->st_uid = f->st.uid;
+ ((struct fakeroot_kernel_stat *)st)->st_gid = f->st.gid;
+ ((struct fakeroot_kernel_stat *)st)->st_dev = f->st.dev;
+ ((struct fakeroot_kernel_stat *)st)->st_rdev = f->st.rdev;
+ break;
+ case _STAT_VER_GLIBC2:
+ ((struct fakeroot_glibc2_stat *)st)->st_mode = f->st.mode;
+ ((struct fakeroot_glibc2_stat *)st)->st_ino = f->st.ino;
+ ((struct fakeroot_glibc2_stat *)st)->st_uid = f->st.uid;
+ ((struct fakeroot_glibc2_stat *)st)->st_gid = f->st.gid;
+ ((struct fakeroot_glibc2_stat *)st)->st_dev = f->st.dev;
+ ((struct fakeroot_glibc2_stat *)st)->st_rdev = f->st.rdev;
+ break;
+ case _STAT_VER_GLIBC2_1:
+ ((struct fakeroot_glibc21_stat *)st)->st_mode = f->st.mode;
+ ((struct fakeroot_glibc21_stat *)st)->st_ino = f->st.ino;
+ ((struct fakeroot_glibc21_stat *)st)->st_uid = f->st.uid;
+ ((struct fakeroot_glibc21_stat *)st)->st_gid = f->st.gid;
+ ((struct fakeroot_glibc21_stat *)st)->st_dev = f->st.dev;
+ ((struct fakeroot_glibc21_stat *)st)->st_rdev = f->st.rdev;
+ break;
+ default:
+ st->st_mode =f->st.mode;
+ st->st_ino =f->st.ino ;
+ st->st_uid =f->st.uid ;
+ st->st_gid =f->st.gid ;
+ st->st_dev =f->st.dev ;
+ st->st_rdev =f->st.rdev;
+ break;
+ }
+#endif
}
#ifdef STAT64_SUPPORT
@@ -461,14 +548,22 @@ void send_get_fakem(struct fake_msg *buf)
#endif /* FAKEROOT_FAKENET */
void send_stat(const struct stat *st,
- func_id_t f){
+ func_id_t f
+#ifdef STUPID_ALPHA_HACK
+ , int ver
+#endif
+ ){
struct fake_msg buf;
#ifndef FAKEROOT_FAKENET
if(init_get_msg()!=-1)
#endif /* ! FAKEROOT_FAKENET */
{
+#ifndef STUPID_ALPHA_HACK
cpyfakemstat(&buf,st);
+#else
+ cpyfakemstat(&buf,st,ver);
+#endif
buf.id=f;
send_fakem(&buf);
}
@@ -490,18 +585,30 @@ void send_stat64(const struct stat64 *st,
}
#endif /* STAT64_SUPPORT */
-void send_get_stat(struct stat *st){
+void send_get_stat(struct stat *st
+#ifdef STUPID_ALPHA_HACK
+ , int ver
+#endif
+ ){
struct fake_msg buf;
#ifndef FAKEROOT_FAKENET
if(init_get_msg()!=-1)
#endif /* ! FAKEROOT_FAKENET */
{
+#ifndef STUPID_ALPHA_HACK
cpyfakemstat(&buf,st);
+#else
+ cpyfakemstat(&buf,st,ver);
+#endif
buf.id=stat_func;
send_get_fakem(&buf);
+#ifndef STUPID_ALPHA_HACK
cpystatfakem(st,&buf);
+#else
+ cpystatfakem(st,&buf,ver);
+#endif
}
}
diff --git a/communicate.h b/communicate.h
index 0324c1d..72467a5 100644
--- a/communicate.h
+++ b/communicate.h
@@ -118,16 +118,32 @@ enum {chown_func,
#include "message.h"
extern const char *env_var_set(const char *env);
+#ifndef STUPID_ALPHA_HACK
extern void send_stat(const struct stat *st, func_id_t f);
+#else
+extern void send_stat(const struct stat *st, func_id_t f,int ver);
+#endif
extern void send_fakem(const struct fake_msg *buf);
+#ifndef STUPID_ALPHA_HACK
extern void send_get_stat(struct stat *buf);
+#else
+extern void send_get_stat(struct stat *buf,int ver);
+#endif
extern void cpyfakefake (struct fakestat *b1, const struct fakestat *b2);
+#ifndef STUPID_ALPHA_HACK
extern void cpystatfakem(struct stat *st, const struct fake_msg *buf);
+#else
+extern void cpystatfakem(struct stat *st, const struct fake_msg *buf, int ver);
+#endif
#ifndef FAKEROOT_FAKENET
extern int init_get_msg();
extern key_t get_ipc_key();
-extern void cpyfakemstat(struct fake_msg *b1, const struct stat *st);
+# ifndef STUPID_ALPHA_HACK
+extern void cpyfakemstat(struct fake_msg *b1, const struct stat *st);
+# else
+extern void cpyfakemstat(struct fake_msg *b1, const struct stat *st, int ver);
+# endif
#else /* FAKEROOT_FAKENET */
# ifdef FAKEROOT_LIBFAKEROOT
extern volatile int comm_sd;
diff --git a/configure.ac b/configure.ac
index 3fad65b..4f12acc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -406,6 +406,19 @@ if test "x$SHELL" = "x" ; then
AC_MSG_ERROR(no SUS compliant shell found - on Solaris, install SUNWxcu4)
fi
+case "$target_cpu:$target_os" in
+ (alpha*:linux*)
+ AH_TEMPLATE([STUPID_ALPHA_HACK], [stat-struct conversion hackery])
+ AC_MSG_CHECKING([if we need to do stat-struct conversion hackery])
+ AC_EGREP_CPP([3:3],[
+#include <sys/stat.h>
+_STAT_VER:_STAT_VER_GLIBC2_3_4
+],
+ [AC_MSG_RESULT([yes]); AC_DEFINE(STUPID_ALPHA_HACK)],
+ [AC_MSG_RESULT([no]);])
+ ;;
+esac
+
AC_CONFIG_FILES([Makefile scripts/Makefile doc/Makefile doc/es/Makefile doc/fr/Makefile doc/sv/Makefile test/Makefile])
AC_OUTPUT
diff --git a/libfakeroot.c b/libfakeroot.c
index 58e3f2e..3198e05 100644
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -35,7 +35,6 @@
#include <dirent.h>
#include <errno.h>
-
/*
Where are those shared libraries?
If I knew of a configure/libtool way to find that out, I'd use it. Or
@@ -482,7 +481,11 @@ int WRAP_LSTAT LSTAT_ARG(int ver,
r=NEXT_LSTAT(ver, file_name, statbuf);
if(r)
return -1;
+#ifndef STUPID_ALPHA_HACK
send_get_stat(statbuf);
+#else
+ send_get_stat(statbuf, ver);
+#endif
return 0;
}
@@ -495,7 +498,11 @@ int WRAP_STAT STAT_ARG(int ver,
r=NEXT_STAT(ver, file_name, st);
if(r)
return -1;
+#ifndef STUPID_ALPHA_HACK
send_get_stat(st);
+#else
+ send_get_stat(st,ver);
+#endif
return 0;
}
@@ -510,7 +517,11 @@ int WRAP_FSTAT FSTAT_ARG(int ver,
r=NEXT_FSTAT(ver, fd, st);
if(r)
return -1;
+#ifndef STUPID_ALPHA_HACK
send_get_stat(st);
+#else
+ send_get_stat(st,ver);
+#endif
return 0;
}
@@ -610,7 +621,11 @@ int chown(const char *path, uid_t owner, gid_t group){
return r;
st.st_uid=owner;
st.st_gid=group;
+#ifndef STUPID_ALPHA_HACK
send_stat(&st,chown_func);
+#else
+ send_stat(&st,chown_func, _STAT_VER);
+#endif
if(!dont_try_chown())
r=next_lchown(path,owner,group);
else
@@ -632,7 +647,11 @@ int lchown(const char *path, uid_t owner, gid_t group){
return r;
st.st_uid=owner;
st.st_gid=group;
+#ifndef STUPID_ALPHA_HACK
send_stat(&st,chown_func);
+#else
+ send_stat(&st,chown_func, _STAT_VER);
+#endif
if(!dont_try_chown())
r=next_lchown(path,owner,group);
else
@@ -654,7 +673,11 @@ int fchown(int fd, uid_t owner, gid_t group){
st.st_uid=owner;
st.st_gid=group;
+#ifndef STUPID_ALPHA_HACK
send_stat(&st, chown_func);
+#else
+ send_stat(&st, chown_func, _STAT_VER);
+#endif
if(!dont_try_chown())
r=next_fchown(fd,owner,group);
@@ -677,7 +700,11 @@ int chmod(const char *path, mode_t mode){
st.st_mode=(mode&ALLPERMS)|(st.st_mode&~ALLPERMS);
+#ifndef STUPID_ALPHA_HACK
send_stat(&st, chmod_func);
+#else
+ send_stat(&st, chmod_func, _STAT_VER);
+#endif
/* if a file is unwritable, then root can still write to it
(no matter who owns the file). If we are fakeroot, the only
@@ -708,7 +735,11 @@ int fchmod(int fd, mode_t mode){
return(r);
st.st_mode=(mode&ALLPERMS)|(st.st_mode&~ALLPERMS);
+#ifndef STUPID_ALPHA_HACK
send_stat(&st,chmod_func);
+#else
+ send_stat(&st,chmod_func, _STAT_VER);
+#endif
/* see chmod() for comment */
mode |= 0600;
@@ -751,7 +782,11 @@ int WRAP_MKNOD MKNOD_ARG(int ver UNUSED,
st.st_mode= mode & ~old_mask;
st.st_rdev= XMKNOD_FRTH_ARG dev;
+#ifndef STUPID_ALPHA_HACK
send_stat(&st,mknod_func);
+#else
+ send_stat(&st,mknod_func, _STAT_VER);
+#endif
return 0;
}
@@ -779,7 +814,11 @@ int mkdir(const char *path, mode_t mode){
st.st_mode=(mode&~old_mask&ALLPERMS)|(st.st_mode&~ALLPERMS)|S_IFDIR;
+#ifndef STUPID_ALPHA_HACK
send_stat(&st, chmod_func);
+#else
+ send_stat(&st, chmod_func, _STAT_VER);
+#endif
return 0;
}
@@ -840,7 +879,11 @@ int rmdir(const char *pathname){
if(r)
return -1;
+#ifndef STUPID_ALPHA_HACK
send_stat(&st,unlink_func);
+#else
+ send_stat(&st,unlink_func, _STAT_VER);
+#endif
return 0;
}
@@ -859,7 +902,11 @@ int remove(const char *pathname){
r=next_remove(pathname);
if(r)
return -1;
+#ifndef STUPID_ALPHA_HACK
send_stat(&st,unlink_func);
+#else
+ send_stat(&st,unlink_func, _STAT_VER);
+#endif
return r;
}
@@ -889,7 +936,11 @@ int rename(const char *oldpath, const char *newpath){
if(s)
return -1;
if(!r)
+#ifndef STUPID_ALPHA_HACK
send_stat(&st,unlink_func);
+#else
+ send_stat(&st,unlink_func, _STAT_VER);
+#endif
return 0;
}
diff --git a/statconv/glibc/linux/alpha/stats.h b/statconv/glibc/linux/alpha/stats.h
new file mode 100644
index 0000000..7d61289
--- /dev/null
+++ b/statconv/glibc/linux/alpha/stats.h
@@ -0,0 +1,86 @@
+/* Definition of `struct stat' used in the kernel. */
+struct fakeroot_kernel_stat
+ {
+ unsigned int st_dev;
+ unsigned int st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned int st_rdev;
+ long int st_size;
+ unsigned long int st_atime;
+ unsigned long int st_mtime;
+ unsigned long int st_ctime;
+ unsigned int st_blksize;
+ int st_blocks;
+ unsigned int st_flags;
+ unsigned int st_gen;
+ };
+
+/* Definition of `struct stat64' used in the kernel. */
+struct fakeroot_kernel_stat64
+ {
+ unsigned long st_dev;
+ unsigned long st_ino;
+ unsigned long st_rdev;
+ long st_size;
+ unsigned long st_blocks;
+
+ unsigned int st_mode;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned int st_blksize;
+ unsigned int st_nlink;
+ unsigned int __pad0;
+
+ unsigned long st_atime;
+ unsigned long st_atimensec;
+ unsigned long st_mtime;
+ unsigned long st_mtimensec;
+ unsigned long st_ctime;
+ unsigned long st_ctimensec;
+ long __unused[3];
+ };
+
+/* Definition of `struct stat' used by glibc 2.0. */
+struct fakeroot_glibc2_stat
+ {
+ __dev_t st_dev;
+ __ino_t st_ino;
+ __mode_t st_mode;
+ __nlink_t st_nlink;
+ __uid_t st_uid;
+ __gid_t st_gid;
+ __dev_t st_rdev;
+ __off_t st_size;
+ __time_t st_atime;
+ __time_t st_mtime;
+ __time_t st_ctime;
+ unsigned int st_blksize;
+ int st_blocks;
+ unsigned int st_flags;
+ unsigned int st_gen;
+ };
+
+/* Definition of `struct stat' used by glibc 2.1. */
+struct fakeroot_glibc21_stat
+ {
+ __dev_t st_dev;
+ __ino64_t st_ino;
+ __mode_t st_mode;
+ __nlink_t st_nlink;
+ __uid_t st_uid;
+ __gid_t st_gid;
+ __dev_t st_rdev;
+ __off_t st_size;
+ __time_t st_atime;
+ __time_t st_mtime;
+ __time_t st_ctime;
+ __blkcnt64_t st_blocks;
+ __blksize_t st_blksize;
+ unsigned int st_flags;
+ unsigned int st_gen;
+ int __pad3;
+ long __unused[4];
+ };
--
fakeroot
More information about the Fakeroot-commits
mailing list