Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 234585 Details for
Bug 319069
app-portage/portage-utils-0.3.1: qfile no longer understand dirs symlinks
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
qfile-optimized-fix-for-realpath-checks.patch
qfile-optimized-fix-for-realpath-checks.patch (text/plain), 2.87 KB, created by
TGL
on 2010-06-08 20:27:08 UTC
(
hide
)
Description:
qfile-optimized-fix-for-realpath-checks.patch
Filename:
MIME Type:
Creator:
TGL
Created:
2010-06-08 20:27:08 UTC
Size:
2.87 KB
patch
obsolete
>Index: qfile.c >=================================================================== >RCS file: /var/cvsroot/gentoo-projects/portage-utils/qfile.c,v >retrieving revision 1.52 >diff -u -r1.52 qfile.c >--- qfile.c 7 Apr 2010 05:58:16 -0000 1.52 >+++ qfile.c 8 Jun 2010 19:23:21 -0000 >@@ -51,6 +51,7 @@ > char *bn_firstchars; > short *non_orphans; > char *real_root; >+ size_t real_root_length; > char *exclude_pkg; > char *exclude_slot; > } qfile_args_t; >@@ -75,12 +76,20 @@ > int i, path_ok; > char bn_firstchar; > char *real_root = args->real_root; >+ size_t real_root_len = args->real_root_length; > char **base_names = args->basenames; > char **dir_names = args->dirnames; > char **real_dir_names = args->realdirnames; > char *bn_firstchars = args->bn_firstchars; > short *non_orphans = args->non_orphans; > >+ // these variables are for checking realpath(dirname(CONTENTS)) >+ char rpath[_Q_PATH_MAX + 1]; >+ char *_rpath = rpath + real_root_len; >+ char fullpath[_Q_PATH_MAX + 1]; >+ memcpy(fullpath, real_root, real_root_len); >+ fullpath[real_root_len] = '\0'; >+ > if ((dir = opendir(path)) == NULL) { > warnp("opendir(%s) failed", path); > return; >@@ -186,15 +195,21 @@ > /* real_dir_name == dirname(CONTENTS) */ > path_ok = 1; > >- else if (real_root[0]) { >- char rpath[_Q_PATH_MAX + 1], *_rpath; >- char *fullpath; >- size_t real_root_len = strlen(real_root); >- >- xasprintf(&fullpath, "%s%s", real_root, e->name); >- fullpath[real_root_len + dirname_len] = '\0'; >- _rpath = rpath + real_root_len; >- if (realpath(fullpath, rpath) == NULL) { >+ else { >+ /* reuse realpath(dirname(...)) from a previous CONTENTS entry >+ * if directory has not changed yet */ >+ if ((fullpath[0] == '\0') || >+ (fullpath[real_root_len + dirname_len] != '\0') || >+ (strncmp(fullpath + real_root_len, e->name, dirname_len))) >+ { >+ rpath[0] = '\0'; >+ memcpy(fullpath + real_root_len, e->name, dirname_len); >+ fullpath[real_root_len + dirname_len] = '\0'; >+ if (realpath(fullpath, rpath) == NULL) >+ rpath[0] = '\0'; >+ } >+ >+ if (rpath[0] == '\0') { > if (verbose) { > warnp("Could not read real path of \"%s\" (from %s)", fullpath, pkg); > warn("We'll never know whether \"%s\" was a result for your query...", >@@ -212,7 +227,6 @@ > /* real_dir_name == realpath(dirname(CONTENTS)) */ > path_ok = 1; > } >- free(fullpath); > } > } > if (!path_ok) >@@ -311,7 +325,7 @@ > int i; > int nb_of_queries = argc; > char *pwd = NULL; >- int real_root_length; >+ size_t real_root_length; > char *real_root = NULL; > char **basenames = NULL; > char **dirnames = NULL; >@@ -455,6 +469,7 @@ > free(pwd); > > qfile_args->real_root = real_root; >+ qfile_args->real_root_length = real_root_length; > qfile_args->basenames = basenames; > qfile_args->dirnames = dirnames; > qfile_args->realdirnames = realdirnames;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 319069
:
230867
| 234585