Re: [gentoo-dev] [PATCH 2/3] qmail.eclass: remove magic to query root group

2021-08-14 Thread David Seifert
On Fri, 2021-08-13 at 12:31 +0200, Rolf Eike Beer wrote:
> Am Freitag, 13. August 2021, 11:06:09 CEST schrieb Ulrich Mueller:
> > > > > > > On Fri, 13 Aug 2021, Rolf Eike Beer wrote:
> > > Am Donnerstag, 12. August 2021, 19:39:08 CEST schrieb Michael
> > > Orlitzky:
> > > > On Thu, 2021-08-12 at 17:22 +0200, Rolf Eike Beer wrote:
> > > > > The default owner is root:root anyway.
> > > > 
> > > > This is only true of you don't call insopts earlier with some
> > > > other
> > > > value. I see "insopts -o root -g qmail -m 700" in there so you
> > > > might
> > > > want to double check.
> > > 
> > > Not my day.
> > > 
> > > Ok, given that there are several places that change users and
> > > groups
> > > and the subfunctions are not always called it would be very few
> > > places
> > > where I can remove the root:root (about 3) and be sure that
> > > everything
> > > works. For that reason I would just keep them all and go back to
> > > the
> > > initial patch 2.
> > 
> > I believe the method of choice would be to execute the offending
> > insopts/doins pair in a subshell, i.e. put a ( ) pair around them.
> 
> I will just do it the other way: explicitly reset it to defaults in
> the 2 
> functions that actually set something special.

Please us subshells instead, it makes local reasoning about the side-
effects much easier.




Re: [gentoo-dev] [PATCH 2/3] qmail.eclass: remove magic to query root group

2021-08-13 Thread Rolf Eike Beer
Am Freitag, 13. August 2021, 11:06:09 CEST schrieb Ulrich Mueller:
> > On Fri, 13 Aug 2021, Rolf Eike Beer wrote:
> > Am Donnerstag, 12. August 2021, 19:39:08 CEST schrieb Michael Orlitzky:
> >> On Thu, 2021-08-12 at 17:22 +0200, Rolf Eike Beer wrote:
> >> > The default owner is root:root anyway.
> >> 
> >> This is only true of you don't call insopts earlier with some other
> >> value. I see "insopts -o root -g qmail -m 700" in there so you might
> >> want to double check.
> > 
> > Not my day.
> > 
> > Ok, given that there are several places that change users and groups
> > and the subfunctions are not always called it would be very few places
> > where I can remove the root:root (about 3) and be sure that everything
> > works. For that reason I would just keep them all and go back to the
> > initial patch 2.
> 
> I believe the method of choice would be to execute the offending
> insopts/doins pair in a subshell, i.e. put a ( ) pair around them.

I will just do it the other way: explicitly reset it to defaults in the 2 
functions that actually set something special.


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-dev] [PATCH 2/3] qmail.eclass: remove magic to query root group

2021-08-13 Thread Ulrich Mueller
> On Fri, 13 Aug 2021, Rolf Eike Beer wrote:

> Am Donnerstag, 12. August 2021, 19:39:08 CEST schrieb Michael Orlitzky:
>> On Thu, 2021-08-12 at 17:22 +0200, Rolf Eike Beer wrote:
>> > The default owner is root:root anyway.
>> 
>> This is only true of you don't call insopts earlier with some other
>> value. I see "insopts -o root -g qmail -m 700" in there so you might
>> want to double check.

> Not my day.

> Ok, given that there are several places that change users and groups
> and the subfunctions are not always called it would be very few places
> where I can remove the root:root (about 3) and be sure that everything
> works. For that reason I would just keep them all and go back to the
> initial patch 2.

I believe the method of choice would be to execute the offending
insopts/doins pair in a subshell, i.e. put a ( ) pair around them.

Ulrich


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH 2/3] qmail.eclass: remove magic to query root group

2021-08-13 Thread Rolf Eike Beer
Am Donnerstag, 12. August 2021, 19:39:08 CEST schrieb Michael Orlitzky:
> On Thu, 2021-08-12 at 17:22 +0200, Rolf Eike Beer wrote:
> > The default owner is root:root anyway.
> 
> This is only true of you don't call insopts earlier with some other
> value. I see "insopts -o root -g qmail -m 700" in there so you might
> want to double check.

Not my day.

Ok, given that there are several places that change users and groups and the 
subfunctions are not always called it would be very few places where I can 
remove the root:root (about 3) and be sure that everything works. For that 
reason I would just keep them all and go back to the initial patch 2.

Eike

signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-dev] [PATCH 2/3] qmail.eclass: remove magic to query root group

2021-08-12 Thread Michael Orlitzky
On Thu, 2021-08-12 at 17:22 +0200, Rolf Eike Beer wrote:
> The default owner is root:root anyway.
> 

This is only true of you don't call insopts earlier with some other
value. I see "insopts -o root -g qmail -m 700" in there so you might
want to double check.





[gentoo-dev] [PATCH 2/3] qmail.eclass: remove magic to query root group

