From pdalgd at gmail.com  Sat Apr 27 15:20:04 2013
From: pdalgd at gmail.com (peter dalgaard)
Date: Sat, 27 Apr 2013 15:20:04 +0200
Subject: [Rd] Verbose output from R CMD check
In-Reply-To: <51798B9D.9000406@antilles.inra.fr>
References: <51769FFE.2020604@antilles.inra.fr>
	<22AF9B56-93D2-44C3-9879-136AFC61C5A7@r-project.org>
	<5176BA38.1040407@antilles.inra.fr>
	<ADD5064D-988D-4F77-983F-032A6EFD6059@r-project.org>
	<51798B9D.9000406@antilles.inra.fr>
Message-ID: <BB0B0758-BFC7-47B1-A509-537FBAEC1A23@gmail.com>


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



[Rd] Verbose output from R CMD check
peter dalgaard