quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.94k stars 325 forks source link

Error running filter crossref.lua #1770

Closed durraniu closed 2 years ago

durraniu commented 2 years ago

Bug description

I am trying to render a Rmd file that has a long name:

2020-12-16-dynamic-time-warping-and-hierarchical-clustering-with-gapminder

But I get this error:

Error running filter C:/Users/<user-name>/AppData/Local/Programs/Quarto/share/filters/crossref/crossref.lua: ...ocal/Programs/Quarto/share/filters/crossref/crossref.lua:3019: attempt to index a nil value (local 'file') stack traceback: ...ocal/Programs/Quarto/share/filters/crossref/crossref.lua:2914: in function <...ocal/Programs/Quarto/share/filters/crossref/crossref.lua:2908>

When I change the file name to 2020-12-16-dtw, it renders successfully.

Contents of Rmd file:

---
title: Dynamic Time Warping and Hierarchical Clustering with {gapminder}
date: '2020-12-16'
---

Abc

RStudio Version:

2022.07.1 Build 554

OS:

Windows 10

Session Info:

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

Random number generation:
 RNG:     L'Ecuyer-CMRG 
 Normal:  Inversion 
 Sample:  Rejection 

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices
[4] utils     datasets  methods  
[7] base     

other attached packages:
 [1] ggrepel_0.9.1    gapminder_0.3.0 
 [3] factoextra_1.0.7 dtwclust_5.5.6  
 [5] dtw_1.22-3       proxy_0.4-25    
 [7] gganimate_1.0.7  magick_2.7.2    
 [9] here_1.0.1       forcats_0.5.1   
[11] stringr_1.4.0    dplyr_1.0.9     
[13] purrr_0.3.4      readr_1.4.0     
[15] tidyr_1.2.0      tibble_3.1.7    
[17] ggplot2_3.3.6    tidyverse_1.3.1 

loaded via a namespace (and not attached):
  [1] readxl_1.3.1           
  [2] backports_1.2.1        
  [3] plyr_1.8.6             
  [4] sp_1.4-5               
  [5] crosstalk_1.2.0.9000   
  [6] digest_0.6.29          
  [7] foreach_1.5.1          
  [8] htmltools_0.5.3.9000   
  [9] viridis_0.5.1          
 [10] rsconnect_0.8.16       
 [11] fansi_1.0.3            
 [12] magrittr_2.0.3         
 [13] memoise_2.0.1          
 [14] cluster_2.1.0          
 [15] doParallel_1.0.16      
 [16] openxlsx_4.2.3         
 [17] modelr_0.1.8           
 [18] extrafont_0.17         
 [19] RcppParallel_5.0.2     
 [20] extrafontdb_1.0        
 [21] pkgdown_1.6.1          
 [22] prettyunits_1.1.1      
 [23] colorspace_2.0-1       
 [24] rvest_1.0.2            
 [25] haven_2.5.0            
 [26] xfun_0.31              
 [27] crayon_1.5.1           
 [28] jsonlite_1.8.0         
 [29] bigmemory.sri_0.1.3    
 [30] iterators_1.0.13       
 [31] glue_1.6.2             
 [32] gtable_0.3.0           
 [33] webshot_0.5.2          
 [34] car_3.0-10             
 [35] Rttf2pt1_1.3.8         
 [36] abind_1.4-5            
 [37] scales_1.1.1           
 [38] DBI_1.1.1              
 [39] rstatix_0.6.0          
 [40] miniUI_0.1.1.1         
 [41] Rcpp_1.0.8.3           
 [42] viridisLite_0.4.0      
 [43] xtable_1.8-4           
 [44] progress_1.2.2         
 [45] clue_0.3-58            
 [46] foreign_0.8-80         
 [47] stats4_4.0.3           
 [48] rayshader_0.24.1       
 [49] htmlwidgets_1.5.4      
 [50] httr_1.4.3             
 [51] modeltools_0.2-23      
 [52] ellipsis_0.3.2         
 [53] pkgconfig_2.0.3        
 [54] farver_2.1.0           
 [55] dbplyr_2.1.1           
 [56] utf8_1.2.1             
 [57] tidyselect_1.1.2       
 [58] labeling_0.4.2         
 [59] rlang_1.0.4            
 [60] manipulateWidget_0.10.1
 [61] reshape2_1.4.4         
 [62] later_1.3.0            
 [63] munsell_0.5.0          
 [64] cellranger_1.1.0       
 [65] tools_4.0.3            
 [66] cachem_1.0.3           
 [67] cli_3.3.0              
 [68] generics_0.1.3         
 [69] gifski_0.8.6           
 [70] broom_1.0.0            
 [71] evaluate_0.15          
 [72] fastmap_1.1.0          
 [73] yaml_2.3.5             
 [74] knitr_1.39             
 [75] fs_1.5.2               
 [76] zip_2.2.0              
 [77] rgl_0.106.8            
 [78] dendextend_1.14.0      
 [79] mime_0.12              
 [80] xml2_1.3.3             
 [81] flexclust_1.4-0        
 [82] compiler_4.0.3         
 [83] rstudioapi_0.13        
 [84] curl_4.3.2             
 [85] png_0.1-7              
 [86] ggsignif_0.6.0         
 [87] reprex_2.0.1           
 [88] tweenr_1.0.1           
 [89] stringi_1.7.8          
 [90] RSpectra_0.16-0        
 [91] lattice_0.20-41        
 [92] Matrix_1.2-18          
 [93] nloptr_1.2.2.2         
 [94] shinyjs_2.0.0          
 [95] ggsci_2.9              
 [96] vctrs_0.4.1            
 [97] pillar_1.8.0           
 [98] lifecycle_1.0.1        
 [99] data.table_1.13.6      
