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

gdal_utils may crash the R session #1680

Closed
agila5 opened this issue May 25, 2021 · 2 comments
Closed

gdal_utils may crash the R session #1680

agila5 opened this issue May 25, 2021 · 2 comments

Comments

@agila5
Copy link
Contributor

agila5 commented May 25, 2021

Dear sf developers, I noticed that when I run the vectortranslate utility in gdal_utils with misspecified options and quiet = FALSE, the R session crashes. For example, the following code returns a warning:

# packages
library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1

# data
osm <- system.file("osm/overpass.osm", package = "sf")
gpkg <- tempfile(fileext = ".gpkg")

# vectortranslate
gdal_utils(
  util = "vectortranslate", 
  source = osm, 
  destination = gpkg, 
  options = c("-oo", "USE_CUSTOM_INDEXING=NO", "-lines")
)
#> Warning in CPL_gdalvectortranslate(source, destination, options, oo, doo, : GDAL
#> Error 6: Unknown option name '-lines'

Created on 2021-05-25 by the reprex package (v2.0.0)

Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 4.0.5 (2021-03-31)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language en                          
#>  collate  Italian_Italy.1252          
#>  ctype    Italian_Italy.1252          
#>  tz       Europe/Berlin               
#>  date     2021-05-25                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version date       lib source        
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.4)
#>  backports     1.2.1   2020-12-09 [1] CRAN (R 4.0.3)
#>  class         7.3-18  2021-01-24 [2] CRAN (R 4.0.5)
#>  classInt      0.4-3   2020-04-07 [1] CRAN (R 4.0.4)
#>  cli           2.5.0   2021-04-26 [1] CRAN (R 4.0.5)
#>  crayon        1.4.1   2021-02-08 [1] CRAN (R 4.0.4)
#>  DBI           1.1.1   2021-01-15 [1] CRAN (R 4.0.4)
#>  digest        0.6.27  2020-10-24 [1] CRAN (R 4.0.4)
#>  dplyr         1.0.6   2021-05-05 [1] CRAN (R 4.0.5)
#>  e1071         1.7-7   2021-05-23 [1] CRAN (R 4.0.5)
#>  ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.0.5)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 4.0.4)
#>  fansi         0.5.0   2021-05-25 [1] CRAN (R 4.0.5)
#>  fs            1.5.0   2020-07-31 [1] CRAN (R 4.0.4)
#>  generics      0.1.0   2020-10-31 [1] CRAN (R 4.0.4)
#>  glue          1.4.2   2020-08-27 [1] CRAN (R 4.0.4)
#>  highr         0.9     2021-04-16 [1] CRAN (R 4.0.5)
#>  htmltools     0.5.1.1 2021-01-22 [1] CRAN (R 4.0.4)
#>  KernSmooth    2.23-18 2020-10-29 [2] CRAN (R 4.0.5)
#>  knitr         1.32    2021-04-14 [1] CRAN (R 4.0.5)
#>  lifecycle     1.0.0   2021-02-15 [1] CRAN (R 4.0.4)
#>  magrittr      2.0.1   2020-11-17 [1] CRAN (R 4.0.4)
#>  pillar        1.6.1   2021-05-16 [1] CRAN (R 4.0.5)
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.0.4)
#>  proxy         0.4-25  2021-03-05 [1] CRAN (R 4.0.4)
#>  purrr         0.3.4   2020-04-17 [1] CRAN (R 4.0.4)
#>  R6            2.5.0   2020-10-28 [1] CRAN (R 4.0.4)
#>  Rcpp          1.0.6   2021-01-15 [1] CRAN (R 4.0.4)
#>  reprex        2.0.0   2021-04-02 [1] CRAN (R 4.0.5)
#>  rlang         0.4.11  2021-04-30 [1] CRAN (R 4.0.5)
#>  rmarkdown     2.7     2021-02-19 [1] CRAN (R 4.0.4)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.4)
#>  sf          * 0.9-8   2021-03-17 [1] CRAN (R 4.0.5)
#>  stringi       1.5.3   2020-09-09 [1] CRAN (R 4.0.3)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 4.0.4)
#>  styler        1.4.1   2021-03-30 [1] CRAN (R 4.0.5)
#>  tibble        3.1.2   2021-05-16 [1] CRAN (R 4.0.5)
#>  tidyselect    1.1.1   2021-04-30 [1] CRAN (R 4.0.5)
#>  units         0.7-1   2021-03-16 [1] CRAN (R 4.0.4)
#>  utf8          1.2.1   2021-03-12 [1] CRAN (R 4.0.4)
#>  vctrs         0.3.8   2021-04-29 [1] CRAN (R 4.0.5)
#>  withr         2.4.2   2021-04-18 [1] CRAN (R 4.0.5)
#>  xfun          0.23    2021-05-15 [1] CRAN (R 4.0.5)
#>  yaml          2.2.1   2020-02-01 [1] CRAN (R 4.0.3)
#> 
#> [1] C:/Users/Utente/Documents/R/win-library/4.0
#> [2] C:/Program Files/R/R-4.0.5/library

while the equivalent code with quiet = FALSE in gdal_utils crashes the R session (I cannot add a reprex). I know that the problem is related to the options set by the user, but I think that it shouldn't crash the session.

@edzer edzer closed this as completed in 062bb19 May 25, 2021
@edzer
Copy link
Member

edzer commented May 25, 2021

Thanks - yes, rather obvious but not clear from the GDAL docs...

@agila5
Copy link
Contributor Author

agila5 commented May 26, 2021

Thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants