Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 900579

Summary: app-alternatives/awk-4 does not manage /usr/share/man/man1/awk.1.bz2 symlink
Product: Gentoo Linux Reporter: John R. Graham <john_r_graham>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: CONFIRMED ---    
Severity: normal CC: mgorny
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=884427
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info as requested.

Description John R. Graham gentoo-dev 2023-03-09 14:21:12 UTC
The /usr/share/man/man1/awk.1.bz2 symlink is managed by sys-apps/gawk instead of app-alternatives/awk. Since /usr/bin/man prefers the compressed man page, the (correctly managed) /usr/share/man/awk.1 file is ignored when the awk man page is displayed when anything else but gawk is selected by USE flag when emerging app-alternatives/awk.

Conditions to cause the bug to manifest:
1. Start with an "out of box" Gentoo install, which prefers gawk.
2. Install an alternative awk, for example:

       USE="-gawk nawk" emerge -1v awk

Now /usr/share/man/man1/awk.1 will correctly render the nawk man page, but /usr/share/man/man1/awk.1.bz2 is still symlinked to the gawk man page, so running

       man awk

will get you the gawk man page instead of the nawk one.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-10 02:31:23 UTC
Please include emerge --info for completeness.
Comment 2 John R. Graham gentoo-dev 2023-03-10 02:42:00 UTC
Created attachment 857085 [details]
emerge --info as requested.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-03-10 05:05:57 UTC
That's weird because app-alternatives/awk definitely has stale symlink cleanup code.
Comment 4 John R. Graham gentoo-dev 2023-03-10 13:15:08 UTC
In my read-through of the awk ebuild and the app-alternatives eclass, I didn't immediately find any code that looked like it was managing the _compressed_ man page symlink that the gawk ebuild leaves behind:

ceres ~ # ls -lrt /usr/share/man/man1/awk*
lrwxrwxrwx 1 root root 10 Mar 10 07:40 /usr/share/man/man1/awk.1.bz2 -> gawk.1.bz2
-rw-r--r-- 1 root root 11 Mar 10 07:44 /usr/share/man/man1/awk.1
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-10 13:19:06 UTC
(In reply to John R. Graham from comment #4)
> In my read-through of the awk ebuild and the app-alternatives eclass, I
> didn't immediately find any code that looked like it was managing the
> _compressed_ man page symlink that the gawk ebuild leaves behind:
> 
> ceres ~ # ls -lrt /usr/share/man/man1/awk*
> lrwxrwxrwx 1 root root 10 Mar 10 07:40 /usr/share/man/man1/awk.1.bz2 ->
> gawk.1.bz2
> -rw-r--r-- 1 root root 11 Mar 10 07:44 /usr/share/man/man1/awk.1

https://gitweb.gentoo.org/repo/gentoo.git/tree/app-alternatives/awk/awk-4.ebuild#n65 should catch it?

(It was added for bug 884427).
Comment 6 John R. Graham gentoo-dev 2023-03-10 16:57:04 UTC
Ah. Yes. That version wasn't in tree when I did my read-through. Still, an emerge of sys-apps/gawk will re-establish the symlink and does not currently force the rebuild of app-alternatives/awk (which would now remove it). I guess that means that the gawk ebuild needs a tweak as well.
Comment 7 Mike Gilbert gentoo-dev 2023-03-10 17:44:00 UTC
I suppose we could just drop pkg_preinst and pkg_postinst from sys-apps/gawk now hat app-alternatives/awk is stable.
Comment 8 Mike Gilbert gentoo-dev 2023-03-10 17:45:03 UTC
Err, I mean pkg_postist and pkg_postrm.