On Wed, 5 Jun 2019 18:07:15 +0200 Frank Schwidom <schwidom at gmx.net> 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], which calls R_ExpandFileName_readline [4], which uses libreadline function tilde_expand [5]. tilde_expand seems to be designed to expand '~' anywhere in the string it is handed, i.e. operate on whole command lines, not file paths. I am taking the liberty of Cc-ing R-devel in case this can be considered a bug. -- Best regards, Ivan [1] https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/names.c#L807 [2] https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/platform.c#L1915 [3] https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-unix.c#L147 [4] https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-std.c#L494 [5] https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187
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 at 23:04, Ivan Krylov <krylov.r00t at gmail.com> wrote: > >> On Wed, 5 Jun 2019 18:07:15 +0200 >> Frank Schwidom <schwidom at gmx.net> 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], which >> calls R_ExpandFileName_readline [4], which uses libreadline function >> tilde_expand [5]. tilde_expand seems to be designed to expand '~' >> anywhere in the string it is handed, i.e. operate on whole command >> lines, not file paths. >> >> I am taking the liberty of Cc-ing R-devel in case this can be >> considered a bug. >> >> -- >> Best regards, >> Ivan >> >> [1] >> >> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/names.c#L807 >> >> [2] >> >> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/platform.c#L1915 >> >> [3] >> >> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-unix.c#L147 >> >> [4] >> >> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-std.c#L494 >> >> [5] >> https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187 >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
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 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 <[1]krylov.r00t at gmail.com> wrote: > > On Wed, 5 Jun 2019 18:07:15 +0200 > Frank Schwidom <[2]schwidom at gmx.net> 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], which > calls R_ExpandFileName_readline [4], which uses libreadline function > tilde_expand [5]. tilde_expand seems to be designed to expand '~' > anywhere in the string it is handed, i.e. operate on whole command > lines, not file paths. > > I am taking the liberty of Cc-ing R-devel in case this can be > considered a bug. > > -- > Best regards, > Ivan > > [1] > [3]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/names.c#L807 > > [2] > [4]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/platform.c#L1915 > > [3] > [5]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-unix.c#L147 > > [4] > [6]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-std.c#L494 > > [5] > [7]https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187 > > ______________________________________________ > [8]R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > [9]https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > [10]http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > References > > Visible links > 1. mailto:krylov.r00t at gmail.com > 2. mailto:schwidom at gmx.net > 3. https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/names.c#L807 > 4. https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/platform.c#L1915 > 5. https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-unix.c#L147 > 6. https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-std.c#L494 > 7. https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187 > 8. mailto:R-help at r-project.org > 9. https://stat.ethz.ch/mailman/listinfo/r-help > 10. http://www.r-project.org/posting-guide.html
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? > https://fs.r-lib.org/ > > Gabor > > On Tue, Jun 11, 2019 at 7:51 AM Frank Schwidom <schwidom at gmx.net> wrote: > > > > 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 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 <[1]krylov.r00t at gmail.com> wrote: > > > > > > On Wed, 5 Jun 2019 18:07:15 +0200 > > > Frank Schwidom <[2]schwidom at gmx.net> 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], which > > > calls R_ExpandFileName_readline [4], which uses libreadline function > > > tilde_expand [5]. tilde_expand seems to be designed to expand '~' > > > anywhere in the string it is handed, i.e. operate on whole command > > > lines, not file paths. > > > > > > I am taking the liberty of Cc-ing R-devel in case this can be > > > considered a bug. > > > > > > -- > > > Best regards, > > > Ivan > > > > > > [1] > > > [3]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/names.c#L807 > > > > > > [2] > > > [4]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/platform.c#L1915 > > > > > > [3] > > > [5]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-unix.c#L147 > > > > > > [4] > > > [6]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-std.c#L494 > > > > > > [5] > > > [7]https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187 > > > > > > ______________________________________________ > > > [8]R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > > [9]https://stat.ethz.ch/mailman/listinfo/r-help > > > PLEASE do read the posting guide > > > [10]http://www.R-project.org/posting-guide.html > > > and provide commented, minimal, self-contained, reproducible code. > > > > > > References > > > > > > Visible links > > > 1. mailto:krylov.r00t at gmail.com > > > 2. mailto:schwidom at gmx.net > > > 3. https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/names.c#L807 > > > 4. https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/platform.c#L1915 > > > 5. https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-unix.c#L147 > > > 6. https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-std.c#L494 > > > 7. https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187 > > > 8. mailto:R-help at r-project.org > > > 9. https://stat.ethz.ch/mailman/listinfo/r-help > > > 10. http://www.r-project.org/posting-guide.html > > > > ______________________________________________ > > R-devel at r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-devel >
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 bad practice anyway. In light of that, the solution with the smallest amount of pain for you is almost surely to just... not do that. Your filenames will be better for it anyway. There is a reason no one has complained about this before, and while I haven't run a study or anything, I strongly suspect its that "everyone" else is already on the "no tildes in filenames" bandwagon, so this behavior, even if technically a bug, has no ability to cause them problems. Best, ~G On Tue, Jun 11, 2019 at 8:25 AM Frank Schwidom <schwidom at gmx.net> wrote:> 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? > > https://fs.r-lib.org/ > > > > Gabor > > > > On Tue, Jun 11, 2019 at 7:51 AM Frank Schwidom <schwidom at gmx.net> wrote: > > > > > > 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 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 <[1] > krylov.r00t at gmail.com> wrote: > > > > > > > > On Wed, 5 Jun 2019 18:07:15 +0200 > > > > Frank Schwidom <[2]schwidom at gmx.net> 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], > which > > > > calls R_ExpandFileName_readline [4], which uses libreadline > function > > > > tilde_expand [5]. tilde_expand seems to be designed to expand > '~' > > > > anywhere in the string it is handed, i.e. operate on whole > command > > > > lines, not file paths. > > > > > > > > I am taking the liberty of Cc-ing R-devel in case this can be > > > > considered a bug. > > > > > > > > -- > > > > Best regards, > > > > Ivan > > > > > > > > [1] > > > > [3] > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/names.c#L807 > > > > > > > > [2] > > > > [4] > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/platform.c#L1915 > > > > > > > > [3] > > > > [5] > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-unix.c#L147 > > > > > > > > [4] > > > > [6] > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-std.c#L494 > > > > > > > > [5] > > > > [7] > https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187 > > > > > > > > ______________________________________________ > > > > [8]R-help at r-project.org mailing list -- To UNSUBSCRIBE and > more, see > > > > [9]https://stat.ethz.ch/mailman/listinfo/r-help > > > > PLEASE do read the posting guide > > > > [10]http://www.R-project.org/posting-guide.html > > > > and provide commented, minimal, self-contained, reproducible > code. > > > > > > > > References > > > > > > > > Visible links > > > > 1. mailto:krylov.r00t at gmail.com > > > > 2. mailto:schwidom at gmx.net > > > > 3. > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/names.c#L807 > > > > 4. > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/main/platform.c#L1915 > > > > 5. > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-unix.c#L147 > > > > 6. > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e333348b81180a0e2c6f2f/src/unix/sys-std.c#L494 > > > > 7. > https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187 > > > > 8. mailto:R-help at r-project.org > > > > 9. https://stat.ethz.ch/mailman/listinfo/r-help > > > > 10. http://www.r-project.org/posting-guide.html > > > > > > ______________________________________________ > > > R-devel at r-project.org mailing list > > > https://stat.ethz.ch/mailman/listinfo/r-devel > > > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >[[alternative HTML version deleted]]