From: "Holger Hoffstätte" <holger.hoffstaette@googlemail.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: btrfs-progs v3.14 mkfs.btrfs bug: --features long-option segfaults, -O short-option OK
Date: Wed, 16 Apr 2014 07:55:00 +0000 (UTC) [thread overview]
Message-ID: <pan.2014.04.16.07.55.00@googlemail.com> (raw)
In-Reply-To: pan.2014.04.16.07.48.53@googlemail.com
On Wed, 16 Apr 2014 07:48:53 +0000, Holger Hoffstätte wrote:
> On Wed, 16 Apr 2014 06:41:44 +0000, Duncan wrote:
>
>> Using btrfs-progs v3.14:
>>
>> mkfs.btrfs ... --features ...
>>
>> segfaults.
>
> Can reproduce (also with glibc 2.19 on Gentoo ;-) and building with debug
> found:
>
> (gdb) bt
> #0 0x00007ffff6f3aaea in strlen () from /lib64/libc.so.6
> #1 0x00007ffff6f3a82e in strdup () from /lib64/libc.so.6
> #2 0x00000000004213e8 in main (ac=2, av=0x7fffffffe308) at mkfs.c:1312
>
> Sure enough that line is handling 'O', where '--features' is supposed to
> be handled. No idea why -O works, but debugging shows that optarg is null
> at that point, so strdup goes poof.
Well, duh! The long_options array does not declare that --features wants
an argument, so getopt does not create one.
holger>diff -u mkfs.c\~ mkfs.c
--- mkfs.c~ 2014-04-16 09:41:42.000000000 +0200
+++ mkfs.c 2014-04-16 09:51:45.408854096 +0200
@@ -350,7 +350,7 @@
{ "version", 0, NULL, 'V' },
{ "rootdir", 1, NULL, 'r' },
{ "nodiscard", 0, NULL, 'K' },
- { "features", 0, NULL, 'O' },
+ { "features", 1, NULL, 'O' },
{ NULL, 0, NULL, 0}
};
This fixes it.
-h
prev parent reply other threads:[~2014-04-16 7:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-16 6:41 btrfs-progs v3.14 mkfs.btrfs bug: --features long-option segfaults, -O short-option OK Duncan
2014-04-16 7:48 ` Holger Hoffstätte
2014-04-16 7:55 ` Holger Hoffstätte [this message]
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=pan.2014.04.16.07.55.00@googlemail.com \
--to=holger.hoffstaette@googlemail.com \
--cc=linux-btrfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).