Package: ruby-net-ssh Version: 1:2.5.2-2 Severity: normal Dear Maintainer,
I am currently packaging our own distkeys key distribution ruby script (see #712787 RFS: distkeys/1.0 -- distribute SSH keys). However it only works with Ruby 1.8 for now, as with Ruby 1.9 I get a error back from ruby-net-ssh when trying to add or remove a key: ./distkeys -K somekey.pub -H somehost add Host: somehost Connecting to host somehost (user: ms, port: 9999)... Opening SFTP session... Key somekey added. Creating a backup to .ssh/authorized_keys-2013-07-01.bak if not already done today... Uploading keys to .ssh/authorized_keys-new... File does exist and has correct size, moving to .ssh/authorized_keys... /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:296:in `[]=': can't add a new key into hash during iteration (RuntimeError) from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:296:in `open_channel' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:320:in `exec' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:354:in `exec!' from ./distkeys:206:in `block in commit' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/request.rb:87:in `call' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/request.rb:87:in `respond_to' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:948:in `dispatch_request' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:911:in `when_channel_polled' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/channel.rb:311:in `call' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/channel.rb:311:in `process' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:214:in `block in preprocess' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:214:in `each' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:214:in `preprocess' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:197:in `process' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:161:in `block in loop' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:161:in `loop' from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:161:in `loop' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:802:in `loop' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/request.rb:72:in `wait' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:842:in `wait_for' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:320:in `lstat!' from ./distkeys:200:in `commit' from ./distkeys:571:in `handle_host' from ./distkeys:677:in `block in handle_gwhost' from ./distkeys:660:in `each' from ./distkeys:660:in `handle_gwhost' from ./distkeys:692:in `loop' from ./distkeys:797:in `<main>' I also tried after purging ruby-net-ssh which also removes ruby-net-sftp and ruby-net-ssh-gateway and installing as gems: mango:~# gem install net-sftp net-ssh net-ssh-gateway Fetching: net-ssh-2.6.7.gem (100%) Fetching: net-sftp-2.1.2.gem (100%) Successfully installed net-ssh-2.6.7 Successfully installed net-sftp-2.1.2 Successfully installed net-ssh-2.6.7 This gives the following backtrace: /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:299:in `[]=': can't add a new key into hash during iteration (RuntimeError) from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:299:in `open_channel' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:323:in `exec' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:357:in `exec!' from ./distkeys:206:in `block in commit' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/request.rb:87:in `call' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/request.rb:87:in `respond_to' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:948:in `dispatch_request' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:911:in `when_channel_polled' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/channel.rb:311:in `call' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/channel.rb:311:in `process' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:217:in `block in preprocess' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:217:in `each' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:217:in `preprocess' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:200:in `process' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:164:in `block in loop' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:164:in `loop' from /var/lib/gems/1.9.1/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:164:in `loop' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:802:in `loop' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/request.rb:72:in `wait' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:842:in `wait_for' from /var/lib/gems/1.9.1/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:320:in `lstat!' from ./distkeys:200:in `commit' from ./distkeys:571:in `handle_host' from ./distkeys:677:in `block in handle_gwhost' from ./distkeys:660:in `each' from ./distkeys:660:in `handle_gwhost' from ./distkeys:692:in `loop' from ./distkeys:797:in `<main>' With Ruby 1.8 this works. The code where this happens in distkeys as of commit bf13f12e8ca3846998cc1cb610403ad958979377 (I will add a tag with this bug report number) to the git repo: request = @sftp.lstat!(newauthkeyfile) do | response | if response.ok? # File size okay? if response[:attrs].size >= wantedsize puts "File does exist and has correct size, moving to #{@authkeyfile}..." # Move the new keyfile over the old one @ssh.exec!( "mv #{newauthkeyfile} #{@authkeyfile}" ) # We saved the changes, so no unsaved changes anymore @changed = false end end end #@sftp.loop URL to git repo is: git://oss.teamix.org/distkeys.git I am trying to work-around this issue by using sftp.rename now. I think its a better choice than executing the mv command. Unless there is some programming mistake in distkeys that Ruby 1.9 brings to light I bet this is an upstream bug. I am willing to forward / report upstream as well, but first wanted to have this tracked in Debian BTS. ms@mango:~> apt-show-versions | grep ruby-net ruby-net-sftp/wheezy uptodate 1:2.0.5-3 ruby-net-ssh/wheezy uptodate 1:2.5.2-2 ruby-net-ssh-gateway/wheezy uptodate 1.1.0-2 Thanks, Martin -- System Information: Debian Release: 7.1 APT prefers stable APT policy: (500, 'stable'), (350, 'unstable'), (110, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.9-1-amd64 (SMP w/4 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages ruby-net-ssh depends on: ii ruby 1:1.9.3 ii ruby1.8 [ruby-interpreter] 1.8.7.358-7 ii ruby1.9.1 [ruby-interpreter] 1.9.3.194-8.1 ruby-net-ssh recommends no packages. ruby-net-ssh suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org