Subject: kern/2419: CD9660 fs is limited wrt badly arranged disks
To: None <gnats-bugs@NetBSD.ORG>
From: Jason Downs <downsj@teeny.org>
List: netbsd-bugs
Date: 05/15/1996 18:34:25
>Number:         2419
>Category:       kern
>Synopsis:       CD9660 fs is limited wrt badly arranged disks
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 15 22:05:01 1996
>Last-Modified:
>Originator:     Jason Downs
>Organization:
Jason Downs		   (503) 256-8535 -/- (503) 952-3749
downsj@teeny.org  --> teeny.org: Free Software for a Free Internet <--
http://www.teeny.org/
	   Powered by ... pentium/romp/sparc/ka630/68030/68020/68010
>Release:        NetBSD-current 960515
>Environment:
System: NetBSD threadway 1.1B NetBSD 1.1B (THREADWAY) #0: Wed May 15 00:11:11 PDT 1996 downsj@threadway:/usr/src/sys/arch/i386/compile/THREADWAY i386


>Description:
	This problem report replaces kern/1990.  This version of the patch
simply uses the newer libkern strncasecmp() instead of a special routine.

	I find it annoying that the original problem report seemed to have
been completely ignored...  These changes are *required* if NetBSD is to
mount certain messed up CD's in a useable manner; not supporting those
buggy disks is in itself also a major bug.

	Especially considering the extend of the changes required, which
are rather trivial; it really makes one wonder sometimes.

>How-To-Repeat:
	See kern/1990.
>Fix:
*** sys/isofs/cd9660/orig/cd9660_lookup.c	Sat Feb 10 04:32:05 1996
--- sys/isofs/cd9660/cd9660_lookup.c	Wed May 15 18:14:16 1996
***************
*** 330,338 ****
  				ino = dbtob(bp->b_blkno) + entryoffsetinblock;
  			dp->i_ino = ino;
  			cd9660_rrip_getname(ep,altname,&namelen,&dp->i_ino,imp);
! 			if (namelen == cnp->cn_namelen
! 			    && !bcmp(name,altname,namelen))
! 				goto found;
  			ino = 0;
  			break;
  		}
--- 330,343 ----
  				ino = dbtob(bp->b_blkno) + entryoffsetinblock;
  			dp->i_ino = ino;
  			cd9660_rrip_getname(ep,altname,&namelen,&dp->i_ino,imp);
! 			if (namelen == cnp->cn_namelen) {
! 				if (!(imp->im_flags & ISOFSMNT_NOCASE)
! 			    	    && !bcmp(name,altname,namelen))
! 					goto found;
! 				else if ((imp->im_flags & ISOFSMNT_NOCASE)
! 				    && !strncasecmp(name,altname,namelen))
! 				    	goto found;
! 			}
  			ino = 0;
  			break;
  		}
*** sys/sys/orig/mount.h	Sun Feb 18 04:47:30 1996
--- sys/sys/mount.h	Wed May 15 18:09:49 1996
***************
*** 300,305 ****
--- 300,306 ----
  #define	ISOFSMNT_NORRIP	0x00000001	/* disable Rock Ridge Ext.*/
  #define	ISOFSMNT_GENS	0x00000002	/* enable generation numbers */
  #define	ISOFSMNT_EXTATT	0x00000004	/* enable extended attributes */
+ #define ISOFSMNT_NOCASE 0x00000008	/* case-insensetive Rock Ridge file names */
  
  /*
   * Arguments to mount NFS
*** sbin/mount_cd9660/orig/mount_cd9660.8	Fri Oct 13 18:11:02 1995
--- sbin/mount_cd9660/mount_cd9660.8	Thu Mar  7 14:09:23 1996
***************
*** 36,42 ****
  .\"
  .\"     @(#)mount_cd9660.8	8.3 (Berkeley) 3/27/94
  .\"
! .Dd March 27, 1994
  .Dt MOUNT_CD9660 8
  .Os BSD 4
  .Sh NAME
--- 36,42 ----
  .\"
  .\"     @(#)mount_cd9660.8	8.3 (Berkeley) 3/27/94
  .\"
! .Dd January 28, 1996
  .Dt MOUNT_CD9660 8
  .Os BSD 4
  .Sh NAME
***************
*** 44,50 ****
  .Nd mount an ISO-9660 filesystem
  .Sh SYNOPSIS
  .Nm mount_cd9660
! .Op Fl egr
  .Op Fl o Ar options
  .Ar special | node
  .Sh DESCRIPTION
--- 44,50 ----
  .Nd mount an ISO-9660 filesystem
  .Sh SYNOPSIS
  .Nm mount_cd9660
! .Op Fl cegr
  .Op Fl o Ar options
  .Ar special | node
  .Sh DESCRIPTION
***************
*** 60,65 ****
--- 60,67 ----
  .Pp
  The options are as follows:
  .Bl -tag -width indent
+ .It Fl c
+ Allow Rockridge file names to be matched case-insensetively.
  .It Fl e
  Enable the use of extended attributes.
  .It Fl g
*** sbin/mount_cd9660/orig/mount_cd9660.c	Fri Oct 13 18:11:03 1995
--- sbin/mount_cd9660/mount_cd9660.c	Tue Apr 16 19:53:44 1996
***************
*** 82,89 ****
  	char *dev, *dir;
  
  	mntflags = opts = 0;
! 	while ((ch = getopt(argc, argv, "ego:r")) != EOF)
  		switch (ch) {
  		case 'e':
  			opts |= ISOFSMNT_EXTATT;
  			break;
--- 82,92 ----
  	char *dev, *dir;
  
  	mntflags = opts = 0;
! 	while ((ch = getopt(argc, argv, "cego:r")) != EOF)
  		switch (ch) {
+ 		case 'c':
+ 			opts |= ISOFSMNT_NOCASE;
+ 			break;
  		case 'e':
  			opts |= ISOFSMNT_EXTATT;
  			break;
>Audit-Trail:
>Unformatted: