Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 276345 - new config protect setting via env.d does not work for first installation
Summary: new config protect setting via env.d does not work for first installation
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: Lowest minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-03 09:26 UTC by Simone
Modified: 2022-10-20 02:43 UTC (History)
0 users

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


Attachments
"bin" ebuild for hadoop 0.19.1 (hadoop-bin-0.19.1.ebuild,930 bytes, text/plain)
2009-07-06 09:09 UTC, Simone
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simone 2009-07-03 09:26:07 UTC
In /usr/lib/portage/pym/portage/dbapi/vartree.py, dblink.mergeme ignores config protection when merging a new file (lines 2738--2751 in 2.1.6.13). This means that CONFIG_PROTECT does not prevent (initially) identical config files from being hardlinked to each other. This will likely baffle the user when he starts configuring his newly installed package.

NOTE: I browsed the 2.2 code and noticed hardlinking is gone. However, 2.2 is still hard masked.
Comment 1 Zac Medico gentoo-dev 2009-07-05 11:16:58 UTC
(In reply to comment #0)
> In /usr/lib/portage/pym/portage/dbapi/vartree.py, dblink.mergeme ignores config
> protection when merging a new file (lines 2738--2751 in 2.1.6.13).

Maybe the code is confusing, but the way I read it, hardlinks are not created for protected files in any case. The "protected" variable is always True for protected files, and the "hardlink_candidates" variable is always None when "protected" is True. As a result, hardlinks should never be created for protected files.
Comment 2 Simone 2009-07-06 09:09:14 UTC
Created attachment 196867 [details]
"bin" ebuild for hadoop 0.19.1
Comment 3 Simone 2009-07-06 09:10:34 UTC
Then maybe I don't understand how CONFIG_PROTECT works. I wrote a simple "bin" ebuild for apache hadoop which just installs everything to /opt: files "masters" and "slaves" get hard linked together. I'm posting the ebuild as an attachment.
Comment 4 Zac Medico gentoo-dev 2009-07-07 21:54:35 UTC
(In reply to comment #3)
> Then maybe I don't understand how CONFIG_PROTECT works. I wrote a simple "bin"
> ebuild for apache hadoop which just installs everything to /opt: files
> "masters" and "slaves" get hard linked together.

If "masters" and "slaves" are under /opt, then it's normal for them to get hard linked together, unless you have /opt in your CONFIG_PROTECT. You can check the value like this:

  portageq envvar CONFIG_PROTECT
Comment 5 Simone 2009-07-08 09:07:03 UTC
They are under /opt/hadoop/conf, which I added to CONFIG_PROTECT (take a look at the ebuild). I'm doing:

INSTALL_DIR=/opt/hadoop
export CONFIG_PROTECT="${CONFIG_PROTECT} ${INSTALL_DIR}/conf"

Before src_install and I'm also adding an env.d file which contains:

CONFIG_PROTECT=${INSTALL_DIR}/conf

If I run portageq envvar with the package already installed, everything looks fine:

$ portageq envvar CONFIG_PROTECT
/etc /opt/hadoop/conf

For actual config protection this is ok, because there is nothing to protect during a clean install. To avoid hardlinking on first install, however, I need to protect /opt/hadoop/conf inside the ebuild, which I thought I could accomplish with the above export.
Comment 6 Zac Medico gentoo-dev 2009-07-08 18:58:15 UTC
Oh, I see. This is related to bug 194043. I suppose that we can make portage parse the env.d entries from $D and use them to modify the CONFIG_PROTECT settings used for installation.