Make archive-tar-minitar tests pass #9

Closed
halostatue opened this Issue Jul 31, 2011 · 5 comments

Comments

Projects
None yet
2 participants
@halostatue
Owner

halostatue commented Jul 31, 2011

Matthew Kent (http://rubyforge.org/users/mattkent)

Doing some testing on Fedora 12 with archive-tar-minitar and noted a few issues running the test suite. I'm guessing
it was developed on a Windows machine? I believe this may have led to some issues with the permission related tests.

I'm enclosing my proposed changes that work on Fedora 12, untested on Windows.

--- tests/tc_tar.rb.orig    2009-10-26 22:34:53.054062448 -0700
+++ tests/tc_tar.rb 2009-10-26 22:36:49.222080730 -0700
@@ -463,20 +463,22 @@
   include TarTester

   require 'rbconfig'
+  require 'time'

-  TEST_TGZ = "\037\213\010\000\001B1A\000\vKI,I\324+I,\322K\257b\240\0250\000\002sSS\254\342 `dj\306``nnnbndbjd\000\0247336`P0\240\231\213\220@i1\320\367@+\351a\327 \004\362\335\034\f\313\034\r\035\031\270\337Ns\344b2\344q\335\375M\304\266QM1W\357\321>\221U\021\005\246\306\367\356\367u3\262;\212\004\265\236\\\334}\351,\377\037;\217\223\301e\247\030\024\\\236\211\277\347\346sii\265\010\330\355\234\240\362\274\371[\202\361\366\302S\316\335o&~m\237r\355\377\303\230\365\352WNW\334\266_\373\273\237\347Q\315t?\263{\377?\006\271\337?\367\207\325\346]\371\376y\307_\234~d\3772\265\346\261}\323\317\373\315\352\377O\376\271/\305\377?X\253\324\303S\373\361\347\277\372^)\267\377\363\03460\331\311\\wW|\031\203\300@\207\325p\004i\2319\251\3064\266\203P\376702B\313\377\246\246\006&\243\371\237\036 $#\263X\001\210@\351@\301XO\201\227k\240]4\nF\301(\030\005\243\200\036\000\000\004\330t\023\000\f\000\000"
-  FILETIMES = Time.mktime(2004).to_i
+  # generated with tar 1.22 via tar --format=ustar -czvf
+  TEST_TGZ = "\037\213\b\000u\000\344J\000\003KI,I\324+I,\322K\257b\240\0250\000\002sSS\020mhnj\200L\203\201\261\2419\203\201\271\271\271\211\271\221\211\251\021P\334\320\330\304\324\214A\301\200f.B\002\245\305@\337\003\235\222\233\235\232W\202G\035!y\250_\340\364\020\001\362\335\034\f\321\fO\274\030\230\337^\273\317\325d r\374c\354w\221\352\246\242\342b\375K\177\005L&\375\213\231\261\267~\366\224\220\200D\003\345?u\002}\v6<\356\263\217\b-{\352\265d*\353\271[\021S7\337\254\335+8\263\370\234E\356\032\276\357^\317\255\304/\251\275[]nW\232*\035e\371\346U\362\367g{\375\317\267\363\357\274f\037x\364g\376\254\332\265\227\326\n~_l\360\354\353\237\257\237\377\034\376\301\255\250~\363\310\314\363\365{s\375\214b>\212O\310\332\371\243\324~\306\265\t\365s\363z\327\177z\177\342\277\210\334\247\365'\377\337\371\362\363\373\276\254\250\367\301s\231\217\317\377\377\351P\344\271z\204\037\f\216\261\n\356\316\351c\320\030\270`\034\262 -3'\325\230\306v\020\312\377\006FFh\371\337\310\330\330d4\377\323\003\204dd\026+\000\021(\035(\030\353)\360r\r\264\213F\301(\030\005\243`\024\214\202Q0\nF\301(\030\005\243`\024\214\202Q0\nF\301(\030\005\243`\024\214\202Q0\nF\301(\030\005\243`\024\214\202Q0\nF\001)\000\000\277\313\321J\000(\000\000"
+  FILETIMES = Time.parse('Thu Jan 01 00:00:00 EST 2004').to_i

   TEST_CONTENTS = [
-    [ "data.tar.gz", 174, 0755 ],
+    [ "data.tar.gz", 207, 0755 ],
     [ "file3",        18, 0755 ],
   ]

   TEST_DATA_CONTENTS = [
-    [ "data",          0, 040755 ],
-    [ "data/file1",   16, 010644 ],
-    [ "data/file2",   16, 010644 ],
-    [ "data/__dir__",  0, 010644 ],
+    [ "data/",         0, 0755,  040755 ], # both tar and unix permissions
+    [ "data/file1",   16, 0644, 0100644 ],
+    [ "data/file2",   16, 0644, 0100644 ],
+    [ "data/__dir__/", 0, 0755,  040755 ],
   ]

   def setup
@@ -550,7 +552,7 @@
                 assert(File.file?(name2))
                 assert_equal(TEST_DATA_CONTENTS[jj][1], File.stat(name2).size, name2)
               end
-              assert_equal(TEST_DATA_CONTENTS[jj][2], File.stat(name2).mode, name2) unless RUBY_PLATFORM =~ /win32/
+              assert_equal(TEST_DATA_CONTENTS[jj][3], File.stat(name2).mode, name2) unless RUBY_PLATFORM =~ /win32/
             end
           end
         ensure
@djberg96

This comment has been minimized.

Show comment
Hide comment
@djberg96

djberg96 Apr 16, 2012

Not sure if this is the right place to put this, but I see a bunch of failures on Windows 7 with Ruby 1.9.x:

c:\Users\djberge\Repositories\minitar>rake test
rake/gempackagetask is deprecated.  Use rubygems/package_task instead
Loaded suite Unnamed TestSuite
Started
.F
===============================================================================
Failure: <16877> expected but was
<4516>.
test_each_works(TC_Tar__Input)
tests/tc_tar.rb:509:in `block (4 levels) in test_each_works'
     506:               assert_kind_of(Reader::EntryStream, entry2)
     507:               assert_equal(TEST_DATA_CONTENTS[jj][0], entry2.name)
     508:               assert_equal(TEST_DATA_CONTENTS[jj][1], entry2.size)
  => 509:               assert_equal(TEST_DATA_CONTENTS[jj][2], entry2.mode)
     510:               assert_equal(FILETIMES, entry2.mtime)
     511:             end
     512:             assert_equal(3, jj)
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `block in each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:614:in `block in each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `loop'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:587:in `each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `each'
tests/tc_tar.rb:505:in `each_with_index'
tests/tc_tar.rb:505:in `block (3 levels) in test_each_works'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:503:in `block (2 levels) in test_each_works'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `block in each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:614:in `block in each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `loop'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:587:in `each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `each'
tests/tc_tar.rb:494:in `each_with_index'
tests/tc_tar.rb:494:in `block in test_each_works'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:492:in `test_each_works'
===============================================================================
F
===============================================================================
Failure: <1> expected but was
<0>.
test_extract_entry_works(TC_Tar__Input)
tests/tc_tar.rb:561:in `block in test_extract_entry_works'
     558:         end
     559:         end
     560:       end
  => 561:       assert_equal(1, ii)
     562:     end
     563:   end
     564: end
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:522:in `test_extract_entry_works'
===============================================================================
E
===============================================================================
Error: test_eof_works(TC_Tar__Reader)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:420:in `test_eof_works'
===============================================================================
E
===============================================================================
Error: test_multiple_entries(TC_Tar__Reader)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:319:in `test_multiple_entries'
===============================================================================
E
===============================================================================
Error: test_read_works(TC_Tar__Reader)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:386:in `test_read_works'
===============================================================================
E
===============================================================================
Error: test_rewind_entry_works(TC_Tar__Reader)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:352:in `test_rewind_entry_works'
===============================================================================
E
===============================================================================
Error: test_rewind_works(TC_Tar__Reader)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:368:in `test_rewind_works'
===============================================================================
E
===============================================================================
Error: test_add_file(TC_Tar__Writer)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:245:in `test_add_file'
===============================================================================
E
===============================================================================
Error: test_add_file_simple(TC_Tar__Writer)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:183:in `test_add_file_simple'
===============================================================================
.E
===============================================================================
Error: test_file_name_is_split_correctly(TC_Tar__Writer)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:212:in `block in test_file_name_is_split_correctly'
tests/tc_tar.rb:211:in `each'
tests/tc_tar.rb:211:in `each_with_index'
tests/tc_tar.rb:211:in `test_file_name_is_split_correctly'
===============================================================================
..E
===============================================================================
Error: test_write_header(TC_Tar__Writer)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:274:in `test_write_header'
===============================================================================
..E
===============================================================================
Error: test_basic_headers(TC_Tar__Header)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:103:in `test_basic_headers'
===============================================================================
E
===============================================================================
Error: test_long_name_works(TC_Tar__Header)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:112:in `test_long_name_works'
===============================================================================
E
===============================================================================
Error: test_new_from_stream(TC_Tar__Header)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:120:in `test_new_from_stream'
===============================================================================
E
===============================================================================
Error: test_new_from_stream_with_evil_name(TC_Tar__Header)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:132:in `test_new_from_stream_with_evil_name'
===============================================================================


Finished in 0.312415 seconds.

21 tests, 35 assertions, 2 failures, 13 errors, 0 pendings, 0 omissions, 0 notifications
28.5714% passed

67.22 tests/s, 112.03 assertions/s

Not sure if this is the right place to put this, but I see a bunch of failures on Windows 7 with Ruby 1.9.x:

c:\Users\djberge\Repositories\minitar>rake test
rake/gempackagetask is deprecated.  Use rubygems/package_task instead
Loaded suite Unnamed TestSuite
Started
.F
===============================================================================
Failure: <16877> expected but was
<4516>.
test_each_works(TC_Tar__Input)
tests/tc_tar.rb:509:in `block (4 levels) in test_each_works'
     506:               assert_kind_of(Reader::EntryStream, entry2)
     507:               assert_equal(TEST_DATA_CONTENTS[jj][0], entry2.name)
     508:               assert_equal(TEST_DATA_CONTENTS[jj][1], entry2.size)
  => 509:               assert_equal(TEST_DATA_CONTENTS[jj][2], entry2.mode)
     510:               assert_equal(FILETIMES, entry2.mtime)
     511:             end
     512:             assert_equal(3, jj)
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `block in each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:614:in `block in each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `loop'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:587:in `each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `each'
tests/tc_tar.rb:505:in `each_with_index'
tests/tc_tar.rb:505:in `block (3 levels) in test_each_works'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:503:in `block (2 levels) in test_each_works'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `block in each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:614:in `block in each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `loop'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:587:in `each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `each'
tests/tc_tar.rb:494:in `each_with_index'
tests/tc_tar.rb:494:in `block in test_each_works'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:492:in `test_each_works'
===============================================================================
F
===============================================================================
Failure: <1> expected but was
<0>.
test_extract_entry_works(TC_Tar__Input)
tests/tc_tar.rb:561:in `block in test_extract_entry_works'
     558:         end
     559:         end
     560:       end
  => 561:       assert_equal(1, ii)
     562:     end
     563:   end
     564: end
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:522:in `test_extract_entry_works'
===============================================================================
E
===============================================================================
Error: test_eof_works(TC_Tar__Reader)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:420:in `test_eof_works'
===============================================================================
E
===============================================================================
Error: test_multiple_entries(TC_Tar__Reader)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:319:in `test_multiple_entries'
===============================================================================
E
===============================================================================
Error: test_read_works(TC_Tar__Reader)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:386:in `test_read_works'
===============================================================================
E
===============================================================================
Error: test_rewind_entry_works(TC_Tar__Reader)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:352:in `test_rewind_entry_works'
===============================================================================
E
===============================================================================
Error: test_rewind_works(TC_Tar__Reader)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:368:in `test_rewind_works'
===============================================================================
E
===============================================================================
Error: test_add_file(TC_Tar__Writer)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:245:in `test_add_file'
===============================================================================
E
===============================================================================
Error: test_add_file_simple(TC_Tar__Writer)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:183:in `test_add_file_simple'
===============================================================================
.E
===============================================================================
Error: test_file_name_is_split_correctly(TC_Tar__Writer)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:212:in `block in test_file_name_is_split_correctly'
tests/tc_tar.rb:211:in `each'
tests/tc_tar.rb:211:in `each_with_index'
tests/tc_tar.rb:211:in `test_file_name_is_split_correctly'
===============================================================================
..E
===============================================================================
Error: test_write_header(TC_Tar__Writer)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:274:in `test_write_header'
===============================================================================
..E
===============================================================================
Error: test_basic_headers(TC_Tar__Header)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:103:in `test_basic_headers'
===============================================================================
E
===============================================================================
Error: test_long_name_works(TC_Tar__Header)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:112:in `test_long_name_works'
===============================================================================
E
===============================================================================
Error: test_new_from_stream(TC_Tar__Header)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:120:in `test_new_from_stream'
===============================================================================
E
===============================================================================
Error: test_new_from_stream_with_evil_name(TC_Tar__Header)
TypeError: can't convert String into Integer
tests/tc_tar.rb:53:in `pack'
     50:            ASCIIZ("", 32), Z(to_oct(nil, 7)), Z(to_oct(nil, 7)),
     51:            ASCIIZ(dname, 155) ]
     52:     arr = arr.join("").split(//).map{ |x| x[0] }
  => 53:     h = arr.pack("C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155")
     54:     ret = h + "\0" * (512 - h.size)
     55:     assert_equal(512, ret.size)
     56:     ret
tests/tc_tar.rb:53:in `header'
tests/tc_tar.rb:34:in `tar_file_header'
tests/tc_tar.rb:132:in `test_new_from_stream_with_evil_name'
===============================================================================


Finished in 0.312415 seconds.

21 tests, 35 assertions, 2 failures, 13 errors, 0 pendings, 0 omissions, 0 notifications
28.5714% passed

67.22 tests/s, 112.03 assertions/s
@halostatue

This comment has been minimized.

Show comment
Hide comment
@halostatue

halostatue Apr 17, 2012

Owner

This sounds like the right place. I haven't looked at this to see if the proposed patches fix the problem.

Owner

halostatue commented Apr 17, 2012

This sounds like the right place. I haven't looked at this to see if the proposed patches fix the problem.

@djberg96

This comment has been minimized.

Show comment
Hide comment
@djberg96

djberg96 Apr 17, 2012

Actually, the main problem there is a 1.8 vs 1.9 issue:

-    arr = arr.join("").split(//).map{ |x| x[0] }
+    if RUBY_VERSION.to_f >= 1.9
+      arr = arr.join("").split(//).map{ |x| x[0].ord }
+    else
+      arr = arr.join("").split(//).map{ |x| x[0] }
+    end

With that change in place it's down to 2 failures on Windows (with your diff above applied):

c:\Users\djberge\Repositories\minitar\tests>rake
(in c:/Users/djberge/Repositories/minitar)
rake/gempackagetask is deprecated.  Use rubygems/package_task instead
Loaded suite Unnamed TestSuite
Started
F
===============================================================================
Failure: 3 expected but was 0.
test_each_works(TC_Tar__Input)
tests/tc_tar.rb:515:in `block (3 levels) in test_each_works'
     512:               assert_equal(TEST_DATA_CONTENTS[jj][2], entry2.mode)
     513:               assert_equal(FILETIMES, entry2.mtime)
     514:             end
  => 515:             assert_equal(3, jj)
     516:           end
     517:         end
     518:       end
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:506:in `block (2 levels) in test_each_works'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `block in each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:614:in `block in each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `loop'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:587:in `each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `each'
tests/tc_tar.rb:497:in `each_with_index'
tests/tc_tar.rb:497:in `block in test_each_works'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:495:in `test_each_works'
===============================================================================
F
===============================================================================
Failure: 1 expected but was 0.
test_extract_entry_works(TC_Tar__Input)
tests/tc_tar.rb:564:in `block in test_extract_entry_works'
     561:         end
     562:         end
     563:       end
  => 564:       assert_equal(1, ii)
     565:     end
     566:   end
     567: end
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:525:in `test_extract_entry_works'
===============================================================================
...................

Finished in 0.333019 seconds.

21 tests, 369 assertions, 2 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
90.4762% passed

Actually, the main problem there is a 1.8 vs 1.9 issue:

-    arr = arr.join("").split(//).map{ |x| x[0] }
+    if RUBY_VERSION.to_f >= 1.9
+      arr = arr.join("").split(//).map{ |x| x[0].ord }
+    else
+      arr = arr.join("").split(//).map{ |x| x[0] }
+    end

With that change in place it's down to 2 failures on Windows (with your diff above applied):

c:\Users\djberge\Repositories\minitar\tests>rake
(in c:/Users/djberge/Repositories/minitar)
rake/gempackagetask is deprecated.  Use rubygems/package_task instead
Loaded suite Unnamed TestSuite
Started
F
===============================================================================
Failure: 3 expected but was 0.
test_each_works(TC_Tar__Input)
tests/tc_tar.rb:515:in `block (3 levels) in test_each_works'
     512:               assert_equal(TEST_DATA_CONTENTS[jj][2], entry2.mode)
     513:               assert_equal(FILETIMES, entry2.mtime)
     514:             end
  => 515:             assert_equal(3, jj)
     516:           end
     517:         end
     518:       end
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:506:in `block (2 levels) in test_each_works'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `block in each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:614:in `block in each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `loop'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:605:in `each_entry'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:587:in `each'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:679:in `each'
tests/tc_tar.rb:497:in `each_with_index'
tests/tc_tar.rb:497:in `block in test_each_works'
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:495:in `test_each_works'
===============================================================================
F
===============================================================================
Failure: 1 expected but was 0.
test_extract_entry_works(TC_Tar__Input)
tests/tc_tar.rb:564:in `block in test_extract_entry_works'
     561:         end
     562:         end
     563:       end
  => 564:       assert_equal(1, ii)
     565:     end
     566:   end
     567: end
c:/Users/djberge/Repositories/minitar/lib/archive/tar/minitar.rb:655:in `open'
tests/tc_tar.rb:525:in `test_extract_entry_works'
===============================================================================
...................

Finished in 0.333019 seconds.

21 tests, 369 assertions, 2 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
90.4762% passed
@halostatue

This comment has been minimized.

Show comment
Hide comment
@halostatue

halostatue Apr 25, 2012

Owner

I hope to look at this issue this summer; I don't foresee being able to do it before then because of other commitments. A pull request with both items patched I can probably apply fairly quickly, but I can't really investigate the issue at this point.

Owner

halostatue commented Apr 25, 2012

I hope to look at this issue this summer; I don't foresee being able to do it before then because of other commitments. A pull request with both items patched I can probably apply fairly quickly, but I can't really investigate the issue at this point.

@halostatue

This comment has been minimized.

Show comment
Hide comment
@halostatue

halostatue Dec 21, 2014

Owner

I believe that all of these are fixed with a01d113.

Owner

halostatue commented Dec 21, 2014

I believe that all of these are fixed with a01d113.

@halostatue halostatue closed this Dec 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment