Giter Site home page Giter Site logo

Comments (6)

esell avatar esell commented on May 28, 2024

Just pushed a fix if you want to give it a go.

from deb-simple.

amoghe avatar amoghe commented on May 28, 2024

I looked at the patch, and I don't think that would fix it.

As I mentioned earlier, the string returned by inspectPackageControl can contain trailing newlines if the pkg control file has trailing newlines. This string gets written directly to the buffer thats being built to output the Packages.gz file. Hence, that file can end up containing things like:

The offending code:

tempCtlData, err := inspectPackage(debPath)
if err != nil {
    return err
}
packBuf.WriteString(tempCtlData) // <-- If tempCtlData contains newlines, they get written through
Package: foo
SomeStuff: blahblah
\n
\n <-- !!! these newlines are BAD. they "leak" from tempCtlData
\n
MD5sum: BADBADSUM
SHA1: SUMSUM
\n <-- these newlines are VALID separators
\n
Package: bar
SomeStuff: blahblah
... and so on and so forth...

from deb-simple.

amoghe avatar amoghe commented on May 28, 2024

A possible fix is:

@@ -152,7 +157,7 @@ func inspectPackageControl(filename bytes.Buffer) (string, error) {
                case tar.TypeReg:
                        if name == "./control" {
                                io.Copy(&controlBuf, tarReader)
-                               return controlBuf.String(), nil
+                               return strings.TrimRight(controlBuf.String(), "\n") + "\n", nil
                        }

from deb-simple.

esell avatar esell commented on May 28, 2024

My bad, I misunderstood what the issue was and thought it was just newlines at the end of the file. Let me play around with your suggestion and see what happens.

It's strange that this is an issue because we're just doing an io.Copy of the original control file. I wonder why the issue is not seen with other repo solutions? Either way we'll figure it out :)

from deb-simple.

esell avatar esell commented on May 28, 2024

Just merged in #15 if you want to give it a go again...

from deb-simple.

esell avatar esell commented on May 28, 2024

gonna go ahead and close this guy, feel free to re-open it if the previous PR didn't fix your issue.

from deb-simple.

Related Issues (18)

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.