Subject: | File:Touch & make |
In creating a script that is required to prevent a make from happening by "touching" a file AFTER another process has updated dependency I noticed that using File::Touch does not give the intended result. Moreover it appears that the file system actually maintains greater granularity of time for modification of files. Consider these two files:
[rlauer@ip-10-1-4-191 lambda](cpanfile)$ stat Lambda
File: ‘Lambda’
Size: 759 Blocks: 8 IO Block: 4096 regular file
Device: ca01h/51713d Inode: 718847 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 501/ rlauer) Gid: ( 501/ rlauer)
Access: 2019-01-14 14:32:58.000000000 -0500
Modify: 2019-01-14 14:32:58.000000000 -0500
Change: 2019-01-14 14:32:58.278280121 -0500
Birth: -
[rlauer@ip-10-1-4-191 lambda](cpanfile)$ stat runtime_layer_arn
File: ‘runtime_layer_arn’
Size: 61 Blocks: 8 IO Block: 4096 regular file
Device: ca01h/51713d Inode: 718761 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 501/ rlauer) Gid: ( 501/ rlauer)
Access: 2019-01-14 14:32:58.274280108 -0500
Modify: 2019-01-14 14:32:58.274280108 -0500
Change: 2019-01-14 14:32:58.274280108 -0500
Birth: -
Note that Lambda was actually touched by File::Touch AFTER runtime_layer_arn...
It appears to me that File::Touch granularity cannot be relied upon for make operations. Perhaps not a bug, but an implementation anomaly? Modification of file attributes vs actual modification or access by the file system? If my analysis is correct than perhaps a note in documentation might be warranted that the granularity may not match actual file system operations and therefore mod/access times do not reflect the actual time but a truncated to the second time.