cr-marcstevens / sha1collisiondetection

Library and command line tool to detect SHA-1 collision in a file
Other
1.31k stars 185 forks source link

Fix BigEndian detection (hopefully permanently) #36

Closed avar closed 7 years ago

avar commented 7 years ago

The 2.13.2 git release with the latest sha1collisiondetection master still broke on Solaris SPARC. These are two commits.

The first one is a failed attempt (there seems to be no sun macro, despite what Oracle's docs say, maybe only the latest version?), it's left there for the git history.

The second one rewrites the Big Endian detection completely based on my investigations into how gcc/glibc etc. and finally Solaris have exported specific macros indicating what the endianness is over time.

This hopefully solves the Solaris bug (I've had reports from two SPARC users that it works), doesn't introduce any regressions, and makes the detection easier to understand going forward.

cr-marcstevens commented 7 years ago

Hi Avar,

It is really a complicated situation, so thanks a lot for your efforts in trying to figure this out! I'll be glad to accept your PR, but let's first wait for confirmation that this solves it and there is no regression elsewhere.

Cheers Marc

avar commented 7 years ago

@cr-marcstevens: Indeed, I think this works, but I'm not 100% sure, and nobody impacted by all these bugs we've had has access to all the platforms involved.

I've sent a patch series to the git mailing list with this PR: https://public-inbox.org/git/20170627121718.12078-1-avarab@gmail.com/

Hopefully we'll get some wider testing of this then.

avar commented 7 years ago

@cr-marcstevens : I'm confident that this should be OK as-is now, I put another cleanup commit on top for the Solaris detection.

I've tested this myself on x86_64, and had 2x testers on Solaris SPARC, and one on Cygwin (another platform that previously failed).

shumow commented 7 years ago

Fix looks good. Thank you @avar for your attention to this matter.

me-and commented 7 years ago

@avar I've not been managing to keep up with everything happening here, but per your request over at #34 I can confirm the code here seems to have everything still working when applied to Git v2.13.2.

avar commented 7 years ago

Great. Thanks a lot for testing it.

On Jul 4, 2017 18:30, "Adam Dinwoodie" notifications@github.com wrote:

@avar https://github.com/avar I've not been managing to keep up with everything happening here, but per your request over at #34 https://github.com/cr-marcstevens/sha1collisiondetection/pull/34 I can confirm the code here seems to have everything still working when applied to Git v2.13.2.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cr-marcstevens/sha1collisiondetection/pull/36#issuecomment-312915679, or mute the thread https://github.com/notifications/unsubscribe-auth/AACw9dBO8cEgsf1otFd0ZkYjCEuCULHLks5sKmilgaJpZM4OGfaU .