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

Invalid cross-device link when output-dir is not on same device as the source file #6466

Closed
grst opened this issue Aug 7, 2023 · 7 comments
Labels
duplicate This issue or pull request already exists

Comments

@grst
Copy link

grst commented Aug 7, 2023

I have the source code of the quarto project checked out in my home directory. I want the rendered report to be stored on a shared group drive that is on a different network mount than my home directory. Therefore I render the document with

quarto render analysis.qmd --to html --embed-resources --standalone --output-dir /shared_data/analysis.html

This results in the following error

ERROR: Invalid cross-device link (os error 18), rename '/home/sturmgre/<path redacted>/analysis.html' -> '/data/<path redacted>/analysis.html'

Error: Invalid cross-device link (os error 18), rename '/home/sturmgre/<path redacted>/analysis.html' -> '/data/<path redacted>/analysis.html'
    at Object.renameSync (deno:runtime/js/30_fs.js:175:9)
    at renderProject (file:///home/sturmgre/apps/quarto/bin/quarto.js:86845:22)
    at async Command.fn (file:///home/sturmgre/apps/quarto/bin/quarto.js:90869:32)
    at async Command.execute (file:///home/sturmgre/apps/quarto/bin/quarto.js:8437:13)
    at async quarto (file:///home/sturmgre/apps/quarto/bin/quarto.js:127555:5)
    at async file:///home/sturmgre/apps/quarto/bin/quarto.js:127573:9
@jjallaire jjallaire transferred this issue from quarto-dev/quarto Aug 8, 2023
@mcanouil
Copy link
Collaborator

I cannot reproduce using the development version of Quarto.
To note, --output-dir is only a valid option within a Quarto project which means the presence of _quarto.yml that you did not provide.

Could you share a small self-contained "working" (reproducible) example to work with, i.e., a complete Quarto document or a Git repository? Thanks.

You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````).

````qmd
---
title: "Reproducible Quarto Document"
format: html
---

This is a reproducible Quarto document using `format: html`.
It is written in Markdown and contains embedded R code.
When you run the code, it will produce a plot.

```{r}
plot(cars)
```

The end.
````

@mcanouil mcanouil added the needs-repro Issues that are blocked until reporter provides an adequate reproduction label Aug 10, 2023
@grst
Copy link
Author

grst commented Aug 11, 2023

The following reproduces the problem for me

ANALYSIS_DIR=/home/sturmgre/quarto-test
DATA=/data/test

cd $ANALYSIS_DIR
echo "Hello World" > test.qmd
touch _quarto.yml

# Creating a hard link should fail - this is to test that the two devices are really independent
ln test.qmd $DATA/test.qmd
ln: failed to create hard link ‘/data/test//test.qmd’ => ‘test.qmd’: Invalid cross-device link
quarto render test.qmd --to html --standalone --embed-resources --output-dir $DATA
  to: html
  output-file: test.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png

metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en

ERROR: Invalid cross-device link (os error 18), rename '/home/sturmgre/quarto-test/test.html' -> '/data/test/test.html'

Error: Invalid cross-device link (os error 18), rename '/home/sturmgre/quarto-test/test.html' -> '/data/test/test.html'
    at Object.renameSync (deno:runtime/js/30_fs.js:175:9)
    at renderProject (file:///home/sturmgre/apps/quarto/bin/quarto.js:86845:22)
    at async Command.fn (file:///home/sturmgre/apps/quarto/bin/quarto.js:90869:32)
    at async Command.execute (file:///home/sturmgre/apps/quarto/bin/quarto.js:8437:13)
    at async quarto (file:///home/sturmgre/apps/quarto/bin/quarto.js:127555:5)
    at async file:///home/sturmgre/apps/quarto/bin/quarto.js:127573:9

Tested with both v1.3.427 and the latest development version.

@mcanouil
Copy link
Collaborator

mcanouil commented Aug 11, 2023

I still can't reproduce and don't understand the goal of trying to hard link the file.
Below my reproducible example (i.e., yours is not):

echo "Hello World" > test.qmd
touch _quarto.yml
mkdir /tmp/test
quarto render test.qmd --to html --standalone --embed-resources --output-dir /tmp/test
image

Is DATA=/data/test a local drive/volume or network/cloud volume?

@grst
Copy link
Author

grst commented Aug 11, 2023

Executing your reproducible example leads to exactly the same error for me.

My point was that $DATA and $HOME are different network volumes. Therefore it's not possible to create a hard link between them.

What happens if you try creating a hard link to your /tmp directory?

ln test.qmd /tmp/test

Depending on you system, /tmp may or may not be an independent volume and therefore not suitable to reproduce my issue.

@mcanouil
Copy link
Collaborator

mcanouil commented Aug 11, 2023

Executing your reproducible example leads to exactly the same error for me.

Your home is not on the same volume as /tmp?

You seem to imply, if you use an output directory within the same volume, it works, but is it?


Because, as I said, --output-dir is for Quarto project and is not designed for simple document (see #2171), you should consider using quarto render test.qmd --to html --standalone --embed-resources && mv test.html $DATA/.


See already opened issues regarding network drives/volumes:

@grst
Copy link
Author

grst commented Aug 11, 2023

Your home is not on the same volume as /tmp

No, on the server I'm working on /tmp is stored entirely in RAM.

You seem to imply, if you use an output directory within the same volume, it works, but is it?

Exactly, if I use

quarto render test.qmd --to html --standalone --embed-resources --output-dir ..

it works flawlessly. Sorry if this hasn't been clear before.

EDIT: I don't think the the drives being "network" drives is a problem as on linux they are a path as any other. The error would also occur with two different local drives.

@mcanouil
Copy link
Collaborator

mcanouil commented Aug 11, 2023

Still without the means to reproduce, it's very unlikely the issue can be solved.

Anyway, this has already been discussed/reported in the issues I linked above and in particular:

So feel free to add complementary information on the other issue as I am closing this one as a duplicate.

@mcanouil mcanouil closed this as not planned Won't fix, can't repro, duplicate, stale Aug 11, 2023
@mcanouil mcanouil added duplicate This issue or pull request already exists and removed needs-repro Issues that are blocked until reporter provides an adequate reproduction labels Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants