Opened 3 months ago

Last modified 13 days ago

#60273 reopened defect

mail-server installs /Library/LaunchDaemons/org.macports.logrotate.plist not registered to port

Reported by: ryandesign (Ryan Schmidt) Owned by: essandess (Steve Smith)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: Cc:
Port: mail-server

Description

I discovered the unexpected file /Library/LaunchDaemons/org.macports.logrotate.plist on our buildbot workers and traced it back to the mail-server port. It is unexpected that a port would install a launchd plist that is not registered to the port and that is therefore not automatically removed when the port is uninstalled. Why does it do this? Do you expect the user to edit this plist?

Change History (6)

comment:1 Changed 3 months ago by essandess (Steve Smith)

Thanks. My dumb mistake. I’ll fix this by adding a startupitem and having this properly destrooted.

Offending Portfile code:

    if { ![file exists /Library/LaunchDaemons/org.macports.logrotate.plist] } {
        xinstall -m 0644 \
            ${prefix}/share/logrotate/org.macports.logrotate.plist.example \
            /Library/LaunchDaemons/org.macports.logrotate.plist  
    }

comment:2 Changed 3 months ago by essandess (Steve Smith)

Wait, port logrotate provides /opt/local/share/logrotate/org.macports.logrotate.plist.example but doesn’t do anything with it.

What would be the recommended way to use this launch daemon example provided by one port as part of a different port?

We definitely want to rotate logs in mail-server because of the large number of various logs, and the logrotate example works perfectly for this.

comment:3 Changed 3 months ago by ryandesign (Ryan Schmidt)

Can you have the mail-server port install a differently-named plist: org.macports.mail-server.logrotate.plist for example?

Since mail-server depends on logrotate, any files installed by logrotate including that example plist will be there when the mail-server port is being built. If you really want to, you can have the port copy that example plist into your destroot and modify it. But it seems like it would be simpler to just have your own copy of the plist in the files directory with whatever modifications you need. For example, perhaps you want your copy of the plist to use a different logrotate conf file so that you don't interfere with a user's existing logrotate conf file.

comment:5 Changed 6 weeks ago by essandess (Steve Smith)

Resolution: fixed
Status: assignedclosed

In 837d1cf79d447bc4e692d5b5bb1f4e50cce01462/macports-ports (master):

mail-server: Add logrotate variant and fix launch daemon issue

  • Add +logrotate variant with its own launch daemon
  • Fixes #60273

comment:6 Changed 13 days ago by ryandesign (Ryan Schmidt)

Resolution: fixed
Status: closedreopened

The file /Library/LaunchDaemons/org.macports.logrotate.plist is still present on buildbot worker machines (and likely on the machines of any users who installed the port), so you haven't successfully modified the port to clean this up. The usual way to clean up these kinds of mistakes is to add a pre-activate block that deletes the offending file and keep that block in place for one year to allow users time to upgrade. See the xdiskusage port for an example.

Note: See TracTickets for help on using tickets.