public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Shreenidhi Shedi <yesshedi@gmail.com>
Cc: dhowells@redhat.com, dwmw2@infradead.org,
	linux-kernel@vger.kernel.org,
	Shreenidhi Shedi <sshedi@vmware.com>
Subject: Re: [PATCH v3 6/6] sign-file: improve help message
Date: Tue, 14 Feb 2023 08:05:07 +0100	[thread overview]
Message-ID: <Y+syo8mnSgzZBAS4@kroah.com> (raw)
In-Reply-To: <20230213190034.57097-6-sshedi@vmware.com>

On Tue, Feb 14, 2023 at 12:30:34AM +0530, Shreenidhi Shedi wrote:
> Add a proper help message with examples on how to use this tool.
> 
> Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
> ---
>  scripts/sign-file.c | 49 ++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 40 insertions(+), 9 deletions(-)
> 
> diff --git a/scripts/sign-file.c b/scripts/sign-file.c
> index 0729d8df5660..d9499ea5c8cc 100644
> --- a/scripts/sign-file.c
> +++ b/scripts/sign-file.c
> @@ -74,13 +74,44 @@ struct module_signature {
>  static const char magic_number[] = "~Module signature appended~\n";
>  
>  static __attribute__((noreturn))
> -void format(void)
> +void print_usage(int retval)
>  {
> -	fprintf(stderr,
> -		"Usage: scripts/sign-file [-dp] <hash algo> <key> <x509> <module> [<dest>]\n");
> -	fprintf(stderr,
> -		"       scripts/sign-file -s <raw sig> <hash algo> <x509> <module> [<dest>]\n");
> -	exit(2);
> +	fprintf(stderr, "Usage: scripts/sign-file [OPTIONS]... [MODULE]...\n");
> +	fprintf(stderr, "Available options:\n");
> +	fprintf(stderr, "-h, --help		Print this help message and exit\n");
> +
> +	fprintf(stderr, "\nOptional args:\n");
> +	fprintf(stderr, "-s, --savesig		Save signature\n");
> +	fprintf(stderr, "-o, --signonly		Sign only\n");
> +	fprintf(stderr, "-b, --bulksign		Sign modules in bulk\n");
> +	fprintf(stderr, "-l, --replaceorig	Replace original\n");
> +#ifndef USE_PKCS7
> +	fprintf(stderr, "-k, --usekeyid		Use key ID\n");
> +#endif
> +	fprintf(stderr, "-r, --rawsig <sig>	Raw signature\n");
> +	fprintf(stderr, "-d, --dest <dest>	Destination path ");
> +	fprintf(stderr, "(Exclusive with bulk option)\n");
> +
> +	fprintf(stderr, "\nMandatory args:\n");
> +	fprintf(stderr, "-p, --privkey <key>	Private key\n");
> +	fprintf(stderr, "-a, --hashalgo <alg>	Hash algorithm\n");
> +	fprintf(stderr, "-x, --x509 <x509>	X509\n");
> +
> +	fprintf(stderr, "\nExamples:\n");
> +
> +	fprintf(stderr, "\nRegular signing:\n");
> +	fprintf(stderr, "scripts/sign-file -a sha512 -p certs/signing_key.pem ");
> +	fprintf(stderr, "-x certs/signing_key.x509 <module>\n");
> +
> +	fprintf(stderr, "\nSigning with destination path:\n");
> +	fprintf(stderr, "scripts/sign-file -a sha512 -p certs/signing_key.pem ");
> +	fprintf(stderr, "-x certs/signing_key.x509 <module> -d <path>\n");
> +
> +	fprintf(stderr, "\nSigning modules in bulk:\n");
> +	fprintf(stderr, "scripts/sign-file -a sha512 -p certs/signing_key.pem ");
> +	fprintf(stderr, "-x certs/signing_key.x509 -b <module1> <module2> ...\n");
> +
> +	exit(retval);
>  }
>  
>  static void display_openssl_errors(int l)
> @@ -264,7 +295,7 @@ static void parse_args(int argc, char **argv, struct cmd_opts *opts)
>  #endif
>  		switch (opt) {
>  		case 'h':
> -			format();
> +			print_usage(0);
>  			break;
>  
>  		case 'r':
> @@ -315,7 +346,7 @@ static void parse_args(int argc, char **argv, struct cmd_opts *opts)
>  			break;
>  
>  		default:
> -			format();
> +			print_usage(2);
>  			break;
>  		}
>  	} while (opt != -1);
> @@ -355,7 +386,7 @@ int sign_file(int argc, char **argv, struct cmd_opts *opts)
>  #endif
>  
>  	if ((bulk_sign && dest_name) || (!bulk_sign && argc != 1))
> -		format();
> +		print_usage(2);
>  
>  	if (dest_name && strcmp(argv[0], dest_name)) {
>  		replace_orig = false;
> -- 
> 2.39.1

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/process/submitting-patches.rst for what
  needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

  reply	other threads:[~2023-02-14  7:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 19:00 [PATCH v3 1/6] sign-file: refactor argument parsing logic Shreenidhi Shedi
2023-02-13 19:00 ` [PATCH v3 2/6] sign-file: move file signing logic to its own function Shreenidhi Shedi
2023-02-14  7:05   ` Greg KH
2023-02-14 10:53   ` kernel test robot
2023-02-16 14:48   ` kernel test robot
2023-02-13 19:00 ` [PATCH v3 3/6] sign-file: add support sign modules in bulk Shreenidhi Shedi
2023-02-14  7:05   ` Greg KH
2023-02-13 19:00 ` [PATCH v3 4/6] sign-file: cosmetic fix Shreenidhi Shedi
2023-02-14  7:05   ` Greg KH
2023-02-14  7:06   ` Greg KH
2023-02-13 19:00 ` [PATCH v3 5/6] sign-file: use const with a global string constant Shreenidhi Shedi
2023-02-14  7:05   ` Greg KH
2023-02-13 19:00 ` [PATCH v3 6/6] sign-file: improve help message Shreenidhi Shedi
2023-02-14  7:05   ` Greg KH [this message]
2023-02-14  7:04 ` [PATCH v3 1/6] sign-file: refactor argument parsing logic Greg KH
2023-02-14  7:06 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+syo8mnSgzZBAS4@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dhowells@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sshedi@vmware.com \
    --cc=yesshedi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox