Opened 8 years ago

Closed 8 years ago

#52381 closed defect (fixed)

neomutt @20160916_2: chgrp fails during non-root destroot

Reported by: jhi Owned by: lbschenkel (Leonardo Brondani Schenkel)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: haspatch maintainer Cc:
Port: neomutt

Description (last modified by larryv (Lawrence Velázquez))

Log snippet (whole log will be attached):

...
:info:destroot          { echo "Can't fix mutt_dotlock's permissions!  This is required to lock mailboxes in the mail spool directory." >&2 ; exit 1 ; } \
:info:destroot  fi
:info:destroot chgrp: you are not a member of group mail
:info:destroot Can't fix mutt_dotlock's permissions!  This is required to lock mailboxes in the mail spool directory.
:info:destroot make[4]: *** [install-exec-hook] Error 1

I am not planning to have a local mail spool, FWIW, just IMAP from gmail.

Attachments (4)

neomutt-main.log (146.2 KB) - added by jhi 8 years ago.
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_mail_neomutt/neomutt/main.log
neomutt-main.log-2.gz (14.4 KB) - added by jhi 8 years ago.
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_mail_neomutt/neomutt/main.log
port_autoconf.tcl.gz (1.4 KB) - added by jhi 8 years ago.
/opt/local/libexec/macports/lib/port1.0/port_autoconf.tcl
neomutt.patch (1.2 KB) - added by lbschenkel (Leonardo Brondani Schenkel) 8 years ago.
add +homespool, enable when not root, add openmaintainer

Download all attachments as: .zip

Change History (23)

Changed 8 years ago by jhi

Attachment: neomutt-main.log added

/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_mail_neomutt/neomutt/main.log

comment:1 Changed 8 years ago by larryv (Lawrence Velázquez)

Description: modified (diff)
Owner: changed from macports-tickets@… to leonardo@…
Summary: neomutt install fails because not in group mailneomutt @20160916_2: chgrp fails during non-root destroot

It looks like you aren’t running MacPorts as root. Is this accurate?

comment:2 in reply to:  1 Changed 8 years ago by jhi

Replying to larryv@…:

It looks like you aren’t running MacPorts as root. Is this accurate?

This is correct. I prefer to minimize root activity.

comment:3 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

I have attached a fix. When not building as root the port will assume you don't want to read mail from the system spool at /var/mail and it will build with --with-homespool, which turns off the dotlock functionality and allows the port to finish building.

comment:4 in reply to:  3 Changed 8 years ago by jhi

Replying to leonardo.schenkel@…:

I have attached a fix. When not building as root the port will assume you don't want to read mail from the system spool at /var/mail and it will build with --with-homespool, which turns off the dotlock functionality and allows the port to finish building.

Can I test this patch somehow locally? (without an updated port from macports.org, that is)

comment:5 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Yes, you can manually run port edit neomutt and add manually enter my changes as described the diff. Then just run a port install neomutt. On next port update or selfupdate your changes to the Portfile will be lost (but the package will remain installed).

Last edited 8 years ago by lbschenkel (Leonardo Brondani Schenkel) (previous) (diff)

comment:6 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

One more thing: I suggest that you do *not* change the revision even though it is in my patch, so when the Portfile is updated on MacPorts it will automatically upgrade to the "official" build. If you do bump the revision then MacPorts will consider the package already up-to-date when that happens.

comment:7 in reply to:  5 Changed 8 years ago by jhi

Replying to leonardo.schenkel@…:

Yes, you can manually run port edit neomutt and add manually enter my changes as described the diff. Then just run a port install neomutt. On next port update or selfupdate your changes to the Portfile will be lost (but the package will remain installed).

Tried that (without the revision bump as suggested). Failed. Looked at the patch. Didn't you mean

if {${install.user} eq "root"}

That is, try the homespool option only if we are root?

comment:8 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

No, it's the opposite. If you are root the package is built normally because that is how it is supposed to be built (this is a behaviour from upstream, not this port). If you are *not* root then neomutt is configured with --with-homespool and mutt_dotlock is not built, which bypasses the "can't fix permissions" error.

It's strange that it didn't work out for you. Did you get the exact same problem as before? Can you post the new complete debug log with my patch applied?

Changed 8 years ago by jhi

Attachment: neomutt-main.log-2.gz added

/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_mail_neomutt/neomutt/main.log

comment:9 in reply to:  8 Changed 8 years ago by jhi

