some fixes

This commit is contained in:
Ward Wouts 2025-01-09 07:45:12 +01:00
parent 8c20f8435f
commit cb321d68ed
3 changed files with 35 additions and 31 deletions

View file

@ -50,20 +50,20 @@ def aprofile_mem(group)
groups = {}
ObjectSpace.each_object { |x|
if not [Array,Hash].include? x.class
e = nil
begin
e = MEntry.new( x.class, Marshal::dump(x).size )
rescue TypeError # undumpable
e = MEntry.new( x.class, 0 )
e = nil
begin
e = MEntry.new( x.class, Marshal::dump(x).size )
rescue TypeError # undumpable
e = MEntry.new( x.class, 0 )
end
if groups.has_key? e.c
groups[e.c].mem += e.mem
groups[e.c].total += 1
else
groups[e.c] = GroupEntry.new( e.c, e.mem, 1 )
end
end
if groups.has_key? e.c
groups[e.c].mem += e.mem
groups[e.c].total += 1
else
groups[e.c] = GroupEntry.new( e.c, e.mem, 1 )
end
end
}
}
File.open( "mem_log", "a+" ) { |file|
file << "Group #{group}\n"
total = 0
@ -547,11 +547,17 @@ def get_multi(subj, group)
# puts "inside thread post pass\n"
if UUEncode.is_uuencoded(tbody)
puts " UUDecoding..."
if tfile
tmode, tfilename, tbody = UUEncode.uudecode(tfile, tfileout)
else
tmode, tfilename, tbody = UUEncode.uudecode(tbody)
end
begin
if tfile
tmode, tfilename, tbody = UUEncode.uudecode(tfile, tfileout)
else
tmode, tfilename, tbody = UUEncode.uudecode(tbody)
end
rescue Encoding::UndefinedConversionError
puts "#{$!}"
puts " Skipping article..."
Thread.current.exit
end
elsif YEnc.is_yencoded(tbody)
puts " YDecoding..."
begin
@ -683,7 +689,7 @@ def get_max_file_length(tempdir=".")
name = "a"*500
name = "#$$#{name}"
begin
file = File.new("#{tempdir}/#{name}", "w", 0644).close
File.new("#{tempdir}/#{name}", "w", 0644).close
FileUtils.rm("#{tempdir}/#{name}")
rescue Errno::ENAMETOOLONG
name = name[0...-1]