All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: "Rasmus Villemoes via lists.openembedded.org"
	<rasmus.villemoes=prevas.dk@lists.openembedded.org>
Cc: openembedded-core@lists.openembedded.org,
	 Richard Purdie <richard.purdie@linuxfoundation.org>,
	 emkan@prevas.dk
Subject: Re: [OE-core] TMPDIR, bitbake v posix
Date: Mon, 16 Mar 2026 10:24:08 +0100	[thread overview]
Message-ID: <87cy14p1on.fsf@prevas.dk> (raw)
In-Reply-To: <188B34BEFB66411E.2721127@lists.openembedded.org> (Rasmus Villemoes via lists openembedded org's message of "Fri, 16 Jan 2026 13:07:44 +0100")

On Fri, Jan 16 2026, "Rasmus Villemoes via lists.openembedded.org" <rasmus.villemoes=prevas.dk@lists.openembedded.org> wrote:

> Hi
>
> When some task uses mktemp(1) or similar functionality (e.g. the
> python tempfile module) to create a temporary file or dir, those end up
> being created in the global /tmp directory. That's obviously not ideal,
> as those might be left behind in case of an unclean shutdown or if the
> script is not properly written, and won't be cleaned by do_clean or
> RM_WORK. Also, /tmp is often a tmpfs instance, while some tasks might
> want to create rather large temporary files.
>
> Most such utilities/interfaces respect the TMPDIR environment variable,
> if set. However, since that name is used by bitbake for a rather central
> concept, one cannot simply 'export TMPDIR', as one doesn't want that
> top-level build dir polluted by random build files, and it still
> wouldn't be removed by do_clean or RM_WORK. Ideally, all tasks would
> have a TMPDIR _environment_ variable set to something below ${WORKDIR},
> maybe even something unique per task (say ${T}/${taskname}.d). But
> there's no simple way to do that that doesn't conflict with bitbake's
> use of the TMPDIR name.
>
> Can we do anything about this?
>
> (1) Do nothing, live with this limitation.
>
> (2) Special-case TMPDIR, so that all tasks are created with a proper
> value of TMPDIR in the environment, not derived from the bitbake
> variable of the same name. Could be settable with some new TASK_TMPDIR
> or do_foo[tmpdir] flag. Somewhat hacky, though.
>
> (3) Bite the bullet and plan for renaming TMPDIR -> BBTMPDIR, so that
> the TMPDIR name becomes available for use with its standard POSIX
> meaning. Obviously a huge thing to do, but hopefully most direct TMPDIR
> references are in core or bitbake and used for deriving other standard
> variables.

I tried doing TMPDIR -> BB_TMPDIR in bitbake and most places in core
(there are some places which use TMPDIR in the posix sense), and it
seems to build a core-image-minimal without problems.

So it's not impossible, and one could prepare for the transition by
eliminating quite a few direct TMPDIR references using already existing
or new derived variables (e.g. BASE_SHAREDWORKDIR =
${TMPDIR}/work-shared), making the number of places that would need
the rename rather small.

I'd be happy to send such preparatory patches, but it would be pointless
if the community doesn't deem this to be a problem worth fixing.

Rasmus


       reply	other threads:[~2026-03-16  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <188B34BEFB66411E.2721127@lists.openembedded.org>
2026-03-16  9:24 ` Rasmus Villemoes [this message]
2026-03-16  9:29   ` [OE-core] TMPDIR, bitbake v posix Paul Barker
2026-03-16  9:31   ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cy14p1on.fsf@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=emkan@prevas.dk \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=rasmus.villemoes=prevas.dk@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.