Skip to content

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

Open
@maowen

Description

@maowen

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions