Version: 2.16-1
Would the following patch help ?
Without the patch :
me@here:~$ ln -s /home/me/testy test/x
me@here:~$ ln -s /home/me/test test/y
me@here:~$ fakechroot fakeroot chroot test readlink x
y
me@here:~$ fakechroot fakeroot chroot test readlink y
With the patch below :
me@here:~$ fakechroot fakeroot chroot test readlink x
/home/moi/testy
me@here:~$ fakechroot fakeroot chroot test readlink y
/
Regards,
JH Chatenet
--- a/src/libfakechroot.h 2011-12-11 13:05:34.000000000 +0100
+++ b/src/libfakechroot.h 2013-08-12 13:15:15.000000000 +0200
@@ -85,7 +85,7 @@
if (strlen((path)) == strlen(fakechroot_path)) { \
((char *)(path))[0] = '/'; \
((char *)(path))[1] = '\0'; \
- } else { \
+ } else if ( ((char *)(path))[strlen(fakechroot_path)] ==
'/' ) { \
memmove((void*)(path), (path)+strlen(fakechroot_path),
1+strlen((path))-strlen(fakechroot_path)); \
} \
} \
--- a/src/readlink.c 2011-12-11 13:05:34.000000000 +0100
+++ b/src/readlink.c 2013-08-19 16:12:09.000000000 +0200
@@ -43,9 +43,12 @@
fakechroot_ptr = strstr(tmp, fakechroot_path);
if (fakechroot_ptr != tmp) {
tmpptr = tmp;
- } else {
+ } else if (tmp[strlen(fakechroot_path)] == '/') {
tmpptr = tmp + strlen(fakechroot_path);
status -= strlen(fakechroot_path);
+ } else if (tmp[strlen(fakechroot_path)] == '\0') {
+ tmpptr = "/";
+ status = strlen(tmpptr);
}
if (strlen(tmpptr) > bufsiz) {
status = bufsiz;
--- a/src/readlinkat.c 2011-12-11 13:05:34.000000000 +0100
+++ b/src/readlinkat.c 2013-08-19 16:13:56.000000000 +0200
@@ -46,9 +46,12 @@
fakechroot_ptr = strstr(tmp, fakechroot_path);
if (fakechroot_ptr != tmp) {
tmpptr = tmp;
- } else {
+ } else if (tmp[strlen(fakechroot_path)] == '/') {
tmpptr = tmp + strlen(fakechroot_path);
status -= strlen(fakechroot_path);
+ } else if (tmp[strlen(fakechroot_path)] == '\0') {
+ tmpptr = "/";
+ status = strlen(tmpptr);
}
if (strlen(tmpptr) > bufsiz) {
status = bufsiz;
--- a/src/__readlink_chk.c 2011-12-11 13:05:34.000000000 +0100
+++ b/src/__readlink_chk.c 2013-08-19 16:14:58.000000000 +0200
@@ -46,9 +46,12 @@
fakechroot_ptr = strstr(tmp, fakechroot_path);
if (fakechroot_ptr != tmp) {
tmpptr = tmp;
- } else {
+ } else if (tmp[strlen(fakechroot_path)] == '/') {
tmpptr = tmp + strlen(fakechroot_path);
status -= strlen(fakechroot_path);
+ } else if (tmp[strlen(fakechroot_path)] == '\0') {
+ tmpptr = "/";
+ status = strlen(tmpptr);
}
if (strlen(tmpptr) > bufsiz) {
status = bufsiz;
--- a/src/__readlinkat_chk.c 2011-12-11 13:05:34.000000000 +0100
+++ b/src/__readlinkat_chk.c 2013-08-19 16:16:29.000000000 +0200
@@ -47,9 +47,12 @@
fakechroot_ptr = strstr(tmp, fakechroot_path);
if (fakechroot_ptr != tmp) {
tmpptr = tmp;
- } else {
+ } else if (tmp[strlen(fakechroot_path)] == '/') {
tmpptr = tmp + strlen(fakechroot_path);
status -= strlen(fakechroot_path);
+ } else if (tmp[strlen(fakechroot_path)] == '\0') {
+ tmpptr = "/";
+ status = strlen(tmpptr);
}
if (strlen(tmpptr) > bufsiz) {
status = bufsiz;
--- a/src/libfakechroot.c 2011-12-11 13:05:34.000000000 +0100
+++ b/src/libfakechroot.c 2013-08-09 17:18:05.000000000 +0200
@@ -144,7 +144,7 @@
if (!first) fakechroot_init();
/* We need to expand ~ paths */
- if (home_path!=NULL && p_path[0]=='~') {
+ if (home_path!=NULL && p_path[0]=='~' && (p_path[1]=='\0' ||
p_path[1]=='/')) {
strcpy(cwd_path, home_path);
strcat(cwd_path, &(p_path[1]));
v_path = cwd_path;
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]