Skip to content

Proposal: honor TMPDIR in gdrcopy package build scripts #343

Description

@hanwen-cluster

Problem

packages/build-rpm-packages.sh and packages/build-deb-packages.sh create their build workspace with an absolute /tmp template:

tmpdir=`mktemp -d /tmp/gdr.XXXXXX`

Because the template is an absolute path, mktemp uses it verbatim and never consults TMPDIR. The entire build then runs under /tmp, where the RPM %build stage executes ./config_arch. On hosts that mount /tmp with noexec (common on hardened OS), that script can't execute, and the build fails:

make: ./config_arch: Permission denied
GDRAPI_ARCH=
...
undefined reference to `memcpy_uncached_store_neon'   # arch never detected → wrong sources compiled

There is no way to redirect the build off /tmp today.

Fix

Let mktemp resolve the base directory itself, so it honors TMPDIR and falls back to /tmp when unset:

-tmpdir=`mktemp -d /tmp/gdr.XXXXXX`
+tmpdir=`mktemp -d --tmpdir gdr.XXXXXX`

Apply the same change in both packages/build-rpm-packages.sh and packages/build-deb-packages.sh.

Portability note

--tmpdir is a GNU coreutils extension. These are Linux-only rpm/deb packaging scripts, so GNU mktemp is a safe assumption. If you prefer to avoid the GNU-specific flag, the portable equivalent is:

-tmpdir=`mktemp -d /tmp/gdr.XXXXXX`
+tmpdir=`mktemp -d "${TMPDIR:-/tmp}/gdr.XXXXXX"`

Both fixes are functionally identical.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions