ThreadError on shell.rb

e$B$O$8$a$^$7$F!"HxED$H$$$$$^$9!#e(B

shell.rb
e$B$r;H$C$?$A$g$C$H$7$?%9%/%j%W%H$r=q$$$FBgNL$N%U%!%$%ke(B(3000e$B%U%!%$%k!(e(B
11GB)e$B$re(B
e$B=hM}$7$F$$$?$iESCf$G;_$^$C$F$7$^$$$^$7$?!#e(B

e$B%9%/%j%W%H<+BN$KLdBj$O$J$$$H;W$&$N$G!“0l1~Js9p$^$G!#e(B
e$B0J2<!”%9%?%C%/%H%l!<%9$HDd;_$7$?%9%/%j%W%H$G$9!#e(B

require ‘pathname’
require ‘shell’
require ‘optparse’

def main(from, to, debug, commands)
files = []
from.find do |path|
files << path if path.file?
end

if debug > 0
STDERR.puts “from_dir = #{from.to_s}”
STDERR.puts “to_dir = #{to.to_s}”
end

files.sort.each do |file|
dest = to + file.relative_path_from(from)
dest.parent.mkpath

  if debug > 0
     STDERR.puts "input = #{file.to_s}"
     STDERR.puts "output = #{dest.to_s}"
  end

  Shell.new.transact do
     cat(file.to_s) | system(*commands) > dest.to_s
  end

end
end

if $0 == FILE
from = nil
to = nil
debug = 0

opt = OptionParser.new
opt.on(’-t’, ‘–to TO’, String) {|v| to = Pathname.new v}
opt.on(’-f’, ‘–from FROM’, String) {|v| from = Pathname.new v}
opt.on(’-d’, ‘–debug’) { debug += 1 }
opt.parse!(ARGV)

unless from and to and ARGV.length > 0
puts opt.help
exit
end

main(from, to, debug, ARGV)
end

/home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/thread.rb:203:in
stop': stopping only thread (ThreadError) note: use sleep to stop forever from /home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/thread.rb:203:inwait’
from
/home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/thread.rb:155:in
exclusive_unlock' from /home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/thread.rb:33:inexclusive’
from
/home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/thread.rb:147:in
exclusive_unlock' from /home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/thread.rb:201:inwait’
from
/home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/shell/process-controller.rb:185:in
wait_all_jobs_execution' from /home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/thread.rb:135:insynchronize’
from
/home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/shell/process-controller.rb:182:in
wait_all_jobs_execution' from /home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/shell/command-processor.rb:246:incheck_point’
from
/home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/shell/command-processor.rb:254:in
transact' from /home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/shell/command-processor.rb:519:insend
from
/home/oda/opt/stow/ruby-1.8.5-p12/lib/ruby/1.8/shell/command-processor.rb:519:in
transact' from ./bin/dir_filter.rb:27:inmain’
from ./bin/dir_filter.rb:18:in each' from ./bin/dir_filter.rb:18:inmain’

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev:30477] the message: “[ruby-dev:30477] ThreadError on
shell.rb”, on Mar/04 10:48(JST) “Akira ODA” writes:

e$B$O$8$a$^$7$F!"HxED$H$$$$$^$9!#e(B

e$B$O$8$a$^$7$Fe(B.

shell.rb e$B$r;H$C$?$A$g$C$H$7$?%9%/%j%W%H$r=q$$$FBgNL$N%U%!%$%ke(B(3000e$B%U%!e(B
e$B%$%k!(e(B 11GB)e$B$r=hM}$7$F$$$?$iESCf$G;_$^$C$F$7$^$$$^$7$?!#e(B

e$B8f0&MQ$"$j$,$H$&$4$6$$$^$9e(B.

e$B%9%/%j%W%H<+BN$KLdBj$O$J$$$H;W$&$N$G!“0l1~Js9p$^$G!#e(B
e$B0J2<!”%9%?%C%/%H%l!<%9$HDd;_$7$?%9%/%j%W%H$G$9!#e(B

e$B$A$g$C$H;n$7$^$7$?$,e(B, e$B:F8=$9$k$N$O$J$+$J$+Fq$7$=$&$G$9e(B…
e$B<B9T$9$k$HI,$::F8=$7$^$9e(B?

e$B$A$J$_$Ke(B,

 Shell.new.transact do
    cat(file.to_s) | system(*commands) > dest.to_s
 end
    :

main(from, to, debug, ARGV)
end

commands(ARGV)e$B$KEO$9%3%^%s%I$O2?$G$7$g$&$+e(B?

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$BHxED$G$9!#e(B

e$B$A$g$C$H;n$7$^$7$?$,e(B, e$B:F8=$9$k$N$O$J$+$J$+Fq$7$=$&$G$9e(B…
e$B<B9T$9$k$HI,$::F8=$7$^$9e(B?

e$B$$$(!">/$J$$%U%!%$%k?t$J$i%(%i!<$,5/$-$J$$$3$H$b$"$j$^$9!#e(B
2,000e$B%U%!%$%k0J>e=hM}$7$?$H$3$m$G$H$^$C$?$H;W$C$?$i!“e(B150e$B%U%!%$%k$[$Ie(B
e$B$G$H$^$k>l9g$b$”$k$h$&$G$9!#e(B

commands(ARGV)e$B$KEO$9%3%^%s%I$O2?$G$7$g$&$+e(B?

e$B<+:n$Ne(BPython e$B%9%/%j%W%H$G$9!#$G!"e(B

% ./bin/dir_filter.rb -f from -t to – python ./bin/clean_sentence.py
-l list.txt

e$B$_$?$$$J46$8$GAv$i$;$F$^$9!#0l1~$N$;$F$*$-$^$9!#e(B

e$BG0$N$?$a!":#!"Be$o$j$Ke(Bgrep e$B$r;H$C$F<B9T$7$F$_$F$$$^$9!#e(B

e$B$=$&$$$($P!"A0$N%a!<%k$K=q$/$N$rK:$l$F$^$7$?$,!“e(Btop
e$B$GD/$a$F$$$k$H<B9T$7$?e(B
e$B;R%W%m%;%9e(B(Python)e$B$,$?$^$Ke(B defunct
e$B$K$J$C$F$^$7$?!#$”$H!“4X78$”$k$+$I$&$+e(B
e$BJ,$+$j$^$;$s$,!“F~NO!”=PNO$N%U%!%$%k$H$be(B NFS
e$B$G%^%&%s%H$5$l$?%U%!%$%k$G$9!#e(B

import sys
import fileinput

def sentences(fp):
sentence_id = None
source = None

for line in fp:
    if line.startswith('# FILE'): continue
    if line.startswith('# '):
        sentence_id = line[2:].rstrip()
    elif line.startswith('#SRC: '):
        source = line[5:].rstrip()
    elif len(line.strip()) > 0:
        yield sentence_id, source, line.rstrip()

def main(args, list_file):
duplicate_ids = read_id(list_file)
for sentence_id, source, tree in sentences(fileinput.input(args)):
if sentence_id not in duplicate_ids:
docid, para, sent = sentence_id.split(’-’)
print ‘# %s-%03d-%03d’ % (docid, int(para), int(sent))
print ‘#SRC: %s’ % source
print tree
print

def read_id(list_file):
fp = file(list_file)
ids = set()
for line in fp:
for id in line.rstrip().split(’\t’)[1:]:
ids.add(id)
fp.close()
return ids

if name == ‘main’:
import optparse
parser = optparse.OptionParser()
parser.add_option(’–list’, ‘-l’, dest=‘list_file’)

(options, args) = parser.parse_args()

if not options.list_file:
    parser.print_help()
    sys.exit(1)

main(args, options.list_file)

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev:30479] the message: “[ruby-dev:30479] Re: ThreadError on
shell.rb”, on Mar/04 16:21(JST)
“Akira ODA” writes:

e$BHxED$G$9!#e(B

e$B$$$(!">/$J$$%U%!%$%k?t$J$i%(%i!<$,5/$-$J$$$3$H$b$"$j$^$9!#e(B
2,000e$B%U%!%$%k0J>e=hM}$7$?$H$3$m$G$H$^$C$?$H;W$C$?$i!“e(B150e$B%U%!%$%k$[$Ie(B
e$B$G$H$^$k>l9g$b$”$k$h$&$G$9!#e(B

e$B%9%l%C%I$,Mm$`$N$G%?%$%_%s%0$,HyL/$J$s$G$9$h$M$'e(B…

commands(ARGV)e$B$KEO$9%3%^%s%I$O2?$G$7$g$&$+e(B?
e$B<+:n$Ne(BPython e$B%9%/%j%W%H$G$9e(B

e$B$A$g$C$H;n$;$=$&$b$J$$$G$9e(B. e$B$?$@e(B,
e$B$3$A$i$G$bF1$88=>]$,0lEY$@$1:F8=$G$-e(B
e$B$^$7$?e(B.

e$B$=$3$Ge(B, shell/process-controller.rb
e$B$N:G8e$NJ}$r0J2<$N$h$&$KJQ99$7$F;ne(B
e$B$7$F$$$?$@$1$J$$$G$7$g$&$+e(B?

Thread.exclusive do
  @job_monitor.synchronize do  # <-- e$B$3$3e(B
    terminate_job(command)
    @job_condition.signal
    command.notify "job(%id) finish.", @shell.debug?
  end                          # <-- e$B$3$3e(B
end

"e$B$3$3e(B"e$B$H$J$C$F$$$k$H$3$m$,JQ998D=j$G$9e(B.

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$BHxED$G$9!#e(B

On 3/6/07, e$B@PDM7=<ye(B [email protected] wrote:

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev:30484] the message: “[ruby-dev:30484] Re: ThreadError on shell.rb”, on Mar/05 03:53(JST)

e$B0l1~3NG’$G$9$,e(B, e$B>e5-8=>]$O=$@5A0$N$b$N$G$H$$$&$3$H$G$9$h$Me(B?

e$BJ,$+$j$K$/$$=q$-J}$G$9$_$^$;$s!#$=$&$G$9!#=$@5A0$N5sF0$G$9!#e(B

e$BHxED$G$9!#e(B

On 3/4/07, e$B@PDM7=<ye(B [email protected] wrote:

"e$B$3$3e(B"e$B$H$J$C$F$$$k$H$3$m$,JQ998D=j$G$9e(B.

e$B$=$N$H$*$j$KJQ99$7$F$_$k$H!“:G8e$^$GAv$j$^$7$?!#$”$j$,$H$&$4$6$$$^$9!#e(B

e$B$$$m$$$m;n$7$F$_$?$s$G$9$,!“$H$j$”$($:8=:_8+$i$l$k8=>]$H$7$F$Oe(B

  • e$B<B9T$9$k%3%^%s%I$,e(B grep e$B$G$bF1$8$/;_$^$ke(B
  • e$B=PNO@h$,%m!<%+%k$N%G%#%9%/$J$i:G8e$^$GAv$ke(B

e$B$H$$$&$H$3$m$G$7$g$&$+!#e(B

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev:30484] the message: “[ruby-dev:30484] Re: ThreadError on
shell.rb”, on Mar/05 03:53(JST)
“Akira ODA” writes:

e$BHxED$G$9!#e(B

e$B$=$N$H$*$j$KJQ99$7$F$_$k$H!":G8e$^$GAv$j$^$7$?!#$"$j$,$H$&$4$6$$$^$9!#e(B

e$B$$$m$$$m;n$7$F$_$?$s$G$9$,!"$H$j$"$($:8=:_8+$i$l$k8=>]$H$7$F$Oe(B

  • e$B<B9T$9$k%3%^%s%I$,e(B grep e$B$G$bF1$8$/;_$^$ke(B
  • e$B=PNO@h$,%m!<%+%k$N%G%#%9%/$J$i:G8e$^$GAv$ke(B

e$B$H$$$&$H$3$m$G$7$g$&$+!#e(B

e$B0l1~3NG’$G$9$,e(B, e$B>e5-8=>]$O=$@5A0$N$b$N$G$H$$$&$3$H$G$9$h$Me(B?

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev:30497] the message: “[ruby-dev:30497] Re: ThreadError on
shell.rb”, on Mar/06 14:48(JST)
“Akira ODA” writes:

e$BHxED$G$9!#e(B

e$B0l1~3NG’$G$9$,e(B, e$B>e5-8=>]$O=$@5A0$N$b$N$G$H$$$&$3$H$G$9$h$Me(B?
e$BJ,$+$j$K$/$$=q$-J}$G$9$_$^$;$s!#$=$&$G$9!#=$@5A0$N5sF0$G$9!#e(B

e$BN;2r$G$9e(B. e$B:#2s$N7o$Oe(B,
e$B$H$j$"$($:$3$N=$@5$G$J$*$C$?$H$$$&$3$H$Ge(B,
e$B$^$?e(B, e$B2?$+$"$j$^$7$?$iO"Mm2<$5$$e(B.

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—