Skip to content

Commit 559fcf4

Browse files
authored
Merge pull request #5860 from larsewi/bit-flip
ENT-13179: Fixed bug where immutable bit is flipped between agent runs
2 parents 6c50024 + cad2292 commit 559fcf4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

cf-agent/verify_files.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ static PromiseResult VerifyFilePromise(EvalContext *ctx, char *path, const Promi
373373
break;
374374
case FS_ATTRS_FAILURE:
375375
RecordFailure(ctx, pp, &a,
376-
"Failed to clear the immutable bit on file '%s'",
377-
changes_path);
376+
"Failed to clear the immutable bit on file '%s': %s",
377+
changes_path, FSAttrsErrorCodeToString(res));
378378
result = PromiseResultUpdate(result, PROMISE_RESULT_FAIL);
379379
break;
380380
case FS_ATTRS_NOT_SUPPORTED:
@@ -663,14 +663,15 @@ static PromiseResult VerifyFilePromise(EvalContext *ctx, char *path, const Promi
663663
switch (res)
664664
{
665665
case FS_ATTRS_SUCCESS:
666-
Log(LOG_LEVEL_VERBOSE, "Set the immutable bit on file '%s'",
667-
changes_path);
666+
RecordChange(ctx, pp, &a,
667+
"Set the immutable bit on file '%s'",
668+
changes_path);
668669
break;
669670
case FS_ATTRS_FAILURE:
670671
/* Things still may be fine as long as the agent does not try to mutate the file */
671-
Log(LOG_LEVEL_VERBOSE,
672-
"Failed to set the immutable bit on file '%s': %s",
673-
changes_path, FSAttrsErrorCodeToString(res));
672+
RecordFailure(ctx, pp, &a,
673+
"Failed to set the immutable bit on file '%s': %s",
674+
changes_path, FSAttrsErrorCodeToString(res));
674675
break;
675676
case FS_ATTRS_NOT_SUPPORTED:
676677
/* We will not treat this as a promise failure because this

libpromises/override_fsattrs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ bool OverrideImmutableRename(
221221
}
222222

223223
ResetTemporarilyClearedImmutableBit(
224-
new_filename, override, res_old, old_is_immutable);
224+
new_filename, override, res_old, new_is_immutable);
225225

226226
return true;
227227
}

0 commit comments

Comments
 (0)