Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 572436 - app-eselect/eselect-php leaves apache2 symlink after toggling to USE=-apache2
Summary: app-eselect/eselect-php leaves apache2 symlink after toggling to USE=-apache2
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-20 12:11 UTC by Dirkjan Ochtman (RETIRED)
Modified: 2016-01-28 18:29 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 Dirkjan Ochtman (RETIRED) gentoo-dev 2016-01-20 12:11:36 UTC
I just switched from apache2 to fpm, by changing the USE flags set up in /etc/portage/package.use. After reemerging, I found the following dangling symlink:

lrwxrwxrwx 1 root root      31 Jan 19 10:26 libphp5.so -> ../../php5.6/apache2/libphp5.so
Comment 1 Michael Orlitzky gentoo-dev 2016-01-20 14:49:40 UTC
Running `eselect php cleanup` is supposed to remove that for you. I added a special case for it:

  if [[ "${sapi}" == "apache2" ]] ; then
    rm -f "${EROOT}$(get_active_libdir)/apache2/modules/libphp[57].so" \
      || die "failed to remove old libphp.so symlink"
  fi

But, I screwed it up. The [57] is within the double quotes so it doesn't get expanded. I just pushed a fix for that as,

https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=64f783dff3a2d62de670c8a5994d012751d2440e

Now, should we be running cleanup() automatically when people emerge eselect-php or dev-lang/php? Maaaybe. At the moment I'm not super confident in the behavior of "cleanup" or "update" (they need refactoring / documentation).

I'd like to be sure that "cleanup" won't remove anything that it shouldn't before taking that step. For example, it shouldn't remove a valid mod_php.so symlink just because you emerged eselect-php with USE="-apache2". Instead you should have to re-emerge dev-lang/php with USE="-apache2" to make the symlink invalid -- only then should it be removed.
Comment 2 Michael Orlitzky gentoo-dev 2016-01-22 21:05:20 UTC
I just rewrote "cleanup" and "update" in eselect-php-0.9.1. It's masked for testing, but give it a try? If you do `eselect php cleanup apache2` it should get rid of that symlink.

Once that version gets some testing I could eventually develop the confidence to run cleanup after an emerge.
Comment 3 Michael Orlitzky gentoo-dev 2016-01-22 21:08:31 UTC
Just a note for myself: the cleanup action will only remove dead symlinks, I'm sure of it now. So it would be largely pointless (but not entirely -- we just renamed a symlink!) to trigger it after a change in eselect-php. I think it would make more sense to call it after PHP has been emerged. That would also address bug #432962.
Comment 4 Dirkjan Ochtman (RETIRED) gentoo-dev 2016-01-23 13:15:13 UTC
I just rm'ed the dangling symlink by hand, do you want me to put into place a fake one and try with that?
Comment 5 Michael Orlitzky gentoo-dev 2016-01-23 15:04:22 UTC
(In reply to Dirkjan Ochtman from comment #4)
> I just rm'ed the dangling symlink by hand, do you want me to put into place
> a fake one and try with that?

If you don't mind. The more testing the better, if I'm going to run this thing in the php postinst...
Comment 6 Michael Orlitzky gentoo-dev 2016-01-28 14:56:35 UTC
Ok, I just fixed this in dev-lang/php:

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef0386227889557b516d86fd395417b20aa5c4a1

Now we're calling `eselect php cleanup` as soon as PHP is finished installing, so if you've just removed (say) apache2 support, the module symlink will be dead and will get removed.
Comment 7 Dirkjan Ochtman (RETIRED) gentoo-dev 2016-01-28 15:23:04 UTC
Sorry I failed to test this sooner. :(
Comment 8 Michael Orlitzky gentoo-dev 2016-01-28 18:29:35 UTC
(In reply to Dirkjan Ochtman from comment #7)
> Sorry I failed to test this sooner. :(

Don't worry about it, you'll test it when the new dev-lang/php pulls in the updated eselect-php =P