zsh-users
 help / color / mirror / code / Atom feed
* GnuPG 2.1 with Git, problem in zsh, not in ksh
@ 2015-10-28 11:11 Andreas Kusalananda Kähäri
  2015-10-28 14:33 ` shawn wilson
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Kusalananda Kähäri @ 2015-10-28 11:11 UTC (permalink / raw)
  To: zsh-users

Hi,

I'm a Perl developer using zsh and git, and I sign my git commits using
gpg2 (from GnuPG 2.1).

In ksh, I'm able to "git commit -S code.pl", but I noticed that this
stopped working the other week when I started using zsh:

[laptop] ENA % git commit -S submit.pl
gpg: signing failed: Inappropriate ioctl for device
gpg: signing failed: Inappropriate ioctl for device
error: gpg failed to sign the data
fatal: failed to write commit object

Simply starting up ksh and running the same command works. "Works"
in this case means git calls gpg2 which uses pinentry to request the
password, etc.

Since I'm resonably new to zsh, I'm not even sure where to start looking
for the solution.  The environment variables in zsh are identical to
those in ksh.

This is my ~/.zshrc file:

# For interactive zsh sessions

# Completion options
unsetopt AUTO_REMOVE_SLASH

# History options
setopt EXTENDED_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_DUPS
setopt SHARE_HISTORY
unsetopt INC_APPEND_HISTORY

HISTFILE="$HOME/.zsh/history"
HISTSIZE=10000
SAVEHIST=5000

bindkey '^R' history-incremental-pattern-search-backward
bindkey '^G' history-beginning-search-backward

# Input/Output options
setopt CORRECT
setopt DVORAK

# Job control options
setopt BGNICE

# Prompting options
#setopt TRANSIENT_RPROMPT

PROMPT="[%m] %B%F{red}%1~%f%b %# "
RPROMPT="%F{blue}%T%f"

# Zle options
unsetopt BEEP
setopt VI

autoload -Uz compinit
compinit

alias ls="ls -F"

export VISUAL="vim"
export EDITOR="$VISUAL"

-- 
:: Andreas Kusalananda Kähäri, Bioinformatics Developer, BILS,
:: Uppsala University, Sweden
::----------------------------------------------------------------------
:: My other car is a cdr.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
  2015-10-28 11:11 GnuPG 2.1 with Git, problem in zsh, not in ksh Andreas Kusalananda Kähäri
@ 2015-10-28 14:33 ` shawn wilson
  2015-10-28 14:47   ` Andreas Kusalananda Kähäri
  0 siblings, 1 reply; 11+ messages in thread
From: shawn wilson @ 2015-10-28 14:33 UTC (permalink / raw)
  To: Zsh Users

check that GPG_AGENT_INFO and GPG_TTY are correct - the syntax of the
former is <socket file>:<pid>:<idr but just set it to 1>

On Wed, Oct 28, 2015 at 7:11 AM, Andreas Kusalananda Kähäri
<andreas.kahari@bils.se> wrote:
> Hi,
>
> I'm a Perl developer using zsh and git, and I sign my git commits using
> gpg2 (from GnuPG 2.1).
>
> In ksh, I'm able to "git commit -S code.pl", but I noticed that this
> stopped working the other week when I started using zsh:
>
> [laptop] ENA % git commit -S submit.pl
> gpg: signing failed: Inappropriate ioctl for device
> gpg: signing failed: Inappropriate ioctl for device
> error: gpg failed to sign the data
> fatal: failed to write commit object
>
> Simply starting up ksh and running the same command works. "Works"
> in this case means git calls gpg2 which uses pinentry to request the
> password, etc.
>
> Since I'm resonably new to zsh, I'm not even sure where to start looking
> for the solution.  The environment variables in zsh are identical to
> those in ksh.
>
> This is my ~/.zshrc file:
>
> # For interactive zsh sessions
>
> # Completion options
> unsetopt AUTO_REMOVE_SLASH
>
> # History options
> setopt EXTENDED_HISTORY
> setopt HIST_EXPIRE_DUPS_FIRST
> setopt HIST_FIND_NO_DUPS
> setopt HIST_IGNORE_DUPS
> setopt SHARE_HISTORY
> unsetopt INC_APPEND_HISTORY
>
> HISTFILE="$HOME/.zsh/history"
> HISTSIZE=10000
> SAVEHIST=5000
>
> bindkey '^R' history-incremental-pattern-search-backward
> bindkey '^G' history-beginning-search-backward
>
> # Input/Output options
> setopt CORRECT
> setopt DVORAK
>
> # Job control options
> setopt BGNICE
>
> # Prompting options
> #setopt TRANSIENT_RPROMPT
>
> PROMPT="[%m] %B%F{red}%1~%f%b %# "
> RPROMPT="%F{blue}%T%f"
>
> # Zle options
> unsetopt BEEP
> setopt VI
>
> autoload -Uz compinit
> compinit
>
> alias ls="ls -F"
>
> export VISUAL="vim"
> export EDITOR="$VISUAL"
>
> --
> :: Andreas Kusalananda Kähäri, Bioinformatics Developer, BILS,
> :: Uppsala University, Sweden
> ::----------------------------------------------------------------------
> :: My other car is a cdr.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
  2015-10-28 14:33 ` shawn wilson
