Created attachment 473906 [details, diff] (patch) Work around the bug by calling clearfilenameprefix() pinfo does not correctly find info pages for commands on my system. For example, "pinfo echo" will open up the man page for echo and not find the "echo" function in coreutils.info.bz2. After debugging the issue, it seems this occurs because of code in the original pinfo source to cache the directory where info files are found. When "pinfo echo" is called, it (for whatever reason) calls openinfo() for "libc" first, before eventually calling it for "coreutils". (I still don't know exactly why it looks for libc first, as I haven't investigated this.) On the first openinfo() call for "libc", the filenameprefix variable is not defined. Therefore, it calls matchfile() on each possible path (on my system: "/usr/share/info", "/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.4/info", and "/usr/share/binutils-data/x86_64-pc-linux-gnu/2.26.1/info") in turn until it finds a match. matchfile() does this by reading the filenames in the directory given, stripping compression suffixes and ".info" suffixes if any exist, and if a match is found, reconstructs the filename corresponding to that match and modifies the input filename to reflect that. For "libc" it therefore correctly finds constructs "libc.info". It then finds "/usr/share/info/libc.info.bz2" and filenameprefix is set to the directory where the match was found, as a cache. On the second openinfo() call, this time for "coreutils", the filenameprefix variable is defined, so instead of scanning for the file it simply prepends the filenameprefix to the filename. However, because it skips calling matchfile(), it does not append ".info" to the filename. As such, it attempts to look for filenames like "/usr/share/info/coreutils.bz2" instead of "/usr/share/info/coreutils.info.bz2", fails to find anything that matches, and falls back to opening the man page instead. The attached patch works around this by calling clearfilenameprefix() each time openinfo() is called. This results in correct behaviour as it forces matchfile() to be called each time, but this is obviously not ideal as it forces directories to be scanned rather than caching the directory in which the file was found. I'm filing this as a Gentoo bug rather than an upstream bug as I suspect that the "files/pinfo-0.6.10-info-suffix.patch" Gentoo patch (which seems to add additional functionality when reconstructing the filenames from matchfile()) might have something to do with this. However, I do not know the info system on Gentoo well enough to know if this is the case, and I assume that the patch is necessary for pinfo to work on Gentoo so I haven't tried messing with it. If this turns out to be an upstream bug, I apologise! Steps to reproduce: 1. pinfo echo Expected results: * pinfo should display the info page for echo, by opening coreutils.info (from /usr/share/info/coreutils.info.bz2) and displaying the "echo" entry. Actual results: * pinfo displays the man page for echo. emerge --info: Portage 2.3.5 (python 2.7.12-final-0, default/linux/amd64/13.0, gcc-4.9.4, glibc-2.23-r3, 4.9.16-gentoo-mynouveau x86_64) ================================================================= System uname: Linux-4.9.16-gentoo-mynouveau-x86_64-Intel-R-_Core-TM-_i7-5820K_CPU_@_3.30GHz-with-gentoo-2.3 KiB Mem: 32925456 total, 5322752 free KiB Swap: 8191996 total, 8159368 free Timestamp of repository gentoo: Fri, 19 May 2017 16:00:01 +0000 sh bash 4.3_p48-r1 ld GNU ld (Gentoo 2.26.1 p1.0) 2.26.1 app-shells/bash: 4.3_p48-r1::gentoo dev-java/java-config: 2.2.0-r3::gentoo dev-lang/perl: 5.24.1-r1::gentoo dev-lang/python: 2.7.12::gentoo, 3.4.5::gentoo dev-util/cmake: 3.7.2::gentoo dev-util/pkgconfig: 0.28-r2::gentoo sys-apps/baselayout: 2.3::gentoo sys-apps/openrc: 0.24.2::gentoo sys-apps/sandbox: 2.10-r3::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69::gentoo sys-devel/automake: 1.11.6-r1::gentoo, 1.15-r2::gentoo sys-devel/binutils: 2.26.1::gentoo sys-devel/gcc: 4.9.4::gentoo, 5.4.0-r3::gentoo sys-devel/gcc-config: 1.7.3::gentoo sys-devel/libtool: 2.4.6-r3::gentoo sys-devel/make: 4.2.1::gentoo sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers) sys-libs/glibc: 2.23-r3::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sph-local location: /opt/portage-overlay masters: gentoo priority: 0 abendbrot location: /var/lib/layman/abendbrot masters: gentoo priority: 50 gambas-overlay location: /var/lib/layman/gambas-overlay masters: gentoo priority: 50 palemoon location: /var/lib/layman/palemoon masters: gentoo priority: 50 steam-overlay location: /var/lib/layman/steam-overlay masters: gentoo priority: 50 x11 location: /var/lib/layman/x11 masters: gentoo priority: 50 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/lib64/avfs/extfs /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-march=native -O2 -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--ask-enter-invalid --autounmask-keep-masks y" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="https://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/" LANG="en_GB.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j13" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" USE="X a52 aac aacplus acl acpi alsa amd64 amr berkdb bluray bzip2 cairo cdda cddb cdio cdparanoia cli cracklib crypt cups cxx dbus dri dts dvd flac fluidsynth fontconfig fortran gdbm gpm gtk iconv ipv6 jpeg libnotify lzma mad mmx modplug modules mp3 mtp multilib ncurses nls nptl ogg opengl openmp pam pcre png qt3support qt5 readline seccomp session sound sse sse2 ssl startup-notification tcl tcpd theora tk truetype unicode v4l vdpau vim-syntax vorbis xattr xv xvmc zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" L10N="en en_GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_GB" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="x86_64 arm i386 mips mipsel ppc sparc" QEMU_USER_TARGETS="aarch64 alpha arm i386 m68k mips mipsel ppc sparc x86_64" RUBY_TARGETS="ruby21 ruby22" USERLAND="GNU" VIDEO_CARDS="nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
(In reply to Sophie Hamilton from comment #0) > I'm filing this as a Gentoo bug rather than an upstream bug Upstream has been dead for years, so that's fine. > Steps to reproduce: > > 1. pinfo echo > > Expected results: > > * pinfo should display the info page for echo, by opening coreutils.info > (from /usr/share/info/coreutils.info.bz2) and displaying the "echo" entry. > > Actual results: > > * pinfo displays the man page for echo. That actually works for me. But that is not a dismissal. :)
> That actually works for me. But that is not a dismissal. :) Interesting. That must either mean your installation isn't doing that search for "libc" first, then, or that your info pages are named differently (for example, you might actually have "/usr/share/info/coreutils.bz2" instead of the "/usr/share/info/coreutils.info.bz2" I have). Either way, I'll take a look to see if I can reproduce this on a fresh chroot.
(In reply to Sophie Hamilton from comment #2) > > That actually works for me. But that is not a dismissal. :) > > Interesting. That must either mean your installation isn't doing that search > for "libc" first, then, or that your info pages are named differently (for > example, you might actually have "/usr/share/info/coreutils.bz2" instead of > the "/usr/share/info/coreutils.info.bz2" I have). Either way, I'll take a > look to see if I can reproduce this on a fresh chroot. Ah no. I checked again. I get the man page instead of coreutils.info.
I have added your patch in -r6. I didn't see any side effects but we should be able to catch those before this revision goes stable.
Technically the patch is only a workaround as it prevents the directory path cache variable from being used; I didn't know what the best way to fix it would be. That said, it's unlikely to add too much time and if upstream's been dead for years then I expect there won't be many people who would know better, so I'm happy with the patch being applied. Thank you!