Skip to content

The --output trigger overwrites previously rendered file #6472

Open

Description

@snhansen

Bug description

If I render a PDF document with the same name as the .qmd document, i.e. I get test.pdf from test.qmd, then any subsequent rendering using the --output trigger will overwrite test.pdf even though I specify a different name.

Steps to reproduce

Consider a simple document

---
format: pdf
---

Something

and the two commands

quarto render test.qmd
quarto render test.qmd --output test2.pdf

Expected behavior

I would expect two documents test.pdf and test2.pdf.

Actual behavior

I'm only getting the latter as the first is deleted during the second render.

Your environment

No response

Quarto check output

D:\quartotest\test>quarto check install

[>] Checking Quarto installation......OK
      Version: 1.4.309
      Path: C:\Users\au234616\AppData\Local\Programs\Quarto\bin
      CodePage: 1252

Activity

  1. added
    bug
    on Aug 9, 2023
  2. mcanouil commented on Aug 9, 2023

    @mcanouil
    Collaborator

    I cannot reproduce using the latest Quarto version.

    Screen.Recording.2023-08-09.at.21.52.31.mov
  3. added
    needs-repro
    on Aug 9, 2023
  4. snhansen commented on Aug 9, 2023

    @snhansen
    Author

    @mcanouil Try with --output "index.pdf" and --output "index2.pdf". The issue is only when there's a .pdf with the same name as the .qmd.

  5. mcanouil commented on Aug 9, 2023

    @mcanouil
    Collaborator

    I see, then it is related to #4802.
    Quarto creates intermediary/temporary files with the same basename as the Quarto document or Jupyter Notebook. --output is basically just to say to Quarto "move/rename the file to" which means index.pdf is overwritten each time index.qmd is rendered.

    Now, because this is the current behaviour of Quarto, the quick and easy workaround is to account for that in the execution order:

    quarto render test.qmd --output test2.pdf
    quarto render test.qmd
  6. removed
    needs-repro
    on Aug 9, 2023
  7. cscheid commented on Aug 14, 2023

    @cscheid
    Member

    @mcanouil I'm going to open a 1.5 epic for "Execution Planner". It will tackle (and hopefully solve) both parallelization and file overwrite issues. Letting you know so that as you're triaging new features, you know where to put them.

  8. added this to the v1.5 milestone on Aug 14, 2023
  9. self-assigned this
    on Aug 14, 2023
  10. modified the milestones: v1.5, Future on Feb 12, 2024
  11. barryrowlingson commented on Dec 13, 2024

    @barryrowlingson

    This bug is still present in v1.6. The workaround of 9 Aug 2023 isn't a good fit for many situations. Example:

    Student submits work.qmd and work.pdf. I want to render work.qmd to PDF so I can compare, so I quarto render work.qmd -o test.pdf and boom their work.pdf is unexpectedly gone. (Luckily I always put student subs in a git repo so I can revert any accidental changes or deletions back to their submitted state).

    Same thing happens if I use --output-dir ./test/ - PDF appears in the folder but the original PDF goes.

    Best workaround I have at this point is to copy or symlink the original qmd file to a new name and then render that to a new name.pdf

  12. added
    files
    on Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugfiles

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions