{"thread":{"id":"21458","subject":"Problem signing a tag","startedAt":"2009-11-03T00:58:16Z","lastAt":"2009-11-09T20:15:43Z","messageCount":10,"participants":["Joshua J. Kugler","Alex Riesen","Michael J Gruber","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"126619","messageId":"200911021558.17550.joshua@eeinternet.com","threadId":"21458","inReplyTo":null,"subject":"Problem signing a tag","fromName":"Joshua J. Kugler","fromEmail":"joshua@eeinternet.com","sentAt":"2009-11-03T00:58:16Z","receivedAt":"2009-11-03T00:58:16Z","isPatch":false,"sender":{"key":"joshua@eeinternet.com","avatar":"https://gravatar.com/avatar/10b8c5a84877ac408892f6f1117b12a11dc927e42944139a43713073fabcbe71?d=mp&s=160"},"body":"Nobody on the git IRC channel responded to this question, even after \nasking it a few times, so I thought I'd try here.\n\nI'm having trouble signing a tag.  I'm using this command:\n\ngit tag -u EAFD344D14EA086E -F .git/TAG_EDITMSG tag_name\n\nI type in my passphrase, and am then told:\n\nerror: gpg failed to sign the tag\nerror: unable to sign the tag\n\nHowever, if I use this command:\n\ngpg -s -u EAFD344D14EA086E\n\nand use the same passphrase, it works fine. Is there any way to find out \nwhy a key-signing is failing?\n\nThis is git 1.6.5.2 and gpg 1.4.9\n\nThanks!\n\nj\n\n-- \nJoshua Kugler\nPart-Time System Admin/Programmer\nhttp://www.eeinternet.com\nPGP Key: http://pgp.mit.edu/  ID 0x14EA086E\n"},{"id":"126629","messageId":"81b0412b0911022331q2976b6e6u575a9700b212623d@mail.gmail.com","threadId":"21458","inReplyTo":"200911021558.17550.joshua@eeinternet.com","subject":"Re: Problem signing a tag","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2009-11-03T07:31:25Z","receivedAt":"2009-11-03T07:31:25Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Tue, Nov 3, 2009 at 01:58, Joshua J. Kugler <joshua@eeinternet.com> wrote:\n> Nobody on the git IRC channel responded to this question, even after\n> asking it a few times, so I thought I'd try here.\n>\n> I'm having trouble signing a tag.  I'm using this command:\n>\n> git tag -u EAFD344D14EA086E -F .git/TAG_EDITMSG tag_name\n>\n> I type in my passphrase, and am then told:\n>\n> error: gpg failed to sign the tag\n> error: unable to sign the tag\n>\n> However, if I use this command:\n>\n> gpg -s -u EAFD344D14EA086E\n>\n> and use the same passphrase, it works fine. Is there any way to find out\n> why a key-signing is failing?\n\nWhat does \"echo $?\" after it prints? IOW, maybe plain gpg fails too,\nwithout printing anything special, and you don't pay attention to the\nexit code. Git does. And it runs \"gpg -bsau <key-id>\".\n"},{"id":"126663","messageId":"200911030911.47030.joshua@eeinternet.com","threadId":"21458","inReplyTo":"81b0412b0911022331q2976b6e6u575a9700b212623d@mail.gmail.com","subject":"Re: Problem signing a tag","fromName":"Joshua J. Kugler","fromEmail":"joshua@eeinternet.com","sentAt":"2009-11-03T18:11:46Z","receivedAt":"2009-11-03T18:11:46Z","isPatch":false,"sender":{"key":"joshua@eeinternet.com","avatar":"https://gravatar.com/avatar/10b8c5a84877ac408892f6f1117b12a11dc927e42944139a43713073fabcbe71?d=mp&s=160"},"body":"On Monday 02 November 2009, Alex Riesen said something like:\n> On Tue, Nov 3, 2009 at 01:58, Joshua J. Kugler <joshua@eeinternet.com> \nwrote:\n> > Nobody on the git IRC channel responded to this question, even\n> > after asking it a few times, so I thought I'd try here.\n> >\n> > I'm having trouble signing a tag.  I'm using this command:\n> >\n> > git tag -u EAFD344D14EA086E -F .git/TAG_EDITMSG tag_name\n> >\n> > I type in my passphrase, and am then told:\n> >\n> > error: gpg failed to sign the tag\n> > error: unable to sign the tag\n> >\n> > However, if I use this command:\n> >\n> > gpg -s -u EAFD344D14EA086E\n> >\n> > and use the same passphrase, it works fine. Is there any way to\n> > find out why a key-signing is failing?\n>\n> What does \"echo $?\" after it prints? IOW, maybe plain gpg fails too,\n> without printing anything special, and you don't pay attention to the\n> exit code. Git does. And it runs \"gpg -bsau <key-id>\".\n\n$ git tag -s -F .git/TAG_EDITMSG tag_name\n\nYou need a passphrase to unlock the secret key for\nuser: \"Joshua J. Kugler <joshua@azariah.com>\"\n1024-bit DSA key, ID 14EA086E, created 2009-08-09\n\ngpg: problem with the agent - disabling agent use\nerror: gpg failed to sign the tag\nerror: unable to sign the tag\n$ echo $?\n128\n\nAnd when I sign at the prompt:\n\n$ gpg -sa\n\nYou need a passphrase to unlock the secret key for\nuser: \"Joshua J. Kugler <joshua@azariah.com>\"\n1024-bit DSA key, ID 14EA086E, created 2009-08-09\n\ngpg: problem with the agent - disabling agent use\nBlah blah blah blah\n-----BEGIN PGP MESSAGE-----\nVersion: GnuPG v1.4.9 (GNU/Linux)\n\nowGbwMvMwCT46q+Jr8grjjzG01JJDF4fChqdchIzFJJQCK4ONxYGQSYGNlYmkAoG\nLk4BmLZpyxgW7Jol8mB6kt+Hr1xb9gvUnTs9f/XdVIYFW3VNlx3cmvy4sf/R0/m7\nnr9fFpzyFQA=\n=Plql\n-----END PGP MESSAGE-----\n$ echo $?\n2\n\nSo, it appear that it works (prints the signature) but then exits with \nan error code of 2.\n\nUsing --status-log, I get:\n\n[GNUPG:] USERID_HINT EAFD344D14EA086E Joshua J. Kugler \n<joshua@azariah.com>\n[GNUPG:] NEED_PASSPHRASE EAFD344D14EA086E EAFD344D14EA086E 17 0\n[GNUPG:] GOOD_PASSPHRASE\n[GNUPG:] BEGIN_SIGNING\n[GNUPG:] SIG_CREATED S 17 2 00 1257271594 \n4FE551A1A4AE4DEF7EDD58E1EAFD344D14EA086E\n\nNo indication of an error.  The only thing I see that might be an error \nis \"gpg: problem with the agent - disabling agent use.\" But that should \nbe a warning, not an error, correct?  I talked with somebody on the \ngnupg IRC channel and they were able to create a signed tag, even \nthough they were not using an agent.\n\nHere it is with -bsau:\n\n$ gpg -bsau EAFD344D14EA086E\n\nYou need a passphrase to unlock the secret key for\nuser: \"Joshua J. Kugler <joshua@azariah.com>\"\n1024-bit DSA key, ID 14EA086E, created 2009-08-09\n\ngpg: problem with the agent - disabling agent use\nBlah blah blah blah\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.9 (GNU/Linux)\n\niEYEABECAAYFAkrwciEACgkQ6v00TRTqCG7TZwCfSrvb6p0L+ZZqPB8XrVuMpJPj\njicAoJKnfIeTsWylXpklB9Gw/ArdxvxU\n=CM2I\n-----END PGP SIGNATURE-----\n$ echo $?\n2\n\n\nI'm lost. Thanks for the tips.\n\nj\n\n-- \nJoshua Kugler\nPart-Time System Admin/Programmer\nhttp://www.eeinternet.com\nPGP Key: http://pgp.mit.edu/  ID 0x14EA086E\n"},{"id":"126767","messageId":"4AF18F7A.2000904@drmicha.warpmail.net","threadId":"21458","inReplyTo":"200911030911.47030.joshua@eeinternet.com","subject":"Re: Problem signing a tag","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-11-04T14:28:10Z","receivedAt":"2009-11-04T14:28:10Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Joshua J. Kugler venit, vidit, dixit 03.11.2009 19:11:\n> On Monday 02 November 2009, Alex Riesen said something like:\n>> On Tue, Nov 3, 2009 at 01:58, Joshua J. Kugler <joshua@eeinternet.com> \n> wrote:\n>>> Nobody on the git IRC channel responded to this question, even\n>>> after asking it a few times, so I thought I'd try here.\n>>>\n>>> I'm having trouble signing a tag.  I'm using this command:\n>>>\n>>> git tag -u EAFD344D14EA086E -F .git/TAG_EDITMSG tag_name\n>>>\n>>> I type in my passphrase, and am then told:\n>>>\n>>> error: gpg failed to sign the tag\n>>> error: unable to sign the tag\n>>>\n>>> However, if I use this command:\n>>>\n>>> gpg -s -u EAFD344D14EA086E\n>>>\n>>> and use the same passphrase, it works fine. Is there any way to\n>>> find out why a key-signing is failing?\n>>\n>> What does \"echo $?\" after it prints? IOW, maybe plain gpg fails too,\n>> without printing anything special, and you don't pay attention to the\n>> exit code. Git does. And it runs \"gpg -bsau <key-id>\".\n> \n> $ git tag -s -F .git/TAG_EDITMSG tag_name\n> \n> You need a passphrase to unlock the secret key for\n> user: \"Joshua J. Kugler <joshua@azariah.com>\"\n> 1024-bit DSA key, ID 14EA086E, created 2009-08-09\n> \n> gpg: problem with the agent - disabling agent use\n> error: gpg failed to sign the tag\n> error: unable to sign the tag\n> $ echo $?\n> 128\n> \n> And when I sign at the prompt:\n> \n> $ gpg -sa\n> \n> You need a passphrase to unlock the secret key for\n> user: \"Joshua J. Kugler <joshua@azariah.com>\"\n> 1024-bit DSA key, ID 14EA086E, created 2009-08-09\n> \n> gpg: problem with the agent - disabling agent use\n> Blah blah blah blah\n> Blah blah blah blah\n> $ echo $?\n> 2\n\n[...]\n\nI assume you don't want to use gpg-agent, that should be the easy way out.\n\nIf gpg is trying to contact the agent it means that \"use-agent\" is set\n(from the config) and, probably, also that GPG_AGENT_INFO is set but no\nagent responds at that socket. (echo $GPG_AGENT_INFO)\n\nMany distros set up this stuff automatically. Try unsetting both:\nunset GPG_AGENT_INFO\ngpg --no-use-agent ...\n\nIf that helps you can put \"--no-use-agent\" in your gpg config.\n\n2 is a non-fatal error, 128 a fatal one, btw.\n\nMichael\n"},{"id":"126793","messageId":"200911040947.50226.joshua@eeinternet.com","threadId":"21458","inReplyTo":"4AF18F7A.2000904@drmicha.warpmail.net","subject":"Re: Problem signing a tag","fromName":"Joshua J. Kugler","fromEmail":"joshua@eeinternet.com","sentAt":"2009-11-04T18:47:49Z","receivedAt":"2009-11-04T18:47:49Z","isPatch":false,"sender":{"key":"joshua@eeinternet.com","avatar":"https://gravatar.com/avatar/10b8c5a84877ac408892f6f1117b12a11dc927e42944139a43713073fabcbe71?d=mp&s=160"},"body":"On Wednesday 04 November 2009, Michael J Gruber said something like:\n> > gpg: problem with the agent - disabling agent use\n> > error: gpg failed to sign the tag\n> > error: unable to sign the tag\n> > $ echo $?\n> > 128\n> >\n> > And when I sign at the prompt:\n> >\n> > $ gpg -sa\n> >\n> > You need a passphrase to unlock the secret key for\n> > user: \"Joshua J. Kugler <joshua@azariah.com>\"\n> > 1024-bit DSA key, ID 14EA086E, created 2009-08-09\n> >\n> > gpg: problem with the agent - disabling agent use\n> > Blah blah blah blah\n> > Blah blah blah blah\n> > $ echo $?\n> > 2\n>\n> [...]\n>\n> I assume you don't want to use gpg-agent, that should be the easy way\n> out.\n\nWell, I could, but I just haven't set it up. :)\n\n> If that helps you can put \"--no-use-agent\" in your gpg config.\n\nI commented out use-agent in the config. That worked. THANKS!\n\n> 2 is a non-fatal error, 128 a fatal one, btw.\n\nWell, the 2 was from running gpg alone, and 128 was from git erroring \nout.  According to the gpg docs:\n\n\"The program returns 0 if everything was fine, 1 if at least a signature \nwas bad, and other error codes for fatal errors.\"\n\nSo, the docs consider 2 a fatal error, even though it appears it isn't.  \nIt seems that \nhttp://github.com/git/git/blob/a6dbf8814f433a7fbfa9cde6333c98019f6db1e4/builtin-tag.c#L202 \nneeds to be patched to something along the lines of:\n\nrv = finish_command(&gpg)\nif ((rv && rv !=2)  || !len || len < 0)\n\nProbably digging in to the gpg source code to figure out what errors are \nand aren't fatal would be in order.\n\nThanks again for your help! Glad to know what I needed to do to sign my \ntags!\n\nj\n\n-- \nJoshua Kugler\nPart-Time System Admin/Programmer\nhttp://www.eeinternet.com\nPGP Key: http://pgp.mit.edu/  ID 0x14EA086E\n"},{"id":"126889","messageId":"4AF28CE4.5000906@drmicha.warpmail.net","threadId":"21458","inReplyTo":"200911040947.50226.joshua@eeinternet.com","subject":"Re: Problem signing a tag","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-11-05T08:29:24Z","receivedAt":"2009-11-05T08:29:24Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Joshua J. Kugler venit, vidit, dixit 04.11.2009 19:47:\n> On Wednesday 04 November 2009, Michael J Gruber said something like:\n>>> gpg: problem with the agent - disabling agent use\n>>> error: gpg failed to sign the tag\n>>> error: unable to sign the tag\n>>> $ echo $?\n>>> 128\n>>>\n>>> And when I sign at the prompt:\n>>>\n>>> $ gpg -sa\n>>>\n>>> You need a passphrase to unlock the secret key for\n>>> user: \"Joshua J. Kugler <joshua@azariah.com>\"\n>>> 1024-bit DSA key, ID 14EA086E, created 2009-08-09\n>>>\n>>> gpg: problem with the agent - disabling agent use\n>>> Blah blah blah blah\n>>> Blah blah blah blah\n>>> $ echo $?\n>>> 2\n>>\n>> [...]\n>>\n>> I assume you don't want to use gpg-agent, that should be the easy way\n>> out.\n> \n> Well, I could, but I just haven't set it up. :)\n> \n>> If that helps you can put \"--no-use-agent\" in your gpg config.\n> \n> I commented out use-agent in the config. That worked. THANKS!\n> \n>> 2 is a non-fatal error, 128 a fatal one, btw.\n> \n> Well, the 2 was from running gpg alone, and 128 was from git erroring \n> out.  According to the gpg docs:\n> \n> \"The program returns 0 if everything was fine, 1 if at least a signature \n> was bad, and other error codes for fatal errors.\"\n> \n> So, the docs consider 2 a fatal error, even though it appears it isn't.  \n> It seems that \n> http://github.com/git/git/blob/a6dbf8814f433a7fbfa9cde6333c98019f6db1e4/builtin-tag.c#L202 \n> needs to be patched to something along the lines of:\n> \n> rv = finish_command(&gpg)\n> if ((rv && rv !=2)  || !len || len < 0)\n> \n> Probably digging in to the gpg source code to figure out what errors are \n> and aren't fatal would be in order.\n> \n> Thanks again for your help! Glad to know what I needed to do to sign my \n> tags!\n\nDig dig dig... gpg exits with 2 in a lot of cases, one would need to\nparse fd-error to find out more. But it also looks as if gpg exits\nnormally with a good passphrase. So I tried, and at least with gpg 1.4.9\nand git 1.6.5.2 I can sign tags with \"use-agent\" and without a running\nagent: I get asked for the passphrase (after reporting the agent MIA),\nand everything's fine.\n\nMy gpg returns 0 in this case; it returns 2 only if I don't enter the\npassphrase. So, this seems to depend on the version of gpg. Or on\nentering the correct passphrase ;)\n\nMichael\n"},{"id":"126890","messageId":"200911042337.26820.joshua@eeinternet.com","threadId":"21458","inReplyTo":"4AF28CE4.5000906@drmicha.warpmail.net","subject":"Re: Problem signing a tag","fromName":"Joshua J. Kugler","fromEmail":"joshua@eeinternet.com","sentAt":"2009-11-05T08:37:26Z","receivedAt":"2009-11-05T08:37:26Z","isPatch":false,"sender":{"key":"joshua@eeinternet.com","avatar":"https://gravatar.com/avatar/10b8c5a84877ac408892f6f1117b12a11dc927e42944139a43713073fabcbe71?d=mp&s=160"},"body":"On Wednesday 04 November 2009, Michael J Gruber said something like:\n> > So, the docs consider 2 a fatal error, even though it appears it\n> > isn't. It seems that\n> > http://github.com/git/git/blob/a6dbf8814f433a7fbfa9cde6333c98019f6d\n> >b1e4/builtin-tag.c#L202 needs to be patched to something along the\n> > lines of:\n> >\n> > rv = finish_command(&gpg)\n> > if ((rv && rv !=2)  || !len || len < 0)\n> >\n> > Probably digging in to the gpg source code to figure out what\n> > errors are and aren't fatal would be in order.\n> >\n> > Thanks again for your help! Glad to know what I needed to do to\n> > sign my tags!\n>\n> Dig dig dig... gpg exits with 2 in a lot of cases, one would need to\n> parse fd-error to find out more. But it also looks as if gpg exits\n> normally with a good passphrase. So I tried, and at least with gpg\n> 1.4.9 and git 1.6.5.2 I can sign tags with \"use-agent\" and without a\n> running agent: I get asked for the passphrase (after reporting the\n> agent MIA), and everything's fine.\n>\n> My gpg returns 0 in this case; it returns 2 only if I don't enter the\n> passphrase. So, this seems to depend on the version of gpg. Or on\n> entering the correct passphrase ;)\n>\n> Michael\n\nThat is weird.  Because when working from the prompt (with agent MIA), \ngpg 1.4.9, it would accept my pass phrase, and would print the \nsignature (either binary or ascii armored), but it will still exit with \n2.  I don't understand it.  I'll pop on #gnupg tomorrow and ask about \nit.\n\nThanks again for your help with this!\n\nj\n\n-- \nJoshua Kugler\nPart-Time System Admin/Programmer\nhttp://www.eeinternet.com\nPGP Key: http://pgp.mit.edu/  ID 0x14EA086E\n"},{"id":"126920","messageId":"7vy6mk91ig.fsf@alter.siamese.dyndns.org","threadId":"21458","inReplyTo":"4AF28CE4.5000906@drmicha.warpmail.net","subject":"Re: Problem signing a tag","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-05T20:09:59Z","receivedAt":"2009-11-05T20:09:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Dig dig dig... gpg exits with 2 in a lot of cases, one would need to\n> parse fd-error to find out more. But it also looks as if gpg exits\n> normally with a good passphrase. So I tried, and at least with gpg 1.4.9\n> and git 1.6.5.2 I can sign tags with \"use-agent\" and without a running\n> agent: I get asked for the passphrase (after reporting the agent MIA),\n> and everything's fine.\n>\n> My gpg returns 0 in this case; it returns 2 only if I don't enter the\n> passphrase. So, this seems to depend on the version of gpg. Or on\n> entering the correct passphrase ;)\n\nIf the problematic gpg that gives 2 is older than yours, the situation\nlooks to me that \"exiting 2 when failed to contact agent but got a good\npassphrase some other way and successfully signed\" was diagnosed as a bug\nand then fixed in gpg.  If that is the case can we find out which version\nthat fix is in, and add an entry to FAQ to help next person who will be\nhit by this when using \"tag -s\"?\n"},{"id":"126970","messageId":"4AF3F23B.8080203@drmicha.warpmail.net","threadId":"21458","inReplyTo":"7vy6mk91ig.fsf@alter.siamese.dyndns.org","subject":"Re: Problem signing a tag","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-11-06T09:54:03Z","receivedAt":"2009-11-06T09:54:03Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 05.11.2009 21:09:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n>> Dig dig dig... gpg exits with 2 in a lot of cases, one would need to\n>> parse fd-error to find out more. But it also looks as if gpg exits\n>> normally with a good passphrase. So I tried, and at least with gpg 1.4.9\n>> and git 1.6.5.2 I can sign tags with \"use-agent\" and without a running\n>> agent: I get asked for the passphrase (after reporting the agent MIA),\n>> and everything's fine.\n>>\n>> My gpg returns 0 in this case; it returns 2 only if I don't enter the\n>> passphrase. So, this seems to depend on the version of gpg. Or on\n>> entering the correct passphrase ;)\n> \n> If the problematic gpg that gives 2 is older than yours, the situation\n> looks to me that \"exiting 2 when failed to contact agent but got a good\n> passphrase some other way and successfully signed\" was diagnosed as a bug\n> and then fixed in gpg.  If that is the case can we find out which version\n> that fix is in, and add an entry to FAQ to help next person who will be\n> hit by this when using \"tag -s\"?\n\nBoth of us seem to be using gpg 1.4.9, which is weird. I even checked\nFedora's srpm, they don't apply any patches for this. For the record,\nI'm doing\n\nunset GPG_AGENT_INFO\necho a |gpg -bsa\n\nwith \"use-agent\" and a default key signing specified in my gpg conf.\nThis returns \"0\" if I enter the correct passphrase (after being warned\nabout the missing agent) and \"2\" if I enter a wrong one repeatedly.\nJoshua, your reports seem to confirm that you get 2 in both cases from\nyour gpg 1.4.9, right?\n\nMichael\n"},{"id":"127197","messageId":"200911091115.44098.joshua@eeinternet.com","threadId":"21458","inReplyTo":"4AF3F23B.8080203@drmicha.warpmail.net","subject":"Re: Problem signing a tag","fromName":"Joshua J. Kugler","fromEmail":"joshua@eeinternet.com","sentAt":"2009-11-09T20:15:43Z","receivedAt":"2009-11-09T20:15:43Z","isPatch":false,"sender":{"key":"joshua@eeinternet.com","avatar":"https://gravatar.com/avatar/10b8c5a84877ac408892f6f1117b12a11dc927e42944139a43713073fabcbe71?d=mp&s=160"},"body":"On Friday 06 November 2009, Michael J Gruber said something like:\n> Junio C Hamano venit, vidit, dixit 05.11.2009 21:09:\n> > Michael J Gruber <git@drmicha.warpmail.net> writes:\n> >> Dig dig dig... gpg exits with 2 in a lot of cases, one would need\n> >> to parse fd-error to find out more. But it also looks as if gpg\n> >> exits normally with a good passphrase. So I tried, and at least\n> >> with gpg 1.4.9 and git 1.6.5.2 I can sign tags with \"use-agent\"\n> >> and without a running agent: I get asked for the passphrase (after\n> >> reporting the agent MIA), and everything's fine.\n> >>\n> >> My gpg returns 0 in this case; it returns 2 only if I don't enter\n> >> the passphrase. So, this seems to depend on the version of gpg. Or\n> >> on entering the correct passphrase ;)\n> >\n> > If the problematic gpg that gives 2 is older than yours, the\n> > situation looks to me that \"exiting 2 when failed to contact agent\n> > but got a good passphrase some other way and successfully signed\"\n> > was diagnosed as a bug and then fixed in gpg.  If that is the case\n> > can we find out which version that fix is in, and add an entry to\n> > FAQ to help next person who will be hit by this when using \"tag\n> > -s\"?\n>\n> Both of us seem to be using gpg 1.4.9, which is weird. I even checked\n> Fedora's srpm, they don't apply any patches for this. For the record,\n> I'm doing\n>\n> unset GPG_AGENT_INFO\n> echo a |gpg -bsa\n>\n> with \"use-agent\" and a default key signing specified in my gpg conf.\n> This returns \"0\" if I enter the correct passphrase (after being\n> warned about the missing agent) and \"2\" if I enter a wrong one\n> repeatedly. Joshua, your reports seem to confirm that you get 2 in\n> both cases from your gpg 1.4.9, right?\n\nI discovered that there must have been something locked up or wedged.  I \nrebooted (kernel update), and it worked. I looked at the warning again, \nand realized that the warning I got when the exit value was 2 was:\n\ngpg: problem with the agent - disabling agent use\n\nwhile the warning I got when the exit value was 0 was: \n\ngpg: gpg-agent is not available in this session\n\nSo, two different warnings.\n\nThanks again for all the troubleshooting help!\n\nj\n\n-- \nJoshua Kugler\nPart-Time System Admin/Programmer\nhttp://www.eeinternet.com\nPGP Key: http://pgp.mit.edu/  ID 0x14EA086E\n"}]}