@ 2015-10-28 14:47   ` Andreas Kusalananda Kähäri
  2015-10-28 15:02     ` Peter Stephenson
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Kusalananda Kähäri @ 2015-10-28 14:47 UTC (permalink / raw)
  To: shawn wilson; +Cc: Zsh Users

Thanks for this!

Setting GPG_TTY=$( tty ) solved it for me!

GnuPG 2.1 doesn't use GPG_AGENT_INFO any longer, according to the
gpg2(1) manual.

I still don't know why it worked in ksh though... (but never mind).

Cheers,
Andreas


On Wed, Oct 28, 2015 at 10:33:53AM -0400, shawn wilson wrote:
> check that GPG_AGENT_INFO and GPG_TTY are correct - the syntax of the
> former is <socket file>:<pid>:<idr but just set it to 1>
> 
> On Wed, Oct 28, 2015 at 7:11 AM, Andreas Kusalananda Kähäri
> <andreas.kahari@bils.se> wrote:
> > Hi,
> >
> > I'm a Perl developer using zsh and git, and I sign my git commits using
> > gpg2 (from GnuPG 2.1).
> >
> > In ksh, I'm able to "git commit -S code.pl", but I noticed that this
> > stopped working the other week when I started using zsh:
> >
> > [laptop] ENA % git commit -S submit.pl
> > gpg: signing failed: Inappropriate ioctl for device
> > gpg: signing failed: Inappropriate ioctl for device
> > error: gpg failed to sign the data
> > fatal: failed to write commit object
> >
> > Simply starting up ksh and running the same command works. "Works"
> > in this case means git calls gpg2 which uses pinentry to request the
> > password, etc.
> >
> > Since I'm resonably new to zsh, I'm not even sure where to start looking
> > for the solution.  The environment variables in zsh are identical to
> > those in ksh.
> >
> > This is my ~/.zshrc file:
> >
> > # For interactive zsh sessions
> >
> > # Completion options
> > unsetopt AUTO_REMOVE_SLASH
> >
> > # History options
> > setopt EXTENDED_HISTORY
> > setopt HIST_EXPIRE_DUPS_FIRST
> > setopt HIST_FIND_NO_DUPS
> > setopt HIST_IGNORE_DUPS
> > setopt SHARE_HISTORY
> > unsetopt INC_APPEND_HISTORY
> >
> > HISTFILE="$HOME/.zsh/history"
> > HISTSIZE=10000
> > SAVEHIST=5000
> >
> > bindkey '^R' history-incremental-pattern-search-backward
> > bindkey '^G' history-beginning-search-backward
> >
> > # Input/Output options
> > setopt CORRECT
> > setopt DVORAK
> >
> > # Job control options
> > setopt BGNICE
> >
> > # Prompting options
> > #setopt TRANSIENT_RPROMPT
> >
> > PROMPT="[%m] %B%F{red}%1~%f%b %# "
> > RPROMPT="%F{blue}%T%f"
> >
> > # Zle options
> > unsetopt BEEP
> > setopt VI
> >
> > autoload -Uz compinit
> > compinit
> >
> > alias ls="ls -F"
> >
> > export VISUAL="vim"
> > export EDITOR="$VISUAL"
> >
> > --
> > :: Andreas Kusalananda Kähäri, Bioinformatics Developer, BILS,
> > :: Uppsala University, Sweden
> > ::----------------------------------------------------------------------
> > :: My other car is a cdr.
> 

