lirc init script can create circular symlinks

Bug #698007 reported by Joel Ebel
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lirc (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: lirc

This is related to bug 697999 and specifically my need to work around that bug.

If, in /etc/lirc/hardware.conf, you set REMOTE_SOCKET to /dev/lircd1 and transmitter_socket to /dev/lircd, then the lirc init script will create a circular symlink loop between /dev/lircd and /dev/lircd1. The script tests if OLD_SOCKET != REMOTE_SOCKET, but it should also make sure that OLD_SOCKET != TRANSMITTER_SOCKET Additionally, before removing ${OLD_SOCKET}1 the script should do the same checks, which it currently does none.

A patch for this solution is attached.

My preference would actually to be to use the new socket locations in /var/run/lircd, however, then the the order I create those sockets is irrelevant, as the magical symlinking always symlinks /dev/lircd to the remote and /dev/lircd1 to the transmitter, which is backwards from how I need it to be. I'm not actually sure what the best fix is here. Perhaps it could just test if the socket is /var/run/lirc/lircd\d+ and if it is, then just symlink to /dev/$(basename $REMOTE_SOCKET) If this is an acceptable solution, I can probably write up a patch for this behavior if necessary. However, there may be other cases the current behavior is designed to correct for. If bug 697999 gets fixed, then this problem will no longer affect me.

Tags: patch
Revision history for this message
Joel Ebel (jbebel) wrote :
tags: added: patch
Revision history for this message
Joel Ebel (jbebel) wrote :

Note that the original patch is not directly compatible with my patch in bug 697999. Here's a new one should that patch be applied first.

Also, the original patch was against Lucid's lirc, but should apply cleanly to the current version as well.

Revision history for this message
Joel Ebel (jbebel) wrote :
Revision history for this message
Jani Monoses (jani) wrote :

Joel, thanks for the patches on this and bug 697999.
Can they be merged? I understand this was initially made as a workaround for bug 697999 .
Can you make sure they still apply against and work with the latest lirc package in natty?
This seems to be affecting Debian as well, do you have any contact with the Debian maintainers?

I subscribed myself to this bug and will check your reply.

Revision history for this message
Joel Ebel (jbebel) wrote :

The second patch included here is compatible with the patch in bug 69799, if the other patch is applied first. I can combine them into a single patch if that is preferred.

It will take me some time to re-test against natty. Is this likely to be included in natty if I do this soon? If so, I'll raise the priority of this on my todo list.

I have not been in communication with the Debian developers, as I've only tested Ubuntu packages. I can file upstream with Debian as well, but I'd like to take the time to test against Debian first, and adjust patches if necessary.

Do you have any comments regarding the magic symlinking, and if it would be safe to only do so if the socket matches /var/run/lirc/lircd\d+ and then symlink from /dev/$(basename $REMOTE_SOCKET)

Revision history for this message
Jani Monoses (jani) wrote :

I think testing with current natty is needed, so someone with test hardware can confirm it still works as intended before including.

Debian inclusion would help as then it would be synced to Ubuntu easily and we'd have no extra delta to carry or eventually send them anyway (not sure if Debian developers follow Ubuntu Lirc packaging)

Revision history for this message
Joel Ebel (jbebel) wrote :

I've tested that this patch applies cleanly to natty. I have not, and likely won't be able to, test the functionality with natty, as my two IR devices are in use in a mythtv machine I'm unwilling to reinstall with natty.

Revision history for this message
Joel Ebel (jbebel) wrote :

The current debian unstable package (0.9.0~pre1-1) doesn't contain multi-device support at all. This patch won't apply. It does mean that the debian package has significantly less functionality.

The transmitter functionality was added in 0.8.3~pre1-0ubuntu4 by Mario Limonciello <email address hidden> It would be good to get him to review the change.

Revision history for this message
Kees Cook (kees) wrote :

I've asked Mario to take a look at this bug (and 697999) to review the patch. Hopefully we can get this into Natty asap. Thanks for the work on this!

Changed in lirc (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Joel Ebel (jbebel) wrote :

Got around to setting up Precise on my mythtv box, and I'm sad to see that this bug hasn't been fixed yet. I provided a patch, which still applies cleanly to lirc in Precise.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lirc - 0.9.4c-1

---------------
lirc (0.9.4c-1) experimental; urgency=medium

  * New upstream release.
  * New tool irtext2udp.
  * Resolves build errors on kernels > 4.8.0A.
  * Most of patches upstreamed.

 -- Alec Leamas <email address hidden> Sat, 22 Oct 2016 14:52:05 +0200

Changed in lirc (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.