Skip to content
Prev 12523 / 63461 Next

'R CMD build' fails when there are spaces in the path (PR#6830)

The problem definitely occurs when calling R CMD build from a dir whose
file path contains white space.  Now in R CMD build we have

$ grep filepath build.in 
        my $filepath = &file_path($startdir, $filename);
            R_system("zip -r9X $filepath.zip $pkgs $topLevelFiles");
            R_system("$tar chf $filepath $pkgs $topLevelFiles");
            R_system("gzip -9f $filepath");
        my $filepath = &file_path($startdir, $filename);
        my $origfilepath = $filepath;
            $filepath =~ s+^([A-Za-x]):+/cygdrive/\1+;
        R_system("$tar chf $filepath $pkgname");
        R_system("$tar xhf $filepath");
        R_system("$tar chf $filepath $pkgname");
        R_system("gzip -9f $origfilepath");

so in fact in none of the calls to R_system() with $filepath do we
currently perform any kind of quoting or shell escaping.

A simple improvement would be quoting all filepaths in R_system() calls
via \"...\" or '...'.  Unless someone has a better idea or wants to put
in more effort ...

-k