Page MenuHomeFreeBSD

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

Authored by brooks on Jul 8 2022, 12:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 5, 5:22 AM
Unknown Object (File)
Fri, Nov 1, 4:18 AM
Unknown Object (File)
Sat, Oct 26, 1:47 PM
Unknown Object (File)
Sat, Oct 26, 1:47 PM
Unknown Object (File)
Sat, Oct 26, 1:46 PM
Unknown Object (File)
Sat, Oct 26, 1:46 PM
Unknown Object (File)
Sat, Oct 26, 1:46 PM
Unknown Object (File)
Sat, Oct 26, 1:31 PM

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
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 47095
Build 43982: 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
1229

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.