vaeth / eix

eix can access Gentoo portage ebuild information and description very quickly (using a local cache). It can also be used to access information on installed packages, local settings, and local and external overlays, and informs about changes in the tree
GNU General Public License v2.0
166 stars 14 forks source link

eix-remote fails to create temporary directory on pambase[mktemp] system #95

Open waptaff opened 2 years ago

waptaff commented 2 years ago

Hi.

The mktemp flag on sys-auth/pambase allows the per-user /tmp directory feature (for instance, user fred has TMP and TMPDIR set to /tmp/.private/fred).

Running eix-remote as root gives this error:

mktemp: failed to create directory via template ‘/tmp/.private/root/eix-remote.XXXXXXXX’: Permission denied
 * cannot create temporary directory

I suspect this error is happening because eix-drop-permissions does not involve PAM hence does not reset TMP and TMPDIR.

Perhaps the ${TMPDIR:-/tmp} constructs in /usr/share/eix/eix-functions should be updated to first check if TMPDIR is read/writable.

vaeth commented 2 years ago

It is the caller's responsibility to pass a sane value as TMPDIR. Trying to outsmart the user by re-interpreting that value is calling for trouble and perhaps even opens some attack surface on some systems due to such surprising behavior.