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

Bug 103627

Summary: gentoo-bashcomp confused by multiline PORTDIR_OVERLAY
Product: Gentoo Linux Reporter: Ed Catmur <ed>
Component: New packagesAssignee: Gentoo Shell Tools project <shell-tools>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: High    
Version: 2005.1   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Ed Catmur 2005-08-24 14:39:32 UTC
$ emerge app-<tab>
$ emerge app-bash: cd: \: No such file or directory

In /etc/make.conf:
PORTDIR_OVERLAY="                           \
/srv/gentoo/trees/bmg-main/                 \
/srv/gentoo/trees/gentopia/                 \
/srv/gentoo/trees/lila-artwork/             \
/srv/gentoo/trees/kernel-sources/           \
/srv/gentoo/trees/bugs.gentoo.org/          \
/srv/gentoo/trees/gst-plugins.catmur.co.uk/ \
/srv/gentoo/trees/auto-unmask/              \
/srv/gentoo/trees/capella.catmur.co.uk/     \
"

Problem is the _portdir() function in /etc/bash_completion.d/gentoo:

_portdir()
{
    sed -n -e '/^PORTDIR=/ { s/^[^=]\+="\?\([^"]\+\|\S\+\).*/\1/p ; q }' \
        /etc/make.{conf,globals} 2>/dev/null

    if [[ $1 == '-o' ]] ; then
        sed -n -e '/^PORTDIR_OVERLAY=/ { s/^[^=]\+="\?\([^"]\+\|\S\+\).*/\1/p ;
q }' \
            /etc/make.conf 2>/dev/null
    fi
}

far easier to source the file in a subshell then echo the variable:

_portdir()
{
    ( source /etc/make.globals; source /etc/make.conf
    echo $PORTDIR ) 2>/dev/null

    if [[ $1 == '-o' ]] ; then
        ( source /etc/make.conf; echo $PORTDIR_OVERLAY ) 2>/dev/null
    fi
}
Comment 1 Ciaran McCreesh 2005-08-25 02:51:56 UTC

*** This bug has been marked as a duplicate of 100373 ***