Re: [Rd] [R] Open a file which name contains a tilde

2019-06-14 Thread Serguei Sokol
On 14/06/2019 14:43, Frank Schwidom wrote: Hi John, First, the unix and linux filesystem allows the use of any nonzero character in its filesystem filenames Well, even it's not the central point of the discussion let make this assertion more correct. It depends on file system. E.g. JFS (https

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-14 Thread Frank Schwidom
Hi John, First, the unix and linux filesystem allows the use of any nonzero character in its filesystem filenames and the c functions open / fopen, symlink. rename, chdir and so on don't care about any tilde. If the open systemcall gets a file which begins with a tilde then it will try to open

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-13 Thread Paul McQuesten
Gabriel, I apologize. I did not mean to flame, merely to point out a typical usage of tilde that might have escaped the discussion. As you say, Kurt's fix makes this all moot. I also apologize for wasting everyone's time with my spam. On Thu, Jun 13, 2019 at 2:13 AM Gabriel Becker wrote: > At t

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-13 Thread Gabriel Becker
At the risk of looking silly, note that all of this is now largely moot anyway (or will be with the next release of R), thanks to Kurt Hornik's fixing of the bug in question (which he announced on this thread prior to but I read after Paul's). ~G On Wed, Jun 12, 2019 at 11:51 PM Gabriel Becker w

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-12 Thread Gabriel Becker
On Wed, Jun 12, 2019, 5:16 AM Paul McQuesten wrote: > @ Gabriel: > > "Avoid tilde in file names": > Not quite. > A tilde *suffix* is commonly used by *nix editors for backup files > > https://unix.stackexchange.com/questions/76189/what-does-the-tilde-mean-at-the-end-of-a-filename I'm aware of t

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-12 Thread Paul McQuesten
@ Gabriel: "Avoid tilde in file names": Not quite. A tilde *suffix* is commonly used by *nix editors for backup files https://unix.stackexchange.com/questions/76189/what-does-the-tilde-mean-at-the-end-of-a-filename On Wed, Jun 12, 2019 at 2:43 AM Kurt Hornik wrote: > > Duncan Murdoch writes

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-12 Thread Kurt Hornik
> Duncan Murdoch writes: With c76695 in the trunk, we now only tilde expand file names starting with a tilde also when using readline. Best -k > On 11/06/2019 4:34 p.m., William Dunlap via R-devel wrote: >> Note that R treats tildes in file names differently on Windows and Linux. >> On Windo

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-11 Thread Duncan Murdoch
On 11/06/2019 4:34 p.m., William Dunlap via R-devel wrote: Note that R treats tildes in file names differently on Windows and Linux. On Windows, it is only replaced if it it at the beginning of the line and is followed by a forward or backward slash or end-of-line. On Linux it is replaced no mat

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-11 Thread William Dunlap via R-devel
Note that R treats tildes in file names differently on Windows and Linux. On Windows, it is only replaced if it it at the beginning of the line and is followed by a forward or backward slash or end-of-line. On Linux it is replaced no matter where it is in the text and ~someUser will be replaced by

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-11 Thread Frank Schwidom
Hi Gabriel, I actually want to make renames over thousands of files. But if I am not able to express the source filename of the rename operation I will not be able to get the work done. Besides the fact that there are issues I think that R is qualified for solving my problem by the method how i

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-11 Thread Travers Ching
Hi Gabriel, It may be bad practice, but you don't always have control over the file name. E.g. if someone shares a file with a tilde in it -- yes it is simple to rename but it is extra time, and you might not bother to rename a file without foreknowledge of this bug in the first place. Even wors

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-11 Thread Gabriel Becker
Hi Frank, I'm hesitant to be "that guy", but in case no one else has brought this up to you, having files with a tilde in their names (generally but especially on a linux system, where ~ in file names has a very important special meaning in some cases, as we know) strikes me as an exceptionally ba

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-11 Thread Frank Schwidom
Hi, yes, I have seen this package and it has the same tilde expanding problem. Please excuse me I will cc this answer to r-help and r-devel to keep the discussion running. Kind regards, Frank Schwidom On 2019-06-11 09:12:36, Gábor Csárdi wrote: > Just in case, have you seen the fs package? > h

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-10 Thread Frank Schwidom
Hi, to get rid of any possible filename modification I started a little project to cover my usecase: https://github.com/schwidom/simplefs This is my first R package, suggestions and a review are welcome. Thanks in advance Frank Schwidom On 2019-06-07 09:04:06, Richard O'Keefe wrote: >How

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-10 Thread Richard O'Keefe
?path.expand Expand a path name, for example by replacing a leading tilde by the user's home directory (if defined on that platform). *A* path name. The argument is a character vector. If multiple path names are passed, they are passed On most builds of R *A LEADING* "~user" will be

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-08 Thread Rui Barradas
Hello, R 3.6.0 on Ubuntu 19.04. Since no one mentioned it, notice that the tilde in the middle of a string needs to be surrounded by spaces to be expanded. The first code line works as expected, only the second is wrong (buggy). path.expand('a~b') #[1] "a~b" path.expand('a ~ b') #[1] "a /home

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-07 Thread Berry, Charles
> On Jun 6, 2019, at 2:04 PM, Richard O'Keefe wrote: > > How can expanding tildes anywhere but the beginning of a file name NOT be > considered a bug? > > I think that that IS what libreadline is doing if one allows a whitespace separated list of file names. As reported in R-help,

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-07 Thread Richard O'Keefe
How can expanding tildes anywhere but the beginning of a file name NOT be considered a bug? On Thu, 6 Jun 2019 at 23:04, Ivan Krylov wrote: > On Wed, 5 Jun 2019 18:07:15 +0200 > Frank Schwidom wrote: > > > +> path.expand("a ~ b") > > [1] "a /home/user b" > > > How can I switch off any file cri

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-06 Thread Duncan Murdoch
On 06/06/2019 5:04 p.m., Richard O'Keefe wrote: How can expanding tildes anywhere but the beginning of a file name NOT be considered a bug? It looks like a bug in R, but not necessarily a bug in libreadline: we may just be using tilde_expand improperly. Duncan Murdoch On Thu, 6 Jun 2019

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-06 Thread Ivan Krylov
On Wed, 5 Jun 2019 18:07:15 +0200 Frank Schwidom wrote: > +> path.expand("a ~ b") > [1] "a /home/user b" > How can I switch off any file crippling activity? It doesn't seem to be possible if readline is enabled and works correctly. Calls to path.expand [1] end up [2] in R_ExpandFileName [3],