[Rd] dos-style line endings in .Rbuildignore result in files not being excluded

Tony Plate tplate at acm.org
Tue Oct 14 07:10:41 CEST 2008


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



More information about the R-devel mailing list