Replying to leonardo.schenkel@…:

No, it's the opposite. If you are root the package is built normally because that is how it is supposed to be built (this is a behaviour from upstream, not this port). If you are *not* root then neomutt is configured with --with-homespool and mutt_dotlock is not built, which bypasses the "can't fix permissions" error.

It's strange that it didn't work out for you. Did you get the exact same problem as before? Can you post the new complete debug log with my patch applied?

Note: with the "eq root" neomutt built and installed for me.

But, anyway: did now "port uninstall neomutt" (to get rid of the modified revision three), and then re-did "port edit neomutt" to put back the "ne root", and re-tried "port install neomutt". Failed, the new patch attached.

comment:10 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

OK, I checked your log and I think I have a wrong understanding of what ${install.user} actually means. I have done an alternative approach: I have introduced a new variant +homespool, which you should manually activate when running port install without root. This flag will be preserved on upgrades, so you only need to remember to activate it manually when you install the package for the first time.

If I figure out later how to do it properly (I'll need to ask around), I may be able to enable this variant automatically for cases like yours when you aren't running MacPorts with sudo. But you will always be able to enable this yourself, so hopefully that should suffice.

Could you please try again once more?

comment:11 Changed 8 years ago by mf2k (Frank Schima)

Adding a variant does not need a revision change. The user must specifically install the port with the variant to get it. An update will not add it even if it is a default variant.

comment:12 Changed 8 years ago by mf2k (Frank Schima)

Keywords: haspatch maintainer added

comment:13 Changed 8 years ago by neverpanic (Clemens Lang)

In any case, this wouldn't need a revbump. Users that succeeded in installing mutt already have the correct version and don't have to rebuild. Users that have failed builds will automatically use the new Portfile after a fix is committed.

Let me check for a way to find out whether a Portfile is run in a non-root installation…

comment:14 Changed 8 years ago by neverpanic (Clemens Lang)

jhi: Can you attach your copy of /opt/local/libexec/macports/lib/port1.0/port_autoconf.tcl? It should contain install_user $yourusername which is the default for install.user. I'd like to figure out why the proposed solution did not work for you.

comment:15 in reply to:  10 Changed 8 years ago by jhi

Replying to leonardo.schenkel@…:

OK, I checked your log and I think I have a wrong understanding of what ${install.user} actually means. I have done an alternative approach: I have introduced a new variant +homespool, which you should manually activate when running port install without root. This flag will be preserved on upgrades, so you only need to remember to activate it manually when you install the package for the first time.

If I figure out later how to do it properly (I'll need to ask around), I may be able to enable this variant automatically for cases like yours when you aren't running MacPorts with sudo. But you will always be able to enable this yourself, so hopefully that should suffice.

Could you please try again once more?

With the +homespool variant, install works.

Changed 8 years ago by jhi

Attachment: port_autoconf.tcl.gz added

/opt/local/libexec/macports/lib/port1.0/port_autoconf.tcl

comment:16 in reply to:  14 Changed 8 years ago by jhi

Replying to cal@…:

jhi: Can you attach your copy of /opt/local/libexec/macports/lib/port1.0/port_autoconf.tcl? It should contain install_user $yourusername which is the default for install.user. I'd like to figure out why the proposed solution did not work for you.

Done. The install_users seems to be "root".

Note: I used to run macports as root (with sudo) for a while, but got nervous of doing that. So I chown -R:ed /opt/local to myself, and have been running updates fine (no sudo) with that setup.

comment:17 Changed 8 years ago by neverpanic (Clemens Lang)

Oh, OK, that explains it. Non-root copies of MacPorts should be installed by following https://guide.macports.org/#installing.macports.source and passing --with-no-root-privileges switch to ./configure, which will automatically set install.user to your user name.

Note that running MacPorts without root privileges gives build systems unrestricted access to your home directory and your files. Running with sudo as root makes MacPorts drop privileges for builds to an unprivileged macports user.

I think we can keep the variant, but add a code block that makes it the default if install.user is not root:

if {${install.user} ne "root"} {
  default_variants +homespool
}

comment:18 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Great. I have updated the patch with the suggestions and I have added openmaintainer as well.

Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Attachment: neomutt.patch added

add +homespool, enable when not root, add openmaintainer

comment:19 Changed 8 years ago by neverpanic (Clemens Lang)

Resolution: fixed
Status: newclosed

Thanks, committed in r153193 and closing.

Note: See TracTickets for help on using tickets.