Skip to content

quarto book project + wrong config == render trashes entire directory #7998

Closed

Description

@mitzimorris

Bug description

the project config option lib-dir: "./.." is pretty fatal for quarto render.

project:
  type: book
  title: "Stan Reference Manual"
  lib-dir: "./.."

when building a book from the command line using quarto render, the book is first rendered, then the directory is completely deleted.

~/github/stan-dev/docs/src/baz (issue/689-quarto-pdfs)> ls -lta
total 88
drwxr-xr-x  14 mitzi  staff   448 Dec 20 16:01 .
-rw-r--r--   1 mitzi  staff  1080 Dec 20 16:01 _quarto.yml
-rw-r--r--   1 mitzi  staff  2079 Dec 20 16:00 header.tex
drwxr-xr-x   5 mitzi  staff   160 Dec 20 16:00 .quarto
-rw-r--r--   1 mitzi  staff  2370 Dec 20 16:00 includes.Rmd
-rw-r--r--   1 mitzi  staff   543 Dec 20 16:00 js.html
-rw-r--r--   1 mitzi  staff    10 Dec 20 16:00 .gitignore
-rw-r--r--   1 mitzi  staff    74 Dec 20 16:00 references.Rmd
drwxr-xr-x   4 mitzi  staff   128 Dec 20 16:00 img
-rw-r--r--   1 mitzi  staff  2193 Dec 20 16:00 index.qmd
-rw-r--r--   1 mitzi  staff  1904 Dec 20 16:00 encoding.Rmd
-rw-r--r--   1 mitzi  staff   591 Dec 20 16:00 comments.Rmd
-rw-r--r--   1 mitzi  staff  6520 Dec 20 16:00 quarto_styles.css
drwxr-xr-x  24 mitzi  staff   768 Dec 20 16:00 ..
~/github/stan-dev/docs/src/baz (issue/689-quarto-pdfs)> quarto render
[1/5] index.qmd
[2/5] encoding.Rmd


processing file: encoding.Rmd
1/1
output file: encoding.knit.md



processing file: encoding.Rmd
1/1
output file: encoding.knit.md

[3/5] includes.Rmd


processing file: includes.Rmd
1/1
output file: includes.knit.md



processing file: includes.Rmd
1/1
output file: includes.knit.md

[4/5] comments.Rmd


processing file: comments.Rmd
1/1
output file: comments.knit.md



processing file: comments.Rmd
1/1
output file: comments.knit.md

[5/5] references.Rmd


processing file: references.Rmd
1/1
output file: references.knit.md



processing file: references.Rmd
1/1
output file: references.knit.md


pandoc 
  to: latex
  output-file: index.tex
  standalone: true
  toc: true
  number-sections: true
  top-level-division: chapter
  pdf-engine: pdflatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf
  syntax-definition: ../stan.xml
  toc-depth: 2
  
metadata
  crossref:
    chapters: true
  documentclass: book
  papersize: letter
  block-headings: false
  bibliography:
    - ../bibtex/all.bib
  biblio-style: apalike
  latex-tinytex: false
  latex-engine: pdflatex
  toc-title: Table of Contents
  title: Stan Reference Manual
  author: Stan Development Team
  
running pdflatex - 1
  This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded format=pdflatex)
   restricted \write18 enabled.
  entering extended mode
  
running pdflatex - 2
  This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded format=pdflatex)
   restricted \write18 enabled.
  entering extended mode
  

ERROR: TypeError: Invalid argument (os error 22), rename '/Users/mitzi/github/stan-dev/docs/src' -> '/Users/mitzi/github/stan-dev/docs/src/baz'
~/github/stan-dev/docs/src/baz> pwd
/Users/mitzi/github/stan-dev/docs/src/baz
~/github/stan-dev/docs/src/baz> ls -lta
total 0
drwxr-xr-x  23 mitzi  staff  736 Dec 20 16:02 ..
drwxr-xr-x   2 mitzi  staff   64 Dec 20 16:02 .
~/github/stan-dev/docs/src/baz> cd ..

at this point, source directory baz no longer exists.

Activity

  1. added
    bug
    on Dec 20, 2023
  2. cscheid commented on Dec 20, 2023

    @cscheid
    Member

    the project config option lib-dir: "./.." is pretty fatal for quarto render.

    We should be emitting a much better error message here and refusing to go along, but Quarto doesn't (or shouldn't!) allow projects to refer outside of their roots. This is by design, and unfortunately it's a change from Bookdown that might surprise you.

    The bad error here is that the relative reference to an out-of-root location causes Quarto to misbehave. But just to temper your expectations: the fix will be to refuse to start the rendering process, not for that to be handled.

    Quarto, by design, requires all project content to be inside the root.

  3. mitzimorris commented on Dec 20, 2023

    @mitzimorris
    Author

    I have a set of manuals, they share css and latex headers. they are in parallel directories, and the common resources are in the parent directory. how can I avoid making copies of these files in each directory?

  4. mitzimorris commented on Dec 20, 2023

    @mitzimorris
    Author

    not rendering with an error message is fine.

    there is insufficient information on project config options: https://quarto.org/docs/reference/projects/options.html

    trying to guess from other examples led to this (non) disaster (because, of course, github).

  5. cscheid commented on Dec 20, 2023

    @cscheid
    Member

    How can I avoid making copies of these files in each directory?

    With the acknowledgment that this is a unix-specific solution, I'd use hard-links. For a "better" solution, I'd use git sub-trees (which I find significantly easier to use than submodules).

  6. added this to the v1.5 milestone on Dec 21, 2023
  7. self-assigned this
    on Jun 17, 2024
  8. added
    websites
    on Jun 17, 2024
  9. modified the milestones: v1.5, v1.6 on Jun 25, 2024
  10. added
    files
    on Oct 22, 2024
  11. cscheid commented on Nov 15, 2024

    @cscheid
    Member

    It took us way too long to get to this, but it's finally fixed. It should be signficantly harder to get Quarto to accidentally delete its own project while doing file system gymnastics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugfilesprojectswebsites

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions