* btrfs-progs v3.14 mkfs.btrfs bug: --features long-option segfaults, -O short-option OK @ 2014-04-16 6:41 Duncan 2014-04-16 7:48 ` Holger Hoffstätte 0 siblings, 1 reply; 3+ messages in thread From: Duncan @ 2014-04-16 6:41 UTC (permalink / raw) To: linux-btrfs Using btrfs-progs v3.14: mkfs.btrfs ... --features ... segfaults. mkfs.btrfs ... -O ... works fine. * I used other long options, so it's not simply a problem parsing long options. * I tried the long option with various features; none worked, including --features list-all with no other options. That too segfaulted, tho -O list-all worked. Segfault line as logged: mkfs.btrfs[5231]: segfault at 0 ip 00007fb531c7ab1a sp 00007fffaf1a7a78 error 4 in libc-2.19.so[7fb531bf8000+19a000] btrfs-progs v3.14 from git on kernel v3.14 from git, gentoo/~amd64, built with gcc-4.8.2, using glibc-2.19. -- Duncan - List replies preferred. No HTML msgs. "Every nonfree program has a lord, a master -- and if you use the program, he is your master." Richard Stallman ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: btrfs-progs v3.14 mkfs.btrfs bug: --features long-option segfaults, -O short-option OK 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 0 siblings, 1 reply; 3+ messages in thread From: Holger Hoffstätte @ 2014-04-16 7:48 UTC (permalink / raw) To: linux-btrfs 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. -h ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: btrfs-progs v3.14 mkfs.btrfs bug: --features long-option segfaults, -O short-option OK 2014-04-16 7:48 ` Holger Hoffstätte @ 2014-04-16 7:55 ` Holger Hoffstätte 0 siblings, 0 replies; 3+ messages in thread From: Holger Hoffstätte @ 2014-04-16 7:55 UTC (permalink / raw) To: linux-btrfs 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-16 7:55 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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).