[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#783884: jessie-pu: package cwm/5.5-1



Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian.org@packages.debian.org
Usertags: pu

This is a backport of a patch to fix lookups on XFS and other
filesystems which don't populate d_type in struct dirent. The effect of
this bug is that using the 'exec' or 'wm' functions in cwm can't search
for executables. The fix is to add a test using lstat() where the
existing test fails. The debdiff is attached.

-- System Information:
Debian Release: 8.0
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/12 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru cwm-5.5/debian/changelog cwm-5.5/debian/changelog
--- cwm-5.5/debian/changelog	2015-04-30 23:04:09.000000000 +0200
+++ cwm-5.5/debian/changelog	2015-04-30 23:04:47.000000000 +0200
@@ -1,3 +1,10 @@
+cwm (5.5-1+deb8u1) stable; urgency=low
+
+  * Fix "Lookups for 'exec' and 'wm' fail on XFS" by adding an extra check
+    using lstat() if the d_type check fails (Closes: #783588)
+
+ -- James McDonald <james@jamesmcdonald.com>  Thu, 30 Apr 2015 08:05:25 +0200
+
 cwm (5.5-1) unstable; urgency=low
 
   * Initial release (Closes: #505924)
diff -Nru cwm-5.5/debian/patches/lstat-check cwm-5.5/debian/patches/lstat-check
--- cwm-5.5/debian/patches/lstat-check	1970-01-01 01:00:00.000000000 +0100
+++ cwm-5.5/debian/patches/lstat-check	2015-04-30 23:04:47.000000000 +0200
@@ -0,0 +1,39 @@
+From: James McDonald <james@jamesmcdonald.com>
+Description: Fix 'exec' lookups for filesystems which don't support d_type.
+ Lookups in kbfunc_exec fail on filesystems where the d_type field of
+ struct dirent is not populated, such as XFS. This patch adds an additional
+ test with lstat(2) if the initial test fails.
+--- a/kbfunc.c
++++ b/kbfunc.c
+@@ -236,6 +236,7 @@
+ 	struct menu		*mi;
+ 	struct menu_q		 menuq;
+ 	int			 l, i, cmd = arg->i;
++	struct stat		sb;
+ 
+ 	switch (cmd) {
+ 	case CWM_EXEC_PROGRAM:
+@@ -266,15 +267,20 @@
+ 			continue;
+ 
+ 		while ((dp = readdir(dirp)) != NULL) {
+-			/* skip everything but regular files and symlinks */
+-			if (dp->d_type != DT_REG && dp->d_type != DT_LNK)
+-				continue;
+ 			(void)memset(tpath, '\0', sizeof(tpath));
+ 			l = snprintf(tpath, sizeof(tpath), "%s/%s", paths[i],
+ 			    dp->d_name);
+ 			/* check for truncation etc */
+ 			if (l == -1 || l >= (int)sizeof(tpath))
+ 				continue;
++			/* skip everything but regular files and symlinks */
++			if (dp->d_type != DT_REG && dp->d_type != DT_LNK) {
++				/* use an additional stat-based check in case d_type isn't supported */
++				if (lstat(tpath, &sb) < 0)
++					continue;
++				if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))
++					continue;
++			}
+ 			if (access(tpath, X_OK) == 0)
+ 				menuq_add(&menuq, NULL, "%s", dp->d_name);
+ 		}
diff -Nru cwm-5.5/debian/patches/series cwm-5.5/debian/patches/series
--- cwm-5.5/debian/patches/series	2015-04-30 23:04:09.000000000 +0200
+++ cwm-5.5/debian/patches/series	2015-04-30 23:04:47.000000000 +0200
@@ -3,3 +3,4 @@
 support-external-cflags
 rename-cwm
 change-default-binaries
+lstat-check

Reply to: