Guest User

Untitled

a guest
Jan 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. #!/bin/bash
  2. echo .
  3.  
  4. echo This bash script demonstrates a spurious message when cp -p is used to copy files to a MSDOS FAT32 formatted drive.
  5.  
  6. echo This script is run on the Terminal application of a MacBook Pro [OS X 10.11.6] [ darwin ].
  7.  
  8. echo We start with two identical files, test1,txt and test2.txt to be copied to a flash drive.
  9.  
  10. echo test1.txt has NOT been recently edited and the command produces NO error message.
  11.  
  12. cp -p -v test1.txt /VOLUMES/KMOVER/testout1.txt
  13.  
  14. echo .
  15.  
  16. echo test2.txt is a recently edited file so the below produces a spurious error message even though the copy works.
  17.  
  18. cp -p -v test2.txt /VOLUMES/KMOVER/testout2.txt
  19.  
  20. echo The error message above is expected to appear as follows:
  21.  
  22. echo "cp: fchflags: /Volumes/KMOVER/testout2.txt: Invalid argument"
  23.  
  24. echo .
  25.  
  26. echo The ls -la command results below shows that both copies worked, all .txt files have exactly the same size, and their modification date/times are preserved.
  27. ls -la test*.txt
  28.  
  29. ls -la /VOLUMES/KMOVER/test*.txt
  30.  
  31. echo .
  32.  
  33. echo So far, I have noticed three conditions that cause this spurious message for a cp.
  34. echo Without any one of these, the spurious message is not present.
  35.  
  36. echo 1. The source file has a recent date [less than a few hours old].
  37.  
  38. echo 2. The -p parameter is specified to preseve the modification date.
  39.  
  40. echo 3. The copy is to an MSDOS FAT32 flash drive.
  41.  
  42. echo .
  43.  
  44. echo I suspect this is a bug in cp or fchflags.
  45.  
  46. echo Can anyone please confirm this and advise on what to do about it.
Add Comment
Please, Sign In to add comment