Copy Update 'cp -au ' Anomaly

For discussions about programming and projects not necessarily associated with Porteus.

Copy Update 'cp -au ' Anomaly

Postby Bogomips » 07 Dec 2015, 00:28

Code: Select all
guest@porteus:~$ echo Update Test
Update Test
guest@porteus:~$ mkdir /tmp/src
guest@porteus:~$ touch /tmp/src/{b,c,d}
guest@porteus:~$ ls -i /tmp/src/{b,c,d}
26019 /tmp/src/b  26020 /tmp/src/c  26025 /tmp/src/d

guest@porteus:~$ ln /tmp/src/b /tmp/src/a
guest@porteus:~$ ls -i /tmp/src
26019 a  26019 b  26020 c  26025 d

guest@porteus:~$ mkdir dst
guest@porteus:~$ cp -a /tmp/src/* dst

guest@porteus:~$ ls -i dst
26002 a  26002 b  26026 c  26034 d

guest@porteus:~$ ln -f dst/c dst/a
guest@porteus:~$ ls -il dst
total 0
26026 -rw-r--r-- 2 guest guest 0 Dec  7 00:00 a
26002 -rw-r--r-- 1 guest guest 0 Dec  7 00:00 b
26026 -rw-r--r-- 2 guest guest 0 Dec  7 00:00 c
26034 -rw-r--r-- 1 guest guest 0 Dec  7 00:00 d

guest@porteus:~$ ls -il /tmp/src/
total 0
26019 -rw-r--r-- 2 guest guest 0 Dec  7 00:00 a
26019 -rw-r--r-- 2 guest guest 0 Dec  7 00:00 b
26020 -rw-r--r-- 1 guest guest 0 Dec  7 00:00 c
26025 -rw-r--r-- 1 guest guest 0 Dec  7 00:00 d

guest@porteus:~$ cp -au /tmp/src/* dst
guest@porteus:~$ ls -il dst
total 0
26026 -rw-r--r-- 3 guest guest 0 Dec  7 00:00 a
26026 -rw-r--r-- 3 guest guest 0 Dec  7 00:00 b
26026 -rw-r--r-- 3 guest guest 0 Dec  7 00:00 c
26034 -rw-r--r-- 1 guest guest 0 Dec  7 00:00 d
The files 'b' and 'c' should always remain unchanged.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
Bogomips
Full of knowledge
Full of knowledge
 
Posts: 2291
Joined: 25 Jun 2014, 16:21
Location: London
Distribution: 3.2.2 Cinnamon & KDE5

Return to Programming



Who is online

Users browsing this forum: No registered users and 1 guest