Skip to content

Instantly share code, notes, and snippets.

@manoj23
Last active April 20, 2016 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj23/3683f5307012296e56829ac8efe7e405 to your computer and use it in GitHub Desktop.
Save manoj23/3683f5307012296e56829ac8efe7e405 to your computer and use it in GitHub Desktop.
Archlinux packaging of ckermit and the lock directory issue

Archlinux packaging of ckermit and the lock directory issue

The current situation

ckermit uses the default /var/lock folder which is "rwxr-xr-x 5 root root". ckermit is patched to handle the environment variable LOCK_DIR to specifiy another lock directory. Archlinux no longer provides the lock directory /var/lock/lockdev to allow users in the lock group to read/write into it.

What I suggest

Archlinux should put back the folder /var/lock/lockdev which would be: "drwxrwxr-x 2 root lock": it is unclear why they have removed it. The filesystem package should be patched to install the file lockdev.conf (see attached file) in /etc/tmpfiles.d/.

ckermit should not include the LOCK_DIR patch but should be hard-compiled with the right lock directory. The ckermit package should be patched to remove the LOCK_DIR patch and hard-compile the lock directory to /var/lock/lockdev:

From 8b53966a88701e41807c374169bfc52fa6d449a4 Mon Sep 17 00:00:00 2001
From: Georges Savoundararadj <savoundg@gmail.com>
Date: Fri, 9 Oct 2015 23:29:16 -0700
Subject: [PATCH] ckermit: set lock directory to /var/lock/lockdev

ckermit should use the lock directory /var/lock/lockdev
which is read/write for the users in the group lock.
By default, it uses /var/lock which is wrong.

Also, this commit removes the patch that adds the support
for the environment variable LOCK_DIR because it became
unnecessary.
---
 ckermit/trunk/PKGBUILD      | 11 ++++-------
 ckermit/trunk/lockdir.patch | 48 ---------------------------------------------
 2 files changed, 4 insertions(+), 55 deletions(-)
 delete mode 100644 ckermit/trunk/lockdir.patch

diff --git a/ckermit/trunk/PKGBUILD b/ckermit/trunk/PKGBUILD
index 00cbc68..ebdd1ab 100644
--- a/ckermit/trunk/PKGBUILD
+++ b/ckermit/trunk/PKGBUILD
@@ -12,21 +12,18 @@ arch=('i686' 'x86_64')
 license=('custom')
 depends=('ncurses')
 url="http://www.columbia.edu/kermit/ck90.html"
-#source=('ftp://kermit.columbia.edu/kermit/archives/cku302.tar.gz' 'lockdir.patch')
-source=('ftp://ftp.kermitproject.org/kermit/archives/cku302.tar.gz'
-	'lockdir.patch')
-md5sums=('eac4dbf18b45775e4cdee5a7c74762b0'
-         '5968e55dd472b2efb0e31cb3a6fb1655')
+#source=('ftp://kermit.columbia.edu/kermit/archives/cku302.tar.gz')
+source=('ftp://ftp.kermitproject.org/kermit/archives/cku302.tar.gz')
+md5sums=('eac4dbf18b45775e4cdee5a7c74762b0')
 
 prepare() {
   cd $srcdir
   chmod -R og-rwx ./
-  patch -p1 < lockdir.patch
 }
 
 build() {
   cd $srcdir
-  make linux
+  make linux KFLAGS=-DLOCK_DIR=\\\\\\\\\\\\\\\"/var/lock/lockdev\\\\\\\\\\\\\\\"
   echo "#!/usr/bin/ckermit" > _tmp.ini
   cat ckermit.ini >> _tmp.ini
 }
diff --git a/ckermit/trunk/lockdir.patch b/ckermit/trunk/lockdir.patch
deleted file mode 100644
index 55b4cd6..0000000
--- a/ckermit/trunk/lockdir.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-commit f956d739e9b1451eff1592fa640358877dcf958c
-Author: Samuel Tardieu <sam@rfc1149.net>
-Date:   Thu Jul 19 20:53:24 2012 +0200
-
-    Use LOCK_DIR environment variable if defined instead of /var/lock
-
-diff --git a/ckutio.c b/ckutio.c
-index 05564de..14b11cd 100644
---- a/ckutio.c
-+++ b/ckutio.c
-@@ -4971,6 +4971,11 @@ ttglckdir() {				/* Get Lockfile directory name */
- #endif /* __OpenBSD__ */
- }
- 
-+char *get_lockdir() {
-+  char *lockdir = getenv("LOCK_DIR");
-+  return lockdir ? lockdir : LOCK_DIR;
-+}
-+
- static int
- ttlock(ttdev) char *ttdev; {
- 
-@@ -5077,8 +5082,7 @@ ttlock(ttdev) char *ttdev; {
-     char symlock[LFNAML];		/* Name for symlink lockfile name */
- #endif /* CKSYMLINK */
-     char tmpnam[LFNAML+30];		/* Temporary lockfile name. */
--    char *lockdir = LOCK_DIR;		/* Defined near top of this file, */
--					/* or on cc command line. */
-+    char *lockdir = get_lockdir();
-     haslock = 0;                        /* Not locked yet. */
-     *flfnam = '\0';			/* Lockfile name is empty. */
-     lock2[0] = '\0';			/* Clear secondary lockfile name. */
-diff --git a/ckuus4.c b/ckuus4.c
-index 946603a..ba9afaf 100644
---- a/ckuus4.c
-+++ b/ckuus4.c
-@@ -13882,8 +13882,9 @@ nvlook(s) char *s; {
- #ifdef UNIX
-       case VN_LCKDIR: {
- #ifndef NOUUCP
--          extern char * uucplockdir;
--          ckstrncpy(vvbuf,uucplockdir,VVBUFL);
-+	  extern char *get_lockdir();
-+	  char * lockdir = get_lockdir();
-+          ckstrncpy(vvbuf,lockdir,VVBUFL);
-           x = strlen(vvbuf);
-           if (x > 0) {
-               if (vvbuf[x-1] != '/') {
-- 
2.6.1

Source:

# See tmpfiles.d(5) for details
d /run/lock/lockdev 0775 root lock -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment