Coder Social home page Coder Social logo

Comments (10)

lrhn avatar lrhn commented on July 20, 2024 1

Seems related to #47244

from sdk.

devoncarew avatar devoncarew commented on July 20, 2024

I suspect the archive itself is corrupt or somehow non-standard. On macos, I see:

Screenshot 2024-04-14 at 9 44 08 PM

Closing as I think the issue is with the archive and not the GZipCodec class. If on further investigation of the archive you believe its well-formed / something GZipCodec should parse, please re-open.

from sdk.

meowofficial avatar meowofficial commented on July 20, 2024

@devoncarew I updated the file. Now it opens with the standard macos archive utility. Could you check it again?

from sdk.

a-siva avatar a-siva commented on July 20, 2024

//cc @brianquinlan

from sdk.

brianquinlan avatar brianquinlan commented on July 20, 2024

I can repro. Python is able to decompress this file:

>>> s = open('test.csv.gz', 'rb').read()
>>> import gzip
>>> t = gzip.decompress(s)
>>> len(t)
68541

The bytes that Dart actually decodes are:

>>> x = [105, 100, 83, 117, 98, 67, 97, 109, 112, 97, 105, 103, 110, 84, 105, 116, 108, 101, 44, 105, 100, 83, 117, 98, 65, 100, 83, 101, 116, 84, 105, 116, 108, 101, 44, 105, 100, 83, 117, 98, 67, 97, 109, 112, 97, 105, 103, 110, 44, 105, 100, 67, 97, 109, 112, 97, 105, 103, 110, 84, 105, 116, 108, 101, 10]
>>> bytes(x)
b'idSubCampaignTitle,idSubAdSetTitle,idSubCampaign,idCampaignTitle\n'

Which is the first line of the file. If I understand correctly, the GZIP file format consists of concatenated compressed data sets. So maybe we are only decoding the first data set?

from sdk.

brianquinlan avatar brianquinlan commented on July 20, 2024

I get the same output as Dart when use the zpipe example after changing:

-    ret = inflateInit(&strm);
+    ret = inflateInit2(&strm, 32 + 15);

The Python implementation looks very similar to ours.

from sdk.

brianquinlan avatar brianquinlan commented on July 20, 2024

If I extract the file and recompress it with gzip, both Dart and zpipe and decompress the file. How did you generate this archive?

from sdk.

meowofficial avatar meowofficial commented on July 20, 2024

@brianquinlan This archive is from raw data export API response of https://docs.tracker.my.com/api/export-api/raw/about

from sdk.

brianquinlan avatar brianquinlan commented on July 20, 2024

Yep. OK, I missed that Python deals with gzip data starting in Python code:
https://github.com/python/cpython/blob/fc21c7f7a731d64f7e4f0e82469f78fa9c104bbd/Lib/gzip.py#L622

I also found an example on how to handle concatenated gzip streams in C from Mark Adler himself:
https://stackoverflow.com/questions/17820664/is-this-a-bug-in-this-gzip-inflate-method/17822217#17822217

from sdk.

brianquinlan avatar brianquinlan commented on July 20, 2024

I have a straightforward fix for this but it will take a while for me to convince myself that it always works.

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.