-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Implement linkage for Linux #3517
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
Conversation
Library/Homebrew/os/linux/elf.rb
Outdated
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.
The above two lines aren't particularly obvious in what they are doing. Can you add a comment and then we can hopefully figure out how to make them more readable?
Library/Homebrew/os/linux/elf.rb
Outdated
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.
I'd say pretty much every number in this file should be a constant explaining what it means otherwise they are a bit "magic".
Library/Homebrew/os/linux/elf.rb
Outdated
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.
Is StandardError not the default for raise? I can't remember. Also, make this message no more than 80 characters or use <<~EOS`
Library/Homebrew/os/linux/elf.rb
Outdated
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.
Don't know what LDD_RX means
Library/Homebrew/os/linux/elf.rb
Outdated
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.
A Metadata.new shouldn't be modifying files.
Library/Homebrew/os/linux/elf.rb
Outdated
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.
This regex is repeated so consider making it a constant
Library/Homebrew/os/linux/elf.rb
Outdated
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.
This doesn't need to be a regex.
Library/Homebrew/os/linux/elf.rb
Outdated
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.
This doesn't need to be a regex.
Library/Homebrew/os/linux/elf.rb
Outdated
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.
Can probably just make this (*)
40668f6 to
1af0516
Compare
|
Thanks for the feedback, Mike. I've addressed your comments. |
69baaf6 to
4cfe957
Compare
MikeMcQuaid
left a comment
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.
Looking much better! A few more nits, thanks.
Library/Homebrew/os/linux/elf.rb
Outdated
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.
MAGIC_NUMBER_OFFSET
Library/Homebrew/os/linux/elf.rb
Outdated
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.
Use MAGIC_NUMBER.size
Library/Homebrew/os/linux/elf.rb
Outdated
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.
OS_ABI_OFFSET
Library/Homebrew/os/linux/elf.rb
Outdated
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.
Use OSABI_LINUX.to_s.size
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.
I've added a read_uint8 helper function.
Library/Homebrew/os/linux/elf.rb
Outdated
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.
Use TYPE_EXECUTABLE.to_s.size
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.
These are not equivalent.
TYPE_EXECUTABLE.to_s.size ≠ TYPE_SIZE
TYPE_EXECUTABLE.to_s.size = 1
TYPE_SIZE = 2
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.
I've added a read_uint16 helper function.
Library/Homebrew/os/linux/elf.rb
Outdated
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.
.first rather than [0]
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.
os_abi
Library/Homebrew/os/linux/elf.rb
Outdated
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.
.first rather than [0]
Library/Homebrew/os/linux/elf.rb
Outdated
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.
[OSABI_SYSTEM_V, OSABI_LINUX].include?(osabi)
Library/Homebrew/os/linux/elf.rb
Outdated
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.
.first rather than [0]
Library/Homebrew/os/linux/elf.rb
Outdated
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.
Stick a newline after each return; makes this easier to follow/scan (and consider doing this elsewhere in the file).
|
Fixed. Thanks again for the feedback, Mike. |
|
Thanks again @sjackman! |
|
@sjackman Merging this because there's been a lot of back and forth but ideally we'd get some tests to cover a bit more of the diff, here. Can do that in follow-up PR. |
|
It looks as though Codecov doesn't count lines-of-code as covered that are covered by tests that run only on Linux. Is that the case? |
|
Thanks for merging, Mike! |
@sjackman Correct. If we can figure out a way to upload and combine the coverage that would be good. @reitermarkus looked at this before I think; any thoughts Markus? |
extend/pathname: Add os/linux/elf.rb
brew testswith your changes locally?