Tue Apr 18 22:56:41 2023 UTC ()
The bit definitions for the TF_* timestamp bits (TF_MODIFY, etc.) were
incorrect, and timestamps were written in the wrong order.

See RRIP 4.1.6 Description of the "TF" System Use Entry for details.

From: https://reviews.freebsd.org/D39221


(christos)
diff -r1.14 -r1.15 src/usr.sbin/makefs/cd9660/iso9660_rrip.c
diff -r1.6 -r1.7 src/usr.sbin/makefs/cd9660/iso9660_rrip.h

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

--- src/usr.sbin/makefs/cd9660/iso9660_rrip.c 2014/05/30 13:14:47 1.14
+++ src/usr.sbin/makefs/cd9660/iso9660_rrip.c 2023/04/18 22:56:41 1.15
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: iso9660_rrip.c,v 1.14 2014/05/30 13:14:47 martin Exp $ */ 1/* $NetBSD: iso9660_rrip.c,v 1.15 2023/04/18 22:56:41 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.14 2014/05/30 13:14:47 martin Exp $"); 47__RCSID("$NetBSD: iso9660_rrip.c,v 1.15 2023/04/18 22:56:41 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;
@@ -687,31 +687,31 @@ cd9660node_rrip_nm(struct ISO_SUSP_ATTRI @@ -687,31 +687,31 @@ cd9660node_rrip_nm(struct ISO_SUSP_ATTRI
687int 687int
688cd9660node_rrip_tf(struct ISO_SUSP_ATTRIBUTES *p, fsnode *_node) 688cd9660node_rrip_tf(struct ISO_SUSP_ATTRIBUTES *p, fsnode *_node)
689{ 689{
690 p->attr.rr_entry.TF.flags[0] = TF_MODIFY | TF_ACCESS | TF_ATTRIBUTES; 690 p->attr.rr_entry.TF.flags[0] = TF_MODIFY | TF_ACCESS | TF_ATTRIBUTES;
691 p->attr.rr_entry.TF.h.length[0] = 5; 691 p->attr.rr_entry.TF.h.length[0] = 5;
692 p->attr.rr_entry.TF.h.version[0] = 1; 692 p->attr.rr_entry.TF.h.version[0] = 1;
693 693
694 /* 694 /*
695 * Need to add creation time, backup time, 695 * Need to add creation time, backup time,
696 * expiration time, and effective time. 696 * expiration time, and effective time.
697 */ 697 */
698 698
699 cd9660_time_915(p->attr.rr_entry.TF.timestamp, 699 cd9660_time_915(p->attr.rr_entry.TF.timestamp,
700 _node->inode->st.st_atime); 700 _node->inode->st.st_mtime);
701 p->attr.rr_entry.TF.h.length[0] += 7; 701 p->attr.rr_entry.TF.h.length[0] += 7;
702 702
703 cd9660_time_915(p->attr.rr_entry.TF.timestamp + 7, 703 cd9660_time_915(p->attr.rr_entry.TF.timestamp + 7,
704 _node->inode->st.st_mtime); 704 _node->inode->st.st_atime);
705 p->attr.rr_entry.TF.h.length[0] += 7; 705 p->attr.rr_entry.TF.h.length[0] += 7;
706 706
707 cd9660_time_915(p->attr.rr_entry.TF.timestamp + 14, 707 cd9660_time_915(p->attr.rr_entry.TF.timestamp + 14,
708 _node->inode->st.st_ctime); 708 _node->inode->st.st_ctime);
709 p->attr.rr_entry.TF.h.length[0] += 7; 709 p->attr.rr_entry.TF.h.length[0] += 7;
710 return 1; 710 return 1;
711} 711}
712 712
713int 713int
714cd9660_susp_sp(struct ISO_SUSP_ATTRIBUTES *p, cd9660node *spinfo __unused) 714cd9660_susp_sp(struct ISO_SUSP_ATTRIBUTES *p, cd9660node *spinfo __unused)
715{ 715{
716 p->attr.su_entry.SP.h.length[0] = 7; 716 p->attr.su_entry.SP.h.length[0] = 7;
717 p->attr.su_entry.SP.h.version[0] = 1; 717 p->attr.su_entry.SP.h.version[0] = 1;

cvs diff -r1.6 -r1.7 src/usr.sbin/makefs/cd9660/iso9660_rrip.h (expand / switch to unified diff)

--- src/usr.sbin/makefs/cd9660/iso9660_rrip.h 2013/01/28 21:03:28 1.6
+++ src/usr.sbin/makefs/cd9660/iso9660_rrip.h 2023/04/18 22:56:41 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: iso9660_rrip.h,v 1.6 2013/01/28 21:03:28 christos Exp $ */ 1/* $NetBSD: iso9660_rrip.h,v 1.7 2023/04/18 22:56:41 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.
@@ -38,35 +38,37 @@ @@ -38,35 +38,37 @@
38 * This will hold all the functions needed to 38 * This will hold all the functions needed to
39 * write an ISO 9660 image with Rock Ridge Extensions 39 * write an ISO 9660 image with Rock Ridge Extensions
40 */ 40 */
41 41
42/* For writing must use ISO_RRIP_EXTREF structure */ 42/* For writing must use ISO_RRIP_EXTREF structure */
43 43
44#include "makefs.h" 44#include "makefs.h"
45#include <cd9660_rrip.h> 45#include <cd9660_rrip.h>
46#include "cd9660.h" 46#include "cd9660.h"
47#include <sys/queue.h> 47#include <sys/queue.h>
48 48
49#define PX_LENGTH 0x2C 49#define PX_LENGTH 0x2C
50#define PN_LENGTH 0x14 50#define PN_LENGTH 0x14
51#define TF_CREATION 0x00 51
52#define TF_MODIFY 0x01 52#define TF_CREATION 0x01
53#define TF_ACCESS 0x02 53#define TF_MODIFY 0x02
54#define TF_ATTRIBUTES 0x04 54#define TF_ACCESS 0x04
55#define TF_BACKUP 0x08 55#define TF_ATTRIBUTES 0x08
56#define TF_EXPIRATION 0x10 56#define TF_BACKUP 0x10
57#define TF_EFFECTIVE 0x20 57#define TF_EXPIRATION 0x20
58#define TF_LONGFORM 0x40 58#define TF_EFFECTIVE 0x40
59#define NM_CONTINUE 0x80 59#define TF_LONGFORM 0x80
 60
 61#define NM_CONTINUE 0x80
60#define NM_CURRENT 0x100 62#define NM_CURRENT 0x100
61#define NM_PARENT 0x200 63#define NM_PARENT 0x200
62 64
63 65
64#define SUSP_LOC_ENTRY 0x01 66#define SUSP_LOC_ENTRY 0x01
65#define SUSP_LOC_DOT 0x02 67#define SUSP_LOC_DOT 0x02
66#define SUSP_LOC_DOTDOT 0x04 68#define SUSP_LOC_DOTDOT 0x04
67 69
68#define SUSP_TYPE_SUSP 1 70#define SUSP_TYPE_SUSP 1
69#define SUSP_TYPE_RRIP 2 71#define SUSP_TYPE_RRIP 2
70 72
71#define SUSP_ENTRY_SUSP_CE 1 73#define SUSP_ENTRY_SUSP_CE 1
72#define SUSP_ENTRY_SUSP_PD 2 74#define SUSP_ENTRY_SUSP_PD 2