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

Fix deb/ar.go: Read() may return less bytes. Also fix trailing slashes. #106

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ebikt
Copy link
Contributor

@ebikt ebikt commented May 29, 2019

IMHO read is allowed to be short and return less bytes than requested. Also add suport for trailing slashes (#59).

deb/ar.go Outdated
}
if count != 60 {
if pos < 60 {
Copy link
Owner

Choose a reason for hiding this comment

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

Can this code be implemented by using an io.LimitReader and ioutils.ReadAll?

deb/ar.go Outdated
}
if string(header) != "!<arch>\n" {
return fmt.Errorf("Header doesn't look right!")
return fmt.Errorf("Header doesn't look as 'ar' file.")
Copy link
Owner

Choose a reason for hiding this comment

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

The english here is a bit broken - maybe Header is invalid for an 'ar' archive. instead?

@paultag
Copy link
Owner

paultag commented May 29, 2019

A few comments on the PR here; thanks for your patches!

@ebikt
Copy link
Contributor Author

ebikt commented Jun 6, 2019

I guess it is now more readable (with LimitedReader as you suggested). I also added simple test to be sure that new implementation also works. This test revelaed that FileMode parsing was wrong.

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.

None yet

2 participants