Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 477392 - sys-boot/grub-2.00-r3 does not respect bashcompdir
Summary: sys-boot/grub-2.00-r3 does not respect bashcompdir
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mike Gilbert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 477380
  Show dependency tree
 
Reported: 2013-07-19 13:09 UTC by iGentoo
Modified: 2014-10-20 18:29 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
grub-2.00-r3-build.log.xz (grub-2.00-r3-build.log.xz,49.80 KB, application/x-xz)
2013-07-19 13:09 UTC, iGentoo
Details
grub-2.00-bashcomp-2-compat.patch (grub-2.00-bashcomp-2-compat.patch,3.92 KB, patch)
2013-08-06 15:15 UTC, Alexander Tsoy
Details | Diff
grub-2.00-r4.ebuild.patch (grub-2.00-r4.ebuild.patch,1.21 KB, patch)
2013-08-06 15:16 UTC, Alexander Tsoy
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description iGentoo 2013-07-19 13:09:42 UTC
Created attachment 353644 [details]
grub-2.00-r3-build.log.xz

# qlist sys-boot/grub | grep /usr/share/bash-completion
/usr/share/bash-completion/grub

Portage 2.2.0_alpha188 (hardened/linux/amd64/selinux, gcc-4.8.1, glibc-2.17, 3.10.1-pax.x86_64 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.10.1-pax.x86_64-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9300_@_2.50GHz-with-gentoo-2.2
KiB Mem:     6114240 total,   3061916 free
KiB Swap:   10484724 total,  10484724 free
Timestamp of tree: Fri, 19 Jul 2013 12:30:01 +0000
ld GNU gold (GNU Binutils 2.23.2) 1.11
ccache version 3.1.9 [disabled]
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.5.4-r6, 2.6.8-r2, 2.7.5-r1, 3.1.5-r1, 3.2.5-r1, 3.3.2-r1
dev-util/ccache:          3.1.9
dev-util/cmake:           2.8.11.1
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.14
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.7.3, 4.8.1
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo systemd hardened-dev custom
Installed sets: @local
ACCEPT_KEYWORDS="amd64 x86 ~amd64 ~x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-Wall -Wextra -ggdb -march=native -pipe -O3 -fno-tree-vectorize -frecord-gcc-switches"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind /var/lib/hsqldb"
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/splash /etc/terminfo"
CXXFLAGS="-Wall -Wextra -ggdb -march=native -pipe -O3 -fno-tree-vectorize -frecord-gcc-switches"
DISTDIR="/var/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going"
FCFLAGS="-Wall -Wextra -ggdb -march=native -pipe -O3 -fno-tree-vectorize -frecord-gcc-switches"
FEATURES="assume-digests binpkg-logs buildpkg collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer multilib-strict news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms split-elog split-log splitdebug strict test test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-Wall -Wextra -ggdb -march=native -pipe -O3 -fno-tree-vectorize -frecord-gcc-switches"
GENTOO_MIRRORS="http://mirrors.163.com/gentoo http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--icf=safe"
MAKEOPTS="V=1 -j10"
PKGDIR="/var/portage/packages-amd64"
PORTAGE_BZIP2_COMMAND="lbzip2"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-9ef"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--ipv4 --exclude=/metadata/md5-cache"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/systemd /var/lib/layman/hardened-development /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl alsa amd64 audit berkdb bzip2 c++0x cairo caps cli cracklib crypt custom-cflags cxx dbus dri gdbm gmp gnome gpm gtk gtk3 hardened iconv icu ipv6 jit jpeg jpeg2k justify lzma mmx modules mudflap multilib ncurses nls nptl open_perms opengl openmp orc pam pax_kernel pcre png pulseaudio qt4 readline selinux session sse sse2 ssl svg systemd tcpd threads tiff udev unicode urandom vim-syntax xattr xinetd zlib" ABI_X86="x32 32 64" ALSA_CARDS="hda-intel" 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="btrfs caps cifs crypt crypt-gpg crypt-loop dmsquash-live gensplash livenet lvm nfs plymouth ssh-client syslog systemd" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US zh zh_CN" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-4" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="pypy1_9 pypy2_0 python3_1 python3_2 python3_3 python2_5 python2_6 python2_7" QEMU_SOFTMMU_TARGETS="x86_64 arm mips64el ppc64" RUBY_TARGETS="ruby20 ruby19" USERLAND="GNU" VIDEO_CARDS="nouveau nvidia" 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"
USE_PYTHON="2.7-pypy-1.9 2.7-pypy-2.0 3.1 3.2 3.3 2.5 2.6 2.7"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND

=================================================================
                        Package Settings
=================================================================

sys-boot/grub-2.00-r3 was built with the following:
USE="custom-cflags device-mapper (multilib) nls (selinux) test truetype -debug -doc -efiemu -libzfs -mount -sdl -static" GRUB_PLATFORMS="pc -coreboot -efi-32 -efi-64 -emu -ieee1275 -multiboot -qemu -qemu-mips -yeeloong"
CFLAGS="-Wall -Wextra -ggdb -march=native -pipe -O2 -frecord-gcc-switches"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"


app-shells/bash-completion-2.1-r1 was built with the following:
USE=""
Comment 1 Mike Gilbert gentoo-dev 2013-07-21 00:37:52 UTC
+*grub-2.00-r4 (21 Jul 2013)
+
+  21 Jul 2013; Mike Gilbert <floppym@gentoo.org>
+  +files/grub-2.00-os-prober-efi-system.patch, +grub-2.00-r4.ebuild,
+  grub-9999.ebuild:
+  Add support for probing EFI system partition, bug 477314 by Ben Kohler.
+  Respect bashcompdir, bug 477392 by Alphat-PC.
Comment 2 Alexander Tsoy 2013-07-22 12:53:15 UTC
Installing grub completion in 'completionsdir' ($(get_bashcompdir)) is not enough. Symlinks should be made for all supported commands (respecting USE=multislot of course):

$ egrep '^[[:space:]]*__grub_.*_program=' /usr/share/bash-completion/completions/grub | awk '{print $3}'
grub-set-default
grub-reboot
grub-editenv
grub-mkconfig
grub-setup
grub-install
grub-mkfont
grub-mkrescue
grub-mkimage
grub-mkpasswd-pbkdf2
grub-probe
grub-script-check
Comment 3 Mike Gilbert gentoo-dev 2013-07-29 20:01:27 UTC
(In reply to Alexander Tsoy from comment #2)

Are you sure about that?

I don't seem to be able to get the grub completions to work with or without the symlinks. However, I am a zsh user, so I may be doing it wrong.

Can you give me an example of a completion that I can actually reproduce?
Comment 4 Alexander Tsoy 2013-07-30 14:31:16 UTC
(In reply to Mike Gilbert from comment #3)

This is described in bash-completions' README:

Q. I author/maintain package X and would like to maintain my own
   completion code for this package. Where should I put it to be sure
   that interactive bash shells will find it and source it?

   Install it in one of the directories pointed to by
   bash-completion's pkgconfig file variables.  There are two
   alternatives: the recommended one is 'completionsdir' (get it with
   "pkg-config --variable=completionsdir bash-completion") from which
   completions are loaded on demand based on invoked commands' names,
   so be sure to name your completion file accordingly, and to include
   for example symbolic links in case the file provides completions
   for more than one command.  The other one which is present for
   backwards compatibility reasons is 'compatdir' (get it with
   "pkg-config --variable=compatdir bash-completion") from which files
   are loaded when bash_completion is loaded.


Also see my patch to the gentoo-bashcomp ebuild in bug 477024.

If you use non-login shell, then you likely need to source /usr/share/bash-completion/bash_completion. I have this lines in my ~/.bashrc:

[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \
    . /usr/share/bash-completion/bash_completion


And of course you need bash-completion-2.1-r1 to test changes.
Comment 5 Mike Gilbert gentoo-dev 2013-07-30 15:15:09 UTC
(In reply to Alexander Tsoy from comment #4)

Right, so I have the right stuff set up in my bash startup files.

Can you give me an example of something I can type at a shell prompt that will trigger a grub-specific completion to occur? That would be very helpful to eliminate my own stupidity as the cause of my problem.
Comment 6 Alexander Tsoy 2013-07-30 15:58:34 UTC
(In reply to Mike Gilbert from comment #5)

Hmm.. I also can't get it working with bash-completion-2.1-r1. I'll take a closer look at it later.
Comment 7 Alexander Tsoy 2013-08-06 15:15:42 UTC
Created attachment 355244 [details, diff]
grub-2.00-bashcomp-2-compat.patch

Add bash-completion-2 support - remove calls to deprecated have() function.

Also it would be great to get rid of unecessary forks:
__VAR=$( echo CMD | sed "@program_transform_name@" )
but this require a patch for build system.
Comment 8 Alexander Tsoy 2013-08-06 15:16:07 UTC
Created attachment 355246 [details, diff]
grub-2.00-r4.ebuild.patch
Comment 9 Mike Gilbert gentoo-dev 2013-08-06 15:52:29 UTC
Thanks for the patch!

Could you submit it upstream please? Either send a message to the grub-devel mailing list, or open a bug and attach it.

https://lists.gnu.org/mailman/listinfo/grub-devel

http://savannah.gnu.org/bugs/?group=grub
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-10-20 18:25:51 UTC
Ping. Is there anything happening in this bug? Looks like current versions of grub2 use correct completionsdir on Gentoo.
Comment 11 Mike Gilbert gentoo-dev 2014-10-20 18:28:39 UTC
(In reply to Michał Górny from comment #10)
> Ping. Is there anything happening in this bug? Looks like current versions
> of grub2 use correct completionsdir on Gentoo.

I believe the completions are still installed in a single file, which does not work with the newer bash-comepletion package?
Comment 12 Mike Gilbert gentoo-dev 2014-10-20 18:29:31 UTC
I suppose this is technically a separate issue. Closing.