From unknown Tue Aug 19 07:26:41 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#20826 <20826@debbugs.gnu.org> To: bug#20826 <20826@debbugs.gnu.org> Subject: Status: SEEK_HOLE not supported for ext4 for kernel < 3.1 Reply-To: bug#20826 <20826@debbugs.gnu.org> Date: Tue, 19 Aug 2025 14:26:41 +0000 retitle 20826 SEEK_HOLE not supported for ext4 for kernel < 3.1 reassign 20826 grep submitter 20826 Johannes Meixner severity 20826 normal tag 20826 wontfix thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 16 06:39:58 2015 Received: (at submit) by debbugs.gnu.org; 16 Jun 2015 10:39:58 +0000 Received: from localhost ([127.0.0.1]:55315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4oHd-00041O-EH for submit@debbugs.gnu.org; Tue, 16 Jun 2015 06:39:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46496) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4oHZ-00040V-Va for submit@debbugs.gnu.org; Tue, 16 Jun 2015 06:39:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4oHT-0006n4-NG for submit@debbugs.gnu.org; Tue, 16 Jun 2015 06:39:48 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4oHT-0006n0-Ke for submit@debbugs.gnu.org; Tue, 16 Jun 2015 06:39:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4oHS-0001Sp-IQ for bug-grep@gnu.org; Tue, 16 Jun 2015 06:39:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4oHN-0006kw-Kw for bug-grep@gnu.org; Tue, 16 Jun 2015 06:39:46 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42449 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4oHN-0006jd-DD for bug-grep@gnu.org; Tue, 16 Jun 2015 06:39:41 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 93FAEADC1 for ; Tue, 16 Jun 2015 10:39:39 +0000 (UTC) Date: Tue, 16 Jun 2015 12:39:39 +0200 (CEST) From: Johannes Meixner To: bug-grep@gnu.org Subject: SEEK_HOLE not supported for ext4 for kernel < 3.1 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] 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: -5.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: -5.0 (-----) Hello, newer grep versions do "lseek (fd, cur, SEEK_HOLE)" but that does not always work as expected, at least not for ext4 for kernel < 3.1. This can cause weird results when using a newer grep for files on ext4 with kernel < 3.1. Our (SUSE) kernel developers found and analyzed that issue. Here some excerpts from their mails: ---------------------------------------------------------------------- > homer:/usr/local/src/kernel/linux-3.x.git # grep master xx > Binary file xx matches > homer:/usr/local/src/kernel/linux-3.x.git # split -n 2 xx > homer:/usr/local/src/kernel/linux-3.x.git # grep master xaa > CONFIG_LOCALVERSION="-master" > homer:/usr/local/src/kernel/linux-3.x.git # grep master xab > homer:/usr/local/src/kernel/linux-3.x.git # > > it doesn't like the first 2000 lines of .config (xx), > but does like both halves. > > Made sure by adding that line to xab. > > homer:/usr/local/src/kernel/linux-3.x.git # grep master xaa > CONFIG_LOCALVERSION="-master" > homer:/usr/local/src/kernel/linux-3.x.git # grep master xab > CONFIG_LOCALVERSION="-master" I could reproduce it. Now grepping the grep code, I found that it checks the binary also by looking at the hole in a file: /* Look for a hole after the current location. */ off_t hole_start = lseek (fd, cur, SEEK_HOLE); if (0 <= hole_start) { if (lseek (fd, cur, SEEK_SET) < 0) suppressible_error (filename, errno); if (hole_start < st->st_size) return TEXTBIN_BINARY; } And hole_start returns 32768 instead of an error or the end of file. The reason is that ext4 of SLE11 doesn't support SEEK_HOLE, it just ignores the flag and returns the current position as is. ---------------------------------------------------------------------- "SLE11" is "SUSE Linux Enterprise 11" which has kernel 3.0. Kind Regards Johannes Meixner -- SUSE LINUX GmbH - GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton - HRB 21284 (AG Nuernberg) From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 16 07:50:51 2015 Received: (at 20826) by debbugs.gnu.org; 16 Jun 2015 11:50:51 +0000 Received: from localhost ([127.0.0.1]:55328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4pOE-00078b-V6 for submit@debbugs.gnu.org; Tue, 16 Jun 2015 07:50:51 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49444 helo=mx2.suse.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4pOB-00078R-Nj for 20826@debbugs.gnu.org; Tue, 16 Jun 2015 07:50:48 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C93EDAAB4 for <20826@debbugs.gnu.org>; Tue, 16 Jun 2015 11:50:46 +0000 (UTC) Date: Tue, 16 Jun 2015 13:50:46 +0200 (CEST) From: Johannes Meixner To: 20826@debbugs.gnu.org Subject: Re: bug#20826: SEEK_HOLE not supported for ext4 for kernel < 3.1 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: 20826 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: -5.6 (-----) An addendum FYI: >From our (SUSE) kernel developers I got the information that only ext4 has this problem and that kernel git commit c334b1138bd4 (handle SEEK_HOLE/SEEK_DATA generically in /fs/ext4/file.c) fixes it. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 16 08:28:46 2015 Received: (at 20826) by debbugs.gnu.org; 16 Jun 2015 12:28:46 +0000 Received: from localhost ([127.0.0.1]:55348 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4pyw-00082T-BQ for submit@debbugs.gnu.org; Tue, 16 Jun 2015 08:28:46 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53001 helo=mx2.suse.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4pyu-00082L-Nl for 20826@debbugs.gnu.org; Tue, 16 Jun 2015 08:28:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C2F5CABB1 for <20826@debbugs.gnu.org>; Tue, 16 Jun 2015 12:28:42 +0000 (UTC) Date: Tue, 16 Jun 2015 14:28:42 +0200 (CEST) From: Johannes Meixner To: 20826@debbugs.gnu.org Subject: Re: bug#20826: SEEK_HOLE not supported for ext4 for kernel < 3.1 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: 20826 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: -5.6 (-----) >From one of our (SUSE) kernel developers I even got a proposal for a workaround in grep: --- a/src/grep.c +++ b/src/grep.c @@ -575,6 +575,17 @@ file_textbin (char *buf, size_t size, in off_t hole_start = lseek (fd, cur, SEEK_HOLE); if (0 <= hole_start) { + /* if hole_start is identical with cur, it's more likely a buggy + * lseek(SEEK_HOLE) implementation in kernel filesystem; + * check whether it really reads a null byte. + */ + if (hole_start == cur) + { + char c; + if (read (fd, &c, 1) != 1 || c != 0) + hole_start = st->st_size; /* no hole */ + } + if (lseek (fd, cur, SEEK_SET) < 0) suppressible_error (filename, errno); if (hole_start < st->st_size) From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 16 08:47:50 2015 Received: (at 20826) by debbugs.gnu.org; 16 Jun 2015 12:47:50 +0000 Received: from localhost ([127.0.0.1]:55354 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4qHO-0008Tg-0W for submit@debbugs.gnu.org; Tue, 16 Jun 2015 08:47:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42953) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4qHL-0008TW-Px for 20826@debbugs.gnu.org; Tue, 16 Jun 2015 08:47:48 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id A4E752E1212; Tue, 16 Jun 2015 12:47:46 +0000 (UTC) Received: from [10.3.113.115] (ovpn-113-115.phx2.redhat.com [10.3.113.115]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5GCljR8015837; Tue, 16 Jun 2015 08:47:46 -0400 Message-ID: <55801AEC.7070600@redhat.com> Date: Tue, 16 Jun 2015 06:47:40 -0600 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Johannes Meixner , 20826@debbugs.gnu.org, Bug-gnulib Subject: Re: bug#20826: SEEK_HOLE not supported for ext4 for kernel < 3.1 References: In-Reply-To: OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UgH3kgpghUDgerhBd5uvngBXc3gH3f3Pl" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: 20826 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: -5.6 (-----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --UgH3kgpghUDgerhBd5uvngBXc3gH3f3Pl Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [adding bug-gnulib] On 06/16/2015 06:28 AM, Johannes Meixner wrote: >=20 >> From one of our (SUSE) kernel developers > I even got a proposal for a workaround in grep: >=20 > --- a/src/grep.c > +++ b/src/grep.c > @@ -575,6 +575,17 @@ file_textbin (char *buf, size_t size, in > off_t hole_start =3D lseek (fd, cur, SEEK_HOLE); > if (0 <=3D hole_start) > { > + /* if hole_start is identical with cur, it's more likely = a > buggy > + * lseek(SEEK_HOLE) implementation in kernel filesystem; > + * check whether it really reads a null byte. > + */ > + if (hole_start =3D=3D cur) > + { > + char c; > + if (read (fd, &c, 1) !=3D 1 || c !=3D 0) > + hole_start =3D st->st_size; /* no hole */ > + } > + Sounds like we need to update the gnulib lseek module to work around bugs like this in the wild. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --UgH3kgpghUDgerhBd5uvngBXc3gH3f3Pl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVgBrsAAoJEKeha0olJ0Nqv64H/3b2LAeX650I6tnJ/DoMMJjL cORqXvGk6wNIgNNz6sODEuIW0QxjF7nnFQNKBum8QC23/zWGkOtyk3Hp7HBKaoqM vfzSMZJ0njoWN83oI3ENVLubsJTx2H/+3Sj0zjJmxzv1oHL8SmMUViX/98cSNs+p 8QAqFGQw8i7/Tt//YNX0TE+NJlrkhpUfwD5UtpoUFoMRMiYGy3U2L49ByedGmxVz cSfVDGsY4ai32K1CfzsoUiBjs581An11qisIS2xFgQkaO+4IBRN2d0JXoeZ5Ul8j wmRSMj0mkq7NhngfvR/3of2q5u5ivO3jzjmMSOSq7FVILnDBMMv7jG0QW4SX41M= =D2Ps -----END PGP SIGNATURE----- --UgH3kgpghUDgerhBd5uvngBXc3gH3f3Pl-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 16 09:06:56 2015 Received: (at 20826) by debbugs.gnu.org; 16 Jun 2015 13:06:56 +0000 Received: from localhost ([127.0.0.1]:55358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4qZr-0000Sb-KI for submit@debbugs.gnu.org; Tue, 16 Jun 2015 09:06:55 -0400 Received: from mail1.vodafone.ie ([213.233.128.43]:47209) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4qZo-0000SL-C1 for 20826@debbugs.gnu.org; Tue, 16 Jun 2015 09:06:53 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgsFAAgfgFVtTFVh/2dsb2JhbABbgxCEUcAPglQCgT9MAQEBAQEBgQuEIwEBBCMECwFWCw0BCgICBRYLAgIJAwIBAgFFBgEMCAEBiC8BthCFa5EQLIEhiiOFDYJogUUFk1+MeIcGC4UZgj+HfCaDej2CeAEBAQ Received: from unknown (HELO localhost.localdomain) ([109.76.85.97]) by mail1.vodafone.ie with ESMTP; 16 Jun 2015 14:06:44 +0100 Message-ID: <55801F64.9070704@draigBrady.com> Date: Tue, 16 Jun 2015 14:06:44 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Eric Blake , Johannes Meixner , 20826@debbugs.gnu.org, Bug-gnulib Subject: Re: bug#20826: SEEK_HOLE not supported for ext4 for kernel < 3.1 References: <55801AEC.7070600@redhat.com> In-Reply-To: <55801AEC.7070600@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20826 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 16/06/15 13:47, Eric Blake wrote: > [adding bug-gnulib] > > On 06/16/2015 06:28 AM, Johannes Meixner wrote: >> >>> From one of our (SUSE) kernel developers >> I even got a proposal for a workaround in grep: >> >> --- a/src/grep.c >> +++ b/src/grep.c >> @@ -575,6 +575,17 @@ file_textbin (char *buf, size_t size, in >> off_t hole_start = lseek (fd, cur, SEEK_HOLE); >> if (0 <= hole_start) >> { >> + /* if hole_start is identical with cur, it's more likely a >> buggy >> + * lseek(SEEK_HOLE) implementation in kernel filesystem; >> + * check whether it really reads a null byte. >> + */ >> + if (hole_start == cur) >> + { >> + char c; >> + if (read (fd, &c, 1) != 1 || c != 0) >> + hole_start = st->st_size; /* no hole */ >> + } >> + > > Sounds like we need to update the gnulib lseek module to work around > bugs like this in the wild. Interesting. The above runtime check wouldn't be appropriate I think for such an old fleeting problem. Also the read() as a side effect would be very much best avoided. How about a linux kernel version check at build time? As a general point, gnulib would really benefit from SEEK_HOLE, SEEK_DATA wrappers that degenerated to SEEK_END,0 and SEEK_SET,offset respectively. cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 16 15:07:12 2015 Received: (at submit) by debbugs.gnu.org; 16 Jun 2015 19:07:12 +0000 Received: from localhost ([127.0.0.1]:56259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4wCW-0003Sw-47 for submit@debbugs.gnu.org; Tue, 16 Jun 2015 15:07:12 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48158) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4wCU-0003Sj-62 for submit@debbugs.gnu.org; Tue, 16 Jun 2015 15:07:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4wCK-00039d-K0 for submit@debbugs.gnu.org; Tue, 16 Jun 2015 15:07:04 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4wCK-00039Z-HK for submit@debbugs.gnu.org; Tue, 16 Jun 2015 15:07:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4wCJ-0001Fv-MI for bug-grep@gnu.org; Tue, 16 Jun 2015 15:07:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4wCD-00031n-I3 for bug-grep@gnu.org; Tue, 16 Jun 2015 15:06:59 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:50962) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4wCD-00030k-BS for bug-grep@gnu.org; Tue, 16 Jun 2015 15:06:53 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0B80420C7B for ; Tue, 16 Jun 2015 15:06:51 -0400 (EDT) Received: from web3 ([10.202.2.213]) by compute4.internal (MEProxy); Tue, 16 Jun 2015 15:06:51 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=6i41C76Xn3JMQrO 0Kw4d3H1M758=; b=GsaW4mcFxCYWNwl8hKZMjntlP9wtCI319W4QCDU4ybK1x6U 2xKcMuGZoRvUjdIVbusmIenCHui5iO63/r9PwKloxj/JdiCLCx/Fz8NjPMyZcBXD n8Ncoafduaosplh2cz9+m6YipaXAUOyJdgjOgL8wMgBAcPP+Ucb8e4sxj7sI= Received: by web3.nyi.internal (Postfix, from userid 99) id D007A101D29; Tue, 16 Jun 2015 15:06:50 -0400 (EDT) Message-Id: <1434481610.1951539.297264185.38053B75@webmail.messagingengine.com> X-Sasl-Enc: wRP8oDVWmpqyPdvIpliI5z0hrHhf0cYrdExKMd30QgOX 1434481610 From: Paul Jackson To: bug-grep@gnu.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: MessagingEngine.com Webmail Interface - ajax-32536285 In-Reply-To: <55801F64.9070704@draigBrady.com> References: <55801AEC.7070600@redhat.com> <55801F64.9070704@draigBrady.com> Subject: Re: bug#20826: SEEK_HOLE not supported for ext4 for kernel < 3.1 Date: Tue, 16 Jun 2015 14:06:50 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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.3 (----) 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.3 (----) P=E1draig Brady wrote: >> How about a linux kernel version check at build time? Binaries are not always executed on the same kernel on which they are built. --=20 Paul Jackson pj@usa.net From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 16 15:17:44 2015 Received: (at 20826) by debbugs.gnu.org; 16 Jun 2015 19:17:44 +0000 Received: from localhost ([127.0.0.1]:56266 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4wMh-0003hb-Ik for submit@debbugs.gnu.org; Tue, 16 Jun 2015 15:17:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53656) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4wMe-0003hO-KO for 20826@debbugs.gnu.org; Tue, 16 Jun 2015 15:17:41 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id D29A33679CA; Tue, 16 Jun 2015 19:17:37 +0000 (UTC) Received: from [10.3.113.115] (ovpn-113-115.phx2.redhat.com [10.3.113.115]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5GJHaU6032088; Tue, 16 Jun 2015 15:17:37 -0400 Message-ID: <5580764B.2050108@redhat.com> Date: Tue, 16 Jun 2015 13:17:31 -0600 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= , Johannes Meixner , 20826@debbugs.gnu.org, Bug-gnulib Subject: Re: bug#20826: SEEK_HOLE not supported for ext4 for kernel < 3.1 References: <55801AEC.7070600@redhat.com> <55801F64.9070704@draigBrady.com> In-Reply-To: <55801F64.9070704@draigBrady.com> OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2pLlLiqnxgSVlkre9mcXjhubs1m4Wasen" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: 20826 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: -5.6 (-----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2pLlLiqnxgSVlkre9mcXjhubs1m4Wasen Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/16/2015 07:06 AM, P=C3=A1draig Brady wrote: > On 16/06/15 13:47, Eric Blake wrote: >> [adding bug-gnulib] >> >> On 06/16/2015 06:28 AM, Johannes Meixner wrote: >>> >>>> From one of our (SUSE) kernel developers >>> I even got a proposal for a workaround in grep: >>> >>> --- a/src/grep.c >>> +++ b/src/grep.c >>> @@ -575,6 +575,17 @@ file_textbin (char *buf, size_t size, in >>> off_t hole_start =3D lseek (fd, cur, SEEK_HOLE); >>> if (0 <=3D hole_start) >>> { >>> + /* if hole_start is identical with cur, it's more likel= y a >>> buggy >>> + * lseek(SEEK_HOLE) implementation in kernel filesystem= ; >>> + * check whether it really reads a null byte. >>> + */ >>> + if (hole_start =3D=3D cur) >>> + { >>> + char c; >>> + if (read (fd, &c, 1) !=3D 1 || c !=3D 0) >>> + hole_start =3D st->st_size; /* no hole */ You MUST lseek() back to the original spot (or use pread() to avoid changing offset) for the workaround to work. There might also be ways to cache whether the workaround has ever been needed, so that subsequent calls aren't penalized (then again, when working around the bug, the likely behavior is to just treat the file as all data, so you'll only ever encounter the bug once per file, unless you are reading the file's contents multiple times); and as the call is filesystem related, we can't guarantee that it works or fails on all possible files served by the kernel, when crossing device boundaries. So yeah, we're probably stuck with a per-file probing, minimized to the cases where a reported hole sounds suspicious. >>> + } >>> + >> >> Sounds like we need to update the gnulib lseek module to work around >> bugs like this in the wild. >=20 > Interesting. The above runtime check wouldn't be appropriate I think > for such an old fleeting problem. Also the read() as a side effect > would be very much best avoided. How about a linux kernel version chec= k > at build time? >=20 > As a general point, gnulib would really benefit from SEEK_HOLE, SEEK_DA= TA > wrappers that degenerated to SEEK_END,0 and SEEK_SET,offset respectivel= y. Yeah, I've wanted those for several years now (I even mentioned it as a "nice to have" in my Linux Plumber's Convention talk in 2012), but haven't had time to work on it myself yet. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --2pLlLiqnxgSVlkre9mcXjhubs1m4Wasen Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVgHZLAAoJEKeha0olJ0NqvEoH/iM0q+FVERiEvlRvuxb6d+y6 7kF9ZyCVnlnMcnol29vLRD1pyofnUuLjQ+bg6LrJNyenScclhCwKhNwcRZXFwQlj fMysvxrxKQCWgL24Z/q8me6t3grROVUZ44rJ/wSM/iM1oz3VJIsvT/YWhNLCPuOp Hbr5YGWdcqN1Ug47vKYk0+5NjGeLMLu0/A7jou0+gGfijRD6V+MM8C4OmN8qbuUv FILCXMCbJ4kx8HKanE1frRgoAZJtEi1oBLRnjBc2YZhNeEWcpScr2Rll1fpVGAS9 IHVnLOnvpPOnyG0SYBQ/bju27zTKCXvU4GVFuwZ7RwfLdS/KrFFYIQywQRtwJI0= =C9+G -----END PGP SIGNATURE----- --2pLlLiqnxgSVlkre9mcXjhubs1m4Wasen-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 18 20:38:14 2015 Received: (at 20826) by debbugs.gnu.org; 19 Jul 2015 00:38:14 +0000 Received: from localhost ([127.0.0.1]:53432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGccQ-00046E-3f for submit@debbugs.gnu.org; Sat, 18 Jul 2015 20:38:14 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50380) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGccN-000460-Oi for 20826@debbugs.gnu.org; Sat, 18 Jul 2015 20:38:12 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1D5701601B0; Sat, 18 Jul 2015 17:38:06 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id WdVMY3sR53aK; Sat, 18 Jul 2015 17:38:05 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 35BD9160999; Sat, 18 Jul 2015 17:38:05 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 8_zsAnO5Whqa; Sat, 18 Jul 2015 17:38:05 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 097AE1601B0; Sat, 18 Jul 2015 17:38:05 -0700 (PDT) Message-ID: <55AAF16C.8030102@cs.ucla.edu> Date: Sat, 18 Jul 2015 17:38:04 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Eric Blake , =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= , Johannes Meixner , 20826@debbugs.gnu.org, Bug-gnulib Subject: Re: bug#20826: SEEK_HOLE not supported for ext4 for kernel < 3.1 References: <55801AEC.7070600@redhat.com> <55801F64.9070704@draigBrady.com> <5580764B.2050108@redhat.com> In-Reply-To: <5580764B.2050108@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 20826 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: -1.2 (-) As I understand from , Linux releases before 3.1 are no longer supported as of "mid-2015", which is right around now. Also, OpenSUSE 11.4 (based on kernel 2.6.37 -- does this have the kernel bug in question?) is seeing its support end this month, and all other supported openSUSE systems have kernels newer than 3.1. Given all this, I'm inclined to mark this bug as "wontfix" for Grep. This case (though borderline) seems to fall more on the museum-piece side, and we don't want to take on the burden of supporting museum pieces. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 18 20:38:39 2015 Received: (at control) by debbugs.gnu.org; 19 Jul 2015 00:38:40 +0000 Received: from localhost ([127.0.0.1]:53435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGccp-00046u-Ek for submit@debbugs.gnu.org; Sat, 18 Jul 2015 20:38:39 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50403) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGcco-00046f-0t for control@debbugs.gnu.org; Sat, 18 Jul 2015 20:38:38 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 981AA1601B0 for ; Sat, 18 Jul 2015 17:38:32 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ApBb-w7CcOpU for ; Sat, 18 Jul 2015 17:38:32 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0DB51160999 for ; Sat, 18 Jul 2015 17:38:32 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id OREyh3CL1VVW for ; Sat, 18 Jul 2015 17:38:31 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E9B2D1601B0 for ; Sat, 18 Jul 2015 17:38:31 -0700 (PDT) Message-ID: <55AAF187.9030901@cs.ucla.edu> Date: Sat, 18 Jul 2015 17:38:31 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 Subject: Re: SEEK_HOLE not supported for ext4 for kernel < 3.1 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control Cc: control@debbugs.gnu.org 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 (/) tags 20826 wontfix thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 10 18:01:40 2016 Received: (at control) by debbugs.gnu.org; 10 Apr 2016 22:01:40 +0000 Received: from localhost ([127.0.0.1]:57612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apNQJ-0005IS-TY for submit@debbugs.gnu.org; Sun, 10 Apr 2016 18:01:40 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48115) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apNQI-0005IF-IH for control@debbugs.gnu.org; Sun, 10 Apr 2016 18:01:39 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id BCCFC160FD3 for ; Sun, 10 Apr 2016 15:01:32 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id cnp3ijS_uZG4 for ; Sun, 10 Apr 2016 15:01:32 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EBC70161250 for ; Sun, 10 Apr 2016 15:01:31 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id CNfwdhtEErgy for ; Sun, 10 Apr 2016 15:01:31 -0700 (PDT) Received: from [192.168.1.25] (unknown [71.109.149.160]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id ADD2A160FD3 for ; Sun, 10 Apr 2016 15:01:31 -0700 (PDT) To: control@debbugs.gnu.org From: Paul Eggert Subject: grep bug maintenance Message-ID: <570ACD2C.9060304@cs.ucla.edu> Date: Sun, 10 Apr 2016 15:01:16 -0700 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.0 (-) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: -1.0 (-) close 22899 close 22443 close 21554 close 20826 From unknown Tue Aug 19 07:26:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 09 May 2016 11:24:04 +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