Skip to content
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

Errors with OTP 27.1 #38

Open
egze opened this issue Sep 20, 2024 · 7 comments
Open

Errors with OTP 27.1 #38

egze opened this issue Sep 20, 2024 · 7 comments

Comments

@egze
Copy link

egze commented Sep 20, 2024

OTP 27.1 has been released and it breaks the library. There have been some changes to the :zip module.

https://erlangforums.com/t/erlang-otp-27-1-released/4006

How to reproduce:

Run mix test

Example of errors:

1) test sheets/2 load all sheets (XlsxReaderTest)
     test/xlsx_reader_test.exs:157
     ** (FunctionClauseError) no function clause matching in XlsxReader.ZipArchive.translate_zip_error/1

     The following arguments were given to XlsxReader.ZipArchive.translate_zip_error/1:

         # 1
         {:error, {:EXIT, {:function_clause, [{:zip, :update_zip64, [{:local_file_header, 20, 0, 8, 45132, 20680, 3229678449, 250, 467, :undefined, :undefined, :undefined, 0, 0, 15, 20, :undefined}, <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>], [file: ~c"zip.erl", line: 1942]}, {:lists, :foldl, 3, [file: ~c"lists.erl", line: 2146]}, {:zip, :get_z_file, 11, [file: ~c"zip.erl", line: 2252]}, {:zip, :get_z_files, 5, [file: ~c"zip.erl", line: 2223]}, {:zip, :do_unzip, 2, [file: ~c"zip.erl", line: 425]}, {:zip, :unzip, 2, [file: ~c"zip.erl", line: 410]}, {XlsxReader.ZipArchive, :extract, 2, [file: ~c"lib/xlsx_reader/zip_archive.ex", line: 47]}, {XlsxReader.PackageLoader, :extract_xml, 2, [file: ~c"lib/xlsx_reader/package_loader.ex", line: 180]}, {XlsxReader.PackageLoader, :load_workbook_xml, 2, [file: ~c"lib/xlsx_reader/package_loader.ex", line: 124]}, {XlsxReader.PackageLoader, :open, 2, [file: ~c"lib/xlsx_reader/package_loader.ex", line: 48]}, {XlsxReaderTest, :__ex_unit_setup_3_0, 1, [file: ~c"test/xlsx_reader_test.exs", line: 152]}, {XlsxReaderTest, :__ex_unit_describe_3, 1, []}, {ExUnit.Runner, :exec_test_setup, 2, [file: ~c"lib/ex_unit/runner.ex", line: 478]}, {ExUnit.Runner, :"-spawn_test_monitor/4-fun-0-", 2, [file: ~c"lib/ex_unit/runner.ex", line: 411]}, {:timer, :tc, 2, [file: ~c"timer.erl", line: 590]}, {ExUnit.Runner, :"-spawn_test_monitor/4-fun-1-", 6, [file: ~c"lib/ex_unit/runner.ex", line: 407]}]}}}

     Attempted function clauses (showing 2 out of 2):

         defp translate_zip_error({:error, :enoent})
         defp translate_zip_error({:error, code}) when code === :einval or code === :bad_eocd or code === :bad_central_directory or code === :eisdir

     stacktrace:
       (xlsx_reader 0.8.7) lib/xlsx_reader/zip_archive.ex:86: XlsxReader.ZipArchive.translate_zip_error/1
       (xlsx_reader 0.8.7) lib/xlsx_reader/package_loader.ex:180: XlsxReader.PackageLoader.extract_xml/2
       (xlsx_reader 0.8.7) lib/xlsx_reader/package_loader.ex:124: XlsxReader.PackageLoader.load_workbook_xml/2
       (xlsx_reader 0.8.7) lib/xlsx_reader/package_loader.ex:48: XlsxReader.PackageLoader.open/2
       test/xlsx_reader_test.exs:152: XlsxReaderTest.__ex_unit_setup_3_0/1
       XlsxReaderTest.__ex_unit_describe_3/1
@xavier
Copy link
Owner

xavier commented Sep 20, 2024

This seems to be an issue with zip64 support in OTP 27.1.

@egze
Copy link
Author

egze commented Sep 20, 2024

@xavier Thanks. There is a question here https://erlangforums.com/t/erlang-otp-27-1-released/4006/6?u=egze do you know the answer by any chance?

Here is a PR with a fix: stdlib: Fix unzip to not crash on unused data in zip64 extra header by garazdawi · Pull Request #8836 · erlang/otp · GitHub 4 please test it to make sure that it works.

Do you know how that xlsx file was created?

@xavier
Copy link
Owner

xavier commented Sep 20, 2024

Do you know how that xlsx file was created?

It must be a mix of Apple Numbers, Google Sheets and perhaps Excel if the fixture was provided by a 3rd party. I can't tell for sure.

@garazdawi
Copy link

@xavier As you don't know how the file was created, I assume you don't know under which license the file is? I'm wondering if I can just copy your testfile for testing, or if I need to create it on my own.

@xavier
Copy link
Owner

xavier commented Sep 23, 2024

Sure, I mostly created the fixture files myself so they're generated with Apple Numbers except google_spreadsheet.xlsx, obviously. But some fixtures files were contributed by others and I don't know which tool they've used.

@garazdawi
Copy link

It is specifically https://github.com/xavier/xlsx_reader/blob/master/test/fixtures/test.xlsx that I'm wondering about. Git history seems to suggest that you created it?

@xavier
Copy link
Owner

xavier commented Sep 23, 2024

By the looks of it, it was created with Apple Numbers.

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

No branches or pull requests

3 participants