[100] bigmemory_4.5.36       
[101] raster_3.4-10          
[102] httpuv_1.6.1           
[103] R6_2.5.1               
[104] promises_1.2.0.1       
[105] gridExtra_2.3          
[106] rio_0.5.16             
[107] codetools_0.2-18       
[108] assertthat_0.2.1       
[109] rprojroot_2.0.3        
[110] withr_2.5.0            
[111] parallel_4.0.3         
[112] hms_1.1.0              
[113] grid_4.0.3             
[114] class_7.3-17           
[115] rmarkdown_2.14         
[116] carData_3.0-4          
[117] ggpubr_0.4.0           
[118] shiny_1.6.0            
[119] lubridate_1.8.0 

quarto check Output

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

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
      Version: 3.10.2
      Path: C:/Python310/python.exe
      Jupyter: 4.9.2
      Kernels: julia-1.5, python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........OK
      Version: 4.1.3
      Path: C:/PROGRA~1/R/R-41~1.3
      LibPaths:
        - C:/Users/umair/Documents/R/win-library/4.1
        - C:/Program Files/R/R-4.1.3/library
      rmarkdown: 2.13

[>] Checking Knitr engine render......OK

quarto tools check Output

[>] Inspecting toolso.cmd tools check

Tool         Status            Installed     Latest
chromium     Not installed     ---           869685
tinytex      Up to date        v2022.08      v2022.08

Checklist

jjallaire commented 2 years ago

I'm not able to repro this. I have a feeling the issue is that the full path to the file (inclusive of parent directories) exceeds the windows limit (which is I believe 256 characters but could be 512?). What is the full path of the directory your document is located within?

durraniu commented 2 years ago

The full path is: D:/umair-durrani/posts/2020-12-16-dynamic-time-warping-and-hierarchical-clustering-with-gapminder/

jjallaire commented 2 years ago

I wonder if it has something to do with the D drive? What happens if you are on the C drive?

durraniu commented 2 years ago

I haven't tested it with quarto on C drive. But I used to have this same file on C drive within a distill blog. It rendered without any issues. Why might D drive be an issue?

jjallaire commented 2 years ago

Lua could be having difficulty interacting with files on a remote volume (which D could be)

durraniu commented 2 years ago

I have now tested rendering by copying the folder to C:/Documents and using the long file name of the post. I get the same error about crossref.lua. Then I renamed the post to the short name and it rendered successfully. So, the drive location does not seem to be the issue. It is the length of file name, what you previously suggested.

jjallaire commented 2 years ago

okay, I tried this on Windows and didn't reproduce. What version of Windows are you running on?

durraniu commented 2 years ago

Windows 10

jjallaire commented 2 years ago

Okay, could you create a git repo with a minimal reproducible example of the failing case and I'll run exactly that code. If you are running from RStudio vs. VS Code vs. Console that it helpful to know as well.

durraniu commented 2 years ago

I am running from RStudio 2022.07.1. The R version is 4.0.3. Windows 10. Here is the git repo with a single post that fails rendering with a long file name.

jjallaire commented 2 years ago

Okay, thank you! I can reproduce this with your git repo. Will investigate now.

jjallaire commented 2 years ago

Resolved here: https://github.com/quarto-dev/quarto-cli/commit/f99ffd70361e763fabf508f64f5a970084c75d7c