phpmyadmin dpkg postinst fails due to relative paths

Bug #1701335 reported by Kevin P. Grelling on 2017-06-29
This bug affects 1 person
Affects Status Importance Assigned to Milestone
phpmyadmin (Ubuntu)

Bug Description

In the phpymadmin.postinst dpkg script (/var/lib/dpkg/info/phpmyadmin.postinst), there are three lines like the following:

   ln -s ../../phpmyadmin/phpmyadmin.service /etc/avahi/services/
   ln -s ../../phpmyadmin/lighttpd.conf /etc/lighttpd/conf-available/50-phpmyadmin.conf
   ln -sf ../../phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf

Interestingly, there are other symlink creation statements that instead contain the absolute path of the same directory, ie:

   ln -s /etc/phpmyadmin/phpmyadmin.desktop /usr/share/applications/

The issue: Our apache configurations are under version control. We have implemented this by symlinking /etc/apache2 subdirectories directly into a subversion working copy:

  conf-available -> /home/web-maintainer/svn/ApacheConf/conf-available//
  conf-enabled -> /home/web-maintainer/svn/ApacheConf/conf-enabled//
  envvars -> /home/web-maintainer/svn/ApacheConf/envvars
  magic -> /home/web-maintainer/svn/ApacheConf/magic
  ports.conf -> /home/web-maintainer/svn/ApacheConf/ports.conf
  sites-available -> /home/web-maintainer/svn/ApacheConf/sites-available//
  sites-enabled -> /home/web-maintainer/svn/ApacheConf/sites-enabled//

Long story short, the postinst install scripts "../../phpmyadmin" links (at top) do not correctly resolve as /etc/phpmyadmin in this case.

This causes "sudo apt-get install phpmyadmin" to fail with error (1). (Note: Adding a "set -x" to the top of the postinst script allowed me to find and debug this condition.)

Proposed Fix:

I manually edited phpmyadmin.postinst to have absolute paths in the symlink statements above, and dpkg was able to continue and successfully install phpmyadmin.

Perhaps there is some other reason (which I am unfamilar with) to have relative links for some but not all cases in phpmyadmin.postinst, but I believe either absolute paths to /etc/phpmyadmin, or a more sophisticated determination of the phpmyadmin configuration directory would be appropriate. I am particularly worried that when an update comes along, and my modified phpmyadmin.postinst is replaced, update of phpmyadmin will fail again.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers