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

--output-dir fails on cross-device destination #2671

Closed
4 tasks done
Tracked by #8704
castedo opened this issue Sep 30, 2022 · 4 comments · Fixed by #11151
Closed
4 tasks done
Tracked by #8704

--output-dir fails on cross-device destination #2671

castedo opened this issue Sep 30, 2022 · 4 comments · Fixed by #11151
Assignees
Labels
bug Something isn't working file-systems issues with NFS, google drive, onedrive, etc
Milestone

Comments

@castedo
Copy link

castedo commented Sep 30, 2022

Bug description

STEPS: from empty directory on Linux

sudo mkdir /tmp2
sudo mount -t tmpfs tmpfs /tmp2
echo Hi > test.qmd
touch _quarto.yml
quarto render test.qmd --to markdown --output-dir /tmp2

RESULT: quarto outputs:

ERROR: Invalid cross-device link (os error 18), rename '/home/castedo/shr/bugs/q2/test.md' -> '/tmp2/test.md'

NOTES:

  1. This works:
quarto render test.qmd --to markdown --output-dir tmp2
  1. So does
echo Hola > /tmp2/hi.txt
cat /tmp2/hi.txt
  1. These steps with a tmpfs are not my actually usage scenario. I hit this because I run quarto inside a container and was outputing into a public_html directory mounted outside the container. Similar issue should get hit with VMs and shared folders.

Easy for me to work around though.

ENVIRONMENT:

[castedo@quarto-1 1]$ quarto --version
1.1.251
[castedo@quarto-1 1]$ cat /etc/os-release
NAME="Fedora Linux"
VERSION="36 (Container Image)"
ID=fedora
VERSION_ID=36
...

Checklist

  • Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.
@castedo castedo added the bug Something isn't working label Sep 30, 2022
@dragonstyle dragonstyle added this to the v1.3 milestone Oct 7, 2022
@cscheid cscheid added the file-systems issues with NFS, google drive, onedrive, etc label Nov 15, 2022
@cscheid cscheid self-assigned this Nov 15, 2022
@cderv
Copy link
Collaborator

cderv commented Jan 10, 2023

We should probably check --output flag also as a similar issue is reported in quarto-dev/quarto-r#35

Deno.renameSync(pdfOutput, outputPdf);

What we do in R Markdown to prevent this type of issue is having a moving function that is

  • Copying and then renaming
  • Deleting original files copied

Seems like that is what was adviced in Deno too : denoland/deno#3092

Maybe we should have a wrapper of Deno.RenameSync that handles this type error and do a copying instead.

@grst
Copy link

grst commented Aug 11, 2023

There seems to be a PR open in deno now:
denoland/deno#19879

@rcannood
Copy link
Contributor

rcannood commented Oct 8, 2024

Just encountered this issue in pkgdown as well. Would it help to replace all fs.renameSync(a, b) with the following?

  try {
    fs.renameSync(a, b)
  } catch (err: unknown) {
    console.log(`Failed to rename file: ${err}`)
    fs.copyFileSync(a, b)
    fs.unlinkSync(a)
  }

@cscheid
Copy link
Collaborator

cscheid commented Oct 8, 2024

Not that simple when directories are involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working file-systems issues with NFS, google drive, onedrive, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants