All of lore.kernel.org
 help / color / mirror / Atom feed
* mkfs.jffs2: creating dirs in /
@ 2008-06-20 15:28 Mike Frysinger
  2008-06-20 16:22 ` Grant Erickson
  2008-12-23 10:54 ` [PATCH] mkfs.jffs2: fix dir creation " Mike Frysinger
  0 siblings, 2 replies; 7+ messages in thread
From: Mike Frysinger @ 2008-06-20 15:28 UTC (permalink / raw)
  To: linux-mtd

with older mtd-utils, creating a directory in the root worked fine.
with current git, the parent dir search algo breaks this.

for example, just take the current git tree, build it up, and then run:
$ ./mkfs.jffs2 -d . -D device_table.txt -o /dev/null
mkfs.jffs2: skipping device_table entry '/dev': no parent directory!
mkfs.jffs2: skipping device_table entry '/dev/mem': no parent directory!
...
doing `mkdir dev` first works around the issue, but where's the fun in that.

locally i just made the change to interpret_table_entry() where it
looks to see if the dir is "/" and if so, uses "root" rather than
calling find_filesystem_entry(), but i dont think that's the right
long term fix.  i pondered the find_filesystem_entry() function for a
while, but the closest i found was to delete the first if statement
and then tweak the fullname[len] ...
-mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mkfs.jffs2: creating dirs in /
  2008-06-20 15:28 mkfs.jffs2: creating dirs in / Mike Frysinger
@ 2008-06-20 16:22 ` Grant Erickson
  2008-06-20 16:25   ` Mike Frysinger
  2008-12-23 10:54 ` [PATCH] mkfs.jffs2: fix dir creation " Mike Frysinger
  1 sibling, 1 reply; 7+ messages in thread
From: Grant Erickson @ 2008-06-20 16:22 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd

On 6/20/08 8:28 AM, Mike Frysinger wrote:
> with older mtd-utils, creating a directory in the root worked fine.
> with current git, the parent dir search algo breaks this.
> 
> for example, just take the current git tree, build it up, and then run:
> $ ./mkfs.jffs2 -d . -D device_table.txt -o /dev/null
> mkfs.jffs2: skipping device_table entry '/dev': no parent directory!
> mkfs.jffs2: skipping device_table entry '/dev/mem': no parent directory!
> ...
> doing `mkdir dev` first works around the issue, but where's the fun in that.
> 
> locally i just made the change to interpret_table_entry() where it
> looks to see if the dir is "/" and if so, uses "root" rather than
> calling find_filesystem_entry(), but i dont think that's the right
> long term fix.  i pondered the find_filesystem_entry() function for a
> while, but the closest i found was to delete the first if statement
> and then tweak the fullname[len] ...
> -mike

Mike,

I just submitted several patches earlier last week to fix what appears to be
a similar issue:

See:

    http://lists.infradead.org/pipermail/linux-mtd/2008-June/021997.html
    http://lists.infradead.org/pipermail/linux-mtd/2008-June/022008.html
    http://lists.infradead.org/pipermail/linux-mtd/2008-June/022058.html

Have you picked/merged up these changes from GIT?

Regards,

Grant

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mkfs.jffs2: creating dirs in /
  2008-06-20 16:22 ` Grant Erickson
@ 2008-06-20 16:25   ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2008-06-20 16:25 UTC (permalink / raw)
  To: Grant Erickson; +Cc: linux-mtd

On Fri, Jun 20, 2008 at 12:22 PM, Grant Erickson wrote:
> On 6/20/08 8:28 AM, Mike Frysinger wrote:
>> with older mtd-utils, creating a directory in the root worked fine.
>> with current git, the parent dir search algo breaks this.
>>
>> for example, just take the current git tree, build it up, and then run:
>> $ ./mkfs.jffs2 -d . -D device_table.txt -o /dev/null
>> mkfs.jffs2: skipping device_table entry '/dev': no parent directory!
>> mkfs.jffs2: skipping device_table entry '/dev/mem': no parent directory!
>> ...
>> doing `mkdir dev` first works around the issue, but where's the fun in that.
>>
>> locally i just made the change to interpret_table_entry() where it
>> looks to see if the dir is "/" and if so, uses "root" rather than
>> calling find_filesystem_entry(), but i dont think that's the right
>> long term fix.  i pondered the find_filesystem_entry() function for a
>> while, but the closest i found was to delete the first if statement
>> and then tweak the fullname[len] ...
>> -mike
>
> Mike,
>
> I just submitted several patches earlier last week to fix what appears to be
> a similar issue:
>
> See:
>
>    http://lists.infradead.org/pipermail/linux-mtd/2008-June/021997.html
>    http://lists.infradead.org/pipermail/linux-mtd/2008-June/022008.html
>    http://lists.infradead.org/pipermail/linux-mtd/2008-June/022058.html
>
> Have you picked/merged up these changes from GIT?

