Bug 240770 - editors/hnb: Fixes runtime segfaults in amd64 platform
Summary: editors/hnb: Fixes runtime segfaults in amd64 platform
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dmitry Marakasov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-23 12:57 UTC by Santhosh Raju
Modified: 2019-10-31 18:56 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (amdmi3)
fox: maintainer-feedback? (amdmi3)


Attachments
Patch to fix runtime segfaults in amd64 platform (74.56 KB, patch)
2019-09-23 12:57 UTC, Santhosh Raju
no flags Details | Diff
Patch to fix runtime segfaults in amd64 platform (2.09 KB, patch)
2019-09-25 15:13 UTC, Santhosh Raju
no flags Details | Diff
Patch to fix runtime segfaults in amd64 platform (1.93 KB, patch)
2019-09-26 04:48 UTC, Santhosh Raju
fox: maintainer-approval? (amdmi3)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Santhosh Raju freebsd_committer freebsd_triage 2019-09-23 12:57:30 UTC
Created attachment 207740 [details]
Patch to fix runtime segfaults in amd64 platform

I have managed to fix the runtime segfault caused when trying to run hnb in amd6 systems. This causes hnb to run normally in amd64 systems and the 

ONLY_FOR_ARCHS=        i386

Can be taken out.

The root cause of the segfaults were they were using direct 32bit pointer dereferencing which has been fixed to correctly type cast now.

I tested this out in FreeBSD 12.0-RELEASE-p10 (i386 and amd64) and noticed that it works as expected. A minor issue is in displaying unicode characters and it seems to fail at that and I do not know how to fix this at the moment.

I have attached a patch which fixes the above runtime segfault issue.

Thank you.
Comment 1 Dmitry Marakasov freebsd_committer freebsd_triage 2019-09-24 14:13:01 UTC
This is too large to be held in the ports tree, and it is useful outside of FreeBSD. Could you place it somewhere on GitHub as a proper hnb fork with proper commit history (which you try to express here as patch headers) and a version release?

Also 

cd ${WRKSRC}/src && ${GMAKE}

is incorrect, as it doesn't ignores all environment which should be set for make.
Comment 2 Santhosh Raju freebsd_committer freebsd_triage 2019-09-25 11:12:06 UTC
Let me look at the sourceforge source and see if I can copy over the repository with history correctly in git.

I shall also look into the do-build section and try to make it work as before.
Comment 3 Santhosh Raju freebsd_committer freebsd_triage 2019-09-25 15:13:12 UTC
Created attachment 207806 [details]
Patch to fix runtime segfaults in amd64 platform

I found a github[1] repository that had pretty much faithfully converted the Sourceforge repository. However it looks inactive at the moment.

I forked[2] the repository and applied the fixes as well as some other minor tweaks and tagged a v1.9.18 release.

The attached patch now pulls from this repository[2] and does a build. It also addresses the do-build section and now does build correctly.

I am happy to keep the forked repository until someone wants to take proper ownership of the project.

Let me know your thoughts on the patch and the fix.

References

1. https://github.com/Backgammon-/hnb
2. https://github.com/fraggerfox/hnb
Comment 4 Dmitry Marakasov freebsd_committer freebsd_triage 2019-09-25 21:00:48 UTC
Great! Just two more nits:
- The canonical way is to use DISTVERSIONPREFIX=v instead of GH_TAGNAME (see net/rdesktop as example)
- You could probably also merge changes done in post-patch into your repository
Comment 5 Santhosh Raju freebsd_committer freebsd_triage 2019-09-26 04:48:27 UTC
Created attachment 207834 [details]
Patch to fix runtime segfaults in amd64 platform

(In reply to Dmitry Marakasov from comment #4)

> - The canonical way is to use DISTVERSIONPREFIX=v instead of GH_TAGNAME (see net/rdesktop as example)

Done.

> - You could probably also merge changes done in post-patch into your repository

Done.

I have updated the patch to reflect the changes.
Comment 6 Santhosh Raju freebsd_committer freebsd_triage 2019-10-01 13:36:39 UTC
(In reply to Santhosh Raju from comment #5)

Ping! Do these changes look good for a commit?
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-10-31 18:51:27 UTC
A commit references this bug:

Author: amdmi3
Date: Thu Oct 31 18:50:40 UTC 2019
New revision: 516188
URL: https://svnweb.freebsd.org/changeset/ports/516188

Log:
  - Fix on amd64

  PR:		240770
  Submitted by:	fox@FreeBSD.org

Changes:
  head/editors/hnb/Makefile
  head/editors/hnb/distinfo
Comment 8 Dmitry Marakasov freebsd_committer freebsd_triage 2019-10-31 18:56:34 UTC
Sorry for delay, committed (also moved hnbrc installation under PORTEXAMPLES).