Bug 228439 - ports-mgmt/portmaster ignores PM_SU_CMD
Summary: ports-mgmt/portmaster ignores PM_SU_CMD
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Stefan Eßer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-23 13:25 UTC by Sergey
Modified: 2020-08-17 07:01 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey 2018-05-23 13:25:07 UTC
When I set 'SU_CMD=doas sh -c' in /etc/make.conf and 'PM_SU_CMD=doas' in /usr/local/etc/portmaster.rc I'm still not able to run portmaster as simple user:

$ type doas
doas is /usr/local/bin/doas

$ id
uid=1001(x) gid=1001(x) groups=1001(x),0(wheel),5(operator)

$ portmaster shells/mksh

===>>> Currently installed version: mksh-56b
===>>> Port directory: /usr/ports/shells/mksh

===>>> Gathering distinfo list for installed ports

===>>> Launching 'make checksum' for shells/mksh in background
===>>> Gathering dependency list for shells/mksh from ports
===>>> Starting dependency check
===>>> Checking dependency: ports-mgmt/pkg
===>>> Initial dependency check complete for shells/mksh


===>>> Starting build for shells/mksh <<<===

===>>> All dependencies are up to date

===>  Cleaning for mksh-56b
===>   /usr/obj/usr/ports/shells/mksh/work not writable, skipping
===>  Building for mksh-56b
cd /usr/obj/usr/ports/shells/mksh/work/mksh && /usr/bin/env XDG_DATA_HOME=/usr/obj/usr/ports/shells/mksh/work  XDG_CONFIG_HOME=/usr/obj/usr/ports/shells/mksh/work  HOME=/usr/obj/usr/ports/shells/mksh/work TMPDIR="/tmp" PATH=/usr/obj/usr/ports/shells/mksh/work/.bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-Os -pipe -fno-strict-aliasing -fomit-frame-pointer -funroll-loops -ffast-math -march=ivybridge  -fstack-protector"  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector" LIBS=""  CXX="c++" CXXFLAGS="-Os -pipe -fno-strict-aliasing -fomit-frame-pointer -funroll-loops -ffast-math -march=ivybridge -fstack-protector "  MANPREFIX="/usr/local" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" SHELL=/bin/sh /bin/sh /usr/obj/usr/ports/shells/mksh/work/mksh/Build.sh -r -c lto
For the build logs, demonstrate that /dev/null and /dev/tty exist:
crw-rw-rw-  1 root  wheel  0x17 May 23 16:23 /dev/null
crw--w----  1 x     tty    0x50 May 23 16:23 /dev/tty
rm: edit.o: Permission denied
rm: eval.o: Permission denied
rm: exec.o: Permission denied
rm: expr.o: Permission denied
rm: funcs.o: Permission denied
rm: lalloc.o: Permission denied
rm: rlimits.gen: Permission denied
rm: sh_flags.gen: Permission denied
rm: Rebuild.sh: Permission denied
rm: test.sh: Permission denied
Hi from $MirOS: src/bin/mksh/Build.sh,v 1.727 2017/08/29 13:38:28 tg Exp $ on:
$ uname -a >&2
/usr/obj/usr/ports/shells/mksh/work/mksh/Build.sh: cannot create vv.out: Permission denied
*** Error code 2

Stop.
make[1]: stopped in /usr/ports/shells/mksh
*** Error code 1

Stop.
make: stopped in /usr/ports/shells/mksh

===>>> make build failed for shells/mksh
===>>> Aborting update

/usr/local/sbin/portmaster: cannot create /tmp/portmasterfail.txt: Permission denied

===>>> You can restart from the point of failure with this command line:
       portmaster <flags> shells/mksh

This command has been saved to /tmp/portmasterfail.txt
Comment 1 Stefan Eßer freebsd_committer freebsd_triage 2020-01-26 20:06:14 UTC
I noticed that the initial "make clean" was not executed with SU_CMD and thus a non-empty work directory could not be deleted (unless writable by the current user).

After fixing the make invocation in this one place, the build of shells/mksh succeeded for me (with SU_CMD and PM_SU_CMD set as described in the PR).
Comment 2 commit-hook freebsd_committer freebsd_triage 2020-01-26 20:12:31 UTC
A commit references this bug:

Author: se
Date: Sun Jan 26 20:12:08 UTC 2020
New revision: 524230
URL: https://svnweb.freebsd.org/changeset/ports/524230

Log:
  Make the pre-build "make clean" use SU_CMD if appropriate.

  Additionally document that PORTSDIR can be passed in the environment.

  PR:		228439
  Approved by:	antoine (implicit)

Changes:
  head/ports-mgmt/portmaster/Makefile
  head/ports-mgmt/portmaster/files/patch-files_portmaster.8
  head/ports-mgmt/portmaster/files/patch-portmaster
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2020-08-17 07:01:50 UTC
Committed Jan 26 20:12:08 UTC 2020 as r524230.