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

fprime-util purge does not always work #3033

Open
celskeggs opened this issue Nov 19, 2024 · 4 comments
Open

fprime-util purge does not always work #3033

celskeggs opened this issue Nov 19, 2024 · 4 comments
Labels
bug Easy First Issue An issue that should be straight forward to implement, and easily tested via CI. F´ Tools Issues pertaining to the F´ tools help wanted

Comments

@celskeggs
Copy link
Contributor

F´ Version v3.5.0-22-g00c5c8e11
Affected Component build system

Problem Description

I interrupted the generate command with Ctrl-C, and now I have a build directory that the purge command won't remove.

# fprime-util purge
[WARNING] Build cache '[...]/build-fprime-automatic-[...]' invalid or not found. Skipping.
[WARNING] Build cache '[...]/build-fprime-automatic-[...]-ut' invalid or not found. Skipping.
# fprime-util generate --ninja
[ERROR] [...]/build-fprime-automatic-[...] already exists.

Context / Environment

Operating System: Linux
CPU Architecture: x86_64
Platform: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.34
Python version: 3.9.18
CMake version: 3.26.5
Pip version: 21.2.3
Pip packages:
    fprime-tools==3.5.0
    fprime-gds==3.5.0
    fprime-fpp-*==2.2.1a1

How to Reproduce

  1. Run fprime-util generate --ninja and hit Ctrl-C partway through.
  2. Run fprime-util purge
  3. Run fprime-util generate --ninja

Expected Behavior

fprime-util purge should remove the build directory even if it is broken, so that fprime-util generate --ninja can generate a clean build directory.

@celskeggs celskeggs added the bug label Nov 19, 2024
@thomas-bc thomas-bc added help wanted Easy First Issue An issue that should be straight forward to implement, and easily tested via CI. F´ Tools Issues pertaining to the F´ tools labels Nov 19, 2024
@thomas-bc
Copy link
Collaborator

thomas-bc commented Nov 19, 2024

FYI if anyone would like to take a crack at this:
The issue seems to be that we try to load the build before purging it. But since the build is invalid, it gets skipped. We may want to either skip the build loading if possible, or (more likely easier) handle the failure nicely.

For what it's worth, fprime-util purge -f does work fine.

@LeStarch
Copy link
Collaborator

This was originally by design. It pointed out that we shouldn't be removing directories that our tools "don't understand".

Thus purge was intended for well-formed directories where it is clear that our tools created them....and and purge -f was created for clobbering anything following the naming scheme.

I am happy to review this behavior, or change it should the community agree that one is desired behavior over the other.

@celskeggs
Copy link
Contributor Author

I'm okay with the idea that fprime-util purge won't delete a directory that wasn't created with the F Prime tools and it can't understand. But if the directory was made with the F Prime tools, fprime-util purge should always be able to understand it.

One possibility: the first step in fprime-util generate after creating the directory could be to add a special file (.fprime-build-dir or something better named) to mark it as an F Prime directory. That way, if the build generation step fails, there will still be a marker telling fprime-util purge that it's OK to delete the directory. (If someone Ctrl-C'd fprime-util generate before it managed to create that file, then the directory will be empty, and I have no concerns with accidentally deleting an empty directory.)

@LeStarch
Copy link
Collaborator

I like this solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Easy First Issue An issue that should be straight forward to implement, and easily tested via CI. F´ Tools Issues pertaining to the F´ tools help wanted
Projects
None yet
Development

No branches or pull requests

3 participants