Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp directories: respect TMPDIR/TEMP/TMP for local actions #4376

Closed
laszlocsomor opened this issue Jan 2, 2018 · 1 comment
Closed

Temp directories: respect TMPDIR/TEMP/TMP for local actions #4376

laszlocsomor opened this issue Jan 2, 2018 · 1 comment
Assignees
Labels
P1 I'll work on this now. (Assignee required) platform: windows type: feature request

Comments

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Jan 2, 2018

Request

Respect the user's TMPDIR envvar (or TMP and TEMP on Windows) if set, fall back on /tmp on Linux/macOS and to temp-in-execroot on Windows.

Summary

Unexpected effect of cfccdf1 was that it breaks socket creation because the paths are longer than 106 characters.

From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206:

I can confirm that this is the case -- the GNUPGHOME needs to fit within
sockaddr_un.sun_path (see unix(7)). In other test suites that use
GnuPG, i've seen deliberately short paths used.

/cc @jianglai, @jmhodges

Context

@laszlocsomor laszlocsomor self-assigned this Jan 2, 2018
@laszlocsomor laszlocsomor added P1 I'll work on this now. (Assignee required) type: feature request windows-q1-2018-maybe labels Jan 2, 2018
bazel-io pushed a commit that referenced this issue Jan 4, 2018
Create a PosixLocalEnvProvider and
WindowsLocalEnvProvider class, with singleton
instances for now.

This refactoring should not change functionality,
it's just a requirement for an upcoming change.

That upcoming change is for these classes to
respect the client environment's TMPDIR or
TMP/TEMP envvars.

See #4376

Change-Id: I032bb6f18adf8af9e43e6bc543c09c58adae3863
PiperOrigin-RevId: 180799936
bazel-io pushed a commit that referenced this issue Jan 5, 2018
Refactor the test not to use a for-loop to iterate
over the strategies. This way it's easier to see
from the failure stack trace which strategy it was
exactly that failed.

This is preparation for #4376

Change-Id: I2004b58957c823701c2d68682e7d8b78e80c834a
PiperOrigin-RevId: 180911370
bazel-io pushed a commit that referenced this issue Jan 8, 2018
The BazelConfiguration no longer adds the Bazel
server process' TMPDIR/TMP/TEMP environment
variables.

I added that code before having implemented always
creating a temp directory for actions:
cfccdf1

See #4376

Change-Id: I8ba63d6120a0aa849997b274fb2d68ad50b2285c
PiperOrigin-RevId: 181134179
bazel-io pushed a commit that referenced this issue Jan 11, 2018
When Bazel creates the sandbox for an action,
Bazel collects a set of paths that the action may
write to.

The action needs write access to its temp
directory, so Bazel needs to add it to the
writable paths.

See #4376

Change-Id: Ifd3c482aa67ff8a2070045356abad8b39c808db8
PiperOrigin-RevId: 181591520
jmhodges added a commit to jmhodges/bazel_bugs that referenced this issue Jan 15, 2018
Has the commits that close out bazelbuild/bazel#4376
which is related to bazelbuild/bazel#4303
iirina pushed a commit that referenced this issue Jan 24, 2018
When Bazel creates the sandbox for an action,
Bazel collects a set of paths that the action may
write to.

The action needs write access to its temp
directory, so Bazel needs to add it to the
writable paths.

See #4376

Change-Id: Ifd3c482aa67ff8a2070045356abad8b39c808db8
PiperOrigin-RevId: 181591520
iirina pushed a commit that referenced this issue Jan 24, 2018
Fixes #4376

Change-Id: Id78bb0930044626304e54f07735db4d4b2c84720
PiperOrigin-RevId: 181959528
iirina pushed a commit that referenced this issue Jan 26, 2018
When Bazel creates the sandbox for an action,
Bazel collects a set of paths that the action may
write to.

The action needs write access to its temp
directory, so Bazel needs to add it to the
writable paths.

See #4376

Change-Id: Ifd3c482aa67ff8a2070045356abad8b39c808db8
PiperOrigin-RevId: 181591520
iirina pushed a commit that referenced this issue Jan 26, 2018
Fixes #4376

Change-Id: Id78bb0930044626304e54f07735db4d4b2c84720
PiperOrigin-RevId: 181959528
iirina pushed a commit that referenced this issue Jan 26, 2018
When Bazel creates the sandbox for an action,
Bazel collects a set of paths that the action may
write to.

The action needs write access to its temp
directory, so Bazel needs to add it to the
writable paths.

See #4376

Change-Id: Ifd3c482aa67ff8a2070045356abad8b39c808db8
PiperOrigin-RevId: 181591520
iirina pushed a commit that referenced this issue Jan 26, 2018
Fixes #4376

Change-Id: Id78bb0930044626304e54f07735db4d4b2c84720
PiperOrigin-RevId: 181959528
iirina pushed a commit that referenced this issue Jan 30, 2018
When Bazel creates the sandbox for an action,
Bazel collects a set of paths that the action may
write to.

The action needs write access to its temp
directory, so Bazel needs to add it to the
writable paths.

See #4376

