Skip to content

Conversation

@sjackman
Copy link
Contributor

@sjackman sjackman commented Dec 2, 2017

extend/pathname: Add os/linux/elf.rb

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew tests with your changes locally?

Copy link
Member

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?

Copy link
Member

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".

Copy link
Member

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`

Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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 (*)

@sjackman sjackman force-pushed the linkage branch 2 times, most recently from 40668f6 to 1af0516 Compare December 3, 2017 07:32
@sjackman
Copy link
Contributor Author

sjackman commented Dec 3, 2017

Thanks for the feedback, Mike. I've addressed your comments.

@sjackman sjackman force-pushed the linkage branch 3 times, most recently from 69baaf6 to 4cfe957 Compare December 3, 2017 08:09
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a 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.

Copy link
Member

Choose a reason for hiding this comment

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

MAGIC_NUMBER_OFFSET

Copy link
Member

Choose a reason for hiding this comment

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

Use MAGIC_NUMBER.size

Copy link
Member

Choose a reason for hiding this comment

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

OS_ABI_OFFSET

Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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

Copy link
Contributor Author

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.sizeTYPE_SIZE
TYPE_EXECUTABLE.to_s.size = 1
TYPE_SIZE = 2

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

.first rather than [0]

Copy link
Member

Choose a reason for hiding this comment

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

os_abi

Copy link
Member

Choose a reason for hiding this comment

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

.first rather than [0]

Copy link
Member

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)

Copy link
Member

Choose a reason for hiding this comment

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

.first rather than [0]

Copy link
Member

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).

@sjackman
Copy link
Contributor Author

sjackman commented Dec 4, 2017

Fixed. Thanks again for the feedback, Mike.

@MikeMcQuaid MikeMcQuaid merged commit 4f5e938 into Homebrew:master Dec 4, 2017
@MikeMcQuaid
Copy link
Member

Thanks again @sjackman!

@MikeMcQuaid
Copy link
Member

@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.

@sjackman sjackman deleted the linkage branch December 4, 2017 17:40
@sjackman
Copy link
Contributor Author

sjackman commented Dec 4, 2017

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?
https://codecov.io/gh/Homebrew/brew/compare/0ad42ebbcb735422612a7c6d4edc5ad88044dd4b...d79c5ade1abaad0fb1ea88f2b949def8dcfddb81/diff#diff-TGlicmFyeS9Ib21lYnJldy9vcy9saW51eC9lbGYucmI=

@sjackman
Copy link
Contributor Author

sjackman commented Dec 4, 2017

Thanks for merging, Mike!

@MikeMcQuaid
Copy link
Member

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?

@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?

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants