Run ssh with -n whenever input is not being piped into it
authorJoey Hess <joeyh@joeyh.name>
Wed, 15 Feb 2017 19:08:46 +0000 (15:08 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 15 Feb 2017 19:08:46 +0000 (15:08 -0400)
commitf07af030188a60176858999f2a0004ac3f626488
tree2ac40ead857612f66490508b138019172e47d31a
parenta0222ea7eb460d6e6c5655659be21794e76b5d53
Run ssh with -n whenever input is not being piped into it

... to avoid it consuming stdin that it shouldn't.

This fixes git-annex-checkpresentkey --batch remote, which didn't output
results for all keys passed into it.

Other git-annex commands that communicate with a remote over ssh may also
have been consuming stdin that they shouldn't have, which could have
impacted using them in eg, shell scripts. For example, a shell script
reading files from stdin and passing them to git annex drop would be
impacted by this bug, whenever git annex drop ran git-annex-shell
checkpresent, it would consume part/all of the stdin that the shell script
was supposed to consume.

Fixed by adding a ConsumeStdin parameter to Annex.Ssh.sshOptions, which
is used throughout git-annex to run ssh (in order for ssh connection
caching to work). Every call site was checked to see if it used
CreatePipe for stdin, and if not was marked NoConsumeStdin.
14 files changed:
Annex/Ssh.hs
Assistant/WebApp/Configurators/Ssh.hs
CHANGELOG
Command/Map.hs
Remote/Bup.hs
Remote/Ddar.hs
Remote/GCrypt.hs
Remote/Git.hs
Remote/Helper/Ssh.hs
Remote/Rsync.hs
RemoteDaemon/Transport/GCrypt.hs
RemoteDaemon/Transport/Ssh.hs
doc/bugs/checkpresentkey_batch_stops_at_97_or_98_keys.mdwn
doc/bugs/checkpresentkey_batch_stops_at_97_or_98_keys/comment_1_f0d17735d01a04c3c2adeb5ab4c2c0ce._comment [new file with mode: 0644]