Bug 192743 - games/nethack34-nox11: Cannot run the game as non-root user
Summary: games/nethack34-nox11: Cannot run the game as non-root user
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: Greg Lewis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-17 14:21 UTC by ports
Modified: 2015-02-22 19:01 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ports 2014-08-17 14:21:38 UTC
Running nethack-nox11 (installed via pkg) as any user, except for root, makes the game exit with the error:
    "No write permission to lock perm!"

THE CAUSE OF THE PROBLEM:
-------------------------

The game is trying to create a lockfile (named "alock.$NUM") in "/usr/local/share/nethack/".

That directory, however, is owned by root:wheel, and not root:games; furthermore, it is not writable by group.

POSSIBLE SOLUTION:
------------------

I believe the best solution is to have nethack write the lockfile in "/var/games/" instead (which has the correct group and permissions) --- that directory is currently unused. I suspect it was intended for that purpose in the first place.

---

In case anyone else has this problem: a temporary solution is to do the following:

    chgrp games /usr/local/share/nethack
    chmod g+w /usr/local/share/nethack

This will ensure the game can create lockfiles in said directory. The user does *NOT* need to be added to the `games` group (/usr/local/share/nethack/nethack has the setgid bit set).
Comment 1 ports 2014-08-17 14:25:11 UTC
I forgot to note that games/nethack34 (as in, the variant *with* X11) has the same problem in CLI mode --- but I haven't tried it in graphical mode.
Comment 2 Tilman Keskinoz freebsd_committer freebsd_triage 2014-08-17 15:20:33 UTC
over to maintainer
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-02-22 18:59:32 UTC
A commit references this bug:

Author: glewis
Date: Sun Feb 22 18:58:38 UTC 2015
New revision: 379621
URL: https://svnweb.freebsd.org/changeset/ports/379621

Log:
  . Fix permissions on DATADIR

  PR:		192743

Changes:
  head/games/nethack34/pkg-plist
Comment 4 Greg Lewis freebsd_committer freebsd_triage 2015-02-22 19:01:38 UTC
Sorry for not fixing this earlier.