-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
make clean destroys data with BUILDDIR = . #2504
Comments
I think that's a classic case of Garbage In Garbage Out: We put everything inside of In order for your proposed fix to work, we'd need to record all files written during build. That'd require introducing a new file access layer for builders (they currently use raw I'd be willing to accept a sanity check for the Makefile which makes sure that |
I think your case is unusual for me. so, personally, recordings and sanity checks are no needed. |
Well, we don't want to be the next bumblebee, so I think sanity checks wouldn't hurt. :-) |
Ah, I understand that. The sanity check will guard users from suicide. |
I hacked together a sanity check which checks if BUILDDIR is a subdirectory of the Makefile directory (CURDIR), or more precisely, it checks if BUILDDIR is below CURDIR in the filesystem hierarchy and that BUILDIR and CURDIR are not identical. Here is the draft:
I you know a cleaner way to do this in a Makefile, let me know. Otherwise, I would recommend to make the clean rule a call to the sphinx-build program. I.e.
This way, the sanity check on BUILDDIR can be implemented in python. |
Hm, I think "must be a directory below the the root of Sphinx" is an unnecessarily strict requirement — writing to I see two options:
|
I agree on "BUILDDIR must be a directory below the the root of Sphinx" is an unnecessarily strict requirement. Regarding the second option, |
I implemented "Prohibit any parent path to the Sphinx root (ie. any prefix of it.)" using
Draft for testing if CURDIR is below BUILDIR and if CURDIR is equal to BUILDDIR:
Test:
Test Makefile (beware make metaprogramming):
|
Arguably the simplest fix for this would be to remove the |
Fixed by #8450 instead. Closing. |
make clean
wipes the entire documentation ifBUILDDIR = .
.The Makefile rule for clean is
Thus, it expands to
rm -rf ./*
and deletes everything in the current directory. Even worse, ifBUILDDIR =
.Expected Behaviour
The spinx-doc makefile should only delete files and directories generated by sphinx-doc.
Proposed Fix
Generate a list of output files and directories in sphinx-build and delete them individually.
The text was updated successfully, but these errors were encountered: