Page MenuHomeFreeBSD

pkg: Add limited --debug/-d support
ClosedPublic

Authored by brooks on Jul 8 2022, 12:16 PM.
Tags
None
Referenced Files
F86206740: D35756.diff
Mon, Jun 17, 12:11 AM
Unknown Object (File)
May 14 2024, 11:42 AM
Unknown Object (File)
Apr 28 2024, 9:28 PM
Unknown Object (File)
Mar 12 2024, 11:29 AM
Unknown Object (File)
Mar 12 2024, 11:29 AM
Unknown Object (File)
Mar 12 2024, 11:26 AM
Unknown Object (File)
Mar 12 2024, 11:25 AM
Unknown Object (File)
Mar 12 2024, 10:10 AM

Details

Summary

Add an internal debug level global:

  • Level 1 (-d) currently does nothing.
  • Level 2 (-d -d) enables libfetch debugging (quite verbose) so it's possible to see what pkg is attempting to download without having to sniff traffic.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46322
Build 43211: arc lint + arc unit

Event Timeline

I wrote this because it's too hard to tell what's going on when some "enterprise" middle box is corrupting fetches. (We've seen this from two sites so far when people are trying to bootstrap CheriBSD packages and getting blobs of html back instead of their intended downloads.) You can't even see what URLs are being downloaded in order to start debugging and the error "No trusted fingerprint found matching package's certificate" isn't informative.

usr.sbin/pkg/pkg.c
1231

I could be convinced to do debug > 0 for now, but if there were actually debugging output from the program itself the libfetch output is really too verbose for the fist level.

probably accepting the DEBUG_LEVEL env var like pkg(8) would be also a good idea

This revision is now accepted and ready to land.Jul 8 2022, 1:20 PM
debdrup added a subscriber: debdrup.

I spotted a few nits, but they're not worth holding up the review for as they can be fixed before the commit is pushed.

usr.sbin/pkg/pkg.7
131

s/ke/y/

Also, I added a few more words to the sentence to explain exactly what it does, not just that it can be used more than once - but maybe you prefer a different description that avoids the word verbosity, since it's typically used when denoting the -v flag.

  • Fix typo and add a little more documentation of what debug output does.
This revision now requires review to proceed.Jul 28 2022, 6:38 PM
brooks added inline comments.
usr.sbin/pkg/pkg.7
131

I've expanded the description. I'm a little worried about it getting out of date, but for now what it does is simple.

pauamma_gundo.com added inline comments.
usr.sbin/pkg/pkg.7
129

I *think* that markup would be better and more consistent with -- long options markup used elsewhere, but I'm not familiar enough with mdoc(7) to be fully confident.

brooks marked an inline comment as done.
  • Use "Fl -debug" markup
  • Bump doc date
  • Rebase
This revision is now accepted and ready to land.Aug 24 2022, 7:12 AM
This revision was automatically updated to reflect the committed changes.