Bug 280494 - devel/ghidra: fix permissions
Summary: devel/ghidra: fix permissions
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Vladimir Druzenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-29 12:47 UTC by gatekeeper
Modified: 2024-08-01 17:52 UTC (History)
2 users (show)

See Also:


Attachments
git patch (924 bytes, patch)
2024-07-29 12:47 UTC, gatekeeper
no flags Details | Diff
git patch (918 bytes, patch)
2024-07-29 14:45 UTC, gatekeeper
no flags Details | Diff
git patch (885 bytes, patch)
2024-07-30 14:12 UTC, gatekeeper
no flags Details | Diff
v1 (3.72 KB, patch)
2024-07-31 14:54 UTC, Vladimir Druzenko
no flags Details | Diff
git patch (33.33 KB, patch)
2024-07-31 20:00 UTC, gatekeeper
no flags Details | Diff
patch as xz (36.52 KB, application/x-xz)
2024-07-31 20:01 UTC, gatekeeper
no flags Details
git patch (32.31 KB, patch)
2024-08-01 01:02 UTC, gatekeeper
no flags Details | Diff
patch as .tar.xz (36.26 KB, application/x-xz)
2024-08-01 01:03 UTC, gatekeeper
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description gatekeeper 2024-07-29 12:47:14 UTC
Created attachment 252349 [details]
git patch

To be able to run ghidra from the command line, some permissions need to be fixed - this patch achieves that.
Comment 1 Benjamin Takacs 2024-07-29 14:23:05 UTC
that patch seems incomplete, what if the user is neither root nor in the wheel group?
Comment 2 gatekeeper 2024-07-29 14:45:55 UTC
Created attachment 252353 [details]
git patch

Yes, you are right...
Fixed.
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2024-07-29 22:14:37 UTC
There are other scripts in share/ghidra/support: gdbGADPServerRun pythonRun bsim bsim_ctl and etc.
Comment 4 gatekeeper 2024-07-30 14:12:37 UTC
Created attachment 252370 [details]
git patch

Yes; nice catch...
With this patch, I change permissions (0555) for the executable, and shell script files.
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2024-07-30 17:05:09 UTC
(In reply to gatekeeper from comment #4)
What about python scripts?
Comment 6 gatekeeper 2024-07-30 19:22:17 UTC
(In reply to Vladimir Druzenko from comment #5)

I have not marked these python scripts as executable because, to my understanding, they are not supposed to be executed.
They are either (basic) examples of how to script ghidra using python (requires an additional package pyhidra), or internal ghidra python libraries; some of these examples are even written in python v2 and will not run out-of-the-box with v3.

Note: to be able to use the examples, an additional library might be required - pyhidra - which, to the best of my knowledge, has not been ported to FreeBSD yet...
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2024-07-31 14:54:06 UTC
Created attachment 252398 [details]
v1

Check my patch.
Comment 8 gatekeeper 2024-07-31 20:00:29 UTC
Created attachment 252406 [details]
git patch

Thanks for the patch.
I did some changes, namely:
 - removed from SHEBANG_FILES those that are related with debugging

 - added a desktop icon

 - when ghidra is run for the first time, it asks for the path to openjdk; therefore, I have created a small wrapper script (ghidraRunX) that detects if ghidra has been previously configured and, if not, starts ghidra in an xterm, so that a user has the opportunity to configure it; therefore, I also added a dependency on xterm.

 - added a pkg-message
Comment 9 gatekeeper 2024-07-31 20:01:25 UTC
Created attachment 252407 [details]
patch as xz

Same as the git patch, but also as .tar.xz
Comment 10 gatekeeper 2024-08-01 01:02:30 UTC
Created attachment 252413 [details]
git patch

removes need for xterm and properly configures JAVA_HOME using the default installed java version
Comment 11 gatekeeper 2024-08-01 01:03:51 UTC
Created attachment 252414 [details]
patch as .tar.xz

same thing as #10, but as .tar.xz
Comment 12 commit-hook freebsd_committer freebsd_triage 2024-08-01 17:50:25 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2bf3f54aafa6470ebedc2f048ea28453afc76005

commit 2bf3f54aafa6470ebedc2f048ea28453afc76005
Author:     gatekeeper <tiago.gasiba@gmail.com>
AuthorDate: 2024-08-01 17:41:53 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-08-01 17:41:53 +0000

    devel/ghidra: fix permissions be able to run ghidra from the command line

    Also:
     - remove from SHEBANG_FILES those that are related with debugging
     - add a desktop file + icon from:
       https://github.com/NationalSecurityAgency/ghidra/discussions/3709
     - add a pkg-message
     - configure JAVA_HOME using the default installed java version

    PR:     280494
    Fixes:  e2b8d2a61766 (update 9.1 → 11.1.2, take maintainership)
    MFH:    2024Q3

 devel/ghidra/Makefile                      | 49 ++++++++++++++++++++++--------
 devel/ghidra/files/ghidra.desktop.in (new) |  9 ++++++
 devel/ghidra/files/ghidra.svg (new)        |  1 +
 devel/ghidra/pkg-message (new)             |  5 +++
 devel/ghidra/pkg-plist                     |  3 +-
 5 files changed, 54 insertions(+), 13 deletions(-)
Comment 13 commit-hook freebsd_committer freebsd_triage 2024-08-01 17:52:29 UTC
A commit in branch 2024Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=af9f0c5c69cb8743f1949eb434658d2ed7e46608

commit af9f0c5c69cb8743f1949eb434658d2ed7e46608
Author:     gatekeeper <tiago.gasiba@gmail.com>
AuthorDate: 2024-08-01 17:41:53 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-08-01 17:51:26 +0000

    devel/ghidra: fix permissions be able to run ghidra from the command line

    Also:
     - remove from SHEBANG_FILES those that are related with debugging
     - add a desktop file + icon from:
       https://github.com/NationalSecurityAgency/ghidra/discussions/3709
     - add a pkg-message
     - configure JAVA_HOME using the default installed java version

    PR:     280494
    Fixes:  e2b8d2a61766 (update 9.1 → 11.1.2, take maintainership)
    MFH:    2024Q3
    (cherry picked from commit 2bf3f54aafa6470ebedc2f048ea28453afc76005)

 devel/ghidra/Makefile                      | 49 ++++++++++++++++++++++--------
 devel/ghidra/files/ghidra.desktop.in (new) |  9 ++++++
 devel/ghidra/files/ghidra.svg (new)        |  1 +
 devel/ghidra/pkg-message (new)             |  5 +++
 devel/ghidra/pkg-plist                     |  3 +-
 5 files changed, 54 insertions(+), 13 deletions(-)
Comment 14 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-01 17:52:59 UTC
Thanks.