Tony Plate
2008-Oct-14 05:10 UTC
[Rd] dos-style line endings in .Rbuildignore result in files not being excluded
I was trying, on a Linux system, to get a .Rbuildignore file to work. After far too long, I found the problem was the <CR><NL> line endings in the .Rbuildignore file -- I had originally created it on a Windows system, and emacs in Ubuntu was politely hiding that fact from me. The patterns didn't work to exclude files because it was trying to match filenames to patterns like "NOTES.txt^M". I don't know what the best solution to this is, but I got it working by putting a substitute command in the bin/build file like this: while(<RBUILDIGNORE>) { chomp; s/^M$//; push(@exclude_patterns, $_) if $_; (When I cut and paste that code here it ends up as two separate characters ^ and M, but in the bin/build file it's one <CR> character.) One could of course say it is stupid user error to have <CR>'s in the .Rbuildignore file, but it can happen easily, and it would nice if R would work with it. Could a fix for this little problem be incorporated into R? thanks, Tony Plate
Sebastian P. Luque
2008-Oct-14 05:25 UTC
[Rd] dos-style line endings in .Rbuildignore result in files not being excluded
On Mon, 13 Oct 2008 23:10:41 -0600, Tony Plate <tplate at acm.org> wrote:> I was trying, on a Linux system, to get a .Rbuildignore file to work. > After far too long, I found the problem was the <CR><NL> line endings > in the .Rbuildignore file -- I had originally created it on a Windows > system, and emacs in Ubuntu was politely hiding that fact from me.Are you sure? Whenever I open M$ files in Emacs under Debian I see '(DOS)' near the left end of the modeline, which indicates that it has ^C as EOL. This has been the case since at least 21.0. -- Seb
Nathan Coulter
2008-Oct-14 17:31 UTC
[Rd] dos-style line endings in .Rbuildignore result in files not being excluded
> -------Original Message------- > From: Prof Brian Ripley <ripley at stats.ox.ac.uk> > Subject: Re: [Rd] dos-style line endings in .Rbuildignore result in files not being excluded > Sent: 2008-10-14 12:59 > > On Tue, 14 Oct 2008, Nathan Coulter wrote: > > > Prof Brian Ripley wrote: > > > >> But to the point: how often do people get DOS-style files on a > >> Unix-alike? You have to work pretty hard to do this, and there comes a > >> point at which complicating R to workaround wrongly encoded files is not > >> worth the trouble. Let's see if anyone else reports having done this. > >> > > > > In my experience, this is a common occurrence. Granted, foreign line > > delimiters are less common in a configuration file like .Rbuildignore, but > > they > > have been the culprit more than once in package problems I have encountered. > > think functionality like Python's universal newlines would be a big win for > > R. > > But R *does* have 'universal newlines' on its connections, and has for > many years. >I'm suggesting that Python might be a better choice than perl for auxiliary scripts because these details are handled under the hood. -- Nathan Coulter> -------Original Message------- > From: Prof Brian Ripley <ripley at stats.ox.ac.uk> > Subject: Re: [Rd] dos-style line endings in .Rbuildignore result in files not being excluded > Sent: 2008-10-14 12:59 > > On Tue, 14 Oct 2008, Nathan Coulter wrote: > > > Prof Brian Ripley wrote: > > > >> But to the point: how often do people get DOS-style files on a > >> Unix-alike? You have to work pretty hard to do this, and there comes a > >> point at which complicating R to workaround wrongly encoded files is not > >> worth the trouble.??Let's see if anyone else reports having done this. > >> > > > > In my experience, this is a common occurrence.??Granted, foreign line > > delimiters are less common in a configuration file like .Rbuildignore, but > > they > > have been the culprit more than once in package problems I have encountered. > > think functionality like Python's universal newlines would be a big win for > > R. > > But R *does* have 'universal newlines' on its connections, and has for > many years. > > We are talking about a Perl script here, not R. > > > One of the big draws in a programming language like Python is its claim to > > being portable, and universal newlines are a critical part of that > > functionality.??Mac-style newline delimiters are surfacing more often these > > days as well, and the best place to sort this all out would be in the > > built-in > > file manipulation functions. > > -- > > Nathan Coulter > > Computer Programmer > > > > -- > Brian D. Ripley,??????????????????ripley at stats.ox.ac.uk > Professor of Applied Statistics,??http://www.stats.ox.ac.uk/~ripley/ > University of Oxford,???????????? Tel:??+44 1865 272861 (self) > 1 South Parks Road,???????????????????? +44 1865 272866 (PA) > Oxford OX1 3TG, UK????????????????Fax:??+44 1865 272595 >