Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 832182

Summary: sys-apps/man-db-2.9.4-r1: /etc/cron.daily/man-db uses su which is not installed
Product: Gentoo Linux Reporter: Jaak Ristioja <jaak>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: UNCONFIRMED ---    
Severity: normal CC: mjo
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=717128
Whiteboard:
Package list:
Runtime testing required: ---

Description Jaak Ristioja 2022-01-28 08:33:53 UTC
/etc/cron.daily/man-db ends with the line

  exec su man -s /bin/sh -c 'nice mandb --quiet' 2>/dev/null

However, on this system there is no "su" installed due to sys-apps/util-linux[-su] and sys-apps/shadow[-su], and hence it fails with the following log message:

  run-parts: /etc/cron.daily/man-db exited with return code 127
Comment 1 Mike Gilbert gentoo-dev 2022-01-28 16:56:12 UTC
This is technically an optional runtime dependency. If you don't use the cron job, you don't need 'su'.

Given that most users will have 'su' installed by default, I don't really think we need to do anything here.
Comment 2 Jaak Ristioja 2022-01-29 10:30:19 UTC
(In reply to Mike Gilbert from comment #1)
> This is technically an optional runtime dependency. If you don't use the
> cron job, you don't need 'su'.

Yes, but as far as I can tell, man-db seems to enable this by default. At least I can't currently remember opting in, nor having seen any notice about this being optional. Either way, this causes a daily error message in the logs.

What is the official suggested way to disable this cronjob and prevent these errors in the logs?

> Given that most users will have 'su' installed by default, I don't really
> think we need to do anything here.

Although I might only represent the small minority of Gentoo users, I'm pleading You to take my case into account.

For this to be truly optional, I propose adding a "cron" USE-flag (enabled by default) to install /etc/cron.daily/man-db and pull in the proper runtime dependencies.

Thanks! :)
Comment 3 Mike Gilbert gentoo-dev 2022-02-07 02:50:46 UTC
(In reply to Jaak Ristioja from comment #2)
> What is the official suggested way to disable this cronjob and prevent these
> errors in the logs?

chmod -x /etc/cron.daily/man-db

> For this to be truly optional, I propose adding a "cron" USE-flag (enabled
> by default) to install /etc/cron.daily/man-db and pull in the proper runtime
> dependencies.

That would violate Gentoo policy, and I don't see a strong reason to do so.

https://projects.gentoo.org/qa/policy-guide/dependencies.html#pg0001
Comment 4 Jaak Ristioja 2022-02-07 07:32:46 UTC
(In reply to Mike Gilbert from comment #3)
> That would violate Gentoo policy, and I don't see a strong reason to do so.

Interesting policy. Given there were no good solutions to the underlying problem, I understand that a decision still had to be made. So although I disagree with that outcome, you've made a fair argument.

Then how about one of these alternatives:

1) Make man-db unconditionally depend on su, perhaps introducing a virtual/su package.

2) Make /etc/cron.daily/man-db a no-op if su is not installed (i.e. no side-effects AND no error message in the logs) and during installation notify the user to install su to make it work.

3) Make /etc/cron.daily/man-db non-executable by default, and notify the user that installing su and a chmod +x is needed to make it work.
Comment 5 Michael Orlitzky gentoo-dev 2023-02-11 01:34:08 UTC
man-db upstream now ships a tmpfiles entry, making this,

  # Use same perms/settings as the ebuild.                                        
  cachedir="/var/cache/man"
  if [ ! -d "${cachedir}" ]; then
      mkdir -p "${cachedir}"
      chown man:man "${cachedir}"
      chmod 0755 "${cachedir}"
  fi

redundant in the cron job. And once the cron job consists of only,

  exec su man -s /bin/sh -c 'nice mandb --quiet' 2>/dev/null

it's rather extravagant to use "su" as root to accomplish it. All cron implementations in the tree support dropping an entry in /etc/cron.d that launches the job directly as the "man" user. That wasn't the case in... 2018? Because vixie-cron. But it is now.
Comment 6 Mike Gilbert gentoo-dev 2023-02-11 21:21:25 UTC
If someone wants to create/test a cron.d file to replace the cron.daily script, that seems like an nice solution to me.

I use systemd and don't have a cron daemon installed, so I can't easily test it.

Feel free to push it if you have commit access, or provide a patch/github PR otherwise.