[Bug 254842] cp -p does not support preserving created time (btime)

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Apr 7 02:44:30 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254842

            Bug ID: 254842
           Summary: cp -p does not support preserving created time (btime)
           Product: Base System
           Version: 13.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: akw24542 at eoopy.com

1) Create a .txt file. Then open the .txt file and edit the .txt file and save.
Now have 3 different timestamps for atime, mtime and btime.


stat -f "Accessed (atime): %Fa%nModified (mtime): %Fm%nCreated  (btime): %FB"
'/home/liveuser/Desktop/123.txt' 
Accessed (atime): 1617769412.044026000
Modified (mtime): 1617769415.349392000
Created  (btime): 1617768991.589695000


2) Copy the file from the source to the destination.

cp -p '/home/liveuser/Desktop/123.txt' '/'


3) View the file info of the destination.

stat -f "Accessed (atime): %Fa%nModified (mtime): %Fm%nCreated  (btime): %FB"
'/123.txt'                       
Accessed (atime): 1617769412.044026000
Modified (mtime): 1617769415.349392000
Created  (btime): 1617769415.349392000


Result:
atime and mtime were preserved. But btime was not preserved by the source and
was automatically set to mtime.


Expectation:
cp -p supports preserving btime from the source to the destination. The support
works for files and directories.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list