Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Saul Wold <sgw@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 2/2] btrfs: patch to allow for relative paths
Date: Tue, 11 Mar 2014 09:48:41 -0700	[thread overview]
Message-ID: <1394556521-16893-2-git-send-email-sgw@linux.intel.com> (raw)
In-Reply-To: <1394556521-16893-1-git-send-email-sgw@linux.intel.com>

This seems to address the btrfs image failure

[YOCTO #5146]

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 .../btrfs-tools/allow-relative-path.patch          | 58 ++++++++++++++++++++++
 .../btrfs-tools/btrfs-tools_git.bb                 |  4 +-
 2 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/allow-relative-path.patch

diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools/allow-relative-path.patch b/meta/recipes-devtools/btrfs-tools/btrfs-tools/allow-relative-path.patch
new file mode 100644
index 0000000..9cd64a5
--- /dev/null
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools/allow-relative-path.patch
@@ -0,0 +1,58 @@
+From: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
+
+The bug accurs when exec:
+	# mkfs.btrfs -r <a relative path> <device>
+	(note: the path should be 'valid' correspond to your `pwd`)
+error msg:
+	$ scandir for <a relative path> failed: No such file...
+
+Replace strdup() with realpath() to get the correct scan path.
+
+Upstream-Status: Backport (pending)
+
+Reported-by: Saul Wold <sgw@linux.intel.com>
+Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
+---
+ mkfs.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/mkfs.c b/mkfs.c
+index 2dc90c2..1bd3069 100644
+--- a/mkfs.c
++++ b/mkfs.c
+@@ -756,6 +756,7 @@ static int traverse_directory(struct btrfs_trans_handle *trans,
+ 	ino_t parent_inum, cur_inum;
+ 	ino_t highest_inum = 0;
+ 	char *parent_dir_name;
++	char real_path[PATH_MAX];
+ 	struct btrfs_path path;
+ 	struct extent_buffer *leaf;
+ 	struct btrfs_key root_dir_key;
+@@ -764,7 +765,7 @@ static int traverse_directory(struct btrfs_trans_handle *trans,
+ 	/* Add list for source directory */
+ 	dir_entry = malloc(sizeof(struct directory_name_entry));
+ 	dir_entry->dir_name = dir_name;
+-	dir_entry->path = strdup(dir_name);
++	dir_entry->path = realpath(dir_name, real_path);
+ 
+ 	parent_inum = highest_inum + BTRFS_FIRST_FREE_OBJECTID;
+ 	dir_entry->inum = parent_inum;
+@@ -876,7 +877,6 @@ static int traverse_directory(struct btrfs_trans_handle *trans,
+ 		}
+ 
+ 		free_namelist(files, count);
+-		free(parent_dir_entry->path);
+ 		free(parent_dir_entry);
+ 
+ 		index_cnt = 2;
+@@ -887,7 +887,6 @@ static int traverse_directory(struct btrfs_trans_handle *trans,
+ fail:
+ 	free_namelist(files, count);
+ fail_no_files:
+-	free(parent_dir_entry->path);
+ 	free(parent_dir_entry);
+ 	return -1;
+ }
+-- 
+1.8.1.4
+
diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools_git.bb b/meta/recipes-devtools/btrfs-tools/btrfs-tools_git.bb
index 7ecce60..8129cd5 100644
--- a/meta/recipes-devtools/btrfs-tools/btrfs-tools_git.bb
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools_git.bb
@@ -14,7 +14,9 @@ DEPENDS = "util-linux attr e2fsprogs lzo acl"
 
 SRCREV = "8cae1840afb3ea44dcc298f32983e577480dfee4"
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git \
-           file://weak-defaults.patch"
+           file://weak-defaults.patch \
+           file://allow-relative-path.patch \
+          "
 
 S = "${WORKDIR}/git"
 
-- 
1.8.3.1



      reply	other threads:[~2014-03-11 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 16:48 [PATCH 1/2 v2] bind: Update to 9.9.5 Saul Wold
2014-03-11 16:48 ` Saul Wold [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394556521-16893-2-git-send-email-sgw@linux.intel.com \
    --to=sgw@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox