From patchwork Wed Apr 16 07:55:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Holger_Hoffst=C3=A4tte?= X-Patchwork-Id: 3998931 X-Patchwork-Delegate: dave@jikos.cz Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7D5CEBFF02 for ; Wed, 16 Apr 2014 07:55:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B78A12026C for ; Wed, 16 Apr 2014 07:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DEE5A20212 for ; Wed, 16 Apr 2014 07:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754757AbaDPHzQ (ORCPT ); Wed, 16 Apr 2014 03:55:16 -0400 Received: from plane.gmane.org ([80.91.229.3]:53111 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754688AbaDPHzO (ORCPT ); Wed, 16 Apr 2014 03:55:14 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WaKgb-00025g-UN for linux-btrfs@vger.kernel.org; Wed, 16 Apr 2014 09:55:13 +0200 Received: from p5b005b53.dip0.t-ipconnect.de ([91.0.91.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Apr 2014 09:55:13 +0200 Received: from holger.hoffstaette by p5b005b53.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Apr 2014 09:55:13 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: linux-btrfs@vger.kernel.org From: Holger =?iso-8859-1?q?Hoffst=E4tte?= 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) Lines: 40 Message-ID: References: Mime-Version: 1.0 X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p5b005b53.dip0.t-ipconnect.de User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 This fixes it. -h --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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} };