Zlib::GzipWriter - same code - different OS - different result.

D

denmat

Hi List,

I have ruby-1.8.6.114-1.fc7 and archive-tar-minitar (0.5.2).

If I run this script on windowsXP (ruby1.8.6.26 archive-tar-minitar
(0.5.2)) it completes without a problem
def tar_and_gzip(destination, paths)
Zlib::GzipWriter.new(File.open(destination, 'wb')) do |gzip|
begin
out = Archive::Tar::Minitar::Output.new(gzip)
paths.each do |f|
Find.find(f) do |files|
if FileTest.file?(files)
Minitar.pack_file(files, out)
$logger.info('tar_and_gzip') { "Packing file:
#{files}" }
Find.prune
elsif FileTest.directory?(files)
Minitar.pack_file(files, out)
$logger.info('tar_and_gzip') { "Packing
directory: #{files}" }
else
$logger.info('tar_and_gzip') { "Finished packing
files." }
Find.prune
end
end
end
ensure
gzip.finish # same result with gzip.close
end
end
end


destination = '../buildspace'
tar_me = [ "control", "postinst", "md5sum" ]

tar_and_gzip("#{destination}/control.tar.gz", tar_me )

(* only changes to above script on the different boxes is the file
paths)
Yet the same script on my linux box produces:
zlib(finalizer): Zlib::GzipWriter object must be closed explicitly.
zlib(finalizer): the stream was freed prematurely.
zlib(finalizer): Zlib::GzipWriter object must be closed explicitly.
zlib(finalizer): the stream was freed prematurely.

Anyone seen this before or should I submit as a bug?

denmat
 
E

Eric Hodel

Hi List,

I have ruby-1.8.6.114-1.fc7 and archive-tar-minitar (0.5.2).

If I run this script on windowsXP (ruby1.8.6.26 archive-tar-minitar
(0.5.2)) it completes without a problem
def tar_and_gzip(destination, paths)
Zlib::GzipWriter.new(File.open(destination, 'wb')) do |gzip|

Try:

open destination, 'wb' do |io|
Zlib::GzipWriter.wrap io do |gzip|
begin
out = Archive::Tar::Minitar::Output.new(gzip)
paths.each do |f|
Find.find(f) do |files|
if FileTest.file?(files)
Minitar.pack_file(files, out)
$logger.info('tar_and_gzip') { "Packing file:
#{files}" }
Find.prune
elsif FileTest.directory?(files)
Minitar.pack_file(files, out)
$logger.info('tar_and_gzip') { "Packing
directory: #{files}" }
else
$logger.info('tar_and_gzip') { "Finished packing
files." }
Find.prune
end
end
end
ensure
gzip.finish # same result with gzip.close

And remove this.
end
end
end


destination = '../buildspace'
tar_me = [ "control", "postinst", "md5sum" ]

tar_and_gzip("#{destination}/control.tar.gz", tar_me )

(* only changes to above script on the different boxes is the file
paths)
Yet the same script on my linux box produces:
zlib(finalizer): Zlib::GzipWriter object must be closed explicitly.
zlib(finalizer): the stream was freed prematurely.
zlib(finalizer): Zlib::GzipWriter object must be closed explicitly.
zlib(finalizer): the stream was freed prematurely.

Anyone seen this before or should I submit as a bug?

denmat
 
D

denmat

I have ruby-1.8.6.114-1.fc7 and archive-tar-minitar (0.5.2).
If I run this script on windowsXP (ruby1.8.6.26 archive-tar-minitar
(0.5.2)) it completes without a problem
def tar_and_gzip(destination, paths)
Zlib::GzipWriter.new(File.open(destination, 'wb')) do |gzip|

Try:

open destination, 'wb' do |io|
Zlib::GzipWriter.wrap io do |gzip|




begin
out = Archive::Tar::Minitar::Output.new(gzip)
paths.each do |f|
Find.find(f) do |files|
if FileTest.file?(files)
Minitar.pack_file(files, out)
$logger.info('tar_and_gzip') { "Packing file:
#{files}" }
Find.prune
elsif FileTest.directory?(files)
Minitar.pack_file(files, out)
$logger.info('tar_and_gzip') { "Packing
directory: #{files}" }
else
$logger.info('tar_and_gzip') { "Finished packing
files." }
Find.prune
end
end
end
ensure
gzip.finish # same result with gzip.close

And remove this.
end
end
end
destination = '../buildspace'
tar_me = [ "control", "postinst", "md5sum" ]
tar_and_gzip("#{destination}/control.tar.gz", tar_me )
(* only changes to above script on the different boxes is the file
paths)
Yet the same script on my linux box produces:
zlib(finalizer): Zlib::GzipWriter object must be closed explicitly.
zlib(finalizer): the stream was freed prematurely.
zlib(finalizer): Zlib::GzipWriter object must be closed explicitly.
zlib(finalizer): the stream was freed prematurely.
Anyone seen this before or should I submit as a bug?

thank you that works.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top