Tue Apr 18 23:02:51 2023 UTC ()
We previously attempted to emit Rock Ridge NM records only when the name
represented by the Rock Ridge extensions would actually differ. We would
omit the record for an all-upper-case directory name, however Linux (and
perhaps other operating systems) map names with no NM record to
lowercase.

This affected only directories, as file names have an implicit ";1"
version number appended and thus always differ.  To solve, just emit NM
records for all entries other than DOT and DOTDOT .

We could continue to omit the NM record for directories that would avoid
mapping (for example, one named 1234.567) but this does not seem worth
the complexity.

From FreeBSD https://reviews.freebsd.org/D39258


(christos)
diff -r1.15 -r1.16 src/usr.sbin/makefs/cd9660/iso9660_rrip.c

cvs diff -r1.15 -r1.16 src/usr.sbin/makefs/cd9660/iso9660_rrip.c (expand / switch to unified diff)

--- src/usr.sbin/makefs/cd9660/iso9660_rrip.c 2023/04/18 22:56:41 1.15
+++ src/usr.sbin/makefs/cd9660/iso9660_rrip.c 2023/04/18 23:02:51 1.16
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: iso9660_rrip.c,v 1.15 2023/04/18 22:56:41 christos Exp $ */ 1/* $NetBSD: iso9660_rrip.c,v 1.16 2023/04/18 23:02:51 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan 4 * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
5 * Perez-Rathke and Ram Vedam. All rights reserved. 5 * Perez-Rathke and Ram Vedam. All rights reserved.
6 * 6 *
7 * This code was written by Daniel Watt, Walter Deignan, Ryan Gabrys, 7 * This code was written by Daniel Watt, Walter Deignan, Ryan Gabrys,
8 * Alan Perez-Rathke and Ram Vedam. 8 * Alan Perez-Rathke and Ram Vedam.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or 10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following 11 * without modification, are permitted provided that the following
12 * conditions are met: 12 * conditions are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -34,27 +34,27 @@ @@ -34,27 +34,27 @@
34/* This will hold all the function definitions 34/* This will hold all the function definitions
35 * defined in iso9660_rrip.h 35 * defined in iso9660_rrip.h
36 */ 36 */
37 37
38#include "makefs.h" 38#include "makefs.h"
39#include "cd9660.h" 39#include "cd9660.h"
40#include "iso9660_rrip.h" 40#include "iso9660_rrip.h"
41#include <sys/queue.h> 41#include <sys/queue.h>
42#include <stdio.h> 42#include <stdio.h>
43#include <util.h> 43#include <util.h>
44 44
45#include <sys/cdefs.h> 45#include <sys/cdefs.h>
46#if defined(__RCSID) && !defined(__lint) 46#if defined(__RCSID) && !defined(__lint)
47__RCSID("$NetBSD: iso9660_rrip.c,v 1.15 2023/04/18 22:56:41 christos Exp $"); 47__RCSID("$NetBSD: iso9660_rrip.c,v 1.16 2023/04/18 23:02:51 christos Exp $");
48#endif /* !__lint */ 48#endif /* !__lint */
49 49
50static void cd9660_rrip_initialize_inode(cd9660node *); 50static void cd9660_rrip_initialize_inode(cd9660node *);
51static int cd9660_susp_handle_continuation(iso9660_disk *, cd9660node *); 51static int cd9660_susp_handle_continuation(iso9660_disk *, cd9660node *);
52static int cd9660_susp_handle_continuation_common(iso9660_disk *, cd9660node *, 52static int cd9660_susp_handle_continuation_common(iso9660_disk *, cd9660node *,
53 int); 53 int);
54 54
55int 55int
56cd9660_susp_initialize(iso9660_disk *diskStructure, cd9660node *node, 56cd9660_susp_initialize(iso9660_disk *diskStructure, cd9660node *node,
57 cd9660node *parent, cd9660node *grandparent) 57 cd9660node *parent, cd9660node *grandparent)
58{ 58{
59 cd9660node *cn; 59 cd9660node *cn;
60 int r; 60 int r;
@@ -403,46 +403,32 @@ cd9660_rrip_initialize_node(iso9660_disk @@ -403,46 +403,32 @@ cd9660_rrip_initialize_node(iso9660_disk
403 cd9660node_rrip_px(current, grandparent->node); 403 cd9660node_rrip_px(current, grandparent->node);
404 TAILQ_INSERT_TAIL(&node->head, current, rr_ll); 404 TAILQ_INSERT_TAIL(&node->head, current, rr_ll);
405 } 405 }
406 /* Handle PL */ 406 /* Handle PL */
407 if (parent != NULL && parent->rr_real_parent != NULL) { 407 if (parent != NULL && parent->rr_real_parent != NULL) {
408 current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, 408 current = cd9660node_susp_create_node(SUSP_TYPE_RRIP,
409 SUSP_ENTRY_RRIP_PL, "PL", SUSP_LOC_DOTDOT); 409 SUSP_ENTRY_RRIP_PL, "PL", SUSP_LOC_DOTDOT);
410 cd9660_rrip_PL(current,node); 410 cd9660_rrip_PL(current,node);
411 TAILQ_INSERT_TAIL(&node->head, current, rr_ll); 411 TAILQ_INSERT_TAIL(&node->head, current, rr_ll);
412 } 412 }
413 } else { 413 } else {
414 cd9660_rrip_initialize_inode(node); 414 cd9660_rrip_initialize_inode(node);
415 415
416 /* 
417 * Not every node needs a NM set - only if the name is 
418 * actually different. IE: If a file is TEST -> TEST, 
419 * no NM. test -> TEST, need a NM 
420 * 
421 * The rr_moved_dir needs to be assigned a NM record as well. 
422 */ 
423 if (node == diskStructure->rr_moved_dir) { 416 if (node == diskStructure->rr_moved_dir) {
424 cd9660_rrip_add_NM(node, RRIP_DEFAULT_MOVE_DIR_NAME); 417 cd9660_rrip_add_NM(node, RRIP_DEFAULT_MOVE_DIR_NAME);
425 } 418 } else if (node->node != NULL) {
426 else if ((node->node != NULL) && 
427 ((strlen(node->node->name) != 
428 (uint8_t)node->isoDirRecord->name_len[0]) || 
429 (memcmp(node->node->name,node->isoDirRecord->name, 
430 (uint8_t)node->isoDirRecord->name_len[0]) != 0))) { 
431 cd9660_rrip_NM(node); 419 cd9660_rrip_NM(node);
432 } 420 }
433 421
434 
435 
436 /* Rock ridge directory relocation code here. */ 422 /* Rock ridge directory relocation code here. */
437 423
438 /* First handle the CL for the placeholder file. */ 424 /* First handle the CL for the placeholder file. */
439 if (node->rr_relocated != NULL) { 425 if (node->rr_relocated != NULL) {
440 current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, 426 current = cd9660node_susp_create_node(SUSP_TYPE_RRIP,
441 SUSP_ENTRY_RRIP_CL, "CL", SUSP_LOC_ENTRY); 427 SUSP_ENTRY_RRIP_CL, "CL", SUSP_LOC_ENTRY);
442 cd9660_rrip_CL(current, node); 428 cd9660_rrip_CL(current, node);
443 TAILQ_INSERT_TAIL(&node->head, current, rr_ll); 429 TAILQ_INSERT_TAIL(&node->head, current, rr_ll);
444 } 430 }
445 431
446 /* Handle RE*/ 432 /* Handle RE*/
447 if (node->rr_real_parent != NULL) { 433 if (node->rr_real_parent != NULL) {
448 current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, 434 current = cd9660node_susp_create_node(SUSP_TYPE_RRIP,