NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/43963: libsa cd9660.c pathname lookup problem
The following reply was made to PR kern/43963; it has been noted by GNATS.
From: Wolfgang Solfrank <Wolfgang%Solfrank.net@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>,
kern-bug-people%netbsd.org@localhost,
gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost,
minoura%smtp.minoura.org@localhost
Subject: Re: kern/43963: libsa cd9660.c pathname lookup problem
Date: Wed, 13 Oct 2010 15:50:08 +0200
This is a multi-part message in MIME format.
--------------010805080108070801080104
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi again,
so I looked closer at the problem. Turns out that it's got nothing
to do with the order of the path table entries, which is generated
correctly by both mkisofs and makefs.
The problem is that the code doesn't handle the very first entry in
the path table, i.e. the entry for the root directory, correctly.
The attached patch fixes this. While here, it also fixes a minor
bug, where the old code (would it have worked) would not allow multiple
path separators betwween directory entries, i.e. it would not find
i386///binary/kernel//netbsd_install_floppy.gz.
As a minor nit to the original PR, the instructions in How-to-Repeat
can't work anyway, as the 9660 boot code currently only supports
original 9660 filenames (albeit allowing for lower/upper case conversion)
which doesn't allow the '-' character in filenames. You have to type
boot i386/binary/kernel/netbsd_INSTALL_FLOPPY.gz
to get the desired kernel (works, of course, only with the patch applied.)
Ciao,
Wolfgang
--
Wolfgang%Solfrank.net@localhost Wolfgang Solfrank
--------------010805080108070801080104
Content-Type: text/plain;
name="diffs"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="diffs"
Index: sys/lib/libsa/cd9660.c
===================================================================
RCS file: /cvsroot/src/sys/lib/libsa/cd9660.c,v
retrieving revision 1.25
diff -u -r1.25 cd9660.c
--- sys/lib/libsa/cd9660.c 22 Mar 2010 16:57:54 -0000 1.25
+++ sys/lib/libsa/cd9660.c 13 Oct 2010 13:24:42 -0000
@@ -190,19 +190,25 @@
goto out;
}
- parent = 1;
pp = (struct ptable_ent *)buf;
- ent = 1;
+ /*
+ * The first entry is always the root directory.
+ * Since this has a special name in it, handle it separately.
+ */
+ parent = 1;
bno = isonum_732(pp->block) + isonum_711(pp->extlen);
+ pp = (struct ptable_ent *)((char *)pp + PTSIZE(pp));
+ ent = 2;
rc = ENOENT;
- /*
- * Remove extra separators
- */
- while (*path == '/')
- path++;
while (*path) {
+ /*
+ * Remove extra separators
+ */
+ while (*path == '/')
+ path++;
+
if ((char *)pp >= (char *)buf + psize)
break;
if (isonum_722(pp->parent) != parent)
@@ -212,7 +218,7 @@
ent++;
continue;
}
- path += isonum_711(pp->namlen) + 1;
+ path += isonum_711(pp->namlen);
parent = ent;
bno = isonum_732(pp->block) + isonum_711(pp->extlen);
while ((char *)pp < (char *)buf + psize) {
--------------010805080108070801080104--
Home |
Main Index |
Thread Index |
Old Index