]> git.saurik.com Git - apt.git/blobdiff - test/integration/test-apt-key
don't install new deps of candidates for kept back pkgs
[apt.git] / test / integration / test-apt-key
index eb5f998cf55386ddc28413e077209b0b970b4c2c..96cfe41fa62c1686c0374695fdbc2f3b74dca391 100755 (executable)
@@ -81,6 +81,20 @@ gpg:              unchanged: 1' aptkey --fakeroot update
        testsuccess --nomsg aptkey --fakeroot del d141dbac8dae
        testempty aptkey list
 
+       if [ "$(id -u)" != '0' ]; then
+               msgtest 'Test key removal with' 'unreadable key'
+               cleanplate
+               cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
+               echo 'foobar' > "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
+               chmod 000 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
+               testwarning --nomsg aptkey --fakeroot del d141dbac8dae
+               testwarning aptkey list
+               chmod 644 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
+               rm -f "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
+               grep -v '^W: ' "${ROOTDIR}/tmp/testwarning.output" > "${ROOTDIR}/aptkeylist.output" || true
+               testempty cat "${ROOTDIR}/aptkeylist.output"
+       fi
+
        msgtest 'Test key removal with' 'single key in real file'
        cleanplate
        cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
@@ -116,6 +130,14 @@ gpg:              unchanged: 1' aptkey --fakeroot update
        testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
        testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
 
+       msgtest 'Test key removal with' 'spaced fingerprint'
+       cleanplate
+       cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
+       testsuccess --nomsg aptkey --fakeroot del '34A8 E9D1 8DB3 20F3 67E8 EAA0 5A90 D141 DBAC 8DAE'
+       testempty aptkey list
+       testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
+       testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
+
        msgtest 'Test key removal with' 'single key in softlink'
        cleanplate
        ln -s "$(readlink -f "${KEYDIR}/joesixpack.pub")" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
@@ -194,6 +216,16 @@ gpg:              unchanged: 1' aptkey --fakeroot update
                msgtest 'Test verify a file' 'with all keys'
                testsuccess --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}"
 
+               if [ "$(id -u)" != '0' ]; then
+                       msgtest 'Test verify a file' 'with unreadable key'
+                       echo 'foobar' > "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
+                       chmod 000 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
+                       testwarning --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}"
+                       testwarning aptkey list
+                       chmod 644 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
+                       rm -f "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
+               fi
+
                msgtest 'Test verify a file' 'with good keyring'
                testsuccess --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase-multikey.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}"