[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RFS: distkeys/1.0 -- distribute SSH keys



Hi Antonio,

----- Ursprüngliche Mail -----
> On Wed, Jun 19, 2013 at 03:59:53PM +0200, Martin Steigerwald wrote:
> > Currently it only works with Ruby 1.8 (which is mentioned in README).
> 
> I intend to EOL Ruby 1.8 in Debian pretty soon ... it's not a good idea
> to upload 1.8-only software at this point.
> 
> (haven't checked the package though)

Distkeys itself is not ruby 1.8 specific. But with ruby 1.9 a call to sftp.lstat bails out with error message:

/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 ./multikeys.rb:197:in `block in commit'
        from /usr/lib/ruby/vendor_ruby/net/sftp/request.rb:87:in `call'
        from /usr/lib/ruby/vendor_ruby/net/sftp/request.rb:87:in `respond_to'
        from /usr/lib/ruby/vendor_ruby/net/sftp/session.rb:948:in `dispatch_request'
        from /usr/lib/ruby/vendor_ruby/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 /usr/lib/ruby/vendor_ruby/net/sftp/session.rb:802:in `loop'
        from ./multikeys.rb:204:in `commit'
        from ./multikeys.rb:593:in `handle_host'
        from ./multikeys.rb:668:in `block in handle_gwhost'
        from ./multikeys.rb:651:in `each'
        from ./multikeys.rb:651:in `handle_gwhost'
        from ./multikeys.rb:683:in `loop'
        from ./multikeys.rb:771:in `<main>'

(this backtrace is from a slightly older version of script with a bit different line numbers.


I believe this to be a bug in ruby-net-ssh, but I am not sure.


I think error is happening at line 200 in:

		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

If I remove this block, I get no error, but also no necessary key file rename.


But I see no obvious error in there and it works with Ruby 1.8.

I´d like to fix it and asked for help here already.

I am willing to make a bug report against ruby net ssh.

Any other ideas?

Do you see an obvious error in above code? Maybe I am just not seeing it.

I certainly like to see distkeys run with Ruby 1.9.

Thanks,
-- 
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlHB6ZYACgkQDOM8kQ+cso+8eQCcD/JsdQC7kHcSdCfM8JukhZvf
Qb0AnRXTcmsrxKl5WYuq24hKU5Ytycqp
=t60O
-----END PGP SIGNATURE-----

Reply to: