On 29/07/2017 11:59, Mick wrote: > It seems this is one of these things I keep forgetting how to perform > correctly, despite taking notes and reading the documentation. I thought I > had upgraded postgresql from 9.5.7 to 9.6.3-r1 a couple of weeks ago. > > Today depclean asked me to remove 9.5.7 and after a moment's hesitation I > went > along with it. To my surprise I got this at the end of it: > > [snip...] > <<< dir /usr/include/postgresql-9.5/server/catalog > <<< dir /usr/include/postgresql-9.5/server/bootstrap > <<< dir /usr/include/postgresql-9.5/server/access > <<< dir /usr/include/postgresql-9.5/server > <<< dir /usr/include/postgresql-9.5/libpq > <<< dir /usr/include/postgresql-9.5/internal/libpq > <<< dir /usr/include/postgresql-9.5/internal > <<< dir /usr/include/postgresql-9.5/informix/esql > <<< dir /usr/include/postgresql-9.5/informix > <<< dir /usr/include/postgresql-9.5 > --- !empty dir /usr/include > --- !empty dir /usr/bin > --- !empty dir /usr > --- !empty dir /etc/postgresql-9.5 > --- !empty dir /etc/pam.d > --- !empty dir /etc/init.d > --- !empty dir /etc/conf.d > --- !empty dir /etc > Unsetting 9.5 as default...done. > Setting 9.6 as the default...ln: failed to create symbolic link > '/usr/include/libpq-fe.h': File exists > !!! Error: Unable to create link! postgresql-9.6/libpq-fe.h -> > /usr/include/libpq-fe.h > exiting >>>> Regenerating /etc/ld.so.cache... > Packages installed: 1321 > Packages in world: 216 > Packages in system: 44 > Required packages: 1321 > Number removed: 1 > > > Looking at /usr/include/ I see this: > > lrwxrwxrwx 1 root root 29 Jul 16 13:56 postgres_ext.h -> > postgresql-9.5/postgres_ext.h > lrwxrwxrwx 1 root root 14 Jul 29 10:34 postgresql -> postgresql-9.6 > drwxr-xr-x 6 root root 4096 Jul 16 13:55 postgresql-9.6 > > Although the old /usr/include/postgresql-9.5 directory and file > postgres_ext.h > have been removed, the symlink is still pointint to the old file, rather than > having been replaced with a symlink to > /usr/include/postgresql-9.6/postgres_ext.h: > > $ ls -la /usr/include/postgresql-9.6/postgres_ext.h > -rw-r--r-- 1 root root 2151 Jul 16 13:54 > /usr/include/postgresql-9.6/postgres_ext.h > > > I'm trying to understand why this might have happened. Which process/action > is responsible for setting this symlink? > > Also, the entry run by depclean above also confused me: > > Unsetting 9.5 as default...done. > Setting 9.6 as the default... > > How is the default version of postgresql being set in a system? What > specific > actions do these two entries entail? I thought with openrc at least it is a > matter of setting up the latest postgresql version to start up in rc-update. > > I've replaced the symlink with the live postgresql manually for now - I hope > I > haven't borked the database ... >
postgresql is slotted, so various headers files and such need symlinks installed so postgresql uses the correct versioned file. You have 2 versions, which one is correct? - the one the symlink points to. Installing 9.6 on a host with 9.5 present does only that - installs it. It doesn't run it or set it as default, it only installs it. To run it or set it as default is an extra step that you decide yourself when you want to do it. depcleaning 9.5 removes the default version, so the obvious thing for the code to do is set 9.6 as the new default. Maybe the ebuild does it, maybe it's eselect. Doesn't matter, because something should have removed those stale symlinks and didn't. This is a reportable bug Meanwhile fix the symlinks to what they should be using "ln -sfn" and all will be good in the world. -- Alan McKinnon [email protected]

