While looking at bug #168334 I found this one. Not exactly a showstopper nor have I discovered any unexpected behavior but anyway portage-utils tries to follow the location pointed to by /etc/make.profile but when this is a relative location (as set by eselect for example) it doesn't always work out. For example running the debugging version of "q" from /root (or /usr or /etc) gives me: profile ../usr/portage/profiles/default-linux/amd64/2006.1/make.defaults profile ../usr/portage/profiles/default-linux/amd64/2006.1/../make.defaults profile ../usr/portage/profiles/default-linux/amd64/2006.1/../../make.defaults profile ../usr/portage/profiles/default-linux/amd64/2006.1/../../../base/make.defaults profile /etc/make.globals profile /etc/make.conf which is right, but when running from two levels or more deep (like $HOME for a non-root user for example) I get: profile ../usr/portage/profiles/default-linux/amd64/2006.1/make.defaults profile /etc/make.globals profile /etc/make.conf It's trivial to fix with a chdir("/etc") in main.c.
Please attach a patch.
Created attachment 111367 [details, diff] portae-utils-chdir.patch Fair enough, here is the patch. I don't know if changing the directory is the proper way to do it, but the current working directory doesn't seem to affect anything else so why not.
Created attachment 111369 [details, diff] portage-utils-chdir.patch Oh, what the hell, the chdir should have been outside the loop (not that it makes any differnece).
Thanks. This should be in the 0.1.25
This is released in 0.1.25 Bug #168334 ; q -r dies with a segfault after emerge --sync Bug #168442 ; does not properly parse the profile location Bug #170795 ; add a -E/--eclass option to qgrep Bug #170797 ; add a -s/--skip-comments option to qgrep Bug #171024 ; opening '/usr/portage/.metadata.x' failed Bug #171374 ; Misc enhancements for qgrep Bug #172240 ; -A/-B options for qgrep (context lines) Bug #172338 ; qgrepping through installed ebuilds (in the VDB) Bug #173005 ; Colorized output for qgrep.
Closing
This change breaks things. We will have to revert it and or come up with a new patch.
This patch comes from vapier to address the breakage caused by your patch. --- main.c 8 Apr 2007 19:45:41 -0000 1.136 +++ main.c 9 Apr 2007 23:01:13 -0000 @@ -508,7 +508,10 @@ void initialize_portage_env(void) f = 0; if (readlink("/etc/make.profile", profile, sizeof(profile)) == -1) strcpy(profile, "/etc/make.profile"); - chdir("/etc"); + if (profile[0] != '/') { + memmove(profile+5, profile, strlen(profile)); + memcpy(profile, "/etc/", 5); + } do { if (f == 0) snprintf(portage_file, sizeof(portage_file), "%s/make.defaults", profile);
Closing bug