%rec: Dependency
%doc: Dependency information
%mandatory: Type
-%allowed: Target Size CtimeSec CtimeNsec MtimeSec MtimeNsec Hash
-%unique: Type Target Size CtimeSec CtimeNsec MtimeSec MtimeNsec Hash
+%allowed: Target Size InodeNum CtimeSec CtimeNsec MtimeSec MtimeNsec Hash
+%unique: Type Target Size InodeNum CtimeSec CtimeNsec MtimeSec MtimeNsec Hash
%type: Type enum ifcreate ifchange always stamp
%type: Size int
+%type: InodeNum int
%type: CtimeSec int
%type: CtimeNsec int
%type: MtimeSec int
@command{redo-ifchange}'s @option{-f} option forces each target
rebuilding. Comparing to @command{redo}, it will parallelize the
process.
+@item
+ Inode's number is also stored as dependency information, just to
+ prevent possible @code{ctime} collision of two files.
@end itemize
@anchor{Release 1_22_0}
uses @url{https://github.com/BLAKE3-team/BLAKE3, BLAKE3} with 256-bit
output for that purpose.
-Also it stores file's size. Obviously if size differs, then file's
-content too and there is no need to read and hash it.
+Also it stores file's size and its inode number. Obviously if size
+differs, then file's content too and there is no need to read and hash it.
@vindex REDO_INODE_TRUST
But still it could be relatively expensive. So there are additional
type Inode struct {
Size int64
+ InodeNum uint64
CtimeSec int64
CtimeNsec int64
MtimeSec int64
if our.Size != their.Size {
return false
}
+ if our.InodeNum != their.InodeNum {
+ return false
+ }
switch InodeTrust {
case InodeTrustCtime:
if our.CtimeSec != their.CtimeSec || our.CtimeNsec != their.CtimeNsec {
func (inode *Inode) RecfileFields() []recfile.Field {
return []recfile.Field{
{Name: "Size", Value: strconv.FormatInt(inode.Size, 10)},
+ {Name: "InodeNum", Value: strconv.FormatUint(inode.InodeNum, 10)},
{Name: "CtimeSec", Value: strconv.FormatInt(inode.CtimeSec, 10)},
{Name: "CtimeNsec", Value: strconv.FormatInt(inode.CtimeNsec, 10)},
{Name: "MtimeSec", Value: strconv.FormatInt(inode.MtimeSec, 10)},
mtimeNsec := fi.ModTime().UnixNano()
return &Inode{
Size: fi.Size(),
+ InodeNum: uint64(stat.Ino),
CtimeSec: ctimeSec, CtimeNsec: ctimeNsec,
MtimeSec: mtimeSec, MtimeNsec: mtimeNsec,
}, nil
func inodeFromRec(m map[string]string) (*Inode, error) {
size := m["Size"]
+ inodeNum := m["InodeNum"]
ctimeSec := m["CtimeSec"]
ctimeNsec := m["CtimeNsec"]
mtimeSec := m["MtimeSec"]
if err != nil {
return nil, err
}
+ if inodeNum != "" {
+ inode.InodeNum, err = strconv.ParseUint(inodeNum, 10, 64)
+ if err != nil {
+ return nil, err
+ }
+ }
inode.CtimeSec, err = strconv.ParseInt(ctimeSec, 10, 64)
if err != nil {
return nil, err