From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 26 20:28:55 2015 Received: (at submit) by debbugs.gnu.org; 27 Mar 2015 00:28:55 +0000 Received: from localhost ([127.0.0.1]:37700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbI8s-0002Cr-Ub for submit@debbugs.gnu.org; Thu, 26 Mar 2015 20:28:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50463) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbI8r-0002CZ-8R for submit@debbugs.gnu.org; Thu, 26 Mar 2015 20:28:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbI8k-0008SP-SR for submit@debbugs.gnu.org; Thu, 26 Mar 2015 20:28:47 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbI8k-0008SL-Od for submit@debbugs.gnu.org; Thu, 26 Mar 2015 20:28:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbI8j-0007Lx-F6 for bug-coreutils@gnu.org; Thu, 26 Mar 2015 20:28:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbI8e-0008PV-QU for bug-coreutils@gnu.org; Thu, 26 Mar 2015 20:28:45 -0400 Received: from mail-qc0-x233.google.com ([2607:f8b0:400d:c01::233]:35864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbI8e-0008OV-Jy for bug-coreutils@gnu.org; Thu, 26 Mar 2015 20:28:40 -0400 Received: by qcto4 with SMTP id o4so4981245qct.3 for ; Thu, 26 Mar 2015 17:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=bedHqk/A63L4/P8eXCLVfBm3tyhgYzWgchlzs+2Eom4=; b=C5LtFtNDmlUMJVVI1yTJSegPCAha77uwdSwshvLQba//zfCLWLjvqvhZ3NXbVDrh60 j/HwcTwTLino3SvSQWo+sGywu+I+7MfCwodpq017wjCD73uXy8vfnLoozRRYwQScPl+z v9vuB8yk8let3bbUXzzUlfl2Pm6yCVWKuJ46+X6yBJuFyn28vMg6TyUJnenh+N6tfe4h P7JQXAR5BKZcT872EV4YJD8Yt75SBguQtJMaENEuf0Na4kordOHs+OgryfZuFeC/TVM4 mM0SXbkWIeXmMRV8d+7woZIDlKmEKBHu8mnFUm+qHobdbJEqbMCROVgOQ1HYW7G5hptv YxJA== X-Received: by 10.140.94.242 with SMTP id g105mr20728645qge.2.1427416119649; Thu, 26 Mar 2015 17:28:39 -0700 (PDT) Received: from disco.erlich.nygenome.org ([162.212.111.2]) by mx.google.com with ESMTPSA id 77sm324084qhg.16.2015.03.26.17.28.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Mar 2015 17:28:38 -0700 (PDT) Message-ID: <5514A438.7000303@gmail.com> Date: Thu, 26 Mar 2015 20:28:40 -0400 From: Assaf Gordon User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: bug-coreutils@gnu.org Subject: tests/df/skip-duplicates fails on Debian-kFreeBSD due to calling 'strstr(NULL,)' Content-Type: multipart/mixed; boundary="------------010103090702020308040807" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) This is a multi-part message in MIME format. --------------010103090702020308040807 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello, A somewhat exotic test failure: On Debian/kFreeBSD 'tests/df/skip-duplicates' fails with 'df' segfaulting like so: ... ./tests/df/skip-duplicates.sh: line 113: 7741 Segmentation fault LD_PRELOAD=./k.so df ... The flow is: 1. the "k.so" file (inlined C code in 'tests/df/skip-duplicates.sh') returns 'struct mntent' in which '.mnt_opts' is NULL (not just empty string) 2. read_file_system_list() calls dev_from_mount_options(mnt->mnt_opts) . 3. in dev_from_mount_options() "__linux__" is not defined (using FreeBSD kernel v9). 4. strstr() is called with 'mount_options==NULL'. 5. libc segfaults. The direct culprit is 'dev_from_mount_options' in gnulib's mountlist.c, which has: static dev_t dev_from_mount_options (char const *mount_options) { /* GNU/Linux allows file system implementations to define their own meaning for "dev=" mount options, so don't trust the meaning here. */ # ifndef __linux__ static char const dev_pattern[] = ",dev="; char const *devopt = strstr (mount_options, dev_pattern); ... Using gdb, the stack-trace is: $ gdb ../src/df (gdb) set environment LD_PRELOAD=./k.so (gdb) start Program received signal SIGSEGV, Segmentation fault. 0x0000000800abcc04 in strstr () from /lib/x86_64-kfreebsd-gnu/libc.so.0.1 (gdb) bt #0 0x0000000800abcc04 in strstr () from /lib/x86_64-kfreebsd-gnu/libc.so.0.1 #1 0x000000000040f7ed in dev_from_mount_options (mount_options=0x0) at lib/mountlist.c:363 #2 0x000000000040fb6c in read_file_system_list (need_fs_type=false) at lib/mountlist.c:449 #3 0x0000000000405751 in main (argc=1, argv=0x7fffffffd648) at src/df.c:1647 I'm not sure what is the correct,clean fix, attached are two options (one fixes the test, one avoids the call in lib/mountlist.c). Regards, - assaf P.S. On FReeBSD-10.1 the test is skipped: skip-duplicates.sh: skipped test: $CC -shared ... failed to build a shared lib SKIP: tests/df/skip-duplicates.sh --------------010103090702020308040807 Content-Type: text/x-patch; name="fix-df-skip-dups1.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-df-skip-dups1.patch" --- tests/df/skip-duplicates.sh.bad 2014-07-13 18:09:52.000000000 -0400 +++ tests/df/skip-duplicates.sh 2015-03-26 20:24:22.000000000 -0400 @@ -56,13 +56,13 @@ struct mntent *getmntent (FILE *fp) } static struct mntent mntents[] = { - {.mnt_fsname="/short", .mnt_dir="/invalid/mount/dir"}, - {.mnt_fsname="fsname", .mnt_dir="/",}, - {.mnt_fsname="/fsname", .mnt_dir="/."}, - {.mnt_fsname="/fsname", .mnt_dir="/"}, - {.mnt_fsname="virtfs", .mnt_dir="/NONROOT", .mnt_type="fstype1"}, - {.mnt_fsname="virtfs2", .mnt_dir="/NONROOT", .mnt_type="fstype2"}, - {.mnt_fsname="netns", .mnt_dir="net:[1234567]"}, + {.mnt_fsname="/short", .mnt_dir="/invalid/mount/dir", .mnt_opts=""}, + {.mnt_fsname="fsname", .mnt_dir="/", .mnt_opts=""}, + {.mnt_fsname="/fsname", .mnt_dir="/.", .mnt_opts=""}, + {.mnt_fsname="/fsname", .mnt_dir="/", .mnt_opts=""}, + {.mnt_fsname="virtfs", .mnt_dir="/NONROOT", .mnt_type="fstype1", .mnt_opts=""}, + {.mnt_fsname="virtfs2", .mnt_dir="/NONROOT", .mnt_type="fstype2", .mnt_opts=""}, + {.mnt_fsname="netns", .mnt_dir="net:[1234567]", .mnt_opts=""}, }; if (done == 1) --------------010103090702020308040807 Content-Type: text/x-patch; name="fix-lib-mountlist.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-lib-mountlist.patch" --- lib/mountlist.c.bad 2015-03-26 20:30:05.000000000 -0400 +++ lib/mountlist.c 2015-03-26 20:36:54.000000000 -0400 @@ -360,7 +360,9 @@ dev_from_mount_options (char const *moun # ifndef __linux__ static char const dev_pattern[] = ",dev="; - char const *devopt = strstr (mount_options, dev_pattern); + char const *devopt = (mount_options)? + strstr (mount_options, dev_pattern): + NULL; if (devopt) { --------------010103090702020308040807-- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 27 05:26:30 2015 Received: (at 20210-done) by debbugs.gnu.org; 27 Mar 2015 09:26:30 +0000 Received: from localhost ([127.0.0.1]:37811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbQX7-0006gh-OR for submit@debbugs.gnu.org; Fri, 27 Mar 2015 05:26:29 -0400 Received: from mail1.vodafone.ie ([213.233.128.43]:42808) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbQX5-0006gS-Tk for 20210-done@debbugs.gnu.org; Fri, 27 Mar 2015 05:26:28 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AooMAL0hFVVtT7NH/2dsb2JhbABcgwZSWoExgRROwhyFfQKBO0wBAQEBAQF9QQGDUgEBAQMBIw8BSwsLDQsCAgUWCwICCQMCAQIBRQYBDAgBAYgjDAGxVoVplEgBCwEfgSGBLIhbhH+CaIFFBaFZjRMigjKBPD4xgkMBAQE Received: from unknown (HELO localhost.localdomain) ([109.79.179.71]) by mail1.vodafone.ie with ESMTP; 27 Mar 2015 09:26:00 +0000 Message-ID: <55152228.8040101@draigBrady.com> Date: Fri, 27 Mar 2015 09:26:00 +0000 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Assaf Gordon , 20210-done@debbugs.gnu.org Subject: Re: bug#20210: tests/df/skip-duplicates fails on Debian-kFreeBSD due to calling 'strstr(NULL, )' References: <5514A438.7000303@gmail.com> In-Reply-To: <5514A438.7000303@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20210-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 27/03/15 00:28, Assaf Gordon wrote: > Hello, > > A somewhat exotic test failure: > > On Debian/kFreeBSD 'tests/df/skip-duplicates' fails with 'df' segfaulting like so: > > ... > ./tests/df/skip-duplicates.sh: line 113: 7741 Segmentation fault LD_PRELOAD=./k.so df > ... > I'm not sure what is the correct,clean fix, attached are two options (one fixes the test, one avoids the call in lib/mountlist.c). Nice one. I'll apply the test fix to coreutils. thanks! Pádraig. From unknown Sat Aug 16 18:10:04 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 24 Apr 2015 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator