Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Created attachment 994408[details]
call fflush() before checking ferror() on job file descriptor
Description of problem:
at does not properly call fflush() before checking ferror on job file.
If filesystem (/var) is full or almost full when setting at job is attempted, a 0byte or truncated file is created.
This causes a spew of
File <filename> is in wrong format - aborting
to syslog which can fill up /var again very quickly.
Version-Release number of selected component (if applicable):
3.1.10
How reproducible:
Happens if filesystem containing /var/spool/at is full.
Steps to Reproduce:
1. Fill up /var
2. set a small job with `at`
3. observe that the file created is 0bytes long
4. wait for the scheduled time
Actual results:
at does not properly remove at file when write error to the file occurs. This leaves behind a 0byte or potentially truncated job file.
0byte job files are created and when scheduled time is reached, atd complains profusely with:
File <filename> is in wrong format - aborting
If written to /var/log/messages (which is default), file grows rapidly until jobs are removed with atrm.
If /var is already full, and messages is cleared out without cleaning up the bad at jobs, /var fills up again very soon.
Expected results:
at should reach
fprintf(fp, "\n");
if (ferror(fp))
panic("Output error");
so panic() cleans up the malformed atfile.
Need to fflush() before checking ferror() in case the write() returns an error.
Additional info:
Patch attached, built against 3.1.10 and tested on Scientific Linux 6.6.
Created attachment 994408 [details] call fflush() before checking ferror() on job file descriptor Description of problem: at does not properly call fflush() before checking ferror on job file. If filesystem (/var) is full or almost full when setting at job is attempted, a 0byte or truncated file is created. This causes a spew of File <filename> is in wrong format - aborting to syslog which can fill up /var again very quickly. Version-Release number of selected component (if applicable): 3.1.10 How reproducible: Happens if filesystem containing /var/spool/at is full. Steps to Reproduce: 1. Fill up /var 2. set a small job with `at` 3. observe that the file created is 0bytes long 4. wait for the scheduled time Actual results: at does not properly remove at file when write error to the file occurs. This leaves behind a 0byte or potentially truncated job file. 0byte job files are created and when scheduled time is reached, atd complains profusely with: File <filename> is in wrong format - aborting If written to /var/log/messages (which is default), file grows rapidly until jobs are removed with atrm. If /var is already full, and messages is cleared out without cleaning up the bad at jobs, /var fills up again very soon. Expected results: at should reach fprintf(fp, "\n"); if (ferror(fp)) panic("Output error"); so panic() cleans up the malformed atfile. Need to fflush() before checking ferror() in case the write() returns an error. Additional info: Patch attached, built against 3.1.10 and tested on Scientific Linux 6.6.