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.
Modified files:
Index: src/usr.sbin/makefs/cd9660.c
diff -u src/usr.sbin/makefs/cd9660.c:1.22.2.2 src/usr.sbin/makefs/cd9660.c:1.22.2.3
--- src/usr.sbin/makefs/cd9660.c:1.22.2.2 Sat Jan 2 06:45:03 2010
+++ src/usr.sbin/makefs/cd9660.c Fri Jul 15 22:39:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660.c,v 1.22.2.2 2010/01/02 06:45:03 snj Exp $ */
+/* $NetBSD: cd9660.c,v 1.22.2.3 2011/07/15 22:39:02 riz Exp $ */
/*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -103,7 +103,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660.c,v 1.22.2.2 2010/01/02 06:45:03 snj Exp $");
+__RCSID("$NetBSD: cd9660.c,v 1.22.2.3 2011/07/15 22:39:02 riz Exp $");
#endif /* !__lint */
#include <string.h>
@@ -1299,6 +1299,8 @@
/* 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: src/usr.sbin/makefs/cd9660/iso9660_rrip.c
diff -u src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.18.4 src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.18.5
--- src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.18.4 Sat Jan 2 06:45:03 2010
+++ src/usr.sbin/makefs/cd9660/iso9660_rrip.c Fri Jul 15 22:39:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: iso9660_rrip.c,v 1.4.18.4 2010/01/02 06:45:03 snj Exp $ */
+/* $NetBSD: iso9660_rrip.c,v 1.4.18.5 2011/07/15 22:39:02 riz Exp $ */
/*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: iso9660_rrip.c,v 1.4.18.4 2010/01/02 06:45:03 snj Exp $");
+__RCSID("$NetBSD: iso9660_rrip.c,v 1.4.18.5 2011/07/15 22:39:02 riz Exp $");
#endif /* !__lint */
static void cd9660_rrip_initialize_inode(cd9660node *);
@@ -185,10 +185,11 @@
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 @@
cd9660node_rrip_px(current, grandparent->node);
TAILQ_INSERT_TAIL(&node->head, current, rr_ll);
}
+ /* Handle PL */
+ if (parent != NULL && parent->rr_real_parent != NULL) {
+ 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,14 +445,6 @@
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);
- TAILQ_INSERT_TAIL(&node->head, current, rr_ll);
}
}
return 1;
@@ -498,7 +498,7 @@
int
cd9660_rrip_RE(struct ISO_SUSP_ATTRIBUTES *p, cd9660node *node __unused)
{
- p->attr.rr_entry.RE.h.length[0] = 0;
+ p->attr.rr_entry.RE.h.length[0] = 4;
p->attr.rr_entry.RE.h.version[0] = 1;
return 1;
}