NetBSD Problem Report #44114

From tsutsui@ceres.dti.ne.jp  Thu Nov 18 15:32:51 2010
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 91FFC63BA98
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 18 Nov 2010 15:32:51 +0000 (UTC)
Message-Id: <201011181532.oAIFWmZ4006376@mirage.localdomain>
Date: Fri, 19 Nov 2010 00:32:48 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@gnats.NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: makefs(8) -t cd9660 -o rockridge creates corrupted cd9660fs
X-Send-Pr-Version: 3.95

>Number:         44114
>Category:       bin
>Synopsis:       makefs(8) -t cd9660 -o rockridge creates corrupted cd9660fs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    tsutsui
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 18 15:35:00 +0000 2010
>Closed-Date:    Sun Jul 17 02:59:14 +0000 2011
>Last-Modified:  Sun Jul 17 02:59:14 +0000 2011
>Originator:     Izumi Tsutsui
>Release:        NetBSD 5.99.39
>Organization:
>Environment:
System: NetBSD/i386 5.99.39
Architecture: i386
Machine: i386
>Description:
makefs(8) -t cd9660 -o rockridge against directories with deep structure
creates corrupted cd9660 image.

>How-To-Repeat:

% mkdir makefs
% mkdir makefs/1
% mkdir makefs/1/2
% mkdir makefs/1/2/3
% mkdir makefs/1/2/3/4
% mkdir makefs/1/2/3/4/5
% mkdir makefs/1/2/3/4/5/6
% mkdir makefs/1/2/3/4/5/6/7
% mkdir makefs/1/2/3/4/5/6/7/8
% mkdir makefs/1/2/3/4/5/6/7/8-1
% makefs -t cd9660 -o rockridge test.iso makefs
% su
# vnconfig vnd0 test.iso
# mount -t cd9660 /dev/vnd0a /mnt
# ls -lR /mnt/1
total 2
drwxr-xr-x  3 tsutsui  wheel  2048 Nov 19 00:16 2

/mnt/1/2:
total 2
drwxr-xr-x  3 tsutsui  wheel  2048 Nov 19 00:16 3

/mnt/1/2/3:
total 2
drwxr-xr-x  3 tsutsui  wheel  2048 Nov 19 00:16 4

/mnt/1/2/3/4:
total 2
drwxr-xr-x  3 tsutsui  wheel  2048 Nov 19 00:16 5

/mnt/1/2/3/4/5:
total 2
drwxr-xr-x  3 tsutsui  wheel  2048 Nov 19 00:16 6

/mnt/1/2/3/4/5/6:
total 2
drwxr-xr-x  4 tsutsui  wheel  2048 Nov 19 00:16 7

/mnt/1/2/3/4/5/6/7:
total 4
drwxr-xr-x  2 tsutsui  wheel  2048 Nov 19 00:15 8
drwxr-xr-x  2 tsutsui  wheel  2048 Nov 19 00:15 8-1

/mnt/1/2/3/4/5/6/7/8:

/mnt/1/2/3/4/5/6/7/8-1:
ls: fts_read: No such file or directory
# ls -lR /mnt/.rr_moved/
total 2
drwxr-xr-x  4 tsutsui  wheel  2048 Nov 19 00:16 8

/mnt/.rr_moved/8:
ls: fts_read: No such file or directory
# 
---

- kernel also complains "RRIP without PX field?"
- "-o allow-deep-trees" doesn't help.

>Fix:
No idea. Check .rr_moved function?

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: bin-bug-people->tsutsui
Responsible-Changed-By: tsutsui@NetBSD.org
Responsible-Changed-When: Sun, 29 May 2011 01:14:17 +0900
Responsible-Changed-Why:
I'm working on this.


State-Changed-From-To: open->analyzed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sun, 29 May 2011 01:14:17 +0900
State-Changed-Why:
I'm testing fixes:
 - cd9660.c:cd9660_rrip_move_directory() should also update lenght[0] and
   name_len[0] in dir->isoDirRecord
 - cd9660/iso9660_rrip.c:cd9660_rrip_finalize_node() should check
   rr_real_parent in node->parent, not in node itself in RRIP_PL case