-- 
:: Andreas Kusalananda Kähäri, Bioinformatics Developer, BILS,
:: Uppsala University, Sweden
::----------------------------------------------------------------------
:: My other car is a cdr.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
  2015-10-28 14:47   ` Andreas Kusalananda Kähäri
@ 2015-10-28 15:02     ` Peter Stephenson
  2015-10-28 16:22       ` Andreas Kusalananda Kähäri
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Stephenson @ 2015-10-28 15:02 UTC (permalink / raw)
  To: Andreas Kusalananda Kähäri, Zsh Users

On Wed, 28 Oct 2015 15:47:39 +0100
Andreas Kusalananda Kähäri <andreas.kahari@bils.se> wrote:
> Setting GPG_TTY=$( tty ) solved it for me!
> 
> GnuPG 2.1 doesn't use GPG_AGENT_INFO any longer, according to the
> gpg2(1) manual.
> 
> I still don't know why it worked in ksh though... (but never mind).

Maybe something in your ksh set up is marking the variables for export?
It won't do that automatically, though.

pws


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
  2015-10-28 15:02     ` Peter Stephenson
@ 2015-10-28 16:22       ` Andreas Kusalananda Kähäri
  2015-10-28 18:05         ` shawn wilson
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Kusalananda Kähäri @ 2015-10-28 16:22 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh Users

On Wed, Oct 28, 2015 at 03:02:01PM +0000, Peter Stephenson wrote:
> On Wed, 28 Oct 2015 15:47:39 +0100
> Andreas Kusalananda Kähäri <andreas.kahari@bils.se> wrote:
> > Setting GPG_TTY=$( tty ) solved it for me!
> > 
> > GnuPG 2.1 doesn't use GPG_AGENT_INFO any longer, according to the
> > gpg2(1) manual.
> > 
> > I still don't know why it worked in ksh though... (but never mind).
> 
> Maybe something in your ksh set up is marking the variables for export?
> It won't do that automatically, though.
> 
> pws
> 

I don't think that's it. I don't have a ~/.profile file or point $ENV
to anything and ksh93 (standard on OS X, which I use) don't parse any
other startup files. The system /etc/profile only sets the $PATH. The
environment is inherited from my zsh session when I start up ksh, that's
about it, and it worked in ksh but not in zsh (does now, since I set
$GPG_TTY).

I'm wondering if there's some magic happening behind the scenes that I
don't know about. Maybe something in $FPATH gets triggered and does the
wrong thing?



-- 
:: Andreas Kusalananda Kähäri, Bioinformatics Developer, BILS,
:: Uppsala University, Sweden
::----------------------------------------------------------------------
:: My other car is a cdr.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
  2015-10-28 16:22       ` Andreas Kusalananda Kähäri
@ 2015-10-28 18:05         ` shawn wilson
  2015-10-28 19:50           ` Andreas Kusalananda Kähäri
  0 siblings, 1 reply; 11+ messages in thread
From: shawn wilson @ 2015-10-28 18:05 UTC (permalink / raw)
  To: Peter Stephenson, Zsh Users

On Wed, Oct 28, 2015 at 12:22 PM, Andreas Kusalananda Kähäri
<andreas.kahari@bils.se> wrote:
> On Wed, Oct 28, 2015 at 03:02:01PM +0000, Peter Stephenson wrote:
>> On Wed, 28 Oct 2015 15:47:39 +0100
>> Andreas Kusalananda Kähäri <andreas.kahari@bils.se> wrote:
>> > Setting GPG_TTY=$( tty ) solved it for me!
>> >
>> > GnuPG 2.1 doesn't use GPG_AGENT_INFO any longer, according to the
>> > gpg2(1) manual.
>> >
>> > I still don't know why it worked in ksh though... (but never mind).
>>
>> Maybe something in your ksh set up is marking the variables for export?
>> It won't do that automatically, though.
>>
>> pws
>>
>
> I don't think that's it. I don't have a ~/.profile file or point $ENV
> to anything and ksh93 (standard on OS X, which I use) don't parse any
> other startup files. The system /etc/profile only sets the $PATH. The
> environment is inherited from my zsh session when I start up ksh, that's
> about it, and it worked in ksh but not in zsh (does now, since I set
> $GPG_TTY).
>

anything in {,/usr/local}/etc/<whatever files ksh uses> ?

> I'm wondering if there's some magic happening behind the scenes that I
> don't know about. Maybe something in $FPATH gets triggered and does the
> wrong thing?
>

IDK what gpg 2 does - I'm still on 1, but your shell doesn't do magic
out of the box - you have to wave (and throw things) at it to make
that happen.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
  2015-10-28 18:05         ` shawn wilson
