git: 3a52cc4445ba - stable/13 - makefs: emit NM records for all directory entries

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 10 Apr 2023 13:38:12 UTC
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=3a52cc4445ba3e5cbee7b802822be6a1e122ad13

commit 3a52cc4445ba3e5cbee7b802822be6a1e122ad13
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-03-24 17:53:59 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-04-10 13:37:40 +0000

    makefs: emit NM records for all directory entries
    
    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.
    
    PR:             203531
    Reported by:    Thomas Schmitt <scdbackup@gmx.net
    Reviewed by:    kevans
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D39258
    
    (cherry picked from commit 978013a0945d4c6b7ab3ee798dc13c74e913762a)
---
 usr.sbin/makefs/cd9660/iso9660_rrip.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.c b/usr.sbin/makefs/cd9660/iso9660_rrip.c
index afe46c58747d..1107688aa21e 100644
--- a/usr.sbin/makefs/cd9660/iso9660_rrip.c
+++ b/usr.sbin/makefs/cd9660/iso9660_rrip.c
@@ -414,26 +414,12 @@ cd9660_rrip_initialize_node(iso9660_disk *diskStructure, cd9660node *node,
 	} else {
 		cd9660_rrip_initialize_inode(node);
 
-		/*
-		 * Not every node needs a NM set - only if the name is
-		 * actually different. IE: If a file is TEST -> TEST,
-		 * no NM. test -> TEST, need a NM
-		 *
-		 * The rr_moved_dir needs to be assigned a NM record as well.
-		 */
 		if (node == diskStructure->rr_moved_dir) {
 			cd9660_rrip_add_NM(node, RRIP_DEFAULT_MOVE_DIR_NAME);
-		}
-		else if ((node->node != NULL) &&
-			((strlen(node->node->name) !=
-			    (uint8_t)node->isoDirRecord->name_len[0]) ||
-			(memcmp(node->node->name,node->isoDirRecord->name,
-				(uint8_t)node->isoDirRecord->name_len[0]) != 0))) {
+		} else if (node->node != NULL) {
 			cd9660_rrip_NM(node);
 		}
 
-
-
 		/* Rock ridge directory relocation code here. */
 
 		/* First handle the CL for the placeholder file. */