i'm using the very latest git.  so unless something got merged in the
last hour ...
-mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] mkfs.jffs2: fix dir creation in /
  2008-06-20 15:28 mkfs.jffs2: creating dirs in / Mike Frysinger
  2008-06-20 16:22 ` Grant Erickson
@ 2008-12-23 10:54 ` Mike Frysinger
  2008-12-26 12:38   ` Artem Bityutskiy
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2008-12-23 10:54 UTC (permalink / raw)
  To: linux-mtd

With older mtd-utils, creating a directory in the root worked fine.  With
current git, the parent dir search algo breaks this.

For example, just take the current git tree, build it up, and then run:
$ ./mkfs.jffs2 -d . -D device_table.txt -o /dev/null
mkfs.jffs2: skipping device_table entry '/dev': no parent directory!
mkfs.jffs2: skipping device_table entry '/dev/mem': no parent directory!
...
Doing `mkdir ./dev` first works around the issue, but where's the fun in
that.

I've "fixed" the issue in interpret_table_entry() by special casing the
root directory "/" and having the code return the root directory rather
than attempting to do a search for it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
i mentioned this back in June with no response:
http://lists.infradead.org/pipermail/linux-mtd/2008-June/022089.html

 mkfs.jffs2.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index 7255536..a419bb8 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -565,7 +565,10 @@ static int interpret_table_entry(struct filesystem_entry *root, char *line)
 		 * try and find our parent now) */
 		tmp = strdup(name);
 		dir = dirname(tmp);
-		parent = find_filesystem_entry(root, dir, S_IFDIR);
+		if (!strcmp(dir, "/"))
+			parent = root;
+		else
+			parent = find_filesystem_entry(root, dir, S_IFDIR);
 		free(tmp);
 		if (parent == NULL) {
 			error_msg ("skipping device_table entry '%s': no parent directory!", name);
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mkfs.jffs2: fix dir creation in /
  2008-12-23 10:54 ` [PATCH] mkfs.jffs2: fix dir creation " Mike Frysinger
@ 2008-12-26 12:38   ` Artem Bityutskiy
  2008-12-27  3:35     ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Artem Bityutskiy @ 2008-12-26 12:38 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd

On Tue, 2008-12-23 at 05:54 -0500, Mike Frysinger wrote:
> diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
> index 7255536..a419bb8 100644
> --- a/mkfs.jffs2.c
> +++ b/mkfs.jffs2.c
> @@ -565,7 +565,10 @@ static int interpret_table_entry(struct filesystem_entry *root, char *line)
>  		 * try and find our parent now) */
>  		tmp = strdup(name);
>  		dir = dirname(tmp);
> -		parent = find_filesystem_entry(root, dir, S_IFDIR);
> +		if (!strcmp(dir, "/"))
> +			parent = root;
> +		else
> +			parent = find_filesystem_entry(root, dir, S_IFDIR);
>  		free(tmp);
>  		if (parent == NULL) {
>  			error_msg ("skipping device_table entry '%s': no parent directory!", name);

I think that you should instead modify 'find_filesystem_entry()' and
make it return the root (of the tree you build the image for, AFAIU)
when you call it like 'find_filesystem_entry(root, "/", S_IFDIR)'. Looks
more logical to me.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] mkfs.jffs2: fix dir creation in /
  2008-12-26 12:38   ` Artem Bityutskiy
@ 2008-12-27  3:35     ` Mike Frysinger
  2008-12-27 12:25       ` Artem Bityutskiy
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2008-12-27  3:35 UTC (permalink / raw)
  To: linux-mtd

With older mtd-utils, creating a directory in the root worked fine.  With
current git, the parent dir search algo breaks this.

For example, just take the current git tree, build it up, and then run:
$ ./mkfs.jffs2 -d . -D device_table.txt -o /dev/null
mkfs.jffs2: skipping device_table entry '/dev': no parent directory!
mkfs.jffs2: skipping device_table entry '/dev/mem': no parent directory!
...
Doing `mkdir ./dev` first works around the issue, but where's the fun in
that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 mkfs.jffs2.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index 7255536..23a8cf8 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -273,6 +273,11 @@ static struct filesystem_entry *find_filesystem_entry(
 	struct filesystem_entry *e = dir;
 
 	if (S_ISDIR(dir->sb.st_mode)) {
+		/* If this is the first call, and we actually want this
+		 * directory, then return it now */
+		if (strcmp(fullname, e->fullname) == 0)
+			return e;
+
 		e = dir->files;
 	}
 	while (e) {
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mkfs.jffs2: fix dir creation in /
  2008-12-27  3:35     ` Mike Frysinger
@ 2008-12-27 12:25       ` Artem Bityutskiy
  0 siblings, 0 replies; 7+ messages in thread
From: Artem Bityutskiy @ 2008-12-27 12:25 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd

On Fri, 2008-12-26 at 22:35 -0500, Mike Frysinger wrote:
> With older mtd-utils, creating a directory in the root worked fine.  With
> current git, the parent dir search algo breaks this.
> 
> For example, just take the current git tree, build it up, and then run:
> $ ./mkfs.jffs2 -d . -D device_table.txt -o /dev/null
> mkfs.jffs2: skipping device_table entry '/dev': no parent directory!
> mkfs.jffs2: skipping device_table entry '/dev/mem': no parent directory!
> ...
> Doing `mkdir ./dev` first works around the issue, but where's the fun in
> that.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Pushed, thanks.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-12-27 12:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-20 15:28 mkfs.jffs2: creating dirs in / Mike Frysinger
2008-06-20 16:22 ` Grant Erickson
2008-06-20 16:25   ` Mike Frysinger
2008-12-23 10:54 ` [PATCH] mkfs.jffs2: fix dir creation " Mike Frysinger
2008-12-26 12:38   ` Artem Bityutskiy
2008-12-27  3:35     ` Mike Frysinger
2008-12-27 12:25       ` Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.