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

compress/zlib: NewReaderDict does not work as advertised #7935

Closed
rui314 opened this issue May 5, 2014 · 9 comments
Closed

compress/zlib: NewReaderDict does not work as advertised #7935

rui314 opened this issue May 5, 2014 · 9 comments

Comments

@rui314
Copy link
Member

rui314 commented May 5, 2014

What does 'go version' print?
go version devel +2e591e82a8c8 Fri May 02 13:17:55 2014 -0700 + linux/amd64

What happened?
NewReaderDict's documentation says "NewReaderDict ignores the dictionary if the
compressed data does not refer to it."

In reality, it does not ignore a wrong dictionary but returns an ErrDictionary error.
@ianlancetaylor
Copy link
Contributor

Comment 1:

Do you think this is a documentation error or a code error?

Labels changed: added repo-main, release-go1.4.

@rui314
Copy link
Member Author

rui314 commented May 9, 2014

Comment 2:

My guess is this is a documentation error, as this is the only place ErrDictionary could
be returned.
From the perspective of a user, I'd also want it to return an error for a wrong
dictionary. Dictionary is not a hint but mandatory; one need to give exactly the same
dictionary to inflate and deflate, or otherwise zlib will fail to decompress it.

@ianlancetaylor
Copy link
Contributor

Comment 3:

Thanks.  Looking deeper, I think the comment is actually arguably correct.  It says
"NewReaderDict ignores the dictionary if the compressed data does not refer to it." 
What it means by that, I think, is that if the FDICT flag is not set (z.scratch[1]&0x20
== 0) the dict argument is correct.

@rui314
Copy link
Member Author

rui314 commented May 9, 2014

Comment 4:

That interpretation makes sense, but it's I believe confusing. Maybe we should refine
the document?

@ianlancetaylor
Copy link
Contributor

Comment 5:

SGTM but I'll let somebody else sort this out.

@rsc
Copy link
Contributor

rsc commented Sep 15, 2014

Comment 6:

Labels changed: added documentation.

Owner changed to @rsc.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Sep 30, 2014

Comment 7:

I think this is user error but I will add a sentence anyway.

@gopherbot
Copy link

Comment 8:

CL https://golang.org/cl/147390043 mentions this issue.

@rsc
Copy link
Contributor

rsc commented Sep 30, 2014

Comment 9:

This issue was closed by revision 0239595.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Fixes golang#7935.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, ruiu
https://golang.org/cl/147390043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
Fixes golang#7935.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, ruiu
https://golang.org/cl/147390043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
Fixes golang#7935.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, ruiu
https://golang.org/cl/147390043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
Fixes golang#7935.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, ruiu
https://golang.org/cl/147390043
@rsc rsc removed their assignment Jun 23, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants