On a recent -current system, cpio(1), using the -p option, does
not update the target directory with newer files. For example,
when copying a file from ~/tmp/a to ~/tmp/b:
[mark@green:~/tmp/a]$ ls -l
total 4
-rw-r--r-- 1 mark mark 3 Aug 7 09:39 x
[mark@green:~/tmp/a]$ ls -l ../b
total 4
-rw-r--r-- 1 mark mark 3 Aug 7 09:39 x
[mark@green:~/tmp/a]$ echo i am not a duck >x
[mark@green:~/tmp/a]$ ls -l
total 4
-rw-r--r-- 1 mark mark 16 Aug 7 13:54 x
[mark@green:~/tmp/a]$ find . |cpio -pd ../b
[mark@green:~/tmp/a]$ ls -l ../b
total 4
-rw-r--r-- 1 mark mark 3 Aug 7 09:39 x
On other BSDs (well, FreeBSD), the older file in ~/tmp/b is updated.
The documentation for the -u option implies this is the
correct behaviour:
-u Overwrite files even when the original file being copied
is older than the one that will be overwritten.
The following patch appears to fix the issue:
[mark@green:~/dev/pax] diff -u /usr/src/bin/pax/options.c options.c
--- /usr/src/bin/pax/options.c Fri Nov 15 20:34:17 2019
+++ options.c Tue Aug 4 16:38:29 2020
@@ -1156,7 +1156,7 @@
char *str;
FILE *fp;
- kflag = 1;
+ uflag = 1;
pids = 1;
pmode = 1;
pmtime = 0;
@@ -1256,7 +1256,7 @@
/*
* replace newer files
*/
- kflag = 0;
+ uflag = 0;
break;
case 'v':
/*
cpio doesn't offer a -k option, so this seems the simplest change.
With this patch applied to pax/options.c:
[mark@green:~/tmp/a]$ find . |~/dev/pax/cpio -pd ../b
[mark@green:~/tmp/a]$ ls -l ../b
total 4
-rw-r--r-- 1 mark mark 16 Aug 7 14:00 x
Dmesg follows:
OpenBSD 6.7-current (GENERIC) #9: Thu Aug 6 15:31:02 MDT 2020
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
real mem = 1056899072 (1007MB)
avail mem = 1009991680 (963MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.3 @ 0xf93d0 (338 entries)
bios0: vendor American Megatrends Inc. version "090008" date 12/07/2018
bios0: Microsoft Corporation Virtual Machine
acpi0 at bios0: ACPI 2.0
acpi0: sleep states S0 S5
acpi0: tables DSDT FACP WAET SLIC OEM0 SRAT APIC OEMB
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpihve0 at acpi0
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
ioapic0 at mainbus0: apid 0 pa 0xfec00000, version 11, 24 pins, remapped
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD Ryzen 7 1700 Eight-Core Processor, 2602.83 MHz, 17-01-01
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLU
SH,MMX,FXSR,SSE,SSE2,SSE3,PCLMUL,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,
AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,
AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SM
AP,CLFLUSHOPT,SHA,IBPB,VIRTSSBD,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu0: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 8-way L2 cache, 16MB 64b/line 16-way L3 cache
cpu0: ITLB 64 4KB entries fully associative, 64 4MB entries fully
associative
cpu0: DTLB 64 4KB entries fully associative, 64 4MB entries fully
associative
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 173MHz
acpiprt0 at acpi0: bus 0 (PCI0)
acpicpu0 at acpi0: C1(@1 halt!)
acpipci0 at acpi0 PCI0
extent `acpipci0 pcibus' (0x0 - 0xff), flags=0
extent `pciio' (0x0 - 0xffffffff), flags=0
0x10000 - 0xffffffff
extent `pcimem' (0x0 - 0xffffffffffffffff), flags=0
0x0 - 0x3fffffff
0x40000000000 - 0xffffffffffffffff
acpicmos0 at acpi0
"VMBus" at acpi0 not configured
"Hyper_V_Gen_Counter_V1" at acpi0 not configured
pvbus0 at mainbus0: Hyper-V 10.0
hyperv0 at pvbus0: protocol 4.0, features 0x2e7f
hyperv0: heartbeat, kvp, shutdown, timesync
hvs0 at hyperv0 channel 2: ide, protocol 6.2
scsibus1 at hvs0: 2 targets
sd0 at scsibus1 targ 0 lun 0: <Msft, Virtual Disk, 1.0>
naa.60022480e357104f5b7149127201f778
sd0: 25600MB, 512 bytes/sector, 52428800 sectors, thin
hvs1 at hyperv0 channel 15: scsi, protocol 6.2
scsibus2 at hvs1: 2 targets
hvn0 at hyperv0 channel 14: NVS 5.0 NDIS 6.30, address 00:15:5d:00:10:06
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82443BX" rev 0x03
pcib0 at pci0 dev 7 function 0 "Intel 82371AB PIIX4 ISA" rev 0x01
pciide0 at pci0 dev 7 function 1 "Intel 82371AB IDE" rev 0x01: DMA, channel
0 wired to compatibility, channel 1 wired to compatibility
pciide0: channel 0 disabled (no drives)
atapiscsi0 at pciide0 channel 1 drive 0
scsibus3 at atapiscsi0: 2 targets
cd0 at scsibus3 targ 0 lun 0: <Msft, Virtual CD/ROM, 1.0> removable
cd0(pciide0:1:0): using PIO mode 4, DMA mode 2
piixpm0 at pci0 dev 7 function 3 "Intel 82371AB Power" rev 0x02: SMBus
disabled
vga1 at pci0 dev 8 function 0 "Microsoft VGA" rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
isa0 at pcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
vscsi0 at root
scsibus4 at vscsi0: 256 targets
softraid0 at root
scsibus5 at softraid0: 256 targets
root on sd0a (7f9b785a6981db5a.a) swap on sd0b dump on sd0b
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
fd1 at fdc0 drive 1: density unknown
acpi0: PM1 stuck (en 0x101 st 0x1), clearing
Best Regards,
Mark
--
Mark Willson
[email protected]
https://hydrus.org.uk