2021-08-12 Thread Rolf Eike Beer
The default owner is root:root anyway. This also fixes
qmail_supervise_install_one() when called from outside of qmail_src_install().

Signed-off-by: Rolf Eike Beer 
---
 eclass/qmail.eclass | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/eclass/qmail.eclass b/eclass/qmail.eclass
index 6b04cbf7792..40130a502cb 100644
--- a/eclass/qmail.eclass
+++ b/eclass/qmail.eclass
@@ -73,7 +73,7 @@ is_prime() {
 
 dospp() {
insinto "${QMAIL_HOME}"/plugins/
-   insopts -o root -g "${GROUP_ROOT}" -m 0755
+   insopts -m 0755
newins $1 ${2:-$(basename $1)}
 }
 
@@ -86,8 +86,8 @@ dosupervise() {
local runfile=${2:-${service}} logfile=${3:-${service}-log}
[[ -z "${service}" ]] && die "no service given"
 
-   insopts -o root -g "${GROUP_ROOT}" -m 0755
-   diropts -o root -g "${GROUP_ROOT}" -m 0755
+   insopts -m 0755
+   diropts -m 0755
 
dodir ${SUPERVISE_DIR}/${service}{,/log}
fperms +t ${SUPERVISE_DIR}/${service}{,/log}
@@ -192,12 +192,12 @@ qmail_base_install() {
 qmail_config_install() {
einfo "Installing stock configuration files"
insinto "${QMAIL_HOME}"/control
-   insopts -o root -g "${GROUP_ROOT}" -m 644
+   insopts -m 644
doins "${GENQMAIL_S}"/control/{conf-*,defaultdelivery}
 
einfo "Installing configuration sanity checker and launcher"
insinto "${QMAIL_HOME}"/bin
-   insopts -o root -g "${GROUP_ROOT}" -m 644
+   insopts -m 644
doins "${GENQMAIL_S}"/control/qmail-config-system
 
declare -F qmail_config_install_hook >/dev/null && \
@@ -254,9 +254,9 @@ qmail_maildir_install() {
done
 
einfo "Setting up default maildirs in the account skeleton"
-   diropts -o root -g "${GROUP_ROOT}" -m 755
+   diropts -m 755
insinto /etc/skel
-   insopts -o root -g "${GROUP_ROOT}" -m 644
+   insopts -m 644
newins "${GENQMAIL_S}"/control/defaultdelivery .qmail.sample
"${MAILDIRMAKE}" "${D}"/etc/skel/.maildir
keepdir /etc/skel/.maildir/{cur,new,tmp}
@@ -268,7 +268,7 @@ qmail_maildir_install() {
 qmail_tcprules_install() {
dodir "${TCPRULES_DIR}"
insinto "${TCPRULES_DIR}"
-   insopts -o root -g "${GROUP_ROOT}" -m 0644
+   insopts -m 0644
doins "${GENQMAIL_S}"/tcprules/Makefile.qmail
doins "${GENQMAIL_S}"/tcprules/tcp.qmail-*
use ssl && use pop3 || rm -f "${D}${TCPRULES_DIR}"/tcp.qmail-pop3sd
@@ -276,7 +276,7 @@ qmail_tcprules_install() {
 
 qmail_supervise_install_one() {
dosupervise ${1}
-   diropts -o qmaill -g "${GROUP_ROOT}" -m 755
+   diropts -o qmaill -g root -m 755
keepdir /var/log/qmail/${1}
 }
 
@@ -301,7 +301,7 @@ qmail_supervise_install() {
 qmail_spp_install() {
einfo "Installing qmail-spp configuration files"
insinto "${QMAIL_HOME}"/control/
-   insopts -o root -g "${GROUP_ROOT}" -m 0644
+   insopts -m 0644
doins "${GENQMAIL_S}"/spp/smtpplugins
 
einfo "Installing qmail-spp plugins"
@@ -321,16 +321,16 @@ qmail_ssl_install() {
 
einfo "Installing SSL Certificate creation script"
insinto "${QMAIL_HOME}"/control
-   insopts -o root -g "${GROUP_ROOT}" -m 0644
+   insopts -m 0644
doins "${GENQMAIL_S}"/ssl/servercert.cnf
 
insinto "${QMAIL_HOME}"/bin
-   insopts -o root -g "${GROUP_ROOT}" -m 0755
+   insopts -m 0755
doins "${GENQMAIL_S}"/ssl/mkservercert
 
einfo "Installing RSA key generation cronjob"
insinto /etc/${CRON_FOLDER}
-   insopts -o root -g "${GROUP_ROOT}" -m 0755
+   insopts -m 0755
doins "${GENQMAIL_S}"/ssl/qmail-genrsacert.sh
 
keepdir "${QMAIL_HOME}"/control/tlshosts
@@ -340,7 +340,6 @@ qmail_ssl_install() {
 }
 
 qmail_src_install() {
-   export GROUP_ROOT="$(id -gn root)"
qmail_base_install
qmail_config_install
qmail_man_install
-- 
2.26.2



signature.asc
Description: This is a digitally signed message part.