File: mergeall-android-scripts/_readme-items/LOGS/android-timestamps-bug-preoreo.txt

#########################################################################
# The Android timestamp-bug showstopper -- until Oreo.
#
# Run on 2016's Android 7.0 (Nougat) to demo the former Android 
# timestamps copy bug that renders Mergeall unusable.
#
# This first session below copies a file to removable SD card from 
# USB drive in the Termux shell on Jan 5: content copies work correctly, 
# but timestamp copies fail (and use copy time for content-only copies).
# File explorers simply ignore the timestamp-copy error (or worse, 
# don't even try to copy timestamps due to the Android bug).
#
# The second session below copies to internal storage (/sdcard), from 
# both internal storage and SD card (/storage) on Jan 31.  Again, times 
# cannot be copied, and content-only copies simply use copy time.
# 
# This longstanding Android bug made quick content syncs impossible. 
# In Mergeall, file updates on Android 7.0 and earlier copied content 
# correctly but failed to copy modtimes, with errors in the logfile
# (the actual error was generated in Python's shutil.copystat()).
# This meant that copied files were always out of sync in later runs.
#
# Happily, this was fixed as of 2017's Android Oreo, which is required 
# by the Mergeall system.  Less happily, older Androids are widespread.
# This bug also breaks calendar-file backups in the Frigcal program.
#########################################################################


#------------------------------------------------------------------------
# Copy to SD card: content works, times use copy time or fail
#------------------------------------------------------------------------

$ cp /storage/8BB9-1202/Android/data/com.termux/MY-STUFF/Websites/UNION/about-python.html /storage/7FCC-16EC/Android/data/com.termux/MY-STUFF/Websites/UNION/about-python.html

$ cp -p /storage/8BB9-1202/Android/data/com.termux/MY-STUFF/Websites/UNION/about-python.html /storage/7FCC-16EC/Android/data/com.termux/MY-STUFF/Websites/UNION/about-python.html
cp: can't preserve times of '/storage/7FCC-16EC/Android/data/com.termux/MY-STUFF/Websites/UNION/about-python.html': Operation not permitted

$ ls --full-time /storage/8BB9-1202/Android/data/com.termux/MY-STUFF/Websites/UNION/about-python.html
-rwxr-x---    1 u0_a215  everybod     21629 2018-12-19 20:31:16 -0800 /storage/8BB9-1202/Android/data/com.termux/MY-STUFF/Websites/UNION/about-python.html

$ ls --full-time /storage/7FCC-16EC/Android/data/com.termux/MY-STUFF/Websites/UNION/about-python.html
-rwxr-x---    1 u0_a215  everybod     21629 2019-01-05 06:49:46 -0800 /storage/7FCC-16EC/Android/data/com.termux/MY-STUFF/Websites/UNION/about-python.html


#------------------------------------------------------------------------
# Copy to internal storage: content works, times use copy time or fail
#------------------------------------------------------------------------

$ ls --full-time /sdcard/Download/composite.png
-rw-rw----    1 root     everybod   2168778 2018-04-26 08:31:59 -0700 /sdcard/Download/composite.png

$ ls --full-time /storage/5C32-5336/test.txt
-rwxr-xr-x    1 root     everybod         6 2019-01-20 11:18:34 -0800 /storage/5C32-5336/test.txt

$ cp /sdcard/Download/composite.png  /sdcard

$ cp /storage/5C32-5336/test.txt  /sdcard

$ ls --full-time /sdcard/composite.png
-rw-rw----    1 root     everybod   2168778 2019-01-31 06:22:09 -0800 /sdcard/composite.png

$ ls --full-time /sdcard/test.txt
-rw-rw----    1 root     everybod         6 2019-01-31 06:22:19 -0800 /sdcard/test.txt

$ cp -p /sdcard/Download/composite.png  /sdcard
cp: can't preserve times of '/sdcard/composite.png': Operation not permitted
cp: can't preserve ownership of '/sdcard/composite.png': Operation not permitted
cp: can't preserve permissions of '/sdcard/composite.png': Operation not permitted

$ cp -p /storage/5C32-5336/test.txt  /sdcard
cp: can't preserve times of '/sdcard/test.txt': Operation not permitted
cp: can't preserve ownership of '/sdcard/test.txt': Operation not permitted
cp: can't preserve permissions of '/sdcard/test.txt': Operation not permitted



[Home page] Books Code Blog Python Author Train Find ©M.Lutz