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

read_delim (and friends) looks for file when given literal data #1063

Closed
ceresek opened this issue Jan 20, 2020 · 0 comments
Closed

read_delim (and friends) looks for file when given literal data #1063

ceresek opened this issue Jan 20, 2020 · 0 comments

Comments

@ceresek
Copy link

ceresek commented Jan 20, 2020

The read_delim function accepts literal data when the file argument contains a newline, however, it will still attempt to access a file whose name is the literal data. This is because read_delimited will call empty_file on the literal data, which will (on Linux) end up calling the stat syscall.

Easily reproduced with:

[bash] strace -e trace=stat R
[r] library ('readr')
[r] read_delim ('this\nshould\nnot\nhappen', delim = ',')
[console] stat("this\nshould\nnot\nhappen", 0x7ffd6298e220) = -1 ENOENT (No such file or directory)

The function works in that it then correctly parses the literal data, but it is still strange that it should use the literal data to access the file system. (In general, it feels like doing autodetect on the file argument rather than distinguishing files, links and literal data through different arguments is somewhat fragile, and perhaps even not very useful.)

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

1 participant