Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 627476 - app-eselect/eselect-postgresql-2.2 Stabilization Request
Summary: app-eselect/eselect-postgresql-2.2 Stabilization Request
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Stabilization (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords: STABLEREQ
Depends on: 647554
Blocks: 640634
  Show dependency tree
 
Reported: 2017-08-10 17:20 UTC by Aaron W. Swenson
Modified: 2018-02-15 18:13 UTC (History)
0 users

See Also:
Package list:
=app-eselect/eselect-postgresql-2.2
Runtime testing required: No
stable-bot: sanity-check+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron W. Swenson gentoo-dev 2017-08-10 17:20:49 UTC
Stabilization target:
=app-eselect/eselect-postgresql-2.2 ~alpha ~amd64 ~arm ~hppa ~ia64  ~ppc ~ppc64 ~sparc ~x86

2.2 fixed a major bug (625368) that can leave systems in an insane state if a PostgreSQL slot that is set as the default is unmerged before selecting another slot.
Comment 1 Andreas Sturmlechner gentoo-dev 2017-08-11 08:48:22 UTC
FWIW, eselect-postgresql-2.2 can be broken if selecting an already selected slot:


# eselect postgresql list
Available PostgreSQL Slots
  9.4 *                     9.4.12

# eselect postgresql set 9.4
Unsetting 9.4 as default...done.
Setting 9.4 as the default...ln: failed to create symbolic link '/usr/include/postgresql/postgresql-9.4': File exists
!!! Error: Unable to create link! postgresql-9.4 -> /usr/include/postgresql
exiting


At which point one has to manually remove the symlink again.
Comment 2 Aaron W. Swenson gentoo-dev 2017-08-11 12:32:11 UTC
(In reply to Andreas Sturmlechner from comment #1)
> FWIW, eselect-postgresql-2.2 can be broken if selecting an already selected
> slot:
> 
> 
> # eselect postgresql list
> Available PostgreSQL Slots
>   9.4 *                     9.4.12
> 
> # eselect postgresql set 9.4
> Unsetting 9.4 as default...done.
> Setting 9.4 as the default...ln: failed to create symbolic link
> '/usr/include/postgresql/postgresql-9.4': File exists
> !!! Error: Unable to create link! postgresql-9.4 -> /usr/include/postgresql
> exiting
> 
> 
> At which point one has to manually remove the symlink again.

It shouldn't even be trying to make that link as it is senseless; there's no  /usr/include/postgresql-${slot}/postgresql-${slot} directory. There's just /usr/include/postgresql-${slot} and its contents with no self-reference.

To make matters worse, I've run into it once, but I've been unable to replicate it. I thought it was an artifact of my testing.

I'm certain now that you've removed that link, you can run `eselect postgresql set 9.4` again and it will work as expected.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2017-08-11 22:15:13 UTC
ia64 stable
Comment 4 Andreas Sturmlechner gentoo-dev 2017-08-13 14:49:34 UTC
(In reply to Aaron W. Swenson from comment #2)
> (In reply to Andreas Sturmlechner from comment #1)
> It shouldn't even be trying to make that link as it is senseless; there's no
> /usr/include/postgresql-${slot}/postgresql-${slot} directory. There's just
> /usr/include/postgresql-${slot} and its contents with no self-reference.
> 
> To make matters worse, I've run into it once, but I've been unable to
> replicate it. I thought it was an artifact of my testing.
> 
> I'm certain now that you've removed that link, you can run `eselect
> postgresql set 9.4` again and it will work as expected.
# eselect postgresql list
Available PostgreSQL Slots
  9.4                       9.4.12
  9.6                       9.6.4

# eselect postgresql set 9.6
Setting 9.6 as the default...ln: failed to create symbolic link '/usr/include/postgresql/postgresql-9.6': File exists
!!! Error: Unable to create link! postgresql-9.6 -> /usr/include/postgresql
exiting

# ls -l /usr/include/postgresql-9.6/postgresql*
lrwxrwxrwx 1 root root 14 11. Aug 10:51 /usr/include/postgresql-9.6/postgresql-9.4 -> postgresql-9.4
lrwxrwxrwx 1 root root 14 11. Aug 00:39 /usr/include/postgresql-9.6/postgresql-9.5 -> postgresql-9.5
lrwxrwxrwx 1 root root 14  7. Mai 19:16 /usr/include/postgresql-9.6/postgresql-9.6 -> postgresql-9.6

all dead links...
Comment 5 Andreas Sturmlechner gentoo-dev 2017-08-13 14:51:34 UTC
Ah, but after removing those, now it works. I can switch back and forth as much as I like now. ;)
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2017-08-18 21:56:59 UTC
ppc/ppc64 stable
Comment 7 Tim Mohlmann 2017-08-24 20:53:46 UTC
Hi,

Also wrt bug 625368. Upgraded to 2.2 to work around bug. Then I entered in a mouse hunt to delete symlinks that was without end.

Every time eselect fails with an existing file, it doesn't clean up it's own mess. Meaning that if one forgets to delete a single symlink before running `eselect postgresql set 1` it will create what it can and then aborts. After deleting the file you are confronted with in the error, the next fail will find files you already deleted in the past attempts

So first off all I want to share this with fellow user in case they stumble on the bug report looking for a solutions. It is important that all this symlinks are deleted before attempting the new version of app-eselect/eselect-postgresql-2.2:

/usr/include/libpq -> postgresql-9.5/libpq
/usr/include/libpq-fe.h -> postgresql-9.5/libpq-fe.h
/usr/include/postgres_ext.h -> postgresql-9.5/postgres_ext.h
/usr/include/postgresql-9.6/postgresql-9.6 -> postgresql-9.6
/usr/include/pg_config_ext.h -> postgresql-9.5/pg_config_ext.h
/usr/include/pg_config_manual.h -> postgresql-9.5/pg_config_manual.h
(Credit to Anton Bolshakov)

Second, but this is up to the developer if he considers it important or not. Although this is a inconsistent state of symlinks, which the software was not meant to deal with. It does expose the fact that it is not performing any sanity check before modifying symlinks. Eg. existence could be checked before execution. (Who knows what could be wrong on a file system). But it's really up to you guys, off course.

Let me know if you need a separate bug report for this.
Comment 8 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2017-08-25 13:49:41 UTC
amd64 stable
Comment 9 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2017-08-26 09:02:37 UTC
ya, this broke existing installs of things (postfix in my case).  I changed all the linkings to be forceful as my fix though (edit the eselect script to change ln -s to ln -sf).
Comment 10 Thomas Deutschmann (RETIRED) gentoo-dev 2017-08-29 21:42:39 UTC
x86 stable
Comment 11 Tobias Klausmann (RETIRED) gentoo-dev 2017-09-04 13:35:55 UTC
Stable on alpha.
Comment 12 Markus Meier gentoo-dev 2017-09-08 05:04:17 UTC
arm stable
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2017-10-28 20:09:07 UTC
sparc stable (thanks to Rolf Eike Beer)
Comment 14 Larry the Git Cow gentoo-dev 2018-01-14 18:25:48 UTC
The bug has been referenced in the following commit(s):

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

commit 9fb5707e09234326c4fd71ddc0b6b34d66775968
Author:     Aaron W. Swenson <titanofold@gentoo.org>
AuthorDate: 2018-01-14 18:25:05 +0000
Commit:     Aaron W. Swenson <titanofold@gentoo.org>
CommitDate: 2018-01-14 18:25:33 +0000

    app-eselect/eselect-postgresql: Bump to 2.3
    
    ln now tries to force the link (Thanks Matthew Thode [prometheanfire])
    
    Cleans up nonsensical links in /usr/include/postgresql-* that were
    made by some previous versions of this module.
    
    Bug: https://bugs.gentoo.org/627476
    Bug: https://bugs.gentoo.org/631936
    Bug: https://bugs.gentoo.org/640154
    Bug: https://bugs.gentoo.org/640394
    Package-Manager: Portage-2.3.13, Repoman-2.3.3

 app-eselect/eselect-postgresql/Manifest            |  1 +
 .../eselect-postgresql-2.3.ebuild                  | 34 ++++++++++++++++++++++
 2 files changed, 35 insertions(+)}
Comment 15 Sergei Trofimovich (RETIRED) gentoo-dev 2018-02-15 18:13:08 UTC
commit 5c2b716fa91bf2b32c9a06a3e74a2ebb14be73c0
Author: Jeroen Roovers <jer@gentoo.org>
Date:   Sun Feb 11 12:58:21 2018 +0100

    app-eselect/eselect-postgresql: Stable for HPPA too.

Last arch. Closing.