Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 204937 - app-admin/eselect doesn't honor ${ROOT} b/c of a typo, and symlinks into ${ROOT}
Summary: app-admin/eselect doesn't honor ${ROOT} b/c of a typo, and symlinks into ${ROOT}
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: eselect (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo eselect Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2008-01-08 18:54 UTC by Matthijs Kooijman
Modified: 2009-04-18 08:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch against 1.0.10 (eselect-1.0.10-fix-rc-add.patch,508 bytes, patch)
2008-01-08 18:56 UTC, Matthijs Kooijman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthijs Kooijman 2008-01-08 18:54:13 UTC
eselect rc supports the ROOT environment variable. However, when calling, eselect rc add, this does not work as expected. The result is that a symlink is created in /etc/runlevels (so not inside $ROOT) pointing to the initscript inside $ROOT.

From /usr/share/eselect/modules/rc.eselect:106
                                ln -sf \
                                        ${ROOT}/etc/init.d/${script} \
                                        ${ROOTi}/etc/runlevels/${runlevel}/${script} \
                                        && write_kv_list_entry ${runlevel} "[done]" \
                                        || write_kv_list_entry ${runlevel} "[failed]"

Here we see that $ROOT is applied to both the target and name of the symlink, however, it is misspelled for the name, resulting in the symlink being created outside of $ROOT.

Apart from this misspelling, we see that $ROOT is also aplied to the target of the symlink. The resulting symlink will then point to, for example, /somewhere/etc/init.d/somescript. When actually booting into the root fs under $ROOT, /somewhere is obviously not available anymore. The symlink should either point to /etc/init.d/somescript (this is what update-rc does) or to ../init.d/somescript (this is what the default links in baselayout2 have).

I've attached a patch that achieves the former solution. It is made against 1.0.10, but 1.0.11 has the same problem and the patch should apply cleanly. It's a trivial patch anyway.
Comment 1 Matthijs Kooijman 2008-01-08 18:56:16 UTC
Created attachment 140493 [details, diff]
Patch against 1.0.10
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2008-01-08 22:01:46 UTC
I don't see any such problem w/ 1.0.11
Comment 3 Matthijs Kooijman 2008-01-08 22:39:50 UTC
I'm still convinced that this bug is present. To show that the bugged code is still present in 1.0.11, run the following two commands.

# ebuild /usr/portage/app-admin/eselect/eselect-1.0.11.ebuild unpack
# grep -C 2 ROOTi /var/tmp/portage/app-admin/eselect-1.0.11/work/eselect-1.0.11/modules/rc.eselect 

                                ln -sf \
                                        ${ROOT}/etc/init.d/${script} \
                                        ${ROOTi}/etc/runlevels/${runlevel}/${script} \
                                        && write_kv_list_entry ${runlevel} "[done]" \
                                        || write_kv_list_entry ${runlevel} "[failed]"

To verify, I installed eselect-1.0.11 and got the following.

# mkdir -p /somewhere/etc/init.d /somewhere/etc/runlevels/default
# cp /etc/init.d/local /somewhere/etc/init.d/
# ROOT=/somewhere eselect rc add local default
# ls -l /etc/runlevels/default/local 
lrwxrwxrwx 1 root root 27 Jan  8 22:33 /etc/runlevels/default/local -> /somewhere/etc/init.d/local
# ls -l /somewhere/etc/runlevels/default/
total 0

Clearly, the bug is still in 1.0.11. I'm reopening the bug. Could you please see if the above shows the problem for you as well?
Comment 4 Jakub Moc (RETIRED) gentoo-dev 2008-01-08 22:44:21 UTC
(In reply to comment #3)
> I'm still convinced that this bug is present. 

Well, I apparently fixed that locally... sorry.
Comment 5 Piotr Jaroszyński (RETIRED) gentoo-dev 2008-01-17 15:11:04 UTC
Thanks, fixed in svn.
Comment 6 Ed Wildgoose 2008-02-14 18:36:00 UTC
(In reply to comment #5)
> Thanks, fixed in svn.
> 

I have just been bitten by this and wasted a good half a day trying to figure out what was going wrong (ok the problem isn't hard to debug - but it took a while to figure out that it was actually happening)

Can this get pushed out as a new package ASAP please?  (I am surprised that this doesn't bite catalyst and gnap, etc?)

Thanks
Comment 7 Doug Goldstein (RETIRED) gentoo-dev 2008-07-15 21:52:32 UTC
Can we push a -r2 with this? I see you pushed a -r1 without this patch in March, peper..
Comment 8 Ulrich Müller gentoo-dev 2009-04-15 22:06:40 UTC
(In reply to comment #1)
> Created an attachment (id=140493) [edit]
> Patch against 1.0.10

Committed to trunk (r425) and 1.0.x branch (r426). This will be in 1.0.12.
Comment 9 Ulrich Müller gentoo-dev 2009-04-18 08:32:04 UTC
Fixed in 1.0.12.
Thanks for reporting.