@ 2015-10-28 19:50           ` Andreas Kusalananda Kähäri
  2015-10-28 23:49             ` Bart Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Kusalananda Kähäri @ 2015-10-28 19:50 UTC (permalink / raw)
  To: shawn wilson; +Cc: Peter Stephenson, Zsh Users

On Wed, Oct 28, 2015 at 02:05:31PM -0400, shawn wilson wrote:
> On Wed, Oct 28, 2015 at 12:22 PM, Andreas Kusalananda Kähäri
> <andreas.kahari@bils.se> wrote:
> > On Wed, Oct 28, 2015 at 03:02:01PM +0000, Peter Stephenson wrote:
> >> On Wed, 28 Oct 2015 15:47:39 +0100
> >> Andreas Kusalananda Kähäri <andreas.kahari@bils.se> wrote:
> >> > Setting GPG_TTY=$( tty ) solved it for me!
> >> >
> >> > GnuPG 2.1 doesn't use GPG_AGENT_INFO any longer, according to the
> >> > gpg2(1) manual.
> >> >
> >> > I still don't know why it worked in ksh though... (but never mind).
> >>
> >> Maybe something in your ksh set up is marking the variables for export?
> >> It won't do that automatically, though.
> >>
> >> pws
> >>
> >
> > I don't think that's it. I don't have a ~/.profile file or point $ENV
> > to anything and ksh93 (standard on OS X, which I use) don't parse any
> > other startup files. The system /etc/profile only sets the $PATH. The
> > environment is inherited from my zsh session when I start up ksh, that's
> > about it, and it worked in ksh but not in zsh (does now, since I set
> > $GPG_TTY).
> >
> 
> anything in {,/usr/local}/etc/<whatever files ksh uses> ?

Nope. Only uses /etc/profile, and that only sets $PATH. ... unless ksh
is doing magic that I don't see.

> 
> > I'm wondering if there's some magic happening behind the scenes that I
> > don't know about. Maybe something in $FPATH gets triggered and does the
> > wrong thing?
> >
> 
> IDK what gpg 2 does - I'm still on 1, but your shell doesn't do magic
> out of the box - you have to wave (and throw things) at it to make
> that happen.
> 

I dunno. I was playing around with qemu the other night, and I typed
"qemu-system-x86_64" followed by <space> and then <tab> and the shell
decided to execute the command (possibly in an attempt to figure out
its usage info somehow) which filled my terminal with all sorts of qemu
logging crap. Is that a side-effect of using "compinit"? I'd call that
"magic out of the box".

Cheers,


-- 
:: Andreas Kusalananda Kähäri, Bioinformatics Developer, BILS,
:: Uppsala University, Sweden
::----------------------------------------------------------------------
:: My other car is a cdr.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
  2015-10-28 19:50           ` Andreas Kusalananda Kähäri
@ 2015-10-28 23:49             ` Bart Schaefer
  2015-10-29  6:47               ` Andreas Kusalananda Kähäri
  0 siblings, 1 reply; 11+ messages in thread
From: Bart Schaefer @ 2015-10-28 23:49 UTC (permalink / raw)
  To: Zsh Users

On Oct 28,  8:50pm, Andreas Kusalananda Kähäri wrote:
} Subject: Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
}
} I dunno. I was playing around with qemu the other night, and I typed
} "qemu-system-x86_64" followed by <space> and then <tab> and the shell
} decided to execute the command (possibly in an attempt to figure out
} its usage info somehow) which filled my terminal with all sorts of qemu
} logging crap. Is that a side-effect of using "compinit"?

Yes, that's a side-effect of using "compinit".  The completion function
_qemu invokes "qemu -M \?" to get a list of machines you might want to
run; "logging crap" is probably because the writer of _qemu neglected
to redirect stderr of that command.

diff --git a/Completion/Unix/Command/_qemu b/Completion/Unix/Command/_qemu
index db07eba..3c21c3e 100644
--- a/Completion/Unix/Command/_qemu
+++ b/Completion/Unix/Command/_qemu
@@ -2,7 +2,7 @@
 
 _qemu_log_items () {
   local -a opts hline
-  $service -d \? | while read -A hline; do
+  $service -d \? 2>/dev/null | while read -A hline; do
     [[ $hline[1] = Log ]] && continue
     opts=($opts "${hline[1]}[${hline[2,-1]}]")
   done
@@ -11,7 +11,7 @@ _qemu_log_items () {
 
 local _qemu_machines
 
-_qemu_machines=(${${${(f)"$($service -M \?)"}[2,-1]}%% *})
+_qemu_machines=(${${${(f)"$($service -M \? 2>/dev/null)"}[2,-1]}%% *})
 
 _arguments \
   '-'{fda,fdb,hda,hdb,hdc,hdd,cdrom}':disk image:_files' \


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
  2015-10-28 23:49             ` Bart Schaefer
