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)
Sun, Dec 1, 6:56 PM
Unknown Object (File)
Fri, Nov 22, 5:46 PM
Unknown Object (File)
Thu, Nov 21, 11:28 AM
Unknown Object (File)
Nov 5 2024, 5:22 AM
Unknown Object (File)
Nov 1 2024, 4:18 AM
Unknown Object (File)
Oct 26 2024, 1:47 PM
Unknown Object (File)
Oct 26 2024, 1:47 PM
Unknown Object (File)
Oct 26 2024, 1:46 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 Not Applicable
Unit
Tests Not Applicable

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.