Skip to content

Conversation

@didiercolens
Copy link

@didiercolens didiercolens commented Oct 8, 2025

Description:

Attempt to address issue #1876. Note I used AI tools, and reviewed the code, but am not usually coding golang. Fix looks ok to me, but I can understand it does not meet the project standards.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)? (reports issues but not on new code)

@didiercolens didiercolens requested review from a team as code owners October 8, 2025 12:19
@CLAassistant
Copy link

CLAassistant commented Oct 8, 2025

CLA assistant check
All committers have signed the CLA.

@didiercolens didiercolens force-pushed the fix/filesystem-line-number branch from 1a7728a to e6a7e44 Compare October 13, 2025 08:10
@rosecodym
Copy link
Contributor

Thanks for taking a look at this - it's been a vexing issue for a while. But because it's been such a vexing issue, I'd like to ensure we do our due diligence with attempted fixes. Would you mind adding to the PR description:

  • A technical description of what's causing the line number error
  • An explanation of how your PR resolves it

Adding both of these things will allow reviewers to review the code in the context of your intention, and then, if we later merge it, provide a valuable historical record of the bug and the fix.

Thanks! We really appreciate community contributions, especially for thorny problems like this one. I just want to ensure that the rest of us can keep up with you!

Copy link
Contributor

@camgunz camgunz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want a small change to the linesConsumed declaration and had a question about the proto.Clone call, but looks pretty good. I'll also second the asks from @rosecodym

chunkSkel *sources.Chunk,
reporter sources.ChunkReporter,
) error {
var linesConsumed int64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just linesConsumed := 0 is OK here; this will be an int which is 64-bit on all platforms we care about

chunk := *chunkSkel
if chunk.SourceMetadata != nil {
if cloned, ok := proto.Clone(chunk.SourceMetadata).(*source_metadatapb.MetaData); ok {
chunk.SourceMetadata = cloned
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this is doing, but for various personal reasons I'm behind on sleep 😹 so it's likely I'm missing something obvious

}
}

// updateFilesystemLineMetadata sets the 1-based starting line for filesystem chunks and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great comment, love it 🙌🏻

@effortlessdevsec
Copy link

effortlessdevsec commented Nov 1, 2025

hi @rosecodym @camgunz @tflis please merge this pr , we are getting multiple same issue , using this pr, it is resolved, so please merge so that everytime we dont have to build

@camgunz
Copy link
Contributor

camgunz commented Nov 4, 2025

Hey @effortlessdevsec (and @didiercolens)! Again we super appreciate your contributions here. Please address the comments from @rosecodym and myself; like he said we have been looking for a fix for this issue for some time, but we have lots of users of trufflehog and we have to ensure its quality for all of them. A major way we do that is making maintenance as easy as possible, and that includes things like informative, technical PR descriptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants