Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/makefs Apply fixes for PR bin/44114 (makefs(8) -t c...



details:   https://anonhg.NetBSD.org/src/rev/5cd9f8d28c41
branches:  trunk
changeset: 765527:5cd9f8d28c41
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun May 29 17:07:57 2011 +0000

description:
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)

diffstat:

 usr.sbin/makefs/cd9660.c              |   6 ++++--
 usr.sbin/makefs/cd9660/iso9660_rrip.c |  23 ++++++++++++-----------
 2 files changed, 16 insertions(+), 13 deletions(-)

diffs (87 lines):

diff -r 7638cd09928f -r 5cd9f8d28c41 usr.sbin/makefs/cd9660.c
--- a/usr.sbin/makefs/cd9660.c  Sun May 29 15:21:34 2011 +0000
+++ b/usr.sbin/makefs/cd9660.c  Sun May 29 17:07:57 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660.c,v 1.29 2011/05/22 21:51:39 christos Exp $     */
+/*     $NetBSD: cd9660.c,v 1.30 2011/05/29 17:07:57 tsutsui 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.29 2011/05/22 21:51:39 christos Exp $");
+__RCSID("$NetBSD: cd9660.c,v 1.30 2011/05/29 17:07:57 tsutsui Exp $");
 #endif  /* !__lint */
 
 #include <string.h>
@@ -1315,6 +1315,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;
 }
diff -r 7638cd09928f -r 5cd9f8d28c41 usr.sbin/makefs/cd9660/iso9660_rrip.c
--- a/usr.sbin/makefs/cd9660/iso9660_rrip.c     Sun May 29 15:21:34 2011 +0000
+++ b/usr.sbin/makefs/cd9660/iso9660_rrip.c     Sun May 29 17:07:57 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iso9660_rrip.c,v 1.9 2011/05/28 11:59:29 tsutsui Exp $ */
+/*     $NetBSD: iso9660_rrip.c,v 1.10 2011/05/29 17:07:58 tsutsui 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.9 2011/05/28 11:59:29 tsutsui Exp $");
+__RCSID("$NetBSD: iso9660_rrip.c,v 1.10 2011/05/29 17:07:58 tsutsui 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,13 +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);
                }
        }
        return 1;



Home | Main Index | Thread Index | Old Index