Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 363481 - app-admin/eselect - eselect bashcomp enable [foo] links to file ./foo
Summary: app-admin/eselect - eselect bashcomp enable [foo] links to file ./foo
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: eselect (show other bugs)
Hardware: AMD64 Linux
: Normal minor (vote)
Assignee: Gentoo eselect Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2011-04-13 12:46 UTC by jesper
Modified: 2011-09-04 10:09 UTC (History)
0 users

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 jesper 2011-04-13 12:46:05 UTC
When enabling bash completions eselect first links to the file in the cwd if it exists instead of the expected one /usr/share/bash-completion/

Reproducible: Always

Steps to Reproduce:
1. cd /etc
2. eselect bashcomp enable --global crontab

Actual Results:  
lrwxrwxrwx 1 root root 13 Apr 13 16:36 /etc/bash_completion.d/crontab -> //etc/crontab

Expected Results:  
Maybe eselect should inform the user what links where if it finds something in cwd before /usr/share/bash-completion. Or that you have to enter absolute path to use bash completions outside of /usr/share/bash-completion?

Portage 2.1.9.42 (hardened/linux/amd64, gcc-4.4.5, glibc-2.11.3-r0, 2.6.37-gentoo-r4 x86_64)
=================================================================
System uname: Linux-2.6.37-gentoo-r4-x86_64-Intel-R-_Xeon-R-_CPU_X5650_@_2.67GHz-with-gentoo-1.12.14
Timestamp of tree: Tue, 12 Apr 2011 10:45:01 +0000
app-shells/bash:     4.1_p9
dev-lang/python:     2.7.1-r1, 3.1.3-r1
dev-util/cmake:      2.8.4
sys-apps/baselayout: 1.12.14-r1
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.65-r1
sys-devel/automake:  1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.5
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://gentoo.mirror.web4u.cz/ ftp://ftp.lecl.net/pub/gentoo/ ftp://ftp.rhnet.is/pub/gentoo/ ftp://ftp.twaren.net/Linux/Gentoo/ http://gentoo.supp.name/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.se.gentoo.org/gentoo-portage"
USE="acpi amd64 apache2 bacula-clientonly bash-completion bzip2 cli cracklib cron diskio gdbm gpm hardened isag logrotate logwatch lua mmx modules multilib mysql mysqli mysqlnd ncurses nptl nptlonly openmp optimization pam pcre perl pic png posix python readline snmp sse2 ssl strong-optimization subversion symlink syslog threads unicode xml zlib" APACHE2_MODULES="info cgi negotiation dav expires headers alias authn_file authz_host dir mime log_config rewrite vhost_alias status auth_basic auth_digest authn_file authz_user" APACHE2_MPMS="worker" ELIBC="glibc" KERNEL="linux" PHP_TARGETS="php5-3" USERLAND="GNU" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2011-04-13 16:07:17 UTC
jer@bastiaan ~ $ touch crontab
jer@bastiaan ~ $ eselect bashcomp enable crontab
jer@bastiaan ~ $ ls .bash_completion.d/ -l
total 0
lrwxrwxrwx 1 jer jer 18 Apr 13 18:04 crontab -> //home/jer/crontab
lrwxrwxrwx 1 jer jer 30 Oct 26 20:44 cvs -> /usr/share/bash-completion/cvs
lrwxrwxrwx 1 jer jer 33 Oct 26 20:43 gentoo -> /usr/share/bash-completion/gentoo
lrwxrwxrwx 1 jer jer 34 Nov  1 05:02 repoman -> /usr/share/bash-completion/repoman
lrwxrwxrwx 1 jer jer 30 Oct 26 20:43 ssh -> /usr/share/bash-completion/ssh

Indeed!
Comment 2 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-04-13 17:03:44 UTC
Assigning to correct group.

% qfile /usr/share/eselect/modules/bashcomp.eselect
app-admin/eselect (/usr/share/eselect/modules/bashcomp.eselect)
Comment 3 Ulrich Müller gentoo-dev 2011-04-13 20:12:20 UTC
By looking into bashcomp.eselect one can see that it's not a bug, but a
feature: ;-)

        case "${bc}" in
            # absolute path
            /*)
                file=${ROOT}/${bc}
                ;;
            # relative path
            */*)
                file=${ROOT}/${PWD}/${bc}
                ;;
            # no path
            *)
                # CWD
                if [[ -f ${bc} ]] ; then
                    file=${ROOT}/${PWD}/${bc}
                # assume /usr/share/bash-completion
                elif [[ -f ${EROOT}/usr/share/bash-completion/${bc} ]] ; then
                    file=${EROOT}/usr/share/bash-completion/${bc}
                else
                    ...
                fi
                ;;
        esac

However, I wonder how useful this is. We could change search order in the "no path" case, or not search in cwd at all (the user could easily specify "foo" in cwd as "./foo").
Comment 4 Ulrich Müller gentoo-dev 2011-08-28 20:03:14 UTC
Fixed in SVN (revision 830).
Comment 5 Ulrich Müller gentoo-dev 2011-09-04 10:08:40 UTC
Fixed in eselect 1.2.17.
Thank you for reporting this issue.