Bug 16024 - chroot should clear TMPDIR environment variable
Summary: chroot should clear TMPDIR environment variable
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: coreutils (show other bugs)
Version: unstable
Hardware: all Linux
: P2 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-14 17:58 MSD by Michael Shigorin
Modified: 2021-05-13 12:24 MSK (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Shigorin 2008-06-14 17:58:06 MSD
While performing rescue jobs in a chroot (changing rootfs type):

# mkinitrd --help
/sbin/mkinitrd: line 1557: cannot create temp file for here document: No such file or directory

# set | grep T.*MP
TMP=/tmp/.private/root
TMPDIR=/tmp/.private/root
# ls /tmp/.private/root
ls: cannot access /tmp/.private/root: No such file or directory

Indeed.
Comment 1 Dmitry V. Levin 2008-06-14 18:07:42 MSD
(In reply to comment #0)
> While performing rescue jobs in a chroot (changing rootfs type):

This is not a regular operation, right?

> # mkinitrd --help
> /sbin/mkinitrd: line 1557: cannot create temp file for here document: No such file or directory
> 
> # set | grep T.*MP
> TMP=/tmp/.private/root
> TMPDIR=/tmp/.private/root
> # ls /tmp/.private/root
> ls: cannot access /tmp/.private/root: No such file or directory
> 
> Indeed.

There are many ways to fool yourself.
Try "env TMPDIR= chroot" next time.
Comment 2 Michael Shigorin 2008-06-14 22:33:20 MSD
(In reply to comment #1)
> > While performing rescue jobs in a chroot (changing rootfs type):
> This is not a regular operation, right?
It is one of operations when:
- the stress is usually above usual;
- weird diagnostics don't really help.

> > # mkinitrd --help
> > /sbin/mkinitrd: line 1557: cannot create temp file for here document: No such file or directory
> > ls: cannot access /tmp/.private/root: No such file or directory
> There are many ways to fool yourself.
> Try "env TMPDIR= chroot" next time.
I'll sure forget it 'till next time.

Rather wanted to draw your attention to the fact that corner cases like this do matter; is it unreasonable to request that directory existence[/writability] check be performed before setting TMP/TMPDIR?
Comment 3 Dmitry V. Levin 2008-06-14 23:36:11 MSD
Lets handle this issue in chroot(1).
Comment 4 Michael Shigorin 2008-06-15 12:05:21 MSD
Thanks in advance!
Comment 5 Dmitry V. Levin 2008-08-30 03:26:54 MSD
6.11-alt1-2-gc4aa447
Comment 6 Michael Shigorin 2008-09-01 01:02:56 MSD
Your advance has arrived :-)