If you have a patch that works for you, by all means, push it.

As for the philosophy and reasons for logging...I have to defer to Jim to
come up with a cogent response.  I personally wouldn't have bothered with
any logging code.  There may be some delays in his responding.  There
recently was a death in his family, and it may be a couple of weeks before
he can give software development his full attention.

> -----Original Message-----
> From: Rainer Orth <r...@cebitec.uni-bielefeld.de>
> Sent: Monday, May 12, 2025 08:06
> To: gcc-patches@gcc.gnu.org
> Cc: Robert Dubner <rdub...@symas.com>; James K. Lowden
> <jklow...@cobolworx.com>
> Subject: [PATCH] libgcobol: Allow for lack of LOG_PERROR
> 
> The libgcobol build is broken again on Solaris:
> 
> /vol/gcc/src/hg/master/local/libgcobol/libgcobol.cc: In function 'void
> default_exception_handler(ec_type_t)':
> /vol/gcc/src/hg/master/local/libgcobol/libgcobol.cc:11196:44: error:
> 'LOG_PERROR' was not declared in this scope; did you mean 'LOG_ERR'?
> 11196 |   static int priority = LOG_INFO, option = LOG_PERROR, facility
=
> LOG_USER;
>       |                                            ^~~~~~~~~~
>       |                                            LOG_ERR
> /vol/gcc/src/hg/master/local/libgcobol/libgcobol.cc:11202:28: error:
> 'facility' was not declared in this scope
> 11202 |     openlog(ident, option, facility);
>       |                            ^~~~~~~~
> 
> LOG_PERROR is a BSD extension not present on Solaris due to its System V
> heritage, and Linux syslog(3) documents:
> 
>        LOG_PERROR     (Not in POSIX.1-2001 or  POSIX.1-2008.)   Also
log
> the
>                       message to stderr.
> 
> This patch provides a fallback definition, just the minimum to unbreak
> the build.
> 
> Tested on amd64-pc-solaris2.11, sparcv9-sun-solaris2.11, and
> x86_64-pc-linux-gnu.
> 
> Before going further, I'd first like to understand why you chose to use
> syslog in a runtime lib.  While logging to syslog is certainly useful in
> daemons and such, a runtime lib is different IMO: while regular users
> can log to syslog, access to the log files is usually restricted to
> privileged users.  Besides, on multiuser systems those log entries just
> spam the system logs for no gain apparent to me.  On top of that, the
> format of the `log to stderr' part now becomes platform dependent, since
> the details are a system implementation detail even on platforms that do
> support LOG_PERROR.
> 
> That said, if it's really considered crucial that libgcobol continues to
> log to syslog, one could do something like introduce, say,
> syslog_and_perror which uses just syslog with LOG_PERROR on platforms
> that support LOG_PERROR and syslog + warnx (as the code did before the
> EH rewrite) on those that don't.
> 
> Thoughts?
> 
>       Rainer
> 
> --
>
--------------------------------------------------------------------------
> ---
> Rainer Orth, Center for Biotechnology, Bielefeld University
> 
> 
> 2025-05-12  Rainer Orth  <r...@cebitec.uni-bielefeld.de>
> 
>       libgcobol:
>       * libgcobol.cc {!LOG_PERROR] (LOG_PERROR): Provide fallback.

Reply via email to