Change-Id: Ifd3c482aa67ff8a2070045356abad8b39c808db8
PiperOrigin-RevId: 181591520
iirina pushed a commit that referenced this issue Jan 30, 2018
Fixes #4376

Change-Id: Id78bb0930044626304e54f07735db4d4b2c84720
PiperOrigin-RevId: 181959528
iirina pushed a commit that referenced this issue Jan 30, 2018
When Bazel creates the sandbox for an action,
Bazel collects a set of paths that the action may
write to.

The action needs write access to its temp
directory, so Bazel needs to add it to the
writable paths.

See #4376

Change-Id: Ifd3c482aa67ff8a2070045356abad8b39c808db8
PiperOrigin-RevId: 181591520
iirina pushed a commit that referenced this issue Jan 30, 2018
Fixes #4376

Change-Id: Id78bb0930044626304e54f07735db4d4b2c84720
PiperOrigin-RevId: 181959528
iirina pushed a commit that referenced this issue Feb 12, 2018
When Bazel creates the sandbox for an action,
Bazel collects a set of paths that the action may
write to.

The action needs write access to its temp
directory, so Bazel needs to add it to the
writable paths.

See #4376

Change-Id: Ifd3c482aa67ff8a2070045356abad8b39c808db8
PiperOrigin-RevId: 181591520
iirina pushed a commit that referenced this issue Feb 12, 2018
Fixes #4376

Change-Id: Id78bb0930044626304e54f07735db4d4b2c84720
PiperOrigin-RevId: 181959528
jianglai added a commit to google/nomulus that referenced this issue Feb 20, 2018
With bazelbuild/bazel#4376, bazel 0.10.0 now supports accessing system TMPDIR in its sandbox. Use this instead of hardcoding /tmp in BUILD rules to get around the gpg-agent path length restriction.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186010932
werkt pushed a commit to werkt/bazel that referenced this issue Mar 2, 2018
Create a PosixLocalEnvProvider and
WindowsLocalEnvProvider class, with singleton
instances for now.

This refactoring should not change functionality,
it's just a requirement for an upcoming change.

That upcoming change is for these classes to
respect the client environment's TMPDIR or
TMP/TEMP envvars.

See bazelbuild#4376

Change-Id: I032bb6f18adf8af9e43e6bc543c09c58adae3863
PiperOrigin-RevId: 180799936
werkt pushed a commit to werkt/bazel that referenced this issue Mar 2, 2018
Refactor the test not to use a for-loop to iterate
over the strategies. This way it's easier to see
from the failure stack trace which strategy it was
exactly that failed.

This is preparation for bazelbuild#4376

Change-Id: I2004b58957c823701c2d68682e7d8b78e80c834a
PiperOrigin-RevId: 180911370
werkt pushed a commit to werkt/bazel that referenced this issue Mar 2, 2018
The BazelConfiguration no longer adds the Bazel
server process' TMPDIR/TMP/TEMP environment
variables.

I added that code before having implemented always
creating a temp directory for actions:
bazelbuild@cfccdf1

See bazelbuild#4376

Change-Id: I8ba63d6120a0aa849997b274fb2d68ad50b2285c
PiperOrigin-RevId: 181134179
werkt pushed a commit to werkt/bazel that referenced this issue Mar 2, 2018
When Bazel creates the sandbox for an action,
Bazel collects a set of paths that the action may
write to.

The action needs write access to its temp
directory, so Bazel needs to add it to the
writable paths.

See bazelbuild#4376

Change-Id: Ifd3c482aa67ff8a2070045356abad8b39c808db8
PiperOrigin-RevId: 181591520
werkt pushed a commit to werkt/bazel that referenced this issue Mar 2, 2018
Fixes bazelbuild#4376

Change-Id: Id78bb0930044626304e54f07735db4d4b2c84720
PiperOrigin-RevId: 181959528
hridder pushed a commit to hridder/nomulus that referenced this issue Mar 6, 2018
With bazelbuild/bazel#4376, bazel 0.10.0 now supports accessing system TMPDIR in its sandbox. Use this instead of hardcoding /tmp in BUILD rules to get around the gpg-agent path length restriction.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186010932
@dapirian
Copy link

dapirian commented Jun 1, 2021

I believe this has had the side effect that --test_env=TMPDIR=/tmp is not respected, which is problematic

luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    When Bazel creates the sandbox for an action,
    Bazel collects a set of paths that the action may
    write to.

    The action needs write access to its temp
    directory, so Bazel needs to add it to the
    writable paths.

    See bazelbuild/bazel#4376

    Change-Id: Ifd3c482aa67ff8a2070045356abad8b39c808db8
    PiperOrigin-RevId: 181591520
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    The BazelConfiguration no longer adds the Bazel
    server process' TMPDIR/TMP/TEMP environment
    variables.

    I added that code before having implemented always
    creating a temp directory for actions:
    bazelbuild/bazel@cfccdf1

    See bazelbuild/bazel#4376

    Change-Id: I8ba63d6120a0aa849997b274fb2d68ad50b2285c
    PiperOrigin-RevId: 181134179
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) platform: windows type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants