Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 332125 - emerge: write access check for / should be done after processing bashrc
Summary: emerge: write access check for / should be done after processing bashrc
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-10 20:41 UTC by SpanKY
Modified: 2010-08-11 02:31 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SpanKY gentoo-dev 2010-08-10 20:41:22 UTC
i like to run a server with a read-only root most of the time.  but obviously when upgrading packages, i need to remount it read-write.  so in my bashrc hook, i tried something like:
case ${EBUILD_PHASE} in
    preinst)  mount / -o remount,rw ;;
    postinst) (sleep 10s; mount / -o remount,ro) & ;;
esac

but portage does an access("/", W_OK) before my bashrc is called and so aborts before it can be remounted.
Comment 1 Zac Medico gentoo-dev 2010-08-11 01:09:05 UTC
I guess we can just remove the existing check and add something like this just before calling preinst in ebuild.sh:

[[ -w $ROOT ]] || die "$ROOT is not writable"

There's also the issue of pkg_setup which may require write access. I suppose we can just let it die be itself if necessary, though.
Comment 2 SpanKY gentoo-dev 2010-08-11 02:31:16 UTC
yeah, i'm aware of the pkg_setup part, but not too many packages do that.  and ones that do should be doing error checking.

your suggested check looks sane to me.  it would also produce a better log output i think as the current one simply exits with a single line like:
access(/, W_OK)