8000 Fix loading extra fields by hainesr · Pull Request #459 · rubyzip/rubyzip · GitHub
[go: up one dir, main page]

Skip to content

Fix loading extra fields #459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 14, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix reading Ux extra field.
As previously implemented the `uid` and `gid` fields could only ever be
read as 0, because they were being initialized to zero and then
memoization (`@uid ||= uid`) was used to 'save' the new value. Using `nil`
as the initial value for either of these fields breaks so many tests, so I
have fixed this by not using memoization instead. This is safe because it
is only the local extra field that holds these values for this type of
extra field.
  • Loading branch information
hainesr committed Sep 20, 2020
commit fe1d3c8da0591a4a802f711b4a9770f34899132f
4 changes: 2 additions & 2 deletions lib/zip/extra_field/unix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def merge(binstr)
return if !size || size == 0

uid, gid = content.unpack('vv')
@uid ||= uid
@gid ||= gid # rubocop:disable Naming/MemoizedInstanceVariableName
@uid = uid
@gid = gid
end

def ==(other)
Expand Down
0