Skip to content

build_cache.path not honored for "sketches" #2668

Closed
@egnor

Description

@egnor

Describe the problem

Per the documentation the config key build_cache.path (or environment $ARDUINO_BUILD_CACHE_PATH, etc) should cause temp files to go in the designated directory instead of $TMP/arduino which is actually global on the system.

However, while setting that config does redirect the cores/ directory, it does NOT redirect sketches/

To reproduce

  • find some sketch
  • rm -rf /tmp/arduino /tmp/test_dir # clean up to avoid confusion
  • export ARDUINO_BUILD_CACHE_PATH=/tmp/test_dir
  • arduino-cli compile # with any flags needed for the sketch
  • look in /tmp/test_dir and /tmp/arduino

Expected behavior

  • find temp files in /tmp/test_dir
  • find nothing in /tmp/arduino

INSTEAD, I see something like this

% ls -l /tmp/test_dir
total 4
drwxr-xr-x 3 egnor egnor 4096 Jul 16 19:58 cores/

% ls -l /tmp/arduino
total 4
drwxr-xr-x 3 egnor egnor 4096 Jul 16 19:58 sketches/

So, cores/ got moved but sketches/ did not.

Arduino CLI version

arduino-cli Version: 1.0.0 Commit: 05c9852 Date: 2024-06-12T14:13:32Z

Operating system

Linux

Operating system version

Ubuntu 24.04 LTS, kernel 6.8.0-36-generic

Additional context

Code that might be relevant

buildcache.New(paths.TempDir().Join("arduino", "sketches")).Purge(cacheTTL)

return paths.TempDir().Join("arduino", "sketches", s.Hash())

I think the latter one is probably the important one (the first one is just for purging, but it should be made consistent). Both should really be using the common build cache dir.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions