Skip to content

Conversation

lucaskanashiro
Copy link
Contributor

Using the current pack directives makes test_extract_incorrect_size fail
in s390x architecture because of the endian probably. This is the output
of the command executed by the test in amd64:

irb(main):001:0> [501, 500000, 1].pack('LLS')
=> "\xF5\x01\x00\x00 \xA1\a\x00\x01\x00"

And the output of the same command in s390x:

irb(main):001:0> [501, 500000, 1].pack('LLS')
=> "\x00\x00\x01\xF5\x00\a\xA1 \x00\x01"

Changing to 'V' pack directive like is used in
lib/zib/central_directory.rb fixes the test in s390x and does not add a
regression in amd64.

FTR I've faced this issue in ruby-zip Debian package in Ubuntu, here is the log: https://objectstorage.prodstack4-5.canonical.com/v1/AUTH_77e2ada1e7a84929a74ba3b87153c0ac/autopkgtest-focal/focal/s390x/r/ruby-zip/20200323_152440_d8d79@/log.gz

@coveralls
Copy link

coveralls commented Mar 25, 2020

Coverage Status

Coverage remained the same at 95.769% when pulling 262ba00 on lucaskanashiro:fix-test-in-s390x into 382cc84 on rubyzip:master.

Copy link
Member

@jdleesmiller jdleesmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch and for your work on Debian!

The LLS directives coded for 'long-long-short', whereas V3 codes for 'long-long-long'. So, I think this is the right idea, but the last directive should be v for 'short'.

This matches the zip entry pack (the three directives before the final v for extra):

rubyzip/lib/zip/entry.rb

Lines 293 to 296 in 51a3b21

zip64 && zip64.compressed_size ? 0xFFFFFFFF : @compressed_size,
zip64 && zip64.original_size ? 0xFFFFFFFF : @size,
name_size,
@extra ? @extra.local_size : 0].pack('VvvvvvVVVvv')

Using the current pack directives makes test_extract_incorrect_size fail
in s390x architecture because of the endian probably. This is the output
of the command executed by the test in amd64:

irb(main):001:0> [501, 500000, 1].pack('LLS')
=> "\xF5\x01\x00\x00 \xA1\a\x00\x01\x00"

And the output of the same command in s390x:

irb(main):001:0> [501, 500000, 1].pack('LLS')
=> "\x00\x00\x01\xF5\x00\a\xA1 \x00\x01"

Changing to 'VVv' pack directives like is used in
lib/zib/entry.rb fixes the test in s390x and does not add a
regression in amd64.
@jdleesmiller jdleesmiller merged commit 214f75a into rubyzip:master Apr 11, 2020
jdleesmiller added a commit that referenced this pull request Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants