Skip to content

Store all temporary files under a single folder #2031

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

Merged

Conversation

giulianopz
Copy link
Contributor

@giulianopz giulianopz commented Jan 7, 2023

Fix #2028

Any temporary file will be persisted in a new dedicated folder named as "arduino" located in the OS-specific temporary directory, e.g.:

/tmp/
├── arduino
│   ├── arduino-core-cache
│   │   └── core_arduino_avr_uno_640aa5b4d646262327bbea65c3462b39.a 
│   └── arduino-sketch-89E1544CF5F196B29E530BA6940B661F
│       ├── 06.ino.elf
│       ├── 06.ino.with_bootloader.bin
│       ├── build.options.json
│       ├── compile_commands.json
│       ├── core
│       │   ├── abi.cpp.d
[...]

This change is meant to make easier maintenance operations for both end-users and operating-systems.

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)

What kind of change does this PR introduce?

All code lines which reference the default tmp dir to store temporary files were changed to prefix "arduino-core-cache" and "arduino-sketch-[MD5]" dirs with "arduino/" as their parent.

What is the current behavior?

See issue #2028.

What is the new behavior?

All the temporary files will be put inside a new "arduino" folder in the default temporary directory of the OS.

Does this PR introduce a breaking change, and is titled accordingly?

Not sure if this is a braking change with respect to older versions of the cli.

…p dir.

Fix arduino#2028

Any temporary file will be persisted in a new dedicated folder named as "arduino" located in the OS-specific temporary directory, e.g.:
/tmp/
├── arduino
│   ├── arduino-core-cache
│   │   └── core_arduino_avr_uno_640aa5b4d646262327bbea65c3462b39.a
│   └── arduino-sketch-89E1544CF5F196B29E530BA6940B661F
│       ├── 06.ino.elf
│       ├── 06.ino.with_bootloader.bin
│       ├── build.options.json
│       ├── compile_commands.json
│       ├── core
│       │   ├── abi.cpp.d
[...]

This change is meant to make easier maintenance operations for both end-users and operating-systems.

Signed-off-by: giuliano <panzironi.giuliano@gmail.com>
@pzygielo
Copy link

pzygielo commented Jan 7, 2023

Will it work in multi-user environment for the second and next users, once the first temporary arduino directory is created?

@codecov
Copy link

codecov bot commented Jan 7, 2023

Codecov Report

Base: 36.43% // Head: 36.43% // No change to project coverage 👍

Coverage data is based on head (2b56131) compared to base (c0d4e44).
Patch coverage: 50.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2031   +/-   ##
=======================================
  Coverage   36.43%   36.43%           
=======================================
  Files         228      228           
  Lines       19316    19316           
=======================================
  Hits         7038     7038           
  Misses      11444    11444           
  Partials      834      834           
Flag Coverage Δ
unit 36.43% <50.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
commands/compile/compile.go 0.00% <0.00%> (ø)
arduino/sketch/sketch.go 65.53% <100.00%> (ø)
commands/lib/search.go 88.15% <0.00%> (-3.95%) ⬇️
arduino/cores/packagemanager/package_manager.go 66.58% <0.00%> (+0.75%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@giulianopz
Copy link
Contributor Author

giulianopz commented Jan 7, 2023

Will it work in multi-user environment for the second and next users, once the first temporary arduino directory is created?

The second user (and next ones) will not be allowed to compile the same sketch the first user built. But only if they can access the exact same sketch folder: the name of the tmp dir of a sketch ends with an MD5 hash value generated from the path of such dir.

This happens also with the current version of the cli (doesn't it?), anyway.

This PR just deals with grouping the two main dirs containing tmp files as requested in the referenced issue. You should open a new issue, I guess, if you think that this kind of collisions can really happen (I don't know, to be honest).

@pzygielo
Copy link

pzygielo commented Jan 7, 2023

This happens also with the current version of the cli (doesn't it?), anyway.

Now that you shown it I can see that arduino-core-cache locks other users already indeed.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jan 8, 2023
…rip 'arduino' from cache and sketch tmp folders' name
Bikappa
Bikappa previously approved these changes Jan 10, 2023
@Bikappa Bikappa dismissed their stale review January 10, 2023 12:23

Need internal confirmation

@Bikappa Bikappa self-assigned this Jan 10, 2023
@Bikappa Bikappa merged commit 34762a6 into arduino:master Jan 10, 2023
@per1234 per1234 mentioned this pull request Jan 28, 2023
3 tasks
kittaakos pushed a commit to arduino/arduino-ide that referenced this pull request Feb 22, 2023
Aligned CLI build path calculation (arduino/arduino-cli#2031)

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to arduino/arduino-ide that referenced this pull request Feb 22, 2023
Aligned CLI build path calculation (arduino/arduino-cli#2031)

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store all files added to temporary folder below a single dedicated folder
4 participants