[Rd] Verbose output from R CMD check

peter dalgaard pdalgd at gmail.com
Sat Apr 27 15:20:04 CEST 2013


On Apr 25, 2013, at 22:01 , dpleydell wrote:

> Following Simon's suggestion of replacing printf with Rprintf throughout 
> the source code R CMD check now complains less than before, but it still 
> complains...
> 
> I used the following two BASH lines to replace printf
> 
> find . -maxdepth 1 -type f -name '*.c' -exec sed -i 's\printf\Rprintf\' 
> {} \;
> find . -maxdepth 1 -type f -name '*.c' -exec sed -i 
> 's\fRprintf\fprintf\' {} \;
> 
> and using grep I have confirmed that only fprintf and Rprintf remain in 
> the code.
> 
> the original warning (when printf was in the code) was
> 
> [QUOTE : ORIGINAL R CMD check WARNING]
> 
> R CMD check foobar_1.7.5.tar.gz
> [LOTS OF '...OK' CHECK REPORTS REMOVED FOR BREVITY]
> * checking compiled code ... NOTE
> File '/home/david/foobar/package/foobar.Rcheck/foobar/libs/foobar.so':
>  Found 'putchar', possibly from 'putchar' (C)
>    Object: 'foobar.o'
>  Found 'puts', possibly from 'printf' (C), 'puts' (C)
>    Object: 'foobar.o'
> 
> Compiled code should not call functions which might terminate R nor write to stdout/stderr instead of to the console.
> 
> [end QUOTE : ORIGINAL R CMD check WARNING]
> 
> 
> now printf is no longer in the code the warning message is
> 
> [QUOTE : ORIGINAL R CMD check WARNING]
> 
> R CMD check foobar_1.7.6.tar.gz
> [LOTS OF '...OK' CHECK REPORTS REMOVED FOR BREVITY]
> * checking compiled code ... NOTE
> File '/home/david/foobar/package/foobar.Rcheck/foobar/libs/foobar.so':
>  Found 'puts', possibly from 'printf' (C), 'puts' (C)
>    Object: 'foobar.o'
> 
> Compiled code should not call functions which might terminate R nor write to stdout/stderr instead of to the console.
> 
> [end QUOTE : ORIGINAL R CMD check WARNING]
> 
> Which is better than before, but still not clean.
> 
> Both the following lines return 0 hits
> grep printf *.c|grep -v Rprintf|grep -v fprintf
> grep puts *.c
> 
> Is there some way to detect what has caused this warning about puts? 
> It's not a call to 'puts' or 'printf' because there are none.

Longshot: 

grep '[^Rf]printf' *.c

might turn up cases not found by the pipeline above.

Apart from that, trying out the nm command on your .o and .so files could be enlightening.  If push comes to shove, you might compile to assembler code (gcc -S, as far as I remember) and look for the offending puts symbol in the output.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-devel mailing list