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

Can't build the book if there is broken symlink in the book source dir #1957

Open
maowen opened this issue Dec 15, 2022 · 2 comments
Open

Can't build the book if there is broken symlink in the book source dir #1957

maowen opened this issue Dec 15, 2022 · 2 comments
Labels
C-dependency-bug Category: A bug in a dependency Command-serve Command: serve Command-watch Command: watch S-Blocked-Upstream Status: Blocked Upstream S-Duplicate Status: Duplicate S-Not-wrong Status: Possibly not a bug

Comments

@maowen
Copy link

maowen commented Dec 15, 2022

The book will fail to build if the book source directory contains a broken symlink. This is essentially the same issue as #1396. The previous resolution to #1396 provided better context when reporting the error, but it didn't fix the problem.

Steps to reproduce with mdBook v0.4.22:

$ mkdir testbook
$ cd testbook
$ mdbook init --title "Test Book" --ignore none
2022-12-15 11:00:46 [INFO] (mdbook::book::init): Creating a new book with stub content

All done, no errors...

$ ln -s /bad_symlink src/my_symlink
$ mdbook build
2022-12-15 11:01:16 [INFO] (mdbook::book): Book building has started
2022-12-15 11:01:16 [INFO] (mdbook::book): Running the html backend
2022-12-15 11:01:16 [WARN] (mdbook::utils::fs): Failed to read file metadata of "/home/mowen/testbook/src/my_symlink". Attempting to read metadata without traversing symlinks.

I need to be able to set the mdBook source directory to be the same as my source code directory so that I can include markdown files that live with the source code. However, my source code directory contains broken symlinks (e.g. symlinks in the source code tree that will be used to create an installable package), and this causes the book build to fail.

I have submitted an MR (#1944) to resolve this issue, but I didn't submit an issue. I haven't heard back yet, so I thought I would submit this issue to inquire about the status of my MR.

@KFearsoff
Copy link
Contributor

KFearsoff commented Nov 14, 2023

Seems like this is the same issue as #2224

Unfortunately, there's nothing we can do until a patch to notify-rs lands. But to be honest, I'm not very confident a fix to this issue will be released, because treating broken symlinks as broken is a rather sane behavior, and providing user-facing knobs to tweak it might prove very challenging.

Also, apparently there are some cool escape hatches to hack around this behavior nowadays:

https://github.com/phoenixr-codes/mdbook-webinclude
https://github.com/FauconFan/mdbook-cmdrun

@KFearsoff
Copy link
Contributor

KFearsoff commented Nov 14, 2023

@rustbot label +C-dependency-bug +Command-serve +Command-watch +S-Duplicate +S-Not-wrong +S-Blocked-Upstream

@rustbot rustbot added C-dependency-bug Category: A bug in a dependency Command-serve Command: serve Command-watch Command: watch S-Duplicate Status: Duplicate S-Not-wrong Status: Possibly not a bug S-Blocked-Upstream Status: Blocked Upstream labels Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-dependency-bug Category: A bug in a dependency Command-serve Command: serve Command-watch Command: watch S-Blocked-Upstream Status: Blocked Upstream S-Duplicate Status: Duplicate S-Not-wrong Status: Possibly not a bug
Projects
None yet
Development

No branches or pull requests

3 participants