public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] tst_mkfs: Add -I option to mkfs.vfat
Date: Tue, 30 Mar 2021 13:36:50 +0100	[thread overview]
Message-ID: <87a6qkom1p.fsf@suse.de> (raw)
In-Reply-To: <YGMYpaeR7Mp7rATD@pevik>

Hello,

Petr Vorel <pvorel@suse.cz> writes:

> Hi,
>
> ...
>> > +	/*
>> > +	 * Workaround a problem:
>> > +	 * mkfs.vfat: Partitions or virtual mappings on device '/dev/loop0', not
>> > +	 * making filesystem (use -I to override)
>> > +	 */
>> > +	if (!strcmp(fs_type, "vfat")) {
>> > +		argv[pos] = "-I";
>> > +		strcat(fs_opts_str, argv[pos++]);
>
>> Doesn't it need a space after -I?
> No, it's char *const argv[] passed to execvp() in tst_cmd_fds_(), which does the
> separation. Adding spaces on the contrary causes failure (equivalent of
> mkfs.vfat " -I " ...).
>
>> Might be better to put this after fs_opts and then you can check i > 0.
> Have I overlooked introduced regression? It works, only it needs to add " "
> space for formatting output, but functionality works, adding tested
> file.

Ah, well given Martin's comment as well, this LGTM.

>
> Kind regards,
> Petr
>
> Testing file:
>
> #include "tst_test.h"
> #define MOUNT_POINT "mount_ext"
>
> static void do_test(void)
> {
> 	tst_res(TPASS, "here");
> }
>
> static struct tst_test test = {
> 	.test_all = do_test,
> 	.mount_device = 1,
> 	.mntpoint = MOUNT_POINT,
> 	.needs_root = 1,
> 	.dev_fs_type = "vfat",
> 	.dev_fs_opts = (const char *const []){"-v", NULL},
> };
>
> Needed fix:
>
> --- lib/tst_mkfs.c
> +++ lib/tst_mkfs.c
> @@ -60,6 +60,7 @@ void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void),
>  	if (!strcmp(fs_type, "vfat")) {
>  		argv[pos] = "-I";
>  		strcat(fs_opts_str, argv[pos++]);
> +		strcat(fs_opts_str, " ");
>  	}
>  
>  	if (fs_opts) {


-- 
Thank you,
Richard.

  reply	other threads:[~2021-03-30 12:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 14:57 [LTP] [PATCH 1/1] tst_mkfs: Add -I option to mkfs.vfat Petr Vorel
2021-03-30 10:00 ` Richard Palethorpe
2021-03-30 10:36   ` Martin Doucha
2021-03-30 12:25   ` Petr Vorel
2021-03-30 12:36     ` Richard Palethorpe [this message]
2021-03-31  7:58       ` Petr Vorel

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=87a6qkom1p.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=ltp@lists.linux.it \
    /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