Closed cpixl closed 5 years ago
I cannot reproduce this behavior.
cannot reproduce, TMPDIR is passed as /run/user/1000 as expected here
Okay, so that's really weird. I still get this behavior when logging in from agetty (tty2), using /bin/dash
as login shell and trying to access $TMPDIR
from busybox sh
. I'm still investigating the possible causes.
For now, these are the packages I explicitly installed on my system:
2018-03-31 04:56 UTC base-system-0.112_3
2018-03-31 12:02 -03 autojump-22.5.1_1
2018-03-31 12:02 -03 python3-Pygments-2.2.0_2
2018-03-31 12:02 -03 rsync-3.1.3_1
2018-03-31 12:29 -03 sxhkd-0.5.9_1
2018-03-31 12:39 -03 inotify-tools-3.20.1_1
2018-03-31 12:39 -03 lemonbar-xft-1.0.20161107_2
2018-03-31 12:39 -03 xdo-0.5.7_1
2018-03-31 12:39 -03 xprop-1.2.3_1
2018-03-31 12:39 -03 xrandr-1.5.0_1
2018-03-31 12:55 -03 xrdb-1.1.1_1
2018-03-31 14:11 -03 sxiv-24_2
2018-03-31 18:33 -03 xclip-0.13_1
2018-04-01 16:37 -03 libnotify-0.7.7_1
2018-04-18 12:06 -03 xset-1.2.4_1
2018-04-20 21:47 -03 nerd-fonts-2.0.0_1
2018-04-23 01:21 -03 zsh-syntax-highlighting-0.6.0_1
2018-04-23 01:44 -03 compton-git-20170430_3
2018-04-25 00:10 -03 kmscon-8_6
2018-04-27 23:20 -03 dbus-glib-0.110_1
2018-05-02 03:03 -03 xorg-minimal-1.2_2
2018-05-06 23:10 -03 cronie-1.5.2_1
2018-05-06 23:10 -03 dunst-1.3.2_1
2018-05-26 19:26 -03 redshift-1.12_1
2018-05-27 17:40 -03 gtk+-2.24.32_1
2018-05-31 23:33 -03 luaposix51-34.0.4_2
2018-06-17 22:07 -03 rofi-1.5.1_2
2018-07-01 01:55 -03 sc-im-0.7.0_2
2018-07-19 21:33 -03 bspwm-0.9.5_2
2018-07-19 21:33 -03 cava-gui-0.6.1.1_1
2018-07-21 20:32 -03 avahi-0.7_6
2018-07-21 20:32 -03 avahi-utils-0.7_6
2018-07-21 20:32 -03 bluez-5.50_2
2018-07-21 20:32 -03 neovim-0.3.1_1
2018-08-02 20:08 -03 python3-ipython-6.5.0_1
2018-08-17 12:44 -03 pass-1.7.3_1
2018-08-19 14:20 -03 android-tools-9.0.0r3_1
2018-08-19 14:20 -03 git-extras-4.6.0_1
2018-09-01 23:44 -03 linux-firmware-20180825_1
2018-09-02 21:58 -03 gitflow-20120925_2
2018-09-07 10:08 -03 brightnessctl-0.4_1
2018-09-11 19:31 -03 rxvt-unicode-9.22_9
2018-09-17 12:38 -03 noto-fonts-emoji-20180810_1
2018-09-17 12:38 -03 xf86-video-intel-2.99.917.847_1
2018-09-17 12:38 -03 zsh-5.6.2_1
2018-09-19 20:25 -03 chrony-3.4_1
2018-09-20 23:19 -03 plymouth-0.9.3_3
2018-09-25 05:53 -03 zip-3.0_5
2018-09-26 19:35 -03 ntfs-3g-2017.3.23_2
2018-10-02 19:44 -03 anki-2.1.5_1
2018-10-02 19:44 -03 glances-3.0.2_1
2018-10-02 19:44 -03 mupdf-1.13.0_3
2018-10-03 17:15 -03 gst-libav-1.14.4_1
2018-10-03 17:15 -03 gst-plugins-good1-1.14.4_1
2018-10-04 22:18 -03 noto-fonts-cjk-20170601_2
2018-10-08 11:10 -03 fzf-0.17.5_1
2018-10-10 10:14 -03 minikube-0.30.0_1
2018-10-10 14:01 -03 ckb-next-0.3.2_1
2018-10-10 14:01 -03 docker-machine-driver-kvm2-0.30.0_1
2018-10-15 01:09 -03 unzip-6.0_12
2018-10-15 17:24 -03 ripgrep-0.10.0_2
2018-10-15 17:44 -03 busybox-1.29.3_1
2018-10-21 14:42 -03 notmuch-0.28_1
2018-10-21 14:42 -03 pulsemixer-1.4.0_2
2018-10-21 14:42 -03 tigervnc-1.9.0_1
2018-10-21 14:42 -03 tmux-2.8_1
2018-10-21 15:09 -03 xwininfo-1.1.4_1
2018-10-21 20:36 -03 dejavu-fonts-ttf-2.37_1
2018-10-23 19:22 -03 ledger-3.1.1_9
2018-10-23 19:23 -03 weechat-2.3_1
2018-10-23 19:23 -03 weechat-perl-2.3_1
2018-10-23 19:23 -03 weechat-python-2.3_1
2018-10-31 13:04 -03 fd-7.2.0_1
2018-10-31 13:04 -03 i3lock-2.11.1_1
2018-10-31 13:04 -03 maim-5.5.2_3
2018-10-31 13:04 -03 nodejs-10.7.0_3
2018-10-31 13:04 -03 qutebrowser-1.5.2_1
2018-10-31 13:04 -03 rsyslog-8.39.0_1
2018-10-31 16:07 -03 st-0.8.1_1
2018-11-07 16:40 -02 aria2-1.34.0_4
2018-11-07 16:40 -02 curl-7.62.0_2
2018-11-07 16:40 -02 ffmpeg-4.1_1
2018-11-07 16:40 -02 gnupg2-2.2.11_1
2018-11-07 16:40 -02 gst-plugins-bad1-1.14.4_4
2018-11-07 16:40 -02 neomutt-20180716_2
2018-11-07 16:40 -02 python3-3.6.7_2
2018-11-07 16:40 -02 socat-1.7.3.2_5
2018-11-07 16:40 -02 zsh-completions-0.29.0_1
2018-11-07 18:02 -02 pavucontrol-3.0_3
2018-11-09 12:22 -02 jq-1.6_1
2018-11-09 19:12 -02 pdf.js-2.0.943_1
2018-11-10 10:46 -02 offlineimap-7.2.1_1
2018-11-10 23:30 -02 python3-subliminal-2.0.5_1
2018-11-11 17:17 -02 ncurses-term-6.1_2
2018-11-11 17:42 -02 virt-manager-tools-2.0.0_2
2018-11-20 17:23 -02 docker-18.09.0_1
2018-11-20 17:23 -02 editorconfig-0.12.3_1
2018-11-20 17:23 -02 httpie-1.0.2_1
2018-11-20 17:23 -02 kubernetes-helm-2.11.0_2
2018-11-20 17:23 -02 libgraphicsmagick-1.3.31_1
2018-11-20 17:24 -02 mpv-0.29.1_5
2018-11-20 17:24 -02 pulseaudio-12.2_3
2018-11-20 17:24 -02 python3-neovim-0.3.1_1
2018-11-20 17:24 -02 qemu-3.0.0_3
2018-11-20 17:24 -02 sound-theme-freedesktop-0.8_2
2018-11-20 17:24 -02 ttf-ubuntu-font-family-0.83_2
2018-11-20 17:24 -02 urxvt-perls-2.2_4
2018-11-20 17:24 -02 void-repo-nonfree-9_3
2018-11-26 01:23 -02 git-2.19.2_1
2018-11-26 01:24 -02 playerctl-2.0.1_1
2018-11-26 01:24 -02 refind-0.11.4_1
2018-11-26 01:24 -02 telepresence-0.94_1
2018-11-26 01:24 -02 unclutter-xfixes-1.4_1
2018-11-29 16:25 -02 nss-mdns-0.14.1_1
2018-11-29 16:25 -02 setxkbmap-1.3.1_2
2018-11-29 16:25 -02 xtools-0.53_1
2018-12-02 13:01 -02 encfs-1.9.5_2
2018-12-03 13:06 -02 fuse-archivemount-0.8.12_1
2018-12-04 22:49 -02 conky-1.11.0_1
2018-12-04 22:49 -02 cryptsetup-2.0.6_1
2018-12-04 22:49 -02 kubectl-1.13.0_1
2018-12-04 22:49 -02 libvirt-4.10.0_1
2018-12-04 22:49 -02 python3-youtube-dl-2018.12.03_1
2018-12-08 20:54 -02 dbus-1.12.12_1
2018-12-08 20:54 -02 feh-3.1.1_1
2018-12-08 20:54 -02 google-cloud-sdk-227.0.0_1
2018-12-08 20:54 -02 intel-ucode-20180807_3
2018-12-08 20:54 -02 msmtp-1.8.0_1
2018-12-08 20:54 -02 ofono-1.26_1
Solved: for some reason, my busybox installation had the SUID bit set, and glibc has an undocumented behavior of removing the $TMPDIR
on SUID binaries (for security reasons):
It looks like glibc will remove certain environment variables when running setuid programs (sudo is, of course, setuid). TMPDIR is one of these environment variables, although it doesn't seem to be documented anywhere. This is a security feature to prevent setuid programs from having their environments altered to allow for malicious reading/writing of file data.
src: https://serverfault.com/questions/478741/sudo-does-not-preserve-tmpdir
System
xuname:
Void 4.19.8_1 x86_64 GenuineIntel uptodate rFFFFFFFFFF
package:
busybox-1.29.3_1
Expected behavior
Have the
$TMPDIR
environment variable available.Actual behavior
Inside
busybox sh
, the environment variable$TMPDIR
is not visible. The value doesn't seems to have any effect on that, and all other environment variables are passed correctly.Steps to reproduce the behavior
NOTE: It only happens on
busybox
package,busybox-static
doesn't show this issue. I also tested on Alpine Linux (but it uses musl), and it worked without any issues too.