Skip to content

Conversation

@Nepomuk5665
Copy link
Contributor

Summary

  • Fix copy-paste bug where BF_HOOKOPTS_FAMILY was checked instead of BF_HOOKOPTS_PRIORITIES when printing priorities
  • The bug caused priorities to not be printed when only BF_HOOKOPTS_PRIORITIES was set
  • The bug also caused priorities to be printed with potentially invalid values when only BF_HOOKOPTS_FAMILY was set

Bug Details

In bfc_chain_dump(), the condition for printing the priorities field incorrectly checked for BF_HOOKOPTS_FAMILY:

// Before (incorrect - copy-paste error)
if (bf_hookopts_is_used(hookopts, BF_HOOKOPTS_FAMILY)) {
    (void)fprintf(stdout, "%spriorities=%d-%d", ...);
    ...
}

// After (correct)
if (bf_hookopts_is_used(hookopts, BF_HOOKOPTS_PRIORITIES)) {
    (void)fprintf(stdout, "%spriorities=%d-%d", ...);
    ...
}

This was clearly a copy-paste error from the preceding block that checks BF_HOOKOPTS_FAMILY for the family field.

Testing

  • Code inspection confirms the fix matches the enum definition in hook.h

The condition for printing priorities in bfc_chain_dump() incorrectly
checked BF_HOOKOPTS_FAMILY instead of BF_HOOKOPTS_PRIORITIES. This was
likely a copy-paste error from the preceding condition block.

This bug caused:
1. Priorities not being printed when only BF_HOOKOPTS_PRIORITIES was set
2. Priorities being printed (with potentially invalid values) when only
   BF_HOOKOPTS_FAMILY was set
@qdeslandes
Copy link
Contributor

LGTM! Thanks for fixing this!

@qdeslandes qdeslandes merged commit dbb28a7 into facebook:main Jan 26, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants