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

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

On Apr 22, 2008, at 20:50 PM, denmat wrote:

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|

           elsif FileTest.directory?(files)

ensure
gzip.finish # same result with gzip.close

And remove this.

On Apr 23, 2:57 pm, Eric H. [email protected] wrote:

out = Archive::Tar::Minitar::Output.new(gzip)
directory: #{files}" }
And remove this.
(* 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

thank you that works.