From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: bin/44114: makefs(8) -t cd9660 -o rockridge creates corrupted cd9660fs
Date: Sun, 29 May 2011 01:25:48 +0900

 I'm testing the following patch and will commit it if there is
 no particular problem.

 Note cd9660_rrip_initialize_node() changes are just logical cleanup.
 (it's a bit awful to update dot_dot_record which isn't passed as input)

 ---
 Index: cd9660.c
 ===================================================================
 RCS file: /cvsroot/src/usr.sbin/makefs/cd9660.c,v
 retrieving revision 1.28
 diff -u -p -r1.28 cd9660.c
 --- cd9660.c	19 Nov 2010 15:47:32 -0000	1.28
 +++ cd9660.c	28 May 2011 16:20:41 -0000
 @@ -1312,6 +1312,8 @@ cd9660_rrip_move_directory(cd9660node *d
  	/* Set the new name */
  	memset(dir->isoDirRecord->name, 0, ISO_FILENAME_MAXLENGTH_WITH_PADDING);
  	strncpy(dir->isoDirRecord->name, newname, 8);
 +	dir->isoDirRecord->length[0] = 34 + 8;
 +	dir->isoDirRecord->name_len[0] = 8;

  	return dir;
  }
 Index: cd9660/iso9660_rrip.c
 ===================================================================
 RCS file: /cvsroot/src/usr.sbin/makefs/cd9660/iso9660_rrip.c,v
 retrieving revision 1.9
 diff -u -p -r1.9 iso9660_rrip.c
 --- cd9660/iso9660_rrip.c	28 May 2011 11:59:29 -0000	1.9
 +++ cd9660/iso9660_rrip.c	28 May 2011 16:20:41 -0000
 @@ -185,10 +185,11 @@ cd9660_rrip_finalize_node(cd9660node *no
  			break;
  		case SUSP_ENTRY_RRIP_PL:
  			/* Look at rr_real_parent */
 -			if (node->rr_real_parent == NULL)
 +			if (node->parent == NULL ||
 +			    node->parent->rr_real_parent == NULL)
  				return -1;
  			cd9660_bothendian_dword(
 -				node->rr_real_parent->fileDataSector,
 +				node->parent->rr_real_parent->fileDataSector,
  				(unsigned char *)
  				    t->attr.rr_entry.PL.dir_loc);
  			break;
 @@ -398,6 +399,13 @@ cd9660_rrip_initialize_node(cd9660node *
  			cd9660node_rrip_px(current, grandparent->node);
  			TAILQ_INSERT_TAIL(&node->head, current, rr_ll);
  		}
 +		if (parent != NULL && parent->rr_real_parent != NULL) {
 +			/* Handle PL */
 +			current = cd9660node_susp_create_node(SUSP_TYPE_RRIP,
 +			    SUSP_ENTRY_RRIP_PL, "PL", SUSP_LOC_DOTDOT);
 +			cd9660_rrip_PL(current,node);
 +			TAILQ_INSERT_TAIL(&node->head, current, rr_ll);
 +		}
  	} else {
  		cd9660_rrip_initialize_inode(node);

 @@ -437,13 +445,6 @@ cd9660_rrip_initialize_node(cd9660node *
  				SUSP_ENTRY_RRIP_RE, "RE", SUSP_LOC_ENTRY);
  			cd9660_rrip_RE(current,node);
  			TAILQ_INSERT_TAIL(&node->head, current, rr_ll);
 -
 -			/* Handle PL */
 -			current = cd9660node_susp_create_node(SUSP_TYPE_RRIP,
 -				SUSP_ENTRY_RRIP_PL, "PL", SUSP_LOC_DOTDOT);
 -			cd9660_rrip_PL(current,node->dot_dot_record);
 -			TAILQ_INSERT_TAIL(&node->dot_dot_record->head, current,
 -			    rr_ll);
  		}
  	}
  	return 1;

 ---
 Izumi Tsutsui

From: "Izumi Tsutsui" <tsutsui@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44114 CVS commit: src/usr.sbin/makefs
Date: Sun, 29 May 2011 17:07:59 +0000

 Module Name:	src
 Committed By:	tsutsui
 Date:		Sun May 29 17:07:58 UTC 2011

 Modified Files:
 	src/usr.sbin/makefs: cd9660.c
 	src/usr.sbin/makefs/cd9660: iso9660_rrip.c

 Log Message:
 Apply fixes for PR bin/44114 (makefs(8) -t cd9660 -o rockridge creates
 corrupted cd9660fs):
  - makefs/cd9660.c:
   - cd9660_rrip_move_directory() should also update lenght[0] and
     name_len[0] in dir->isoDirRecord
  - makefs/cd9660/iso9660_rrip.c:
   - cd9660_rrip_finalize_node() should check rr_real_parent in node->parent,
     not in node itself in RRIP_PL case
   - cd9660_rrip_initialize_node() should update only node passed as arg
     so handle RRIP_PL in DOTDOT case

 Fixes malformed dotdot entries in deep (more than 8 level) directories
 moved into .rr_moved dir.

 Should be pulled up to netbsd-5.
 (no official ISO has such deep dirs, but cobalt restorecd is affected)


 To generate a diff of this commit:
 cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/makefs/cd9660.c
 cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/makefs/cd9660/iso9660_rrip.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: analyzed->pending-pullups
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Mon, 30 May 2011 02:11:46 +0900
State-Changed-Why:
I'll send it later.


From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44114 CVS commit: [netbsd-5] src/usr.sbin/makefs
Date: Fri, 15 Jul 2011 22:39:03 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Fri Jul 15 22:39:02 UTC 2011

 Modified Files:
 	src/usr.sbin/makefs [netbsd-5]: cd9660.c
 	src/usr.sbin/makefs/cd9660 [netbsd-5]: iso9660_rrip.c

 Log Message:
 Pull up following revision(s) (requested by tsutsui in ticket #1638):
 	usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.9
 	usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.10
 	usr.sbin/makefs/cd9660.c: revision 1.30
 - remove unnecessary (pasto?) line on RRIP PL handling for moved dir
 - RRIP RE length should be 4, not 0
 Apply fixes for PR bin/44114 (makefs(8) -t cd9660 -o rockridge creates
 corrupted cd9660fs):
  - makefs/cd9660.c:
   - cd9660_rrip_move_directory() should also update lenght[0] and
     name_len[0] in dir->isoDirRecord
  - makefs/cd9660/iso9660_rrip.c:
   - cd9660_rrip_finalize_node() should check rr_real_parent in node->parent,
     not in node itself in RRIP_PL case
   - cd9660_rrip_initialize_node() should update only node passed as arg
     so handle RRIP_PL in DOTDOT case
 Fixes malformed dotdot entries in deep (more than 8 level) directories
 moved into .rr_moved dir.
 Should be pulled up to netbsd-5.
 (no official ISO has such deep dirs, but cobalt restorecd is affected)


 To generate a diff of this commit:
 cvs rdiff -u -r1.22.2.2 -r1.22.2.3 src/usr.sbin/makefs/cd9660.c
 cvs rdiff -u -r1.4.18.4 -r1.4.18.5 src/usr.sbin/makefs/cd9660/iso9660_rrip.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 17 Jul 2011 02:59:14 +0000
State-Changed-Why:
Fix pulled up.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.