@ 2015-10-29  6:47               ` Andreas Kusalananda Kähäri
  2015-10-29 11:47                 ` Simon Ruderich
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Kusalananda Kähäri @ 2015-10-29  6:47 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users

On Wed, Oct 28, 2015 at 04:49:55PM -0700, Bart Schaefer wrote:
> On Oct 28,  8:50pm, Andreas Kusalananda Kähäri wrote:
> } Subject: Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
> }
> } I dunno. I was playing around with qemu the other night, and I typed
> } "qemu-system-x86_64" followed by <space> and then <tab> and the shell
> } decided to execute the command (possibly in an attempt to figure out
> } its usage info somehow) which filled my terminal with all sorts of qemu
> } logging crap. Is that a side-effect of using "compinit"?
> 
> Yes, that's a side-effect of using "compinit".  The completion function
> _qemu invokes "qemu -M \?" to get a list of machines you might want to
> run; "logging crap" is probably because the writer of _qemu neglected
> to redirect stderr of that command.

Ok, so that's a feature I'll be turning off then.  I prefer bog standard
command name and file name completion.

My initial problem was solved by setting $GPG_TTY anyway. Thanks!

Andreas

-- 
:: Andreas Kusalananda Kähäri, Bioinformatics Developer, BILS,
:: Uppsala University, Sweden
::----------------------------------------------------------------------
:: My other car is a cdr.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
  2015-10-29  6:47               ` Andreas Kusalananda Kähäri
@ 2015-10-29 11:47                 ` Simon Ruderich
  2015-10-29 17:22                   ` Andreas Kusalananda Kähäri
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Ruderich @ 2015-10-29 11:47 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

On Thu, Oct 29, 2015 at 07:47:56AM +0100, Andreas Kusalananda Kähäri wrote:
> Ok, so that's a feature I'll be turning off then.  I prefer bog standard
> command name and file name completion.

Then you're missing one of the best features of zsh. Context
sensitive completion is IMHO immensely useful and makes working
in the shell much faster and more convenient. I'd recommend that
you give zsh's completion system a try for some time.

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: GnuPG 2.1 with Git, problem in zsh, not in ksh
  2015-10-29 11:47                 ` Simon Ruderich
@ 2015-10-29 17:22                   ` Andreas Kusalananda Kähäri
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas Kusalananda Kähäri @ 2015-10-29 17:22 UTC (permalink / raw)
  To: Simon Ruderich; +Cc: zsh-users

On Thu, Oct 29, 2015 at 12:47:32PM +0100, Simon Ruderich wrote:
> On Thu, Oct 29, 2015 at 07:47:56AM +0100, Andreas Kusalananda Kähäri wrote:
> > Ok, so that's a feature I'll be turning off then.  I prefer bog standard
> > command name and file name completion.
> 
> Then you're missing one of the best features of zsh. Context
> sensitive completion is IMHO immensely useful and makes working
> in the shell much faster and more convenient. I'd recommend that
> you give zsh's completion system a try for some time.

I don't need fast and convinient.  I need correct and reproducable.
I think I might step back into ksh93 for both interactive work and
scripting.  I'm too old for this  ;-)  Thanks for the ride though.


-- 
:: Andreas Kusalananda Kähäri, Bioinformatics Developer, BILS,
:: Uppsala University, Sweden
::----------------------------------------------------------------------
:: My other car is a cdr.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-10-29 17:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-28 11:11 GnuPG 2.1 with Git, problem in zsh, not in ksh Andreas Kusalananda Kähäri
2015-10-28 14:33 ` shawn wilson
2015-10-28 14:47   ` Andreas Kusalananda Kähäri
2015-10-28 15:02     ` Peter Stephenson
2015-10-28 16:22       ` Andreas Kusalananda Kähäri
2015-10-28 18:05         ` shawn wilson
2015-10-28 19:50           ` Andreas Kusalananda Kähäri
2015-10-28 23:49             ` Bart Schaefer
2015-10-29  6:47               ` Andreas Kusalananda Kähäri
2015-10-29 11:47                 ` Simon Ruderich
2015-10-29 17:22                   ` Andreas Kusalananda Kähäri

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).