[Bug 1532855] Re: add-apt-repository exits with 0 even when adding key failed

Scott Moser smoser at ubuntu.com
Thu Mar 9 16:43:41 UTC 2017


## set up a container with software-properties installed from -proposed 
$ rel=xenial
$ name=xenial-1
$ lxc launch ubuntu-daily:$rel $name
$ lxc exec $name -- sh -c 'while ! [ -e /run/cloud-init/result.json ]; do echo .; sleep 1; done' </dev/null
$ lxc exec $name -- sh -e <<"EOF"
rel=$(lsb_release -sc)
line=$(awk '$1 == "deb" && $2 ~ /ubuntu.com/ {
  printf("%s %s %s-proposed main universe\n", $1, $2, rel); exit(0) };
  ' "rel=$rel" /etc/apt/sources.list)
echo "$line" | sudo tee /etc/apt/sources.list.d/proposed.list
apt-get update -qq
apt-get install -qy software-properties-common </dev/null
EOF
...

$ lxc exec $name -- dpkg-query --show software-properties-common </dev/null
software-properties-common 0.96.20.6

$ lxc exec $name -- sh <<"EOF"
add-apt-repository ppa:launchpad/buildd-staging -k hkp://127.0.0.1/
echo exited with $?
EOF
 Buildd staging packages for Launchpad. New packages are staged here for testing on the staging PPA buildds.
 More info: https://launchpad.net/~launchpad/+archive/ubuntu/buildd-staging
gpg: keyring `/tmp/tmph5tjzyms/secring.gpg' created
gpg: keyring `/tmp/tmph5tjzyms/pubring.gpg' created
gpg: requesting key 0A5174AF from hkp server 127.0.0.1
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
gpg: keyserver communications error: keyserver unreachable
gpg: keyserver communications error: public key not found
gpg: keyserver receive failed: public key not found
?: 127.0.0.1: Connection refused
gpgkeys: HTTP fetch error 7: couldn't connect: Connection refused
Failed to add key.
exited with 1

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to software-properties in Ubuntu.
https://bugs.launchpad.net/bugs/1532855

Title:
  add-apt-repository exits with 0 even when adding key failed

Status in software-properties package in Ubuntu:
  Fix Released
Status in software-properties source package in Xenial:
  Fix Committed
Status in software-properties source package in Yakkety:
  Fix Committed

Bug description:
  add-apt-repository exits happily even if it failed adding the key:

  $ sudo env LANGUAGE=en add-apt-repository ppa:launchpad/buildd-staging -k hkp://bad-server/
   Buildd staging packages for Launchpad. New packages are staged here for testing on the staging PPA buildds.
   More info: https://launchpad.net/~launchpad/+archive/ubuntu/buildd-staging
  Press [ENTER] to continue or ctrl-c to cancel adding it

  gpg: keyring `/tmp/tmp3246v7n8/secring.gpg' created
  gpg: keyring `/tmp/tmp3246v7n8/pubring.gpg' created
  gpg: requesting key 0A5174AF from hkp server bad-server
  ?: bad-server: Host not found
  gpgkeys: HTTP fetch error 7: couldn't connect: Success
  gpg: no valid OpenPGP data found.
  gpg: Total number processed: 0
  gpg: keyserver communications error: keyserver unreachable
  gpg: keyserver communications error: public key not found
  gpg: keyserver receive failed: public key not found

  $ echo $?
  0

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: software-properties-common 0.96.17
  ProcVersionSignature: Ubuntu 4.3.0-5.16-generic 4.3.3
  Uname: Linux 4.3.0-5-generic x86_64
  ApportVersion: 2.19.3-0ubuntu2
  Architecture: amd64
  CurrentDesktop: Unity
  Date: Mon Jan 11 17:17:56 2016
  PackageArchitecture: all
  SourcePackage: software-properties
  UpgradeStatus: Upgraded to xenial on 2015-10-28 (74 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/1532855/+subscriptions



More information about the foundations-bugs mailing list