Menu

#46 'make install' doesn't set correct permissions on /usr/local/var/run/lirc/lircd

1.0
closed
None
fixed,
2014-11-18
2014-09-07
No

I see that the default permission in lirc_options.conf is 666.

However, when I run make install, I get:

% sudo make install
[…]
% ls -l /usr/local/var/run/lirc/
total 0
prw-r--r--. 1 root root 0 Sep 6 17:08 lircd
prw-r--r--. 1 root root 0 Sep 6 17:08 lircm

If I delete these files and then restart lircd, it creates a new file with r/w permissions for all. Like so:

% sudo rm /usr/local/var/run/lirc/*
% sudo killall lircd
% sudo /usr/local/sbin/lircd
% ls -l /usr/local/var/run/lirc/
total 0
srw-rw-rw-. 1 root root 0 Sep 6 17:13 lircd

Then I can run irw without needing root permissions.

Here's a patch:

diff --git a/daemons/Makefile.am b/daemons/Makefile.am
index 69f9fe2..75055ce 100644
--- a/daemons/Makefile.am
+++ b/daemons/Makefile.am
@@ -38,18 +38,18 @@ endif
mkdev:
-test -e $(DESTDIR)$(varrundir)/$(PACKAGE)/lircd || \ ($(mkinstalldirs) $(DESTDIR)$(varrundir)/lirc && \ - @mknod@ $(DESTDIR)$(varrundir)/$(PACKAGE)/lircd p)
+ @mknod@ -m 666 $(DESTDIR)$(varrundir)/$(PACKAGE)/lircd p)
-test -e $(DESTDIR)$(varrundir)/$(PACKAGE)/lircm ||\ ($(mkinstalldirs) $(DESTDIR)$(varrundir)/lirc && \ - @mknod@ $(DESTDIR)$(varrundir)/$(PACKAGE)/lircm p)
+ @mknod@ -m 666 $(DESTDIR)$(varrundir)/$(PACKAGE)/lircm p)

mkfifo:
-test -e $(DESTDIR)$(varrundir)/$(PACKAGE)/lircd || \ ($(mkinstalldirs) $(DESTDIR)$(varrundir)/lirc && \ - @mkfifo@ $(DESTDIR)$(varrundir)/$(PACKAGE)/lircd)
+ @mkfifo@ -m 666 $(DESTDIR)$(varrundir)/$(PACKAGE)/lircd)
-test -e $(DESTDIR)$(varrundir)/$(PACKAGE)/lircm || \ ($(mkinstalldirs) $(DESTDIR)$(varrundir)/lirc && \ - @mkfifo@ $(DESTDIR)$(varrundir)/$(PACKAGE)/lircm)
+ @mkfifo@ -m 666 $(DESTDIR)$(varrundir)/$(PACKAGE)/lircm)

rmdev:
rmfifo:

EDIT: format patch

Discussion

  • Alec Leamas

    Alec Leamas - 2014-09-09

    Hm... the question about what the "correct permissions" are is actually not that simple.

    First, the "permissions" options explicitly does not apply on a socket that already exists. This is as it should be, and documented in the manpage.

    Secondly, how should we create these sockets form the Makefile? Looking at [tickets:#12] it seems that creating 666 sockets in system directories like /var probably is a bad idea. We would need some kind of specific permissions e. g., using a group.

    Unless there is more input on this I feel like closing this bug with a reference to [tickets:#12]. Basically, we do need an overhaul to make it feasible to run lircd as a regular user, but this patch might be too simple.

     

    Related

    Tickets: #12

  • Eric Anderson

    Eric Anderson - 2014-09-09

    Just to clarify, with the sockets created this way by the Makefile, 'irw' (and presumably other clients) couldn't connect running as a non-priveleged user. So a clean install wasn't usable.

    Interestingly, when I used a modified lirc.spec under FC-21, the install was fine. Perhaps the rpm packaging didn't bother installing these? Maybe 'make install' could also skip them?

     
  • Alec Leamas

    Alec Leamas - 2014-09-09

    At a second thought I realize that the discussion on permissions in #12 is irrelevant here; that only is about the kernel devices.

    So, indeed, why do the Makefile create these fifos if lircd/lircmd creates if it doesn't exist? At a glance, it looks like we can remove them (which, BTW, are the source of much installation messiness).

    One factor is systemd, which actually creates the .../lircd socket internally, only handling the open file descriptor to lircd app.

    The more I think about we could probably just remove these. But let's have a night's sleep or so before actually doing it

    EDIT: On a sidenote, when packaging it's really the packagers which handles things like installation of devices, permissions etc. On Fedora, at one point /var was actually /run/var which means that all devices was cleared on boot. IIRC, this change has since then been reverted, though (?)

     

    Last edit: Alec Leamas 2014-09-09
  • Alec Leamas

    Alec Leamas - 2014-10-07
    • status: open --> closed
     
  • Alec Leamas

    Alec Leamas - 2014-10-07

    Fixed in [7ec050], closing

     

    Related

    Commit: [7ec050]

  • Alec Leamas

    Alec Leamas - 2014-11-18
    • Resolution: --> fixed,
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.