Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 561198 - dev-db/postgresql: Add Note to Re-source /etc/profile
Summary: dev-db/postgresql: Add Note to Re-source /etc/profile
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-22 18:25 UTC by Oskar Gibson
Modified: 2015-10-08 20:43 UTC (History)
1 user (show)

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 Oskar Gibson 2015-09-22 18:25:07 UTC
man pages are not added to mandb for postgresql-9.4.4 and possibly other versions. Have checked on personal laptop, work desktop, and one production server. The man pages do exist in /usr/share/postgresql{,-9.4}/man/ but are not included in mandb. Admittedly I do not know how mandb or ebuilds really work so can't fault-find much further (though am only too happy to be informed and learn, and help in any way I can).
//Oskar
Comment 1 Alex Xu (Hello71) 2015-09-27 18:23:20 UTC
I believe the intention is that you use "eselect postgresql" to select the man pages you wish to view by default.
Comment 2 Oskar Gibson 2015-09-28 13:38:37 UTC
After a LOT of googling and reading around here and there and trying to find any mention of man pages in included documentation (sure I may have been looking poorly, but I cannot be alone in this, surely), I finally stumbled upon "initdb man". This is quite frankly silly and a poor design decision when every other package I can think of does this automatically. Either it should be done by default under emerge/installation or upon emerge --config which does initdb. This should perhaps be thought over again and a decision made if this is really the way it should be, personally I think it is silly, and should still be considered a bug of sorts, design-wise.
//Oskar
Comment 3 Oskar Gibson 2015-09-28 15:42:15 UTC
Haha, now I realise that just creates a db called man, and I got confused because the man pages appeared after that though that was in fact just due to initdb having been run (I assume...), though I had already done an emerge --config so not sure why they weren't there already. This is seriously silly, why can't the pages just be added by default upon installation like every other package. Also why are they only added for postgres user? The design decisions of this package with regards man pages should definitely be considered a bug, this should not be considered resolved.
//Oskar.
Comment 4 Aaron W. Swenson gentoo-dev 2015-09-28 15:58:34 UTC
(In reply to Oskar Gibson from comment #3)
> Haha, now I realise that just creates a db called man, and I got confused
> because the man pages appeared after that though that was in fact just due
> to initdb having been run (I assume...), though I had already done an emerge
> --config so not sure why they weren't there already. This is seriously
> silly, why can't the pages just be added by default upon installation like
> every other package. Also why are they only added for postgres user? The
> design decisions of this package with regards man pages should definitely be
> considered a bug, this should not be considered resolved.
> //Oskar.

I can't figure out what benefit running mandb provides. It says it indexes it, but not which tool uses it.

/usr/share/postgresql/man{,all,slots} is added to MANPATH, which is used by man to find manpage locations, and /usr/share/postgresql is a symlink to whichever slot is active.

Doing `man createdb` displays the expected information. You can, albeit more inconveniently, do `man /path/to/man/page/file` if you need the documentation for a specific version. There really isn't a better way to pull up version-specific manpages.

If you can tell me what exactly isn't working, I'll reopen this bug and look into addressing the issue in a manner that resolves whatever it is you're (not) experiencing.
Comment 5 Oskar Gibson 2015-09-28 16:09:38 UTC
Hi, sorry I shall try to be as clear as possible, my bad.
I'm not after trying to get version specific man pages, I'm after ANY man pages. Say I'm setting up a new machine, fresh gentoo installation, now I run emerge postgresql, and upon completion run emerge --config postgresql which does an initdb. Say for example I've forgotten some less often used switch for say psql command, so I type man psql, but I get "No manual entry for psql", I really think at this stage they should all be there, like basically every other package I know and vast majority of other distros. 
//Oskar.
Comment 6 Aaron W. Swenson gentoo-dev 2015-09-28 16:25:03 UTC
(In reply to Oskar Gibson from comment #5)
> Hi, sorry I shall try to be as clear as possible, my bad.
> I'm not after trying to get version specific man pages, I'm after ANY man
> pages. Say I'm setting up a new machine, fresh gentoo installation, now I
> run emerge postgresql, and upon completion run emerge --config postgresql
> which does an initdb. Say for example I've forgotten some less often used
> switch for say psql command, so I type man psql, but I get "No manual entry
> for psql", I really think at this stage they should all be there, like
> basically every other package I know and vast majority of other distros. 
> //Oskar.

Okay, the real issue is because you haven't re-sourced /etc/profile resulting in the MANPATH environment variable not being updated in the pre-existing terminal sessions. You most likely ran 'initdb man' in a newly opened terminal session, which is why that appeared to do the trick. Opening the new terminal session is what actually updated the MANPATH environment variable, and not running 'initdb man', thereby finally allowing man to find the documentation you asked it to find.

I was fairly certain that was addressed at some point, but I must have deleted it...or never actually addressed it.

The extent of the fix will be to add a note to 'source /etc/profile'.
Comment 7 Oskar Gibson 2015-09-28 17:32:06 UTC
Hi, Yes you are likely right on that part, n00b mistake on my part, should have known better, but that is not what I believe is an issue here (besides, why can root user still not see manpages even after initdb is done by postgres user?), The adding of manpages to database should be done as part of either installation stage during emerge, or latest during initdb performed by emerge --config, and then be visible for all users, including root (even if commands shouldn't be run as root, if I am developing a large script which requires root, I shouldn't have to switch user just to read a man page (in actual case that I noticed this I just pulled up a new terminal up against one of our FreeBSD test servers because I didn't have time to fault find silly stuff just then), like as is the case with basically every other package i know of, and every other distro I can remember trying.
Sorry to be a pain but I think "#emerge postgresql && emerge --config postgresql && man psql" on a fresh default Gentoo  installation should have same result as "#yum -y install postgresql-server && /etc/init.d/postgresql-9.x initdb && man psql (initdb I don't even think is necessary to get man pages)" on CentOS or "#apt-get -y install postgresql-server && man psql" on Ubuntu/Debian or "# cd /usr/ports/databases/postgresql94-server/ && make config-recursive install clean ; man psql" does on FreeBSD, etc, you get my point I hope.
Sorry to be a pain, but I really do think this would be beneficial not just to me but to basically general user x who isn't an experienced gentoo postgres dev, just trying to give back in any way I can to something I love.
//Oskar
Comment 8 Oskar Gibson 2015-09-28 18:26:22 UTC
(In reply to Aaron W. Swenson from comment #6)
> (In reply to Oskar Gibson from comment #5)
> > Hi, sorry I shall try to be as clear as possible, my bad.
> > I'm not after trying to get version specific man pages, I'm after ANY man
> > pages. Say I'm setting up a new machine, fresh gentoo installation, now I
> > run emerge postgresql, and upon completion run emerge --config postgresql
> > which does an initdb. Say for example I've forgotten some less often used
> > switch for say psql command, so I type man psql, but I get "No manual entry
> > for psql", I really think at this stage they should all be there, like
> > basically every other package I know and vast majority of other distros. 
> > //Oskar.
> 
> Okay, the real issue is because you haven't re-sourced /etc/profile
> resulting in the MANPATH environment variable not being updated in the
> pre-existing terminal sessions. You most likely ran 'initdb man' in a newly
> opened terminal session, which is why that appeared to do the trick. Opening
> the new terminal session is what actually updated the MANPATH environment
> variable, and not running 'initdb man', thereby finally allowing man to find
> the documentation you asked it to find.
> 
> I was fairly certain that was addressed at some point, but I must have
> deleted it...or never actually addressed it.
> 
> The extent of the fix will be to add a note to 'source /etc/profile'.

See comment above but I do not see that as a fix for real issue, only a separate "fix" for a mistake/oversight on my part. real issue is NOT solved.
Comment 9 Oskar Gibson 2015-09-29 17:51:59 UTC
(In reply to Oskar Gibson from comment #8)
> (In reply to Aaron W. Swenson from comment #6)
> > (In reply to Oskar Gibson from comment #5)
> > > Hi, sorry I shall try to be as clear as possible, my bad.
> > > I'm not after trying to get version specific man pages, I'm after ANY man
> > > pages. Say I'm setting up a new machine, fresh gentoo installation, now I
> > > run emerge postgresql, and upon completion run emerge --config postgresql
> > > which does an initdb. Say for example I've forgotten some less often used
> > > switch for say psql command, so I type man psql, but I get "No manual entry
> > > for psql", I really think at this stage they should all be there, like
> > > basically every other package I know and vast majority of other distros. 
> > > //Oskar.
> > 
> > Okay, the real issue is because you haven't re-sourced /etc/profile
> > resulting in the MANPATH environment variable not being updated in the
> > pre-existing terminal sessions. You most likely ran 'initdb man' in a newly
> > opened terminal session, which is why that appeared to do the trick. Opening
> > the new terminal session is what actually updated the MANPATH environment
> > variable, and not running 'initdb man', thereby finally allowing man to find
> > the documentation you asked it to find.
> > 
> > I was fairly certain that was addressed at some point, but I must have
> > deleted it...or never actually addressed it.
> > 
> > The extent of the fix will be to add a note to 'source /etc/profile'.
> 
> See comment above but I do not see that as a fix for real issue, only a
> separate "fix" for a mistake/oversight on my part. real issue is NOT solved.

This is NOT resolved, true issue is that mandb is not updated at all, let alone correctly (for all users), during installation (or first initialisation). As no-one appears to care anymore I shall try to teach myself how Gentoo ebuilds/emerge/portage actually work, how manpages and mandb work, and how standards dictate things should work and how other distros (including the BSDs) make this work, and come up with a patch myself. Hopefully then I will be taken seriously (I am a senior systems administrator/architect NOT a developer by trade so although I am comfortable writing simple-ish less-than a few hundred or thousand line programs with single digit source files in C/perl/python/ruby/php/js/shell/assembly/lua etc, I am not really familiar with development models of Gentoo or large projects in general or finer details of certain parts of system I've simply never needed to delve into). I mean absolutely no disrespect and admire the work you guys do to bring my favourite distro (along with FreeBSD) into fruition; but I really think this is an issue which could be an annoyance at least to others but myself.
//Oskar
Comment 10 Oskar Gibson 2015-09-29 17:57:33 UTC
Just noticed this had been set to confirmed out of previously resolved, my bad for accusing anyone of ignoring/not taking seriously. Sorry guys. Still I shall try to teach myself as much I can and provide patch if possible. Ipsa scientia potestas est, I am only too happy to learn, and give my free time, but as I said above, I am chiefly a sysadmin rather than a dev, even if I am quite comfortable with basic coding.
//Oskar
Comment 11 Aaron W. Swenson gentoo-dev 2015-10-08 20:43:12 UTC
(In reply to Oskar Gibson from comment #10)
> Just noticed this had been set to confirmed out of previously resolved, my
> bad for accusing anyone of ignoring/not taking seriously. Sorry guys. Still
> I shall try to teach myself as much I can and provide patch if possible.
> Ipsa scientia potestas est, I am only too happy to learn, and give my free
> time, but as I said above, I am chiefly a sysadmin rather than a dev, even
> if I am quite comfortable with basic coding.
> //Oskar

I figured your weren't understanding.

I've added the note to the recently pushed ebuilds along with the security fixes.

I'm still not doing anything with mandb, but man works as it should without having to do so.

If you provide me with an example that requires mandb to be run on the PostgreSQL man pages, I'll be happy to follow up with another fix somewhere, somehow.