Bug 202932 - sysutils/rsyslog8 endless loop on FreeBSD 10.2
Summary: sysutils/rsyslog8 endless loop on FreeBSD 10.2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Brad Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-06 16:51 UTC by Alexandre Fenyo
Modified: 2016-06-27 19:56 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (brd)


Attachments
correcting the endless loop bug (1.16 KB, patch)
2015-09-06 16:51 UTC, Alexandre Fenyo
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandre Fenyo 2015-09-06 16:51:40 UTC
Created attachment 160781 [details]
correcting the endless loop bug

Hi,

Bug ID 200429 (endless loop when started at boot time), that had been corrected on FreeBSD 10.1, came back with FreeBSD 10.2, due to kernel behaviour changes.

When the /dev/console device is revoked, writing to the device sets errno to:
- ENXIO with FreeBSD 10.1 kernel
- EIO with FreeBSD 10.2 kernel

The following program can be used to see this behaviour change:
------------------------------------------------------------------
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
extern int errno;
int main() {
  int id = open("/dev/console", O_RDWR);
  revoke("/dev/console");
  int ret = write(id, "X", 1);
  if (ret < 0) printf("errno=%d\n", errno);
  return 0;
}
------------------------------------------------------------------
It returns 6 (ENXIO) on FreeBSD 10.1 and 5 (EIO) on FreeBSD 10.2.

To make rsyslog8 work correctly, here is a new version of sysutils/rsyslog8/files/patch-runtime_stream.c, in which I've added modifications to correct the bug.

Note that the bug had been previously corrected in the main stream, in the rsyslog8 original sources, not by a FreeBSD patch. But I've not sent a patch proposal to the main stream this time because I suspect that the new behaviour of the kernel is unwanted. So, I will open a bug report for this new behaviour, and depending on the result, I may, or not, send back a bug report to the main stream.

Sincerely,
Comment 1 Alexandre Fenyo 2015-09-13 23:58:09 UTC
I've created bug ID 202933 to inform about the kernel source code that changed and that finally breaks the rsyslog8 port.

This kernel change, that has modified the error number returned by a syscall trying to write to a revoked console, seems to be wanted, according to the associated svn log.

But this seems to me to be an ABI change in the 10-Release major branch. So I've asked if such a change is really wanted.

Depending on the response to bug ID 202933 by FreeBSD kernel maintainers, I will report here the way to make the port work correctly.
Comment 2 Brad Davis freebsd_committer freebsd_triage 2016-06-27 19:56:54 UTC
Thank you for working with upstream to get this fixed!