Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: Michael Stapelberg <michael+sup@stapelberg.de>
To: sup-talk <sup-talk@rubyforge.org>
Subject: Re: [sup-talk] curses pinentry woes (still)
Date: Thu, 18 Feb 2010 19:10:07 +0100	[thread overview]
Message-ID: <1266516237-sup-7845@midna.zekjur.net> (raw)
In-Reply-To: <1265574271-sup-5738@midna.zekjur.net>

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

Hi,

Excerpts from Michael Stapelberg's message of So Feb 07 21:25:57 +0100 2010:
> Excerpts from Sven Moritz Hallberg's message of So Feb 07 20:10:04 +0100 2010:
> > Whenever gpg-agent starts pinentry-curses with sup running, the interface gets
> > "messed up". Unfortunately, I'm still experiencing such a problem with sup
> > version 0.10.2.
Further debugging told me that it is a thread related problem. You can work
around it by disabling threads when starting sup using the -n option.

The problem seems to be that other threads still run while one thread calls
system (which in turn uses fork, which seems to be the real cause of the
problem). Even using Thread.critical = true does not fix the problem (it is
removed in ruby 1.9 anyways). I’ve attached a proof of concept which
illustrates the problem.

Could anyone with a little more insight into ruby threads have a look at this
issue please?

Specifically, if you comment out the call to reporting_thread in
lib/sup/modes/thread-index-mode.rb:101, it seems to work.

Best regards,
Michael

[-- Attachment #2: poc.rb --]
[-- Type: application/octet-stream, Size: 410 bytes --]

#!/usr/bin/env ruby

require 'thread'

o = Thread.new {
  count = 0
  while count < 3 do
    puts "ohai from #{Process.pid}"
    sleep 1
    count = count + 1
  end
}

Thread.critical = true

# This does not work:
pid = system "sleep 2; echo done"

# This does work (output does not get interrupted):
#count = 0
#while count < 5 do
#  puts "wait!"
#  count = count + 1
#  sleep 2
#end

Thread.critical = false

[-- Attachment #3: Type: text/plain, Size: 140 bytes --]

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

  reply	other threads:[~2010-02-18 18:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-07 19:10 Sven Moritz Hallberg
2010-02-07 20:25 ` Michael Stapelberg
2010-02-18 18:10   ` Michael Stapelberg [this message]
2010-02-18 18:35     ` Sven Schober
2010-02-19  3:29       ` Michael Stapelberg
2010-02-19 10:30         ` Sven Schober
2010-02-21 11:13           ` Sven Schober

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1266516237-sup-7845@midna.zekjur.net \
    --to=michael+sup@stapelberg.de \
    --cc=sup-talk@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox