Created attachment 3342 [details] Patch to fix crash of nash builtin "ls" command Involved package : mkinitrd-6.0.93-28.mga2.src.rpm ( and beyond ) If nash is built using flag "-DDEBUG" ( this is not very often the case ), it offers a "ls" command which crashes when the listed directory is closed. My proposal for a patch : see attachment which is an unified diff between nash.c~ ( old ) & fixed nash.c
Hi, Thanks you for reporting this bug and providing a patch. However, what's not clear is if our build of nash is affected by this bug, or only the sources for people who rebuild it with -DDEBUG. If it's only the latter, I don't think it's really necessary to patch it. We could have patched it in cauldron, but mkinitrd has been replaced by dracut.
Keywords: (none) => NEEDINFO, PATCHCC: (none) => stormi
Hi (In reply to Samuel VERSCHELDE from comment #1) > Hi, > > Thanks you for reporting this bug and providing a patch. However, what's not > clear is if our build of nash is affected by this bug, or only the sources > for people who rebuild it with -DDEBUG. The build of "nash" is not at all affected by this patch. Only the source file is. > If it's only the latter, I don't > think it's really necessary to patch it. We could have patched it in > cauldron, but mkinitrd has been replaced by dracut. Fixing this bug is not mandatory but I think it can be useful in case of a problem. I used this "nash" feature to fix the "mkinitrd" wrong behaviour.
Here's what I propose to do: I will add the patch in svn, but will not submit the package to the build system. If in the future we have to issue an update to mkinitrd then it will be fixed at the same time. Can you explain what your patch does and why it fixes the bug?
Keywords: (none) => TriagedAssignee: bugsquad => stormiSource RPM: (none) => mkinitrd
Hi (In reply to Samuel VERSCHELDE from comment #3) > Here's what I propose to do: I will add the patch in svn, but will not > submit the package to the build system. If in the future we have to issue an > update to mkinitrd then it will be fixed at the same time. > > Can you explain what your patch does and why it fixes the bug? In lsdir subroutine (between #ifdef DEBUG, #endif) this patch changes the argument of the last (I think) call to "closedir" from closedir(thedir) into closedir(dir) "closedir" requires a DIR* arg (dir is of type DIR*) but "thedir" is a char* variable (one of the arguments of "lsdir"). Obviously, calling "closedir(char *thedir)" is wrong (a real bug); this is why nash crashes. Best regards.
Looks like the bug comes from an old patch from Mandriva : [samuel@localhost SOURCES]$ cat Add-missing-closedir.patch From 1c374f3a2102601ea1510035bdf62427b1190364 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov <arvidjaar@mail.ru> Date: Mon, 15 Jun 2009 16:46:48 +0200 Subject: [PATCH] Add missing closedir Fix missing closedir preventing umount of /initrd/sys (Mandriva bug #16699) --- nash/nash.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/nash/nash.c b/nash/nash.c index d2c5517..0daf281 100644 --- a/nash/nash.c +++ b/nash/nash.c @@ -734,6 +734,7 @@ static int lsdir(char *thedir, char * prefix) printf("\n"); } } + closedir(thedir); return 0; } #endif -- 1.7.1
Fixed in SVN. Package NOT submitted to updates_testing, as I said in comment #3. Thanks for reporting.
Status: NEW => RESOLVEDResolution: (none) => FIXED