Skip to content

Commit

Permalink
Prevent delete failure for non-existent file
Browse files Browse the repository at this point in the history
  • Loading branch information
adreed-msft committed May 5, 2023
1 parent 5b968b1 commit 712dc33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion e2etest/declarativeTestFiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (o *objectUnixStatContainer) AddToMetadata(metadata map[string]string) {

if o.modTime != nil {
mask |= common.STATX_MTIME
metadata[common.POSIXModTimeMeta] = strconv.FormatInt(o.accessTime.UnixNano(), 10)
metadata[common.POSIXModTimeMeta] = strconv.FormatInt(o.modTime.UnixNano(), 10)
}

metadata[common.LINUXStatxMaskMeta] = strconv.FormatUint(uint64(mask), 10)
Expand Down
4 changes: 2 additions & 2 deletions ste/xfer-remoteToLocal-symlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func remoteToLocal_symlink(jptm IJobPartTransferMgr, p pipeline.Pipeline, pacer
return
} else {
err = os.Remove(info.Destination)
if err != nil {
if err != nil && !os.IsNotExist(err) { // should not get back a non-existent error, but if we do, it's not a bad thing.
jptm.FailActiveSend("deleting old file", err)
jptm.ReportTransferDone()
return
Expand All @@ -53,7 +53,7 @@ func remoteToLocal_symlink(jptm IJobPartTransferMgr, p pipeline.Pipeline, pacer
}
} else {
err := os.Remove(info.Destination)
if err != nil {
if err != nil && !os.IsNotExist(err) { // it's OK to fail because it doesn't exist.
jptm.FailActiveSend("deleting old file", err)
jptm.ReportTransferDone()
return
Expand Down

0 comments on commit 712dc33

Please sign in to comment.