.\" -*- nroff -*- .\" Please adjust this date whenever revising the manpage. .TH spgen 1 "October 17, 2015" .\" see http://www.fnal.gov/docs/products/ups/ReferenceManual/html/manpages.html .\" see http://www.linuxjournal.com/article/1158 .\" see http://www.schweikhardt.net/man_page_howto.html .\" groff -Tascii -man ./spgen.1 | more .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .\" .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. Also \fR for roman. .\" pad: src: deputy man page .SH NAME spgen \- harden a Coccinelle semantic patch .B spgen .I .B [\-c | \-\-config ] .B [\-i | \-\-interactive] .B [\-\-default] .B [\-o ] .B [\-\-no-output] .B [\-help | \-\-help] .\" .SH DESCRIPTION \fBspgen\fP is a source-to-source transformation tool for hardening Coccinelle semantic patch scripts. .br It takes a semantic patch and outputs the same patch with added metadata and more options in the form of virtual rules: .RS - \fBpatch\fP: used for + or - rules that transform matching C code. - \fBcontext\fP: used for * rules that find matching C code. - \fBorg\fP: used for script rules that output matches in emacs org format. - \fBreport\fP: used for script rules that output matches in pretty print format. .RE A semantic patch hardened with \fBspgen\fP thus preserves the functionality of the original patch, but allows the user to control the output mode. The user can also specify metadata to be included in the hardened script. .RS - Description of the patch's functionality. - Confidence level for the patch. - Authors of the patch. - URL for gaining more information about the patch. - Known limitations of the patch. - Keywords for the patch. - \fBspatch\fP options with which to run the patch. - Additional comments regarding the patch. - Rule messages to be output in script mode for each match. .RE The metadata can be specified in a configuration file or entered through the commandline in interactive mode. The syntax of the configuration file follows a simple newline-separated pattern. Use interactive mode to get an automatically generated configuration file. .SH EXAMPLES Generate a hardened version of using the configuration in : ./spgen --config Generate a hardened version of using interactive mode through the commandline. The user will be able to save their interactively specified configuration to a file: ./spgen --interactive By default, \fBspgen\fP will look for a foo.config file in the same directory and use that as configuration. If not found, it will start in interactive mode: ./spgen Output the hardened version to instead of stdout: ./spgen -o Suppose that is the original patch and is the hardened version of . Then what could be achieved with spatch --sp-file can now be achieved with spatch --sp-file -D \fIpatch\fP Substitute \fIpatch\fP with \fIcontext\fP, \fIorg\fP, or \fIreport\fP for any of the other modes. .SH OPTIONS Here is a summary of the options available on \fBspgen\fP: .SH SYNOPSIS .B spgen .I .B [\-c | \-\-config ] .B [\-i | \-\-interactive] .B [\-\-default] .B [\-o ] .B [\-\-no-output] .B [\-help | \-\-help] .TP .B \-help | \-\-help Print the help menu. .TP .B \-c | \-\-config Harden the using the configuration specified in . .TP .B \-i | \-\-interactive Harden the using configuration options specified through the commandline. .TP .B \-o Output the hardened semantic patch to instead of stdout. .TP .B \-\-default Harden the without a configuration, instead using default values. This option mainly exists to see what the generated script would look like, as the default values are not specific to the input script. .TP .B \-\-no-output Run the program without outputting anything. This option mainly exists to check that the input script and configuration file are parsable. .SH AUTHOR \fBspgen\fP and this man page were written by Chi Pham .SH REPORTING BUGS Send a mail to .SH COPYRIGHT Copyright 2015, Chi Pham spgen is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, according to version 2 of the License. .SH SEE ALSO \fIspatch\fP(1), \fIpycocci\fP(1), \fIdiff\fP(1)