[SCM] lash/master-experimental: Add patch 06 to fix load projects from JFS (and other filesystems).

js at users.alioth.debian.org js at users.alioth.debian.org
Sat Mar 12 13:53:50 UTC 2011


The following commit has been merged in the master-experimental branch:
commit 712b17ae4bd0accf83dcb8dff7791e94e8e90f6b
Author: Jonas Smedegaard <dr at jones.dk>
Date:   Sat Mar 12 14:24:00 2011 +0100

    Add patch 06 to fix load projects from JFS (and other filesystems).

diff --git a/debian/patches/06_portable_fs_check.patch b/debian/patches/06_portable_fs_check.patch
new file mode 100644
index 0000000..29bf8d3
--- /dev/null
+++ b/debian/patches/06_portable_fs_check.patch
@@ -0,0 +1,101 @@
+Author: Dan Muresan
+Description: Fix load projects from JFS (and other filesystems)
+ lashd doesn't restore projects from JFS filesystems upon startup.
+ .
+ This is because the code uses an unreliable, non-portable check for
+ dirent.d_type == DT_DIR, which fails on many filesystems, causing lashd
+ to think that the project directories are not, in fact, directories.
+ .
+ This patch uses stat / S_ISDIR to properly check dentries (and fixes a
+ similar problem with the lashd "appdb").
+ .
+ Note, not only JFS is affected. From the readdir() manpage:
+ .
+ Currently, only some file systems (among them: Btrfs, ext2, ext3, and
+ ext4) have full support returning the file type in d_type. All
+ applications must properly handle a return of DT_UNKNOWN.
+ .
+ So, XFS, Reiser, Fuse, and whatever comes in the future might all be
+ affected (sorry, can't check).
+Origin: Ubuntu, https://launchpad.net/bugs/730633
+--- a/lashd/appdb.c
++++ b/lashd/appdb.c
+@@ -22,7 +22,9 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/types.h>
++#include <sys/stat.h>
+ #include <dirent.h>
++#include <errno.h>
+ #include <assert.h>
+ 
+ #include "appdb.h"
+@@ -511,18 +513,25 @@
+ 	{
+ 		while ((dentry_ptr = readdir(dir)) != NULL)
+ 		{
+-			if (dentry_ptr->d_type != DT_REG)
++			struct stat statbuf;
++			if (!suffix_match(dentry_ptr->d_name, ".desktop"))
+ 			{
+ 				continue;
+ 			}
+ 
+-			if (!suffix_match(dentry_ptr->d_name, ".desktop"))
++			file_path = lash_catdup(directory_path, dentry_ptr->d_name);
++			if (stat (file_path, &statbuf) != 0)
+ 			{
++				lash_error ("Cannot stat '%s': %s",
++				            file_path, strerror (errno));
++				free(file_path);
++				continue;
++			}
++			if (! S_ISREG (statbuf.st_mode))
++			{
++				free(file_path);
+ 				continue;
+ 			}
+-
+-			file_path = lash_catdup(directory_path, dentry_ptr->d_name);
+-
+ 			if (!lash_appdb_load_file(appdb, file_path))
+ 			{
+ 				free(file_path);
+--- a/lashd/project.c
++++ b/lashd/project.c
+@@ -1158,6 +1158,7 @@
+ 	char *filename = NULL;
+ 	xmlNodePtr projectnode, xmlnode;
+ 	xmlChar *content = NULL;
++	struct stat statbuf;
+ 
+ 	project = project_new();
+ 
+@@ -1166,7 +1167,14 @@
+ 	lash_strset(&project->name, project_dir);
+ 
+ 	project->directory = lash_dup_fqn(parent_dir, project_dir);
+-
++	if (stat (project->directory, &statbuf) != 0)
++	{
++		lash_error ("Cannot stat '%s': %s",
++		            project->directory, strerror (errno));
++		goto fail;
++	}
++	if (! S_ISDIR (statbuf.st_mode))
++		goto fail;
+ 	if (!project_update_last_modify_time(project))
+ 	{
+ 		goto fail;
+--- a/lashd/server.c
++++ b/lashd/server.c
+@@ -176,9 +176,6 @@
+ 	}
+ 
+ 	while ((dentry = readdir(dir))) {
+-		if (dentry->d_type != DT_DIR)
+-			continue;
+-
+ 		/* Skip . and .. */
+ 		if (dentry->d_name[0] == '.')
+ 			continue;
diff --git a/debian/patches/series b/debian/patches/series
index 196729c..d74fe61 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 # 03_netdb.patch
 04_disable_stacktrace.patch
 05_missing_include.patch
+06_portable_fs_check.patch

-- 
lash packaging



More information about the pkg-multimedia-commits mailing list