Bug 274187 - sysutils/syslog-ng: Fix plist error when building with PYTHON option
Summary: sysutils/syslog-ng: Fix plist error when building with PYTHON option
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Cy Schubert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-30 23:59 UTC by Romain Tartière
Modified: 2023-10-03 14:27 UTC (History)
2 users (show)

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


Attachments
Patch to fix the issue (1.14 KB, patch)
2023-09-30 23:59 UTC, Romain Tartière
no flags Details | Diff
make reloc.py references part of PYTHON instead of PYTHON_MOD in plist (2.07 KB, patch)
2023-10-02 08:28 UTC, Peter Czanik
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Tartière freebsd_committer freebsd_triage 2023-09-30 23:59:24 UTC
Created attachment 245343 [details]
Patch to fix the issue

When building with python support:

---Begin OPTIONS List---
===> The following configuration options are available for syslog-ng-4.4.0:
[...]
     PYTHON=on: Build with Python 3.9 support

Some files are orphaned:

===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: lib/syslog-ng/python/syslogng/__pycache__/reloc%%PYTHON_EXT_SUFFIX%%.pyc
Error: Orphaned: lib/syslog-ng/python/syslogng/reloc.py

It look like this is part of https://github.com/syslog-ng/syslog-ng/commit/64f7b8e52e3358dc6c11824954f3a89966b048e1 added last week.


No need to bump PORTREVISION since PYTHON is not a default option.
Comment 1 Romain Tartière freebsd_committer freebsd_triage 2023-10-01 00:06:27 UTC
Also the python packaging do a few weird things:

1. syslog-ng python files are expected to be installed in $PREFIX/etc/python (it makes sense since the main configuration file is $PREFIX/etc/syslog-ng.conf and PatternDB config is in $PREFIX/etc/patterndb.d/)…  Maybe moving everything in a syslog-ng sub-directory would make things cleaner:

  - $PREFIX/etc/syslog-ng/patterndb.d/
  - $PREFIX/etc/syslog-ng/python/
  - $PREFIX/etc/syslog-ng/syslog-ng.conf;

2. the venv used by syslog-ng seems to be in /var/db/python-venv.  It is not a db so /var/db does not seem appropriate.  Maybe it can be moved to /var/syslog-ng/python-venv?

What do you think?
Comment 2 Cy Schubert freebsd_committer freebsd_triage 2023-10-01 04:11:20 UTC
(In reply to Romain Tartière from comment #1)

I'm not enamoured with another high level directory in /var. /var/lib/syslog-ng makes ore sense than /var/syslog-ng.

I've sent an email (cc'd you to Peter Czanik, the author of the FreeBSD syslog-ng port and the virtual maintainer. He is one of the syslog-ng developers and is employed by One Identity, the company that wrote and maintains syslog-ng. Maybe there is a reason they put the files where they do and might maintain some commonality with their Linux packages.

As far as fixing plist is concerned, please commit the change and mark it approved by me. But regarding the other questions, I prefer to let Peter Czanik weigh in first before we do anything.
Comment 3 Peter Czanik 2023-10-02 08:26:13 UTC
reloc.py: I made it part of plist, just at the wrong place. I added it to PYTHON_MOD instead of PYTHON. I'll send a patch soon.

As for the others, they are coming from these configure arguments:

CONFIGURE_ARGS= --sysconfdir=${LOCALBASE}/etc --localstatedir=/var/db \

Most likely these packaging decisions were made when there was a single syslog-ng.conf in /usr/local/etc and a single persists file under /var/db. I know enough FreeBSD packaging to make sure that it compiles and works, but I do not know the best practices how to handle major changes like file location changes. I mean if we change from /usr/local/etc/syslog-ng.conf to /usr/local/etc/syslog-ng/syslog-ng.conf then on the next update syslog-ng would suddenly run on a completely new config instead of the locally customized one. And /var/db/syslog-ng.persist contains some important run-time info, like last read location in a file. Without migrating it to the new location, this info is lost and logs are either sent twice or lost (depending on the driver).

So, while I agree with both changes, first we need to figure out how to cause the least disruption to users. Especially knowing that syslog-ng is part of various FreeBSD-based appliances.
Comment 4 Peter Czanik 2023-10-02 08:28:15 UTC
Created attachment 245371 [details]
make reloc.py references part of PYTHON instead of PYTHON_MOD in plist
Comment 5 Romain Tartière freebsd_committer freebsd_triage 2023-10-03 02:20:27 UTC
Comment on attachment 245343 [details]
Patch to fix the issue

Hey!

@cy, regarding `/var/syslog-ng` vs `/var/lib/syslog-ng`, I don't  really care :-). I trend to omit the `lib` because it is not documented in hier(7) and `lib` does not make sense if `/var` for me, but `/var/db` is waaaaay worse, and I see this all the time on Debian so learned to live with it :-D

@peter, thanks for the fix, I did not checked and indeed the file was listed in the wrong location.  I mark my patch obsolete.

Regarding relocating the files in `/var`, I guess that the `/var/db/syslog-ng.persist` is fine as it is, but indeed other files do not belong here (the syslog-ng.ctl socket would be in /var/run along the syslog-ng.pid file, etc).  I do not know if it is possible (and even if it makes sense) to move these files in many directories.  Maybe we can follow the Debian packaging where all these files are in a single "syslog-ng" directory?

For announcing breaking changes, we do have the UPDATING file, with the drawbacks that now that we ship pre-built FreeBSD packages I guess a lot of users do not read this file anymore…  Maybe the rc-script can move pieces at the new location  for files in /var (at least the persist file), and abort with an error if /usr/loacal/etc/syslog-ng.conf is found telling the user the conf where relocated and to move their configuration to /usr/loacal/etc/syslog-ng/syslog-ng.conf?

Thanks!
Comment 6 Cy Schubert freebsd_committer freebsd_triage 2023-10-03 14:24:36 UTC
$PREFIX/etc/syslog-ng makes sense. Moving the existing config file from $LOCALBASE to $PREFIX/etc/syslog-ng should probably not be done by a script but instead a pkg-message explaining to the customer that they must move their syslog-ng.conf file to the new directory; also making note of this in UPDATING for old-school users.

@Peter, would moving localstatedir to /var/lib/syslog-ng cause our userbase any hardship?
Comment 7 commit-hook freebsd_committer freebsd_triage 2023-10-03 14:27:57 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=af7d33c782d2431191a1039c7cd3ba78d476efae

commit af7d33c782d2431191a1039c7cd3ba78d476efae
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-10-03 13:35:10 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-10-03 14:27:16 +0000

    sysutils/syslog-ng: Fix plist error when building with PYTHON option

    When building with python support:

    ---Begin OPTIONS List---
    ===> The following configuration options are available for syslog-ng-4.4.0:
    [...]
         PYTHON=on: Build with Python 3.9 support

    Some files are orphaned:

    ===> Checking for items in STAGEDIR missing from pkg-plist
    Error: Orphaned: lib/syslog-ng/python/syslogng/__pycache__/reloc%%PYTHON_EXT_SUFFIX%%.pyc
    Error: Orphaned: lib/syslog-ng/python/syslogng/reloc.py

    The initial patch was created by romain@ and the updated patch came from
    Peter Czanik, a syslog-ng developer.

    PR:             274187
    Submitted by:   Original patch by romain@
    Submitted by:   Peter Czanik (CzP) <peter.czanik@oneidentity.com>
                    Balabit (a OneIdentity company) / syslog-ng upstream
                    Updated patch
    MFH:            2023Q4

 sysutils/syslog-ng/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)