Bug 268020 - newsyslog(8) size condition fails on large files
Summary: newsyslog(8) size condition fails on large files
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-27 19:28 UTC by Marcin Gryszkalis
Modified: 2022-12-06 21:33 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Gryszkalis 2022-11-27 19:28:52 UTC
When logfile is large (in my case happened on 1.3TB file) newsyslog fails with "does not exists, skipped" which is triggered by
if (ent->fsize < 0)

quick look suggests that fsize is set via sizefile() that returns int mapped to size in kilobytes, which shouldn't overflow so not sure for the reason of error...
Comment 1 Ed Maste freebsd_committer freebsd_triage 2022-11-29 17:39:06 UTC
I'm not sure what happened in your case, but 1.3TB isn't that far from overflowing an int when converted to kb, so it seems sensible to address that either way.

I suspect this has not been reported before just because it's unusual to have such a large log file.
Comment 2 Marcin Gryszkalis 2022-12-06 21:33:13 UTC
For unknown reason I wrongly assumed 64-bit int. I guess it was overflow of signed 32-bit int. I could be wrong about 1.3TB (it could be more and possibly I checked usage with du without -A while having compression enabled on ZFS).

Log has grown that large simply because of typo in /etc/newsyslog.conf and fixing the typo apparently didn't help so I tested manually with newsyslog -v.