Re: Cleanup of err(1, "unveil") pattern

2021-07-10 Thread Ashton Fagg
Friendly weekly ping. Ashton Fagg writes: > Original thread and discussion here: > > https://marc.info/?l=openbsd-tech&m=162000231914017&w=2 > > I started this a couple of months ago but realized I never actually > finished this and submitted the full diff. So here it is, for whole > src tree. >

Cleanup of err(1, "unveil") pattern

2021-07-02 Thread Ashton Fagg
Original thread and discussion here: https://marc.info/?l=openbsd-tech&m=162000231914017&w=2 I started this a couple of months ago but realized I never actually finished this and submitted the full diff. So here it is, for whole src tree. I've run this through a `make build` here locally to ensu

Cleanup of err(1, "unveil") pattern: usr.bin

2021-05-04 Thread Ashton Fagg
Ashton Fagg writes: > Ok splendid. I've regenerated these, this time including dhcpleased and > slaacd since Florian requested I do this in private mail. > > I went for err(1, "unveil %s", path) per Theo's suggestion - nice and > clear. This is now everything in sbin, bin and games. usr/{bin, sbi

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-03 Thread Ashton Fagg
"Theo de Raadt" writes: > No, it is either: > > err(1, "unveil %s", path) > > or > > err(1, "unveil: %s", path) > > I remain undecided between those two, i don't particularily like two :: in > a error message. Ok splendid. I've regenerated these, this time including dhcpleased and slaacd since F

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-03 Thread Florian Obser
Florian Obser writes: > There are 4 or five cases how unveil is called, depending on how > you count. The permission seems to be always a string literal or NULL. > The path can be: > > 1) a string literal > 2) a #define > 3) a variable > 4) the empty string literal "" For the archives, I misreme

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-03 Thread Theo de Raadt
Ashton Fagg wrote: > On Mon, 3 May 2021 at 10:17, Theo de Raadt wrote: > > So if the messages were just 'unveil %s: error' or 'unveil: %s: error' > > I would be thrilled, as this allows users to realize why the program is > > not working right. > > Florian/Theo, > > Thanks for the reviews. >

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-03 Thread Ashton Fagg
On Mon, 3 May 2021 at 10:17, Theo de Raadt wrote: > So if the messages were just 'unveil %s: error' or 'unveil: %s: error' > I would be thrilled, as this allows users to realize why the program is > not working right. Florian/Theo, Thanks for the reviews. So it sounds like err(1, "unveil: %s er

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-03 Thread Florian Obser
"Theo de Raadt" writes: > Florian Obser wrote: > >> In this hunk alone you have three out of five and you log them all >> differently. I think this should be unified as >> fatal("unveil(\"%s\", \"%s\")", _PATH_RESCONF, "wc"); >> fatal("unveil(\"%s\", \"%s\")", /etc/resolv.conf.tail, "r

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-03 Thread Theo de Raadt
Theo de Raadt wrote: > Florian Obser wrote: > > > In this hunk alone you have three out of five and you log them all > > differently. I think this should be unified as > > fatal("unveil(\"%s\", \"%s\")", _PATH_RESCONF, "wc"); > > fatal("unveil(\"%s\", \"%s\")", /etc/resolv.conf.tail, "r

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-03 Thread Theo de Raadt
Florian Obser wrote: > In this hunk alone you have three out of five and you log them all > differently. I think this should be unified as > fatal("unveil(\"%s\", \"%s\")", _PATH_RESCONF, "wc"); > fatal("unveil(\"%s\", \"%s\")", /etc/resolv.conf.tail, "r"); > fatal("unveil(\"%s\

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-03 Thread Florian Obser
On Sun, May 02, 2021 at 09:00:21PM -0400, Ashton Fagg wrote: > "Theo de Raadt" writes: > > > Showing the symbolic name is not doing anywhere else in the tree. > > > > Most likely they should be > > > >err(1, "unveil: %s", path); > > Per Theo's advice, updated diffs are attached.

Cleanup of err(1, "unveil") pattern: xenocara

2021-05-02 Thread Ashton Fagg
Ashton Fagg writes: > Hi all, > > I saw a discussion on here a while ago about the use of patterns like: > > if (unveil(some_path, "r") == -1) >err(1, "unveil"); > > And why that's maybe not preferable for debugging and troubleshooting > purposes for programs which have multiple unveil calls

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-02 Thread Ashton Fagg
"Theo de Raadt" writes: > Showing the symbolic name is not doing anywhere else in the tree. > > Most likely they should be > > err(1, "unveil: %s", path); Per Theo's advice, updated diffs are attached. diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 993c829f2d2..

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-02 Thread Ashton Fagg
Thanks for the review - wasn't sure if that was useful. Will regenerate without the symbolic names. On Sun, 2 May 2021 at 20:37, Theo de Raadt wrote: > > Showing the symbolic name is not doing anywhere else in the tree. > > Most likely they should be > >err(1, "unveil: %s", path); > >

Re: Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-02 Thread Theo de Raadt
Showing the symbolic name is not doing anywhere else in the tree. Most likely they should be err(1, "unveil: %s", path); Ashton Fagg wrote: > Ashton Fagg writes: > > > Hi all, > > > > I saw a discussion on here a while ago about the use of patterns like: > > > > if (unveil(some_p

Cleanup of err(1, "unveil") pattern: bin, games, sbin

2021-05-02 Thread Ashton Fagg
Ashton Fagg writes: > Hi all, > > I saw a discussion on here a while ago about the use of patterns like: > > if (unveil(some_path, "r") == -1) >err(1, "unveil"); > > And why that's maybe not preferable for debugging and troubleshooting > purposes for programs which have multiple unveil calls

Cleanup of err(1, "unveil") pattern? Diff for ps.c.

2021-05-01 Thread Ashton Fagg
Hi all, I saw a discussion on here a while ago about the use of patterns like: if (unveil(some_path, "r") == -1) err(1, "unveil"); And why that's maybe not preferable for debugging and troubleshooting purposes for programs which have multiple unveil calls (which happens fairly often). Origin