Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 168442
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: portage-utils <portage-utils@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Georgi Georgiev <chutz@gg3.net>
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
putils-chdir.patch portae-utils-chdir.patch patch Georgi Georgiev 2007-02-27 00:08 0000 1.14 KB Details | Diff
putils-chdir.patch portage-utils-chdir.patch patch Georgi Georgiev 2007-02-27 00:12 0000 468 bytes Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 168442 depends on: Show dependency tree
Bug 168442 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2007-02-26 10:26 0000
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.

------- Comment #1 From solar 2007-02-26 18:22:24 0000 -------
Please attach a patch.

------- Comment #2 From Georgi Georgiev 2007-02-27 00:08:54 0000 -------
Created an attachment (id=111367) [details]
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.

------- Comment #3 From Georgi Georgiev 2007-02-27 00:12:34 0000 -------
Created an attachment (id=111369) [details]
portage-utils-chdir.patch

Oh, what the hell, the chdir should have been outside the loop (not that it
makes any differnece).

------- Comment #4 From solar 2007-02-27 00:30:12 0000 -------
Thanks. This should be in the 0.1.25

------- Comment #5 From solar 2007-04-05 18:42:17 0000 -------
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.

------- Comment #6 From solar 2007-04-05 18:43:01 0000 -------
Closing

------- Comment #7 From solar 2007-04-09 22:58:57 0000 -------
This change breaks things. We will have to revert it and or come up with a new
patch. 

------- Comment #8 From solar 2007-04-09 23:08:50 0000 -------
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);

------- Comment #9 From solar 2007-06-21 14:02:04 0000 -------
Closing bug

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug