Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'cocci-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux

Pull coccinelle updates from Julia Lawall:
"This simplifies and clarifies the handling of output generated by
Coccinelle that is sent to standard error.

By default, this goes to /dev/null. Remind the user of that and
encourage them to provide another file name (Benjamin Philip)"

* tag 'cocci-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux:
Documentation: Coccinelle: document debug log handling
scripts: coccicheck: warn on unset debug file
scripts: coccicheck: simplify debug file handling

+29 -13
+16 -5
Documentation/dev-tools/coccinelle.rst
··· 127 127 128 128 make coccicheck MODE=report V=1 129 129 130 + By default, coccicheck will print debug logs to stdout and redirect stderr to 131 + /dev/null. This can make coccicheck output difficult to read and understand. 132 + Debug and error messages can instead be written to a debug file instead by 133 + setting the ``DEBUG_FILE`` variable:: 134 + 135 + make coccicheck MODE=report DEBUG_FILE="cocci.log" 136 + 137 + Coccinelle cannot overwrite a debug file. Instead of repeatedly deleting a log 138 + file, you could include the datetime in the debug file name:: 139 + 140 + make coccicheck MODE=report DEBUG_FILE="cocci-$(date -Iseconds).log" 141 + 130 142 Coccinelle parallelization 131 143 -------------------------- 132 144 ··· 220 208 You can learn what these options are by using V=1; you could then 221 209 manually run Coccinelle with debug options added. 222 210 223 - Alternatively you can debug running Coccinelle against SmPL patches 224 - by asking for stderr to be redirected to stderr. By default stderr 225 - is redirected to /dev/null; if you'd like to capture stderr you 226 - can specify the ``DEBUG_FILE="file.txt"`` option to coccicheck. For 227 - instance:: 211 + An easier approach to debug running Coccinelle against SmPL patches is to ask 212 + coccicheck to redirect stderr to a debug file. As mentioned in the examples, by 213 + default stderr is redirected to /dev/null; if you'd like to capture stderr you 214 + can specify the ``DEBUG_FILE="file.txt"`` option to coccicheck. For instance:: 228 215 229 216 rm -f cocci.err 230 217 make coccicheck COCCI=scripts/coccinelle/free/kfree.cocci MODE=report DEBUG_FILE=cocci.err
+13 -8
scripts/coccicheck
··· 138 138 if [ $VERBOSE -ne 0 ] ; then 139 139 echo "Running ($NPROC in parallel): $@" 140 140 fi 141 - if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then 141 + if [ "$DEBUG_FILE" != "/dev/null" ]; then 142 142 echo $@>>$DEBUG_FILE 143 143 $@ 2>>$DEBUG_FILE 144 144 else ··· 259 259 260 260 } 261 261 262 - if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then 263 - if [ -f $DEBUG_FILE ]; then 264 - echo "Debug file $DEBUG_FILE exists, bailing" 265 - exit 266 - fi 267 - else 268 - DEBUG_FILE="/dev/null" 262 + if [ "$DEBUG_FILE" = "" ]; then 263 + echo 'You have not explicitly specified the debug file to use.' 264 + echo 'Using default "/dev/null" as debug file.' 265 + echo 'Debug logs will be printed to stdout.' 266 + echo 'You can specify the debug file with "make coccicheck DEBUG_FILE=<debug_file>"' 267 + echo '' 268 + DEBUG_FILE="/dev/null" 269 + fi 270 + 271 + if [ -f $DEBUG_FILE ]; then 272 + echo "Debug file $DEBUG_FILE exists, bailing" 273 + exit 269 274 fi 270 275 271 276 if [ "$COCCI" = "" ] ; then