Page MenuHomeFreeBSD

usr.sbin/newsyslog: Implement E newsyslog.conf entry flag
ClosedPublic

Authored by otis on Feb 26 2021, 4:36 PM.
Tags
None
Referenced Files
F102751040: D28940.id84878.diff
Sat, Nov 16, 4:35 PM
Unknown Object (File)
Sat, Oct 19, 4:22 PM
Unknown Object (File)
Oct 10 2024, 9:12 PM
Unknown Object (File)
Sep 23 2024, 1:56 PM
Unknown Object (File)
Sep 18 2024, 10:13 AM
Unknown Object (File)
Sep 9 2024, 3:02 AM
Unknown Object (File)
Sep 6 2024, 3:21 AM
Unknown Object (File)
Sep 2 2024, 6:33 PM
Subscribers

Details

Summary

Based on a conversation with @dvl (https://twitter.com/DLangille/status/1364944587647836166) where an idea came from his work colleague, Laszlo Danielisz:

Implement E flag for newsyslog.conf entries.

This flag instructs newsyslog to not rotate a logfile when its size is zero bytes.

Its most frequent use will be along with N and/or B flags.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

otis requested review of this revision.Feb 26 2021, 4:36 PM

This arose from a Tweet: https://twitter.com/DLangille/status/1364944587647836166

My question came from a work colleague, Laszlo Danielisz. It was his idea.

Adding reviewers who did some work on newsyslog over the past years.

This revision is now accepted and ready to land.Feb 26 2021, 7:32 PM

Seems reasonable to me, just a couple of minor comments.

usr.sbin/newsyslog/newsyslog.c
535

The parentheses around (ent->fsize == 0) are redundant.

usr.sbin/newsyslog/newsyslog.conf.5
291

I'd suggest adding a sentence noting that this option is not very useful without 'B'.

It would be cool if we could also avoid rotation if the file only contains the message from the previous rotation, but I'm not sure how best to approach that.

I also think

usr.sbin/newsyslog/newsyslog.conf.5
291

Perhaps also mention: don't use compression. e.g. JXYZ

otis marked an inline comment as done.Feb 26 2021, 8:04 PM
otis added inline comments.
usr.sbin/newsyslog/newsyslog.conf.5
291

I'd suggest adding a sentence noting that this option is not very useful without 'B'.

It would be cool if we could also avoid rotation if the file only contains the message from the previous rotation, but I'm not sure how best to approach that.

  • A mention of B has been added
  • I was thinking about it, it can be subject to another RR in near future.
291

Perhaps also mention: don't use compression. e.g. JXYZ

As has been mentioned on IRC, compression does not matter in this case, as B ensures that the new file is empty and rotated file can be compressed anyway.

rpokala requested changes to this revision.Feb 27 2021, 2:49 AM
rpokala added a subscriber: rpokala.
rpokala added inline comments.
usr.sbin/newsyslog/newsyslog.c
1300

The description and manpage say E, but you're checking for e.

This revision now requires changes to proceed.Feb 27 2021, 2:49 AM
otis added inline comments.
usr.sbin/newsyslog/newsyslog.c
1300

The description and manpage say E, but you're checking for e.

There is switch (tolowerch(*q)) so yes, e is apropriate.

The new revision wasn't uploaded, but this seems ok to me.

The new revision wasn't uploaded, but this seems ok to me.

Now it can be accepted. RR has been updated.

otis marked 2 inline comments as done.Feb 27 2021, 4:18 PM
usr.sbin/newsyslog/newsyslog.conf.5
288–301

New sentences should start on new lines.

  • Start new sentence on a new line.
otis marked an inline comment as done.Feb 27 2021, 5:18 PM
rpokala added inline comments.
usr.sbin/newsyslog/newsyslog.c
1300

Ugh, it is! That's

  1. Gross 🤮
  2. Not your fault 😜

Bearing that in mind, LGTM.

This revision is now accepted and ready to land.Feb 28 2021, 12:17 AM