apt-key cannot handle spaces in --keyring filename

Bug #1471024 reported by Brian Murray
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Debian)
New
Undecided
Unassigned
apt (Ubuntu)
New
Undecided
Unassigned

Bug Description

Any apt-key command with a keyring option with a space fails:

$ apt-key --keyring /mnt/sec-machines/apport-retrace/Ubuntu\ 15.10/apt/etc/apt/trusted.gpg.d/brian-murray-ppa.gpg list
usage: gpg [options] [filename]
[ 2:35PM 10435 ] [ bdmurray@impulse:/tmp ]
 $ apt-key --keyring /mnt/sec-machines/apport-retrace/Ubuntu\ 15.10/apt/etc/apt/trusted.gpg adv --keyserver hkp://keyserver.ubuntu.com:80/ --recv-keys 0BA6DE0806196831530C54F0915A9DFB6AF4FEF1
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.G5RYVPgFgS --no-auto-check-trustdb --trust-model always --keyring /mnt/sec-machines/apport-retrace/Ubuntu 15.10/apt/etc/apt/trusted.gpg --primary-keyring /mnt/sec-machines/apport-retrace/Ubuntu 15.10/apt/etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80/ --recv-keys 0BA6DE0806196831530C54F0915A9DFB6AF4FEF1
usage: gpg [options] [filename]

This is because gpg isn't passed the keyring file name with the space. Below we can see apt-key create a folder named foo instead of using the passed "foo bar".

 $ apt-key --keyring /tmp/foo\ bar adv --keyserver hkp://keyserver.ubuntu.com:80/ --recv-keys 0BA6DE0806196831530C54F0915A9DFB6AF4FEF1
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.KlGKirY5Uk --no-auto-check-trustdb --trust-model always --keyring /tmp/foo bar --primary-keyring /tmp/foo bar --keyserver hkp://keyserver.ubuntu.com:80/ --recv-keys 0BA6DE0806196831530C54F0915A9DFB6AF4FEF1
gpg: keyring `/tmp/foo' created
usage: gpg [options] [filename]

Tags: usability wily
Revision history for this message
Brian Murray (brian-murray) wrote :

This is due to the way that gpg is called from apt-key:

      --keyring)
         shift
         TRUSTEDFILE="$1"
         FORCED_KEYRING="$1"
         if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ] || [ "$2" = 'adv' ]; then
            GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"

tags: added: wily
tags: added: usability
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers