STINNER Victor <vstin...@redhat.com> added the comment:

I'm curious: is it possible to query the filesystem to check if a copied is 
copied using CoW? I guess that it's possible, it will be non portable. So I 
guess that it's better to avoid checking that in unit tests.

vstinner@apu$ dd if=/dev/urandom of=urandom bs=1k count=1k
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0309671 s, 33.9 MB/s
vstinner@apu$ cp --reflink urandom urandom2
'urandom' -> 'urandom2'

vstinner@apu$ stat urandom
  File: urandom
  Size: 1048576         Blocks: 2048       IO Block: 4096   regular file
Device: 31h/49d Inode: 16265363    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/vstinner)   Gid: ( 1000/vstinner)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2019-06-05 13:56:21.381196972 +0200
Modify: 2019-06-05 13:56:21.412197007 +0200
Change: 2019-06-05 13:56:21.412197007 +0200
 Birth: 2019-06-05 13:56:21.381196972 +0200

vstinner@apu$ stat urandom2
  File: urandom2
  Size: 1048576         Blocks: 2048       IO Block: 4096   regular file
Device: 31h/49d Inode: 16265364    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/vstinner)   Gid: ( 1000/vstinner)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2019-06-05 13:56:24.487200453 +0200
Modify: 2019-06-05 13:56:24.496200463 +0200
Change: 2019-06-05 13:56:24.496200463 +0200
 Birth: 2019-06-05 13:56:24.487200453 +0200

Using stat command line tool, I don't see anything obvious saying that the two 
files share the same data on disk.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37157>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to