-
Notifications
You must be signed in to change notification settings - Fork 177
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: virtualFile.Read returns EOF with valid data #159
Open
cmaglie
wants to merge
2
commits into
GeertJohan:master
Choose a base branch
from
cmaglie:fix-EOF-plus-data
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It happens that the read method in VirtualFile may return EOF together with data. This is not how the os.File behaves normally as explained in https://golang.org/pkg/os/#File.Read > func (f *File) Read(b []byte) (n int, err error) > > Read reads up to len(b) bytes from the File. It returns the number > of bytes read and any error encountered. At end of file, Read > returns 0, io.EOF.
cmaglie
added a commit
to cmaglie/arduino-cli
that referenced
this pull request
Jul 6, 2020
This version must be kept until the following pull request is merged upstream: GeertJohan/go.rice#159
cmaglie
added a commit
to arduino/arduino-cli
that referenced
this pull request
Jul 7, 2020
* Added download of signature files for 'downloads.arduino.cc' domain * Slightly simplified tmp file creation * Use patched version of rice-box This version must be kept until the following pull request is merged upstream: GeertJohan/go.rice#159 * Added signature verification subroutines * Implemented package_index.json signature verification * Added missing license headers * Added negative test on signature check * Only copy signature if the file is present
matthijskooijman
approved these changes
Sep 11, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good to me. I've also tested this version, and it works as expected along with openpgp (which is the same case @cmaglie ran into).
cmaglie
added a commit
to cmaglie/go.rice
that referenced
this pull request
Sep 15, 2020
This is required until GeertJohan#159 is merged.
cmaglie
added a commit
to cmaglie/go.rice
that referenced
this pull request
Sep 15, 2020
This is required until GeertJohan#159 is merged.
cmaglie
added a commit
to cmaglie/arduino-cli
that referenced
this pull request
Sep 15, 2020
Golang projects that uses the CLI as-a-library will fail to build because the "replace" directive is valid only for the local project. This should fix the build until GeertJohan/go.rice#159 is merged. Once the upstrea patch is merged this commit could be reverted and the fork removed.
cmaglie
added a commit
to arduino/arduino-cli
that referenced
this pull request
Sep 15, 2020
Golang projects that use the CLI as-a-library will fail to build because the "replace" directive is valid only for the local project. This should fix the build until GeertJohan/go.rice#159 is merged. Once the upstream patch is merged this commit could be reverted and the fork removed.
@GeertJohan is there any chance this will be merged? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It happens that the read method in VirtualFile may return EOF together with data.
This is not how the
os.File
behaves normally as explained in https://golang.org/pkg/os/#File.ReadThis bug leads to an infinite loop when I tried to read openpgp keyring using the golang builting openpgp package.
After some digging I found that the library relies on the fact that
Read
sends the EOF alone (without valid data).This pull request fix the wrong behaviour.
I've added also a test to check how the
os.File.Read
behaves compared torice.File.Read
.I would like to also thank you for go.rice, we are using it successfully in the arduino-cli.