minitar 0.12.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Code-of-Conduct.md +105 -51
- data/History.md +62 -51
- data/Licence.md +2 -2
- data/Manifest.txt +7 -8
- data/README.rdoc +1 -1
- data/Rakefile +3 -33
- data/lib/{archive/tar/minitar → minitar}/input.rb +24 -28
- data/lib/{archive/tar/minitar → minitar}/output.rb +10 -12
- data/lib/minitar/posix_header.rb +267 -0
- data/lib/{archive/tar/minitar → minitar}/reader.rb +18 -23
- data/lib/{archive/tar/minitar → minitar}/writer.rb +43 -49
- data/lib/minitar.rb +297 -9
- data/test/minitest_helper.rb +0 -2
- data/test/support/tar_test_helpers.rb +7 -8
- data/test/test_issue_46.rb +49 -0
- data/test/test_minitar.rb +60 -0
- data/test/test_tar_header.rb +34 -36
- data/test/test_tar_input.rb +55 -55
- data/test/test_tar_output.rb +3 -3
- data/test/test_tar_reader.rb +54 -56
- data/test/test_tar_writer.rb +37 -41
- metadata +40 -15
- data/lib/archive/tar/minitar/posix_header.rb +0 -278
- data/lib/archive/tar/minitar.rb +0 -311
- data/lib/archive-tar-minitar.rb +0 -3
- data/support/hoe/deprecated_gem.rb +0 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f9377a70924a7e6954296abbfea87d0df96fbbe3ddcef584432d841dd1f0f74
|
4
|
+
data.tar.gz: 9b81684df72a10837ccbd1656bcf0949093f6655f6407167e642c2deffa70528
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5affea92e847be657d518f28b82963c8117d7a0b099ced14ee70f789218b05cf74136ca7449e1df7afbf64d7da8cc43e8bdbe9aa3d88cb3aec2f703a51643778
|
7
|
+
data.tar.gz: cbba7e39c5ef44151046c4cecf3c07b39c1c5140a35311bd71a62305e945c3810cf24443cc23fa9880c7f58549cec63b963d89017f112bf297ca02be4fc1d5a0
|
data/Code-of-Conduct.md
CHANGED
@@ -2,73 +2,127 @@
|
|
2
2
|
|
3
3
|
## Our Pledge
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
nationality, personal appearance, race, religion, or sexual
|
10
|
-
orientation.
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
22
14
|
|
23
|
-
|
15
|
+
## Our Standards
|
24
16
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
- Demonstrating empathy and kindness toward other people
|
21
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
- Giving and gracefully accepting constructive feedback
|
23
|
+
- Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
- Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
- The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
- Public or private harassment
|
34
|
+
- Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
32
37
|
professional setting
|
33
38
|
|
34
|
-
##
|
39
|
+
## Enforcement Responsibilities
|
35
40
|
|
36
|
-
|
37
|
-
behavior and
|
38
|
-
response to any
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
39
45
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
threatening, offensive, or harmful.
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
45
50
|
|
46
51
|
## Scope
|
47
52
|
|
48
|
-
This Code of Conduct applies
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
representative at an online or offline event.
|
53
|
-
further defined and clarified by project maintainers.
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
54
58
|
|
55
59
|
## Enforcement
|
56
60
|
|
57
61
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported
|
59
|
-
complaints will be reviewed and investigated and
|
60
|
-
|
61
|
-
|
62
|
-
|
62
|
+
reported to the community leaders responsible for enforcement at [INSERT CONTACT
|
63
|
+
METHOD]. All complaints will be reviewed and investigated promptly and fairly.
|
64
|
+
|
65
|
+
All community leaders are obligated to respect the privacy and security of the
|
66
|
+
reporter of any incident.
|
67
|
+
|
68
|
+
## Enforcement Guidelines
|
69
|
+
|
70
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
71
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
72
|
+
|
73
|
+
### 1. Correction
|
74
|
+
|
75
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
76
|
+
unprofessional or unwelcome in the community.
|
77
|
+
|
78
|
+
**Consequence**: A private, written warning from community leaders, providing
|
79
|
+
clarity around the nature of the violation and an explanation of why the
|
80
|
+
behavior was inappropriate. A public apology may be requested.
|
63
81
|
|
64
|
-
|
65
|
-
|
66
|
-
|
82
|
+
### 2. Warning
|
83
|
+
|
84
|
+
**Community Impact**: A violation through a single incident or series of
|
85
|
+
actions.
|
86
|
+
|
87
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
88
|
+
interaction with the people involved, including unsolicited interaction with
|
89
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
90
|
+
includes avoiding interactions in community spaces as well as external channels
|
91
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
92
|
+
ban.
|
93
|
+
|
94
|
+
### 3. Temporary Ban
|
95
|
+
|
96
|
+
**Community Impact**: A serious violation of community standards, including
|
97
|
+
sustained inappropriate behavior.
|
98
|
+
|
99
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
100
|
+
communication with the community for a specified period of time. No public or
|
101
|
+
private interaction with the people involved, including unsolicited interaction
|
102
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
103
|
+
Violating these terms may lead to a permanent ban.
|
104
|
+
|
105
|
+
### 4. Permanent Ban
|
106
|
+
|
107
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
108
|
+
standards, including sustained inappropriate behavior, harassment of an
|
109
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
110
|
+
|
111
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
112
|
+
community.
|
67
113
|
|
68
114
|
## Attribution
|
69
115
|
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
71
|
-
available at
|
116
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
117
|
+
version 2.1, available at
|
118
|
+
<https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
|
119
|
+
|
120
|
+
Community Impact Guidelines were inspired by
|
121
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
122
|
+
|
123
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
124
|
+
<https://www.contributor-covenant.org/faq>. Translations are available at
|
125
|
+
<https://www.contributor-covenant.org/translations>.
|
72
126
|
|
73
|
-
[homepage]:
|
74
|
-
[
|
127
|
+
[homepage]: https://www.contributor-covenant.org
|
128
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
data/History.md
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
# History
|
2
2
|
|
3
|
-
## 0.
|
3
|
+
## 1.0.0 / 2024-08-07
|
4
4
|
|
5
|
-
-
|
6
|
-
|
5
|
+
- Breaking Changes:
|
6
|
+
|
7
|
+
- Minimum Ruby version is 3.1.
|
8
|
+
|
9
|
+
- The `Archive::Tar::Minitar` namespace has been completely removed and
|
10
|
+
`Minitar` is a class instead of a module.
|
11
|
+
|
12
|
+
- Enhancements:
|
13
|
+
|
14
|
+
- Added `Minitar.pack_as_file`, originally proposed by John Prince back in
|
15
|
+
2011 [#7][#7].
|
7
16
|
|
8
17
|
## 0.12 / 2024-08-06
|
9
18
|
|
@@ -17,7 +26,7 @@
|
|
17
26
|
- symlink support is complete. Merged as PR [#42][#42], rebased and built on top
|
18
27
|
of PR [#12][#12] by fetep.
|
19
28
|
|
20
|
-
- kymmt90 fixed a documentation error on Minitar.pack in PR [#43][#43].
|
29
|
+
- kymmt90 fixed a documentation error on `Minitar.pack` in PR [#43][#43].
|
21
30
|
|
22
31
|
- This version is a soft-deprecation of all versions before Ruby 2.7, as they
|
23
32
|
will no longer be tested in CI.
|
@@ -28,9 +37,9 @@
|
|
28
37
|
|
29
38
|
## 0.9 / 2019-09-04
|
30
39
|
|
31
|
-
- jtappa added the ability to skip fsync with a new option to Minitar.unpack
|
32
|
-
Minitar::Input#extract_entry
|
33
|
-
to enable. Merged from a modified version of PR [#37][#37].
|
40
|
+
- jtappa added the ability to skip fsync with a new option to `Minitar.unpack`
|
41
|
+
and `Minitar::Input#extract_entry`. Provide `:fsync => false` as the last
|
42
|
+
parameter to enable. Merged from a modified version of PR [#37][#37].
|
34
43
|
|
35
44
|
## 0.8 / 2019-01-05
|
36
45
|
|
@@ -50,10 +59,11 @@
|
|
50
59
|
## 0.7 / 2018-02-19
|
51
60
|
|
52
61
|
- Fixed issue [#28][#28] with a modified version of PR [#29][#29] covering the
|
53
|
-
security policy and position for Minitar
|
54
|
-
report and an initial patch. Additional information was added as
|
62
|
+
security policy and position for `Minitar`. Thanks so much to ooooooo_q for
|
63
|
+
the report and an initial patch. Additional information was added as
|
64
|
+
[#30][#30].
|
55
65
|
|
56
|
-
- dearblue contributed PR [#33][#33] providing a fix for Minitar::Reader when
|
66
|
+
- dearblue contributed PR [#33][#33] providing a fix for `Minitar::Reader` when
|
57
67
|
the IO-like object does not have a `#pos` method.
|
58
68
|
|
59
69
|
- Kevin McDermott contributed PR [#34][#34] so that an InvalidTarStream is
|
@@ -66,7 +76,7 @@
|
|
66
76
|
|
67
77
|
- Addressed a potential DOS with negative size fields in tar headers
|
68
78
|
([#31][#31]). This has been handled in two ways: the size field in a tar
|
69
|
-
header is interpreted as a strict octal value and the Minitar reader will
|
79
|
+
header is interpreted as a strict octal value and the `Minitar` reader will
|
70
80
|
raise an InvalidTarStream if the size ends up being negative anyway.
|
71
81
|
|
72
82
|
## 0.6.1 / 2017-02-07
|
@@ -86,61 +96,62 @@
|
|
86
96
|
command-line utility anyway. (Installing `archive-tar-minitar` will install
|
87
97
|
both `minitar` and `minitar-cli`, at least until version 1.0.)
|
88
98
|
|
89
|
-
- Minitar extraction before 0.6 traverses directories if the tarball
|
90
|
-
a relative directory reference, as reported in [#16][#16] by
|
91
|
-
This has been disallowed entirely and will throw a
|
92
|
-
when found. Additionally, if the final destination
|
93
|
-
already-existing symbolic link, the existing symbolic link
|
94
|
-
and the file will be written correctly (on platforms that
|
95
|
-
links).
|
99
|
+
- `Minitar` extraction before 0.6 traverses directories if the tarball
|
100
|
+
includes a relative directory reference, as reported in [#16][#16] by
|
101
|
+
@ecneladis. This has been disallowed entirely and will throw a
|
102
|
+
`SecureRelativePathError` when found. Additionally, if the final destination
|
103
|
+
of an entry is an already-existing symbolic link, the existing symbolic link
|
104
|
+
will be removed and the file will be written correctly (on platforms that
|
105
|
+
support symbolic links).
|
96
106
|
|
97
107
|
- Enhancements:
|
98
108
|
|
99
109
|
- Licence change. After speaking with Mauricio Fernández, we have changed the
|
100
110
|
licensing of this library to Ruby and Simplified BSD and have dropped the
|
101
111
|
GNU GPL license. This takes effect from the 0.6 release.
|
102
|
-
- Printing a deprecation warning for including Archive::Tar to put Minitar
|
103
|
-
the top-level namespace.
|
104
|
-
- Printing a deprecation warning for including Archive::Tar::Minitar into a
|
105
|
-
class (Minitar will be a class for version 1.0).
|
106
|
-
- Moved Archive::Tar::PosixHeader to Archive::Tar::Minitar::PosixHeader
|
107
|
-
deprecation warning. Do not depend on
|
108
|
-
it will be moving to
|
109
|
-
|
112
|
+
- Printing a deprecation warning for including Archive::Tar to put `Minitar`
|
113
|
+
in the top-level namespace.
|
114
|
+
- Printing a deprecation warning for including `Archive::Tar::Minitar` into a
|
115
|
+
class (`Minitar` will be a class for version 1.0).
|
116
|
+
- Moved `Archive::Tar::PosixHeader` to `Archive::Tar::Minitar::PosixHeader`
|
117
|
+
with a deprecation warning. Do not depend on
|
118
|
+
`Archive::Tar::Minitar::PosixHeader`, as it will be moving to
|
119
|
+
`::Minitar::PosixHeader` in a future release.
|
120
|
+
- Added an alias, `::Minitar`, for `Archive::Tar::Minitar`, opted in with
|
110
121
|
`require 'minitar'`. In future releases, this alias will be enabled by
|
111
|
-
default, and the Archive::Tar namespace will be removed entirely for
|
112
|
-
1.0.
|
113
|
-
- Modified the handling of `mtime` in PosixHeader to do an integer
|
114
|
-
(
|
115
|
-
the time object.
|
116
|
-
- Writer::RestrictedStream was renamed to Writer::WriteOnlyStream for
|
117
|
-
No alias or deprecation warning was provided for this as it is an
|
118
|
-
implementation detail.
|
119
|
-
- Writer::BoundedStream was renamed to Writer::BoundedWriteStream for
|
120
|
-
A deprecation warning is provided on first use because a
|
121
|
-
may raise a BoundedWriteStream::FileOverflow exception.
|
122
|
-
- Writer::BoundedWriteStream::FileOverflow has been renamed to
|
123
|
-
Writer::WriteBoundaryOverflow and inherits from StandardError instead of
|
124
|
-
RuntimeError
|
125
|
-
specifying Writer::BoundedWriteStream::FileOverflow because
|
126
|
-
Writer::BoundedWriteStream has been declared a private constant.
|
127
|
-
- Modified Writer#add_file_simple to accept the data for a file in
|
122
|
+
default, and the `Archive::Tar` namespace will be removed entirely for
|
123
|
+
version 1.0.
|
124
|
+
- Modified the handling of `mtime` in `PosixHeader` to do an integer
|
125
|
+
conversion (`#to_i`) so that a Time object can be used instead of the
|
126
|
+
integer value of the time object.
|
127
|
+
- `Writer::RestrictedStream` was renamed to `Writer::WriteOnlyStream` for
|
128
|
+
clarity. No alias or deprecation warning was provided for this as it is an
|
129
|
+
internal implementation detail.
|
130
|
+
- `Writer::BoundedStream` was renamed to `Writer::BoundedWriteStream` for
|
131
|
+
clarity. A deprecation warning is provided on first use because a
|
132
|
+
BoundedWriteStream may raise a `BoundedWriteStream::FileOverflow` exception.
|
133
|
+
- `Writer::BoundedWriteStream::FileOverflow` has been renamed to
|
134
|
+
`Writer::WriteBoundaryOverflow` and inherits from `StandardError` instead of
|
135
|
+
`RuntimeError`. Note that for Ruby 2.0 or higher, an error will be raised
|
136
|
+
when specifying `Writer::BoundedWriteStream::FileOverflow` because
|
137
|
+
`Writer::BoundedWriteStream` has been declared a private constant.
|
138
|
+
- Modified `Writer#add_file_simple` to accept the data for a file in
|
128
139
|
`opts[:data]`. When `opts[:data]` is provided, a stream block must not be
|
129
140
|
provided. Improved the documentation for this method.
|
130
|
-
- Modified Writer#add_file to accept `opts[:data]` and transparently call
|
131
|
-
Writer#add_file_simple in this case.
|
141
|
+
- Modified `Writer#add_file` to accept `opts[:data]` and transparently call
|
142
|
+
`Writer#add_file_simple` in this case.
|
132
143
|
- Methods that require blocks are no longer required, so the
|
133
|
-
Archive::Tar::Minitar::BlockRequired exception has been removed with a
|
144
|
+
`Archive::Tar::Minitar::BlockRequired` exception has been removed with a
|
134
145
|
warning (this may not work on Ruby 1.8).
|
135
146
|
- Dramatically reduced the number of strings created when creating a POSIX
|
136
147
|
tarball header.
|
137
|
-
- Added a helper, Input.each_entry that iterates over each entry in an
|
138
|
-
entry object.
|
148
|
+
- Added a helper, `Input.each_entry` that iterates over each entry in an
|
149
|
+
opened entry object.
|
139
150
|
|
140
151
|
- Bugs:
|
141
152
|
|
142
153
|
- Fix [#2][#2] to handle IO streams that are not seekable, such as pipes,
|
143
|
-
STDIN
|
154
|
+
`STDIN`, or `STDOUT`.
|
144
155
|
- Fix [#3][#3] to make the test timezone resilient.
|
145
156
|
- Fix [#4][#4] for supporting the reading of tar files with filenames in the
|
146
157
|
GNU long filename extension format. Ported from @atoulme’s fork, originally
|
@@ -151,7 +162,7 @@
|
|
151
162
|
splitting.
|
152
163
|
- Fix [#14][#14] provided by @kzys should fix Windows detection issues.
|
153
164
|
- Fix [#16][#16] as specified above.
|
154
|
-
- Fix an issue where Minitar.pack would not include Unix hidden files when
|
165
|
+
- Fix an issue where `Minitar.pack` would not include Unix hidden files when
|
155
166
|
creating a tarball.
|
156
167
|
|
157
168
|
- Development:
|
@@ -178,6 +189,7 @@
|
|
178
189
|
[#3]: https://github.com/halostatue/minitar/issues/3
|
179
190
|
[#4]: https://github.com/halostatue/minitar/issues/4
|
180
191
|
[#6]: https://github.com/halostatue/minitar/issues/6
|
192
|
+
[#7]: https://github.com/halostatue/minitar/issues/7
|
181
193
|
[#12]: https://github.com/halostatue/minitar/pull/12
|
182
194
|
[#13]: https://github.com/halostatue/minitar/issues/13
|
183
195
|
[#14]: https://github.com/halostatue/minitar/issues/14
|
@@ -201,4 +213,3 @@
|
|
201
213
|
[#45]: https://github.com/halostatue/minitar/issues/45
|
202
214
|
[#46]: https://github.com/halostatue/minitar/issues/46
|
203
215
|
[#47]: https://github.com/halostatue/minitar/pull/47
|
204
|
-
[#63]: https://github.com/halostatue/minitar/issues/63
|
data/Licence.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
minitar is free software that may be redistributed and/or modified under the
|
4
4
|
terms of Ruby’s licence or the Simplified BSD licence.
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
- Copyright 2004–2024 Austin Ziegler.
|
7
|
+
- Portions copyright 2004 Mauricio Julio Fernández Pradier.
|
8
8
|
|
9
9
|
### Simplified BSD Licence
|
10
10
|
|
data/Manifest.txt
CHANGED
@@ -7,17 +7,16 @@ README.rdoc
|
|
7
7
|
Rakefile
|
8
8
|
docs/bsdl.txt
|
9
9
|
docs/ruby.txt
|
10
|
-
lib/archive-tar-minitar.rb
|
11
|
-
lib/archive/tar/minitar.rb
|
12
|
-
lib/archive/tar/minitar/input.rb
|
13
|
-
lib/archive/tar/minitar/output.rb
|
14
|
-
lib/archive/tar/minitar/posix_header.rb
|
15
|
-
lib/archive/tar/minitar/reader.rb
|
16
|
-
lib/archive/tar/minitar/writer.rb
|
17
10
|
lib/minitar.rb
|
18
|
-
|
11
|
+
lib/minitar/input.rb
|
12
|
+
lib/minitar/output.rb
|
13
|
+
lib/minitar/posix_header.rb
|
14
|
+
lib/minitar/reader.rb
|
15
|
+
lib/minitar/writer.rb
|
19
16
|
test/minitest_helper.rb
|
20
17
|
test/support/tar_test_helpers.rb
|
18
|
+
test/test_issue_46.rb
|
19
|
+
test/test_minitar.rb
|
21
20
|
test/test_tar_header.rb
|
22
21
|
test/test_tar_input.rb
|
23
22
|
test/test_tar_output.rb
|
data/README.rdoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
home :: https://github.com/halostatue/minitar/
|
4
4
|
code :: https://github.com/halostatue/minitar/
|
5
5
|
bugs :: https://github.com/halostatue/minitar/issues
|
6
|
-
rdoc ::
|
6
|
+
rdoc :: https://rdoc.info/gems/minitar/
|
7
7
|
cli :: https://github.com/halostatue/minitar-cli
|
8
8
|
|
9
9
|
== Description
|
data/Rakefile
CHANGED
@@ -11,7 +11,6 @@ Hoe.plugin :gemspec2
|
|
11
11
|
Hoe.plugin :git2
|
12
12
|
Hoe.plugin :minitest
|
13
13
|
Hoe.plugin :rubygems
|
14
|
-
Hoe.plugin :deprecated_gem
|
15
14
|
Hoe.plugin :cov
|
16
15
|
|
17
16
|
Hoe.spec "minitar" do
|
@@ -20,41 +19,10 @@ Hoe.spec "minitar" do
|
|
20
19
|
self.history_file = "History.md"
|
21
20
|
self.readme_file = "README.rdoc"
|
22
21
|
|
23
|
-
require_ruby_version ">= 1
|
24
|
-
|
25
|
-
# This is a hack because of an issue with Hoe 3.26, but I'm not sure which
|
26
|
-
# hoe version introduced this issue or if it's a JRuby issue. This issue is
|
27
|
-
# demonstrable in lib/hoe.rb at line 676, which is (reformatted for space):
|
28
|
-
#
|
29
|
-
# ```ruby
|
30
|
-
# readme =
|
31
|
-
# input
|
32
|
-
# .lines
|
33
|
-
# .chunk { |l| l[/^(?:=+|#+)/] || "" } # # chunk is different somehow
|
34
|
-
# .map(&:last) # <-- HERE: "#" does not respond to #last
|
35
|
-
# .each_slice(2)
|
36
|
-
# .map { |k, v|
|
37
|
-
# kp = k.join
|
38
|
-
# kp = kp.strip.chomp(":").split.last.downcase if k.size == 1
|
39
|
-
# [kp, v.join.strip]
|
40
|
-
# }
|
41
|
-
# .to_h
|
42
|
-
# ```
|
43
|
-
#
|
44
|
-
# We don't *ship* with JRuby, but use it in CI only, so this is here at least
|
45
|
-
# temporarily.
|
46
|
-
if RUBY_PLATFORM.match?(/java/)
|
47
|
-
self.summary = self.description = "Description for testing"
|
48
|
-
self.homepage = "https://github.com/KineticCafe/app-identity/tree/main/ruby/"
|
49
|
-
end
|
22
|
+
require_ruby_version ">= 3.1"
|
50
23
|
|
51
24
|
self.licenses = ["Ruby", "BSD-2-Clause"]
|
52
25
|
|
53
|
-
self.post_install_message = <<-EOS
|
54
|
-
The `minitar` executable is no longer bundled with `minitar`. If you are
|
55
|
-
expecting this executable, make sure you also install `minitar-cli`.
|
56
|
-
EOS
|
57
|
-
|
58
26
|
spec_extras[:metadata] = ->(val) { val["rubygems_mfa_required"] = "true" }
|
59
27
|
|
60
28
|
extra_dev_deps << ["base64", "~> 0.2"]
|
@@ -69,4 +37,6 @@ expecting this executable, make sure you also install `minitar-cli`.
|
|
69
37
|
extra_dev_deps << ["rake", ">= 10.0", "< 14"]
|
70
38
|
extra_dev_deps << ["rdoc", ">= 0.0"]
|
71
39
|
extra_dev_deps << ["standard", "~> 1.0"]
|
40
|
+
extra_dev_deps << ["standard-minitest", "~> 1.0"]
|
41
|
+
extra_dev_deps << ["standard-thread_safety", "~> 1.0"]
|
72
42
|
end
|
@@ -1,9 +1,7 @@
|
|
1
|
-
|
1
|
+
require "minitar/reader"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
module Archive::Tar::Minitar
|
6
|
-
# Wraps a Archive::Tar::Minitar::Reader with convenience methods and wrapped
|
3
|
+
class Minitar
|
4
|
+
# Wraps a Minitar::Reader with convenience methods and wrapped
|
7
5
|
# stream management; Input only works with data streams that can be rewound.
|
8
6
|
class Input
|
9
7
|
include Enumerable
|
@@ -15,8 +13,8 @@ module Archive::Tar::Minitar
|
|
15
13
|
# instance, +Input.open+ returns the value of the block.
|
16
14
|
#
|
17
15
|
# call-seq:
|
18
|
-
#
|
19
|
-
#
|
16
|
+
# Minitar::Input.open(io) -> input
|
17
|
+
# Minitar::Input.open(io) { |input| block } -> obj
|
20
18
|
def self.open(input)
|
21
19
|
stream = new(input)
|
22
20
|
|
@@ -36,7 +34,7 @@ module Archive::Tar::Minitar
|
|
36
34
|
# Iterates over each entry in the provided input. This wraps the common
|
37
35
|
# pattern of:
|
38
36
|
#
|
39
|
-
#
|
37
|
+
# Minitar::Input.open(io) do |i|
|
40
38
|
# inp.each do |entry|
|
41
39
|
# # ...
|
42
40
|
# end
|
@@ -46,8 +44,8 @@ module Archive::Tar::Minitar
|
|
46
44
|
# behaviour.
|
47
45
|
#
|
48
46
|
# call-seq:
|
49
|
-
#
|
50
|
-
#
|
47
|
+
# Minitar::Input.each_entry(io) -> enumerator
|
48
|
+
# Minitar::Input.each_entry(io) { |entry| block } -> obj
|
51
49
|
def self.each_entry(input)
|
52
50
|
return to_enum(__method__, input) unless block_given?
|
53
51
|
|
@@ -67,8 +65,8 @@ module Archive::Tar::Minitar
|
|
67
65
|
# support rewinding.
|
68
66
|
#
|
69
67
|
# call-seq:
|
70
|
-
#
|
71
|
-
#
|
68
|
+
# Minitar::Input.new(io) -> input
|
69
|
+
# Minitar::Input.new(path) -> input
|
72
70
|
def initialize(input)
|
73
71
|
@io = if input.respond_to?(:read)
|
74
72
|
input
|
@@ -76,8 +74,8 @@ module Archive::Tar::Minitar
|
|
76
74
|
::Kernel.open(input, "rb")
|
77
75
|
end
|
78
76
|
|
79
|
-
unless
|
80
|
-
raise
|
77
|
+
unless Minitar.seekable?(@io, :rewind)
|
78
|
+
raise Minitar::NonSeekableStream
|
81
79
|
end
|
82
80
|
|
83
81
|
@tar = Reader.new(@io)
|
@@ -117,11 +115,11 @@ module Archive::Tar::Minitar
|
|
117
115
|
# cycle.
|
118
116
|
# <tt>:entry</tt>:: The entry being extracted; this is a
|
119
117
|
# Reader::EntryStream, with all methods thereof.
|
120
|
-
def extract_entry(destdir, entry, options = {}, &
|
118
|
+
def extract_entry(destdir, entry, options = {}, &) # :yields action, name, stats:
|
121
119
|
stats = {
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
120
|
+
current: 0,
|
121
|
+
currinc: 0,
|
122
|
+
entry: entry
|
125
123
|
}
|
126
124
|
|
127
125
|
# extract_entry is not vulnerable to prefix '/' vulnerabilities, but it
|
@@ -135,14 +133,14 @@ module Archive::Tar::Minitar
|
|
135
133
|
# However, squeeze consecutive '/' characters together.
|
136
134
|
full_name = entry.full_name.squeeze("/")
|
137
135
|
|
138
|
-
if
|
136
|
+
if /\.{2}(?:\/|\z)/.match?(full_name)
|
139
137
|
raise SecureRelativePathError, "Path contains '..'"
|
140
138
|
end
|
141
139
|
|
142
140
|
if entry.directory?
|
143
|
-
extract_directory(destdir, full_name, entry, stats, options, &
|
141
|
+
extract_directory(destdir, full_name, entry, stats, options, &)
|
144
142
|
else # it's a file
|
145
|
-
extract_file(destdir, full_name, entry, stats, options, &
|
143
|
+
extract_file(destdir, full_name, entry, stats, options, &)
|
146
144
|
end
|
147
145
|
end
|
148
146
|
|
@@ -169,7 +167,7 @@ module Archive::Tar::Minitar
|
|
169
167
|
rescue # ignore IOError if it's an unpatched (old) Ruby
|
170
168
|
nil
|
171
169
|
ensure
|
172
|
-
dir
|
170
|
+
dir&.close rescue nil # standard:disable Style/RescueModifier
|
173
171
|
end
|
174
172
|
|
175
173
|
def extract_directory(destdir, full_name, entry, stats, options)
|
@@ -177,7 +175,7 @@ module Archive::Tar::Minitar
|
|
177
175
|
|
178
176
|
yield :dir, full_name, stats if block_given?
|
179
177
|
|
180
|
-
if
|
178
|
+
if Minitar.dir?(dest)
|
181
179
|
begin
|
182
180
|
FileUtils.chmod(entry.mode, dest)
|
183
181
|
rescue
|
@@ -186,7 +184,7 @@ module Archive::Tar::Minitar
|
|
186
184
|
else
|
187
185
|
File.unlink(dest.chomp("/")) if File.symlink?(dest.chomp("/"))
|
188
186
|
|
189
|
-
FileUtils.mkdir_p(dest, :
|
187
|
+
FileUtils.mkdir_p(dest, mode: entry.mode)
|
190
188
|
FileUtils.chmod(entry.mode, dest)
|
191
189
|
end
|
192
190
|
|
@@ -198,16 +196,14 @@ module Archive::Tar::Minitar
|
|
198
196
|
|
199
197
|
def extract_file(destdir, full_name, entry, stats, options)
|
200
198
|
destdir = File.join(destdir, File.dirname(full_name))
|
201
|
-
FileUtils.mkdir_p(destdir, :
|
199
|
+
FileUtils.mkdir_p(destdir, mode: 0o755)
|
202
200
|
|
203
201
|
destfile = File.join(destdir, File.basename(full_name))
|
204
202
|
|
205
203
|
File.unlink(destfile) if File.symlink?(destfile)
|
206
204
|
|
207
205
|
# Errno::ENOENT
|
208
|
-
#
|
209
|
-
FileUtils.chmod(0o600, destfile) rescue nil
|
210
|
-
# rubocop:enable Style/RescueModifier
|
206
|
+
FileUtils.chmod(0o600, destfile) rescue nil # standard:disable Style/RescueModifier
|
211
207
|
|
212
208
|
yield :file_start, full_name, stats if block_given?
|
213
209
|
|