archive 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03fd0b29dfe98ee0c8545cb831b85d56b62cf0f9
4
- data.tar.gz: 7063adf82e2d6338c486670d91a87176d5b28d70
3
+ metadata.gz: 8573b5dc0a8783ecd5519bef313fab1a86ce6920
4
+ data.tar.gz: 59a004ca0682e4601c730cd4a753b5a1e0bd33fa
5
5
  SHA512:
6
- metadata.gz: 180d415f4639a31f50e2f90320e7c3af03bd3bad1495420a234d80064358e9f1f4176ebd76d8508c73b5dd1c4d19757570bd66e498628cd37e9b6699494d399f
7
- data.tar.gz: 7d45612e9ee2e07b240a0c0b2008ff2ae7fd291fa7443c0f65a82fe2e716421ca366c4a5a367ca0b19b2fb188247277711460456a12500487dd93d82b68cacc4
6
+ metadata.gz: 9ac13f3f8b58920f3e99e4996634cfe3321610a8063e1aff7913f1c374a975f0c3659da773edfe522e1e16e540d435d5749d60c55abf7f537f9bedff8a724f84
7
+ data.tar.gz: 1efd78f10a7c0eba26889a04bc4b3fd40d5b573499a96c8e62d66f458b3380c368654e584f482f8ded6d3cdcd2e98a1d9cfaa2efa96bbb415e0c86052db4aa51
@@ -0,0 +1,6 @@
1
+ # 0.0.2 (05/02/2013)
2
+ * Better memory management; heap corruption issue that wasn't showing up in tests.
3
+ * Fixes for FreeBSD 9
4
+ * Ensure Archive.get_files is protected properly (injekt)
5
+ # 0.0.1 (04/26/2013)
6
+ * First release!
data/README.md CHANGED
@@ -67,6 +67,7 @@ We have verified that archive works as intended on these platforms:
67
67
 
68
68
  * Mac OS X 10.8
69
69
  * Ubuntu Linux 12.04 LTS
70
+ * FreeBSD 9
70
71
 
71
72
  And these Rubies:
72
73
 
@@ -74,10 +75,19 @@ And these Rubies:
74
75
  * 2.0.0
75
76
  * JRuby 1.7 with Java 7
76
77
 
78
+ It does not work on these platforms:
79
+
80
+ * SmartOS "base64 1.9.1". The version of libarchive they distribute via pkgsrc
81
+ is broken, see this URL:
82
+
83
+ http://freebsd.1045724.n5.nabble.com/Extracting-tgz-file-Attempt-to-write-to-an-empty-file-td3910927.html
84
+
85
+ Regardless, installing a newer libarchive by hand will likely fix this issue.
86
+
77
87
  Please let us know if your operating system isn't working! It'll likely
78
- complain about a call called `stat` which varies wildly on different POSIX
79
- systems. We just need to know what platform you're on and how we can install it
80
- ourselves to move forward. Thanks!
88
+ complain about a part of a structure in a syscall called `stat` which varies
89
+ wildly on different POSIX systems. We just need to know what platform you're on
90
+ and how we can install it ourselves to move forward. Thanks!
81
91
 
82
92
  ## Contributing
83
93
 
@@ -60,20 +60,24 @@ module Archive
60
60
  Archive::Compress.new(filename, args).compress(get_files(dir), true)
61
61
  end
62
62
 
63
- protected
63
+ class << self
64
64
 
65
- #
66
- # Finds the files for the dir passed to ::compress.
67
- #
68
- def self.get_files(dir)
69
- require 'find'
65
+ protected
66
+
67
+ #
68
+ # Finds the files for the dir passed to ::compress.
69
+ #
70
+ def get_files(dir)
71
+ require 'find'
72
+
73
+ files = []
70
74
 
71
- files = []
75
+ Find.find(dir) do |path|
76
+ files.push(path) if File.file?(path)
77
+ end
72
78
 
73
- Find.find(dir) do |path|
74
- files.push(path) if File.file?(path)
79
+ return files
75
80
  end
76
81
 
77
- return files
78
82
  end
79
83
  end
@@ -93,8 +93,8 @@ module Archive # :nodoc:
93
93
  def unpack_loop # :nodoc:
94
94
  loop do
95
95
  buffer = FFI::MemoryPointer.new :pointer, 1
96
- size = FFI::MemoryPointer.new :size_t
97
- offset = FFI::MemoryPointer.new :long_long
96
+ size = FFI::MemoryPointer.new :ulong_long, 1
97
+ offset = FFI::MemoryPointer.new :long_long, 1
98
98
 
99
99
  result = LibArchive.archive_read_data_block(@in, buffer, size, offset)
100
100
 
@@ -104,7 +104,7 @@ module Archive # :nodoc:
104
104
  raise LibArchive.archive_error_string(@in)
105
105
  end
106
106
 
107
- result = LibArchive.archive_write_data_block(@out, buffer.get_pointer(0), size.read_ulong_long, offset.read_long_long);
107
+ result = LibArchive.archive_write_data_block(@out, buffer.read_pointer, size.read_ulong_long, offset.read_long_long);
108
108
 
109
109
  if result != LibArchive::ARCHIVE_OK
110
110
  raise LibArchive.archive_error_string(@out)
@@ -33,6 +33,27 @@ module Archive # :nodoc:
33
33
  :st_lspare, :long,
34
34
  :st_qspare, :long_long
35
35
  )
36
+ elsif ::FFI::Platform.bsd?
37
+ layout(
38
+ :st_dev, :dev_t,
39
+ :st_ino, :ino_t,
40
+ :st_mode, :mode_t,
41
+ :st_nlink, :nlink_t,
42
+ :st_uid, :uid_t,
43
+ :st_gid, :gid_t,
44
+ :st_rdev, :dev_t,
45
+ :st_atimespec, Timespec,
46
+ :st_mtimespec, Timespec,
47
+ :st_ctimespec, Timespec,
48
+ :st_size, :off_t,
49
+ :st_blocks, :long_long,
50
+ :st_blksize, :ulong_long,
51
+ :st_flags, :ulong,
52
+ :st_gen, :ulong,
53
+ :st_lspare, :long,
54
+ :st_birthtimespec, Timespec,
55
+ :st_qspare, :long_long
56
+ )
36
57
  else
37
58
  layout(
38
59
  :st_dev, :dev_t,
@@ -46,7 +67,7 @@ module Archive # :nodoc:
46
67
  :st_mtimespec, Timespec,
47
68
  :st_ctimespec, Timespec,
48
69
  :st_size, :off_t,
49
- :st_blocks, :quad_t,
70
+ :st_blocks, :blkcnt_t,
50
71
  :st_blksize, :ulong,
51
72
  :st_flags, :ulong,
52
73
  :st_gen, :ulong
@@ -1,3 +1,3 @@
1
1
  module Archive
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Hollensbe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-26 00:00:00.000000000 Z
11
+ date: 2013-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -144,6 +144,7 @@ extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
146
  - .gitignore
147
+ - CHANGELOG.md
147
148
  - Gemfile
148
149
  - Guardfile
149
150
  - LICENSE.txt
@@ -155,7 +156,6 @@ files:
155
156
  - lib/archive/extract.rb
156
157
  - lib/archive/libarchive.rb
157
158
  - lib/archive/version.rb
158
- - test.rb
159
159
  homepage: https://github.com/erikh/archive
160
160
  licenses:
161
161
  - MIT
data/test.rb DELETED
@@ -1,4 +0,0 @@
1
- require 'archive'
2
-
3
- Dir.chdir("test/data")
4
- Archive.compress_and_print("test.tar.gz", "libarchive")