[R-pkg-devel] shapefile .dbf recognised as executable
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Fri Feb 11 23:44:12 CET 2022
On 11/02/2022 5:22 p.m., Murray Efford wrote:
> I have long distributed a small spatial ESRI shapefile as demonstration data in the extdata directory of 'secr'. It comprises the three files OVforest.shp, OVforest.dbf and OVforest.shx. I wanted to make minor changes (adding a coordinate reference system, dropping an attribute). I find that after merely reading (sf::st_read("OVforest.shp") and re-writing the same (sf::st_write("OVforest.shp")) the .dbf file is recognised by R CMD check as executable and raises a Warning (on GNU/Linux, but not in Windows).
>
> No doubt this can be blamed on specifics of the driver used by sf::st_write, but I have been unable to find any settings that might change the behaviour.
>
> I would like to know: Is this a false positive, and if not, How can I remove the executable component(s)? Can I apply the test used by R CMD check outside of R CMD check?
It's not easy to run just that test, but you can see it if you look here:
https://github.com/wch/r-source/blob/988077a792e628677bd5884b351fe08b2c17b8c8/src/library/tools/R/check.R#L4866-L4941
The basic idea is that it uses the "file" command. There are some known
false positives.
If you are on Linux, try running "file OVforest.dbf" and see what it says.
Duncan Murdoch
More information about the R-package-devel
mailing list