-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Avoid a possible recursive copy when destination (build_dir) is underneath source directory #1026
Conversation
Any feedback on this PR? |
I'm having trouble figuring out the configuration where this is a problem. If I set |
When you have the book.toml file in the root of your project. in book.toml you have and the build dir is also under the root somewhere, something like
So, during the build all the contents of "src" (so all files - except filtered .md files) are copied into "target", including "target" itself - recursing. in short: when "build-dir" is a subdir of "src". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you have the book.toml file in the root of your project.
Ah. I still can't reproduce it, but I suspect it depends on how the OS handles mutating the directory while iterating over it. Seems reasonable to try to guard against it, though.
OK, I hope that addresses the two comments on texts in the PR. |
…neath source directory. Update docs to match.
Thanks. I'll switch to release v0.3.7 now! |
Avoid a possible recursive copy when destination (build_dir) is underneath source directory
If the user makes a mistake in config
mdbook
could have started a never-ending copy that only ends when your disk is full. This change avoids that.It also makes it possible to create a valid (if not recommended) configuration where your
build-dir
is underneath thesrc
directory. One reason for possibly wishing to do that is when you desiresrc
to be the root directory of a project.Relates to #1024