Opened 6 months ago

Closed 6 months ago

#68841 closed defect (fixed)

dovecot: Invalid add_users command in Portfile

Reported by: pcafstockf (Frank Stock) Owned by: jberry@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: dovecot

Description (last modified by pcafstockf (Frank Stock))

Dovecot port attempts to add two user accounts (_dovecot and _dovenull). Portfiles support adding multiple accounts, but it needs to be done using a single add_users command.

As currently written, only the _dovenull account ends up actually being created.

Instead of:

add_users ${default_internal_user} group=${default_internal_user} realname=Dovecot
add_users ${default_login_user}    group=${default_login_user}    realname=Dovenull

The Profile needs to be:

add_users ${default_internal_user} group=${default_internal_user} realname=Dovecot ${default_login_user}    group=${default_login_user}    realname=Dovenull

Or for readability maybe:

add_users \
    ${default_internal_user} group=${default_internal_user} realname=Dovecot \
    ${default_login_user}    group=${default_login_user}    realname=Dovenull

Note the line continuation chars.

Forgot to add a link to the add_users documentation (https://guide.macports.org/#reference.keywords)

Change History (5)

comment:1 Changed 6 months ago by pcafstockf (Frank Stock)

Description: modified (diff)

comment:2 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to jberry@…
Status: newassigned
Summary: Invalid add_users command in Portfiledovecot: Invalid add_users command in Portfile

True, except that add_users is not a command; it's an option (i.e. a variable). As such, the first line of the original portfile sets the variable and the second line overwrites it. The solution is either setting the variable just once, as you suggested, or using add_users-append on the second line.

I'm assigning the ticket to the port's maintainer but he hasn't been heard from in awhile and may not be participating in MacPorts anymore. (His last commit was in 2019.)

If you like, you could submit a pull request to fix the issue.

comment:3 Changed 6 months ago by pcafstockf (Frank Stock)

I would be happy to submit a pull request, but am doing something wrong. I would appreciate any suggestions on this problem.

I forked macports-ports git repo, pulled down a copy of the fork and created a branch (but made no changes).
Then set up a local port repo (which is something I've done before and am comfortable with).
Created a symlink inside the local port repo to my local git repo (just the mail/dovecot directory).
Ran portindex within the local rep, and then port search dovecot, port file dovecot (which came back with the expected path to my local port repo), and finally port lint dovecot which reported 0 errors and 0 warnings.

However, all/any of port build dovecot, port -y install dovecot, port install dovecot all return:
Error: Unable to execute port: Could not open file: /my-local-portrepo/mail/dovecot/Portfile.
Neither port clean nor magic sudo are of any help.
port edit dovecot also worksfine, and does update the expected Portfile.

Oh, and I've been using this MacPorts installation on this machine for about 2 years and can install, and uninstall other ports just fine (even now).
MacPorts 2.8.1 - macOS 10.15.7

I also tried copying the dovecot port to the local repo (instead of symlinking) but that did not help either.

Remove dovecot altogether from the local repo (and re-index), then MacPorts will happily install dovecot (using rsync).

comment:4 in reply to:  3 Changed 6 months ago by jmroot (Joshua Root)

Replying to pcafstockf:

However, all/any of port build dovecot, port -y install dovecot, port install dovecot all return:
Error: Unable to execute port: Could not open file: /my-local-portrepo/mail/dovecot/Portfile.\

Most likely a permissions issue. Because builds are done with reduced privileges, the Portfile and all recursive parent directories need to be accessible to the macports user.

I can just push this simple fix directly though, rather than making you open a PR.

comment:5 Changed 6 months ago by jmroot (Joshua Root)

Resolution: fixed
Status: assignedclosed

In f3cae9d02f55382a29755b37c4d7fae5e3b83178/macports-ports (master):

dovecot: don't overwrite add_users contents

Closes: #68841

Note: See TracTickets for help on using tickets.