From unknown Tue Jun 17 01:34:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46048: split -n K/N loses data, sum of output files is smaller than input file. Resent-From: Paul Hirst Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 23 Jan 2021 08:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46048 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 46048@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161139034211613 (code B ref -1); Sat, 23 Jan 2021 08:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jan 2021 08:25:42 +0000 Received: from localhost ([127.0.0.1]:33616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3EEk-00031B-Be for submit@debbugs.gnu.org; Sat, 23 Jan 2021 03:25:42 -0500 Received: from lists.gnu.org ([209.51.188.17]:53206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3B0C-0004Jp-Ci for submit@debbugs.gnu.org; Fri, 22 Jan 2021 23:58:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3B0B-0001MV-Px for bug-coreutils@gnu.org; Fri, 22 Jan 2021 23:58:24 -0500 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]:43376) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3B09-0006ZQ-Rt for bug-coreutils@gnu.org; Fri, 22 Jan 2021 23:58:23 -0500 Received: by mail-io1-xd2a.google.com with SMTP id x21so15609175iog.10 for ; Fri, 22 Jan 2021 20:58:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=phirst-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=wVZ24DzQvUFfordsi0jdYSP3k0BHR1mWNqJH5cBzYTo=; b=TpyD454PhpTjhOS2m9lNXsFWCUQ/Ebc5s3vhCkqMLlwmNrn8nRePZtj2zGQFY9UtQg xonckCv26bQbqgIwF+1z/N0OCOPNfb5EFUGIrdLMmBq+/eKjLMC8vL+fFnLXin2JYshG /Ll3TcbtYiGVUTeVV+h+/0rOS+wr755vfa0Dknb68/zxZO2SxN3RfLolO2TnijAnsc6n ChBgFj2nHttr8krn1WeFBrwXArBmNdF9RNNEwfAe4c1POn8dxlG6A2Ir71xXA2WN2XBr WmYmM4mv4vVuS7+wd7ISRBfJ0hWOFxTM4HqL0GHEOWe0rQ/bdrkPg37ZLxs2ZD1aoTxu SR+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=wVZ24DzQvUFfordsi0jdYSP3k0BHR1mWNqJH5cBzYTo=; b=nxofmzJxaLwYvofYUb/x35J93J1ExKDejuKARQayrx4NpsaTW7nxgT+Dg6TcQo5LrP Jm53Oxmfz9+YS9iXuVeuB0fL9uYMulCGhQmYXlJMykzgTm+PMhIQJRl7hC4tGeqdctYS KVhUP42mzq3H1mjIk4YqcgI+qEpMeiW2QoqLc+K7aYGs8xE0BszOAkBu1IgHReTdrD+A xoSmIwM6DRNtJn8Wdro7m29X9AnYzIzDqPG3zKUddrdmY9rU6JKf6pabxNMH8ZJJqbaC K6egJNrc7SGjqIpEBg/4Tdq5h3iboxUs5p+xzJv+FTQyMJk//xiuc7PK2HSkw7FNRmmB BvgQ== X-Gm-Message-State: AOAM530PgYC6U3OvHrLeqjqF5BPLWCbDdsArmAjXhWSjtXtOIQA/7qCl MHk0kaB0nea7LCnuZoTwk7I3bK2J3aX4qnChj71qZ0iUyA6iGQ== X-Google-Smtp-Source: ABdhPJymCD4Au/aaQ7lWDJkisS20rF3e+vNX+nMXPd3hXsBP4LSVu6zflXGJWKXehGHEGGeTls/AjZCegK2nozBUnoc= X-Received: by 2002:a05:6e02:1447:: with SMTP id p7mr3863299ilo.93.1611377899661; Fri, 22 Jan 2021 20:58:19 -0800 (PST) MIME-Version: 1.0 From: Paul Hirst Date: Fri, 22 Jan 2021 18:58:03 -1000 Message-ID: Content-Type: multipart/alternative; boundary="0000000000004f03d305b98a27d5" Received-SPF: pass client-ip=2607:f8b0:4864:20::d2a; envelope-from=paul@phirst.org; helo=mail-io1-xd2a.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_05=-0.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Mailman-Approved-At: Sat, 23 Jan 2021 03:25:38 -0500 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: -2.3 (--) --0000000000004f03d305b98a27d5 Content-Type: text/plain; charset="UTF-8" split --number K/N appears to lose data in, with the sum of the sizes of the output files being smaller than the original input file by 131072 bytes. $ split --version split (GNU coreutils) 8.30 ... $ head -c 1000000 < /dev/urandom > test.dat $ split --number=1/4 test.dat > t1 $ split --number=2/4 test.dat > t2 $ split --number=3/4 test.dat > t3 $ split --number=4/4 test.dat > t4 $ ls -l -rw-r--r-- 1 user user 250000 Jan 22 18:36 t1 -rw-r--r-- 1 user user 250000 Jan 22 18:36 t2 -rw-r--r-- 1 user user 250000 Jan 22 18:36 t3 -rw-r--r-- 1 user user 118928 Jan 22 18:36 t4 -rw-r--r-- 1 user user 1000000 Jan 22 18:33 test.dat Surely this should not be the case? Paul --0000000000004f03d305b98a27d5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
split --number K/N appears to lose data in, with the = sum of the sizes of the output files being smaller than the original input = file by 131072 bytes.

$ split --versionsplit (GNU coreutils) 8.30
...

$ head = -c 1000000 < /dev/urandom > test.dat
$ split --number=3D1/4= test.dat > t1
$ split --number=3D2/4 test.dat > t2
$ split --number=3D3/4 test.dat > t3
$ split --number=3D4/4= test.dat > t4

$ ls -l
-rw-r--r-- 1 user use= r=C2=A0 250000 Jan 22 18:36 t1
-rw-r--r-- 1 user user=C2=A0 250000 Jan 2= 2 18:36 t2
-rw-r--r-- 1 user user=C2=A0 250000 Jan 22 18:36 t3
-rw-r-= -r-- 1 user user=C2=A0 118928 Jan 22 18:36 t4
-rw-r--r-- 1 user user 100= 0000 Jan 22 18:33 test.dat

Surely this should not = be the case?

Paul
--0000000000004f03d305b98a27d5-- From unknown Tue Jun 17 01:34:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46048: split -n K/N loses data, sum of output files is smaller than input file. Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 24 Jan 2021 16:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46048 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Hirst , 46048@debbugs.gnu.org Received: via spool by 46048-submit@debbugs.gnu.org id=B46048.161150718711493 (code B ref 46048); Sun, 24 Jan 2021 16:54:01 +0000 Received: (at 46048) by debbugs.gnu.org; 24 Jan 2021 16:53:07 +0000 Received: from localhost ([127.0.0.1]:37057 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3idP-0002zJ-67 for submit@debbugs.gnu.org; Sun, 24 Jan 2021 11:53:07 -0500 Received: from mail-wm1-f48.google.com ([209.85.128.48]:38565) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3idN-0002yk-Mv for 46048@debbugs.gnu.org; Sun, 24 Jan 2021 11:53:06 -0500 Received: by mail-wm1-f48.google.com with SMTP id y187so8696412wmd.3 for <46048@debbugs.gnu.org>; Sun, 24 Jan 2021 08:53:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Cn3DToVjYI0gSO+gw9/MBBvn2vGzi9bI/uv13puscog=; b=e+edRWexSeRqAug6HPJYSSGIzfeH3JgT5ZoLcdjWrwwN4vaDZBX/P1p1EBj62ZY5wA biKX/VjRDojGEJPYCsJaT2qF5fS+fmqCXsAHj/kHITN9hv6YULHDMQ97TFC/wnGPVSfL L48QvrriHKhe4nL9zNiZJbVMThuq05xSUzhHCTWuT5UkHOkwawN/t9oZMz09YPyu19CD MCbtl2YfeC63dc/2pmKiLrv/iJ5y0EpzOTdCWYDjAQSujLPUaemkG+YGEymkRzq5R9Jj G2oFKONxlzqlyqgPXmcjNYClA99wc/hh382D1zVnpxJILYW+mlVhe0lK1h3TSsyrSqlP CtOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Cn3DToVjYI0gSO+gw9/MBBvn2vGzi9bI/uv13puscog=; b=Jpdt50LfioUPlgn/kCdoaFVN6pufIeQHt9suqq1BgLavgKc6QBMnr4J7ynrUloyVKE FlVHj18e0FcYGWtxyqFoYPnXsVrWCOc9gV0OB5aUTWkOcqdSQPSBY7gvm3L+2dQ1OVIz iKsUtcUqoRj2BcBJdoQvrkY1erENbq/NWShvxGmWNrRMXw1fL+99SwGh3U2JJYcfDBZF +VOk91yArT0sxNgcwtXpdS+XmnOlXBRniUtJa11z47PUJgjcXVWkEj1tD9b4ClWOj1XX 7Xd2QmBRbUroh5PjdLjrCTOw4tfXPeVbyfxfhAEYjYw8W38O8tmLL8VZJIYXv8F3486o Ft0g== X-Gm-Message-State: AOAM530ayrpTJpHfE/Zi6ZTKKE/4KknJ1mEtIQgUiTzA0l3NKRfIuGX5 fqGzCG+c04uNEeoe+hUsTIhBCTSY00w= X-Google-Smtp-Source: ABdhPJwandoaR2KGkQKy6f816rNjCv05opvnXyqxRShjBjMM8hNLLLpxUswCqwDvYR+Gf24EcsWZow== X-Received: by 2002:a1c:e90a:: with SMTP id q10mr12183038wmc.102.1611507179369; Sun, 24 Jan 2021 08:52:59 -0800 (PST) Received: from localhost.localdomain (86-42-14-227-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.14.227]) by smtp.googlemail.com with UTF8SMTPSA id n12sm21158839wrg.76.2021.01.24.08.52.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Jan 2021 08:52:58 -0800 (PST) References: From: =?UTF-8?Q?P=C3=A1draig?= Brady Message-ID: Date: Sun, 24 Jan 2021 16:52:57 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) 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: -0.5 (/) On 23/01/2021 04:58, Paul Hirst wrote: > split --number K/N appears to lose data in, with the sum of the sizes of > the output files being smaller than the original input file by 131072 bytes. > > $ split --version > split (GNU coreutils) 8.30 > ... > > $ head -c 1000000 < /dev/urandom > test.dat > $ split --number=1/4 test.dat > t1 > $ split --number=2/4 test.dat > t2 > $ split --number=3/4 test.dat > t3 > $ split --number=4/4 test.dat > t4 > > $ ls -l > -rw-r--r-- 1 user user 250000 Jan 22 18:36 t1 > -rw-r--r-- 1 user user 250000 Jan 22 18:36 t2 > -rw-r--r-- 1 user user 250000 Jan 22 18:36 t3 > -rw-r--r-- 1 user user 118928 Jan 22 18:36 t4 > -rw-r--r-- 1 user user 1000000 Jan 22 18:33 test.dat > > Surely this should not be the case? Ugh. This functionality was broken for all files > 128KiB due to adjustments for handling /dev/zero $ truncate -s 1000000 test.dat $ split --number=4/4 test.dat | wc -c 118928 The following patch fixes it here. I need to do some more testing, before committing. thanks! diff --git a/src/split.c b/src/split.c index 0660da13f..6aa8d50e9 100644 --- a/src/split.c +++ b/src/split.c @@ -1001,7 +1001,7 @@ bytes_chunk_extract (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, } else { - if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0) + if (lseek (STDIN_FILENO, start, SEEK_SET) < 0) die (EXIT_FAILURE, errno, "%s", quotef (infile)); initial_read = SIZE_MAX; } From unknown Tue Jun 17 01:34:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46048: split -n K/N loses data, sum of output files is smaller than input file. Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 24 Jan 2021 16:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46048 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 46048@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161150753111971 (code B ref -1); Sun, 24 Jan 2021 16:59:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Jan 2021 16:58:51 +0000 Received: from localhost ([127.0.0.1]:37062 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3iiw-000370-Qc for submit@debbugs.gnu.org; Sun, 24 Jan 2021 11:58:51 -0500 Received: from lists.gnu.org ([209.51.188.17]:58326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3iiv-00036t-1S for submit@debbugs.gnu.org; Sun, 24 Jan 2021 11:58:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3iiu-0006vU-Oi for bug-coreutils@gnu.org; Sun, 24 Jan 2021 11:58:48 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:40110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3iit-00020y-0M for bug-coreutils@gnu.org; Sun, 24 Jan 2021 11:58:48 -0500 Received: by mail-wm1-x331.google.com with SMTP id c127so8694905wmf.5 for ; Sun, 24 Jan 2021 08:58:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=l+HeuaoXAfZ0aiANjaPs9qDQFUuIyEeeMw1QK5fdf6M=; b=hPKu8AV3bf6QSaU3qCW2WdyQA7Egw1r4Wn0XzMjNP7pMKWJn6/ShqnAU30VH18ISep yD/0Fat5eJXCc18l+LzDjQaOJgxUuLpdcs3g4G+x/YMv49ZFKvTqiKKavIsxjIJEJypp /ej4O06Upb60fc32thIXsrml4+VUXYulszTZ3fgmbyGE0nHMSymJlR2flv/ZsE8e03Gk UN8zv6pndWLNVGIFcKlGrhjL9S7pMvc7pTFuHp7Hcb4bq1CXdUy4TaPr3aS4P5PHQv7w uT9IOHMSGl1uvP/lqt9kauoX/QIXujPCzHahDcjRIBZfb7ejy5hy0FimClBJX9ojVJRW wxBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=l+HeuaoXAfZ0aiANjaPs9qDQFUuIyEeeMw1QK5fdf6M=; b=Kpq/6ygwEfWe1Q1uoNXjmiyCd4a4rpUIDVpA9TuBn+H9ByOEweEtJWwbEsmhljhPZP zKzWZUVFlwT/Xx2oEh7trYMvt4DSwOLkp2SMPDDCseZkrA5qy5kVIdLcCn65uAV/Xd7O j3EaWZeEo+TfqZT8tjyqDAY0Bvq7AEmTVl3UsIlmmbDHoA1O6wNLj8YJTzYUQdNP8xlX Vpib4izTTWeJNj/I76ViGXDzueikaI5zCh0qgsojtgenasPnGyQNL1CAO9scOB7+15gk yYvYuGSLtcprQ1AFjYIJoFgxfdMD93Tm3jWcHS+NhEth3WZAeFuT3US0MhwfAJtOHASq zWSw== X-Gm-Message-State: AOAM530A6uYk/sQ0D0tl4h3hqH1888Pz/BtPSFY66PvcJ/ZGzKfBZuJC Vhxzw3HA8WoxzPXeJRIHoRWOsXXYnQE= X-Google-Smtp-Source: ABdhPJyIb4x3YP4WQ+czUZY+pmabOcMA+PPQnkBFNO5ELiBEhl8yaAZb+SUzOp8L+3PMumf6p/zKxw== X-Received: by 2002:a05:600c:4e92:: with SMTP id f18mr3225163wmq.126.1611507524647; Sun, 24 Jan 2021 08:58:44 -0800 (PST) Received: from localhost.localdomain (86-42-14-227-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.14.227]) by smtp.googlemail.com with UTF8SMTPSA id v6sm18612529wrx.32.2021.01.24.08.58.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Jan 2021 08:58:43 -0800 (PST) References: From: =?UTF-8?Q?P=C3=A1draig?= Brady Message-ID: Date: Sun, 24 Jan 2021 16:58:43 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=pixelbeat@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.9 (/) 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.9 (-) On 24/01/2021 16:52, Pádraig Brady wrote: > diff --git a/src/split.c b/src/split.c > index 0660da13f..6aa8d50e9 100644 > --- a/src/split.c > +++ b/src/split.c > @@ -1001,7 +1001,7 @@ bytes_chunk_extract (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, > } > else > { > - if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0) > + if (lseek (STDIN_FILENO, start, SEEK_SET) < 0) > die (EXIT_FAILURE, errno, "%s", quotef (infile)); > initial_read = SIZE_MAX; > } The same adjustment is needed in lines_chunk_split() I'll add a test also. cheers, Pádraig From unknown Tue Jun 17 01:34:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46048: split -n K/N loses data, sum of output files is smaller than input file. Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 24 Jan 2021 19:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46048 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Paul Hirst , 46048@debbugs.gnu.org Received: via spool by 46048-submit@debbugs.gnu.org id=B46048.161151813812768 (code B ref 46048); Sun, 24 Jan 2021 19:56:01 +0000 Received: (at 46048) by debbugs.gnu.org; 24 Jan 2021 19:55:38 +0000 Received: from localhost ([127.0.0.1]:37356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3lU2-0003Js-CV for submit@debbugs.gnu.org; Sun, 24 Jan 2021 14:55:38 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:37014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3lTz-0003Je-9u for 46048@debbugs.gnu.org; Sun, 24 Jan 2021 14:55:37 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 275311600E0; Sun, 24 Jan 2021 11:55:29 -0800 (PST) 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 XJUCsSikwz_Q; Sun, 24 Jan 2021 11:55:28 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 78835160110; Sun, 24 Jan 2021 11:55:28 -0800 (PST) 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 OMfqbunL4lle; Sun, 24 Jan 2021 11:55:28 -0800 (PST) Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 50BE21600E0; Sun, 24 Jan 2021 11:55:28 -0800 (PST) References: From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sun, 24 Jan 2021 11:55:27 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) 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.7 (-) On 1/24/21 8:52 AM, P=C3=A1draig Brady wrote: > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (lseek (STDIN_FILENO, start, SEEK_CU= R) < 0) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (lseek (STDIN_FILENO, start, SEEK_SE= T) < 0) Dumb question: will this handle the case where you're splitting from=20 stdin and stdin is a seekable file and its initial file offset is nonzero= ? From unknown Tue Jun 17 01:34:07 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Paul Hirst Subject: bug#46048: closed (Re: bug#46048: split -n K/N loses data, sum of output files is smaller than input file.) Message-ID: References: <4f858cd0-19e4-d159-c2e7-51b3aad0b3b0@draigBrady.com> X-Gnu-PR-Message: they-closed 46048 X-Gnu-PR-Package: coreutils Reply-To: 46048@debbugs.gnu.org Date: Mon, 25 Jan 2021 14:22:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1611584522-11996-1" This is a multi-part message in MIME format... ------------=_1611584522-11996-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #46048: split -n K/N loses data, sum of output files is smaller than input = file. which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 46048@debbugs.gnu.org. --=20 46048: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D46048 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1611584522-11996-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 46048-done) by debbugs.gnu.org; 25 Jan 2021 14:21:45 +0000 Received: from localhost ([127.0.0.1]:38319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l42kT-00036x-FJ for submit@debbugs.gnu.org; Mon, 25 Jan 2021 09:21:45 -0500 Received: from mail-wm1-f47.google.com ([209.85.128.47]:52206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l42kR-00036h-Gi for 46048-done@debbugs.gnu.org; Mon, 25 Jan 2021 09:21:44 -0500 Received: by mail-wm1-f47.google.com with SMTP id m2so11051333wmm.1 for <46048-done@debbugs.gnu.org>; Mon, 25 Jan 2021 06:21:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=yj9IhYJMp1+Iq/X6txId02FH/sjK9CYUvAtTVB3rWJs=; b=bVl6UavhDyqxp+lZUll5G5gVapEjLUfYa6DStwPmd59XJobr1pusvdYS4l2KDbWVdl csD86hAFTHIgkDWYFluJyKnWUg/OiQu+wfXVXD3rD+gmJ7K/imn9wyTUQ+RfjoOcS2Hq K3lyLdBC8mD5scFlAoImUSrYdZSOoE0Cy1TQP/MbtFXUCFqR6ZG0CNpLRJ+R9DjaisQj PdR0uTdB+T83ZttDxUZR8JNrylk6416/r85RLJIakesjH4D+XE3BLseuLKswoNd0GlMH e2w1ZBU9PkPuplhOjx4B/u2UJzkxEtVtsdWyQFW/HFvnFPWljDr36wgKCvUjed8dvJB7 ltHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=yj9IhYJMp1+Iq/X6txId02FH/sjK9CYUvAtTVB3rWJs=; b=jKGjFRWGKFdNF+Gwj2r75d091mQICb3HLkgHhHXx+znG/IWe7qf9kK6qBPAVt0i8FD qyR7YjmPNQdMyCLZMZ272O5uSXFYTvfwFod3bmR81yQQhdu6ciIu36sDxiu8zNV7VThM 5ujA4LDn6e/ppoHnrItC/C9K6RUaPMquP46HWB8vGDMcwAuH6J0vB4Pw8wqt6bUtHhsV znquCZW6cdRHzJZtaH2CZGQjEiaJy2Mljrp4unWrt8r/sKBDXpVchiF/DddZ+xlwzJ3H i9IFXAGlKxiHUxmvwtpRkQFEvO4QV+25MoO+2EYi49MBZ8BLipnegpy44m1ggQ5QxaLK nKug== X-Gm-Message-State: AOAM532jcWSlTbTt6uzKkPvoAb+ohdHP7wHrLCIda1DaFn7hFV6HxUaz Ig7OYdsD39kvVgcTg4ZhPGJP+cxBmvo= X-Google-Smtp-Source: ABdhPJzKGkFqVLh5IWRL8t0yy272bY4chQw8O02hh4DIEzRV4BAHZlFMrWbMVHoS9ON1oXDhq8q1nQ== X-Received: by 2002:a1c:ac86:: with SMTP id v128mr376025wme.76.1611584497501; Mon, 25 Jan 2021 06:21:37 -0800 (PST) Received: from localhost.localdomain (86-42-14-227-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.14.227]) by smtp.googlemail.com with UTF8SMTPSA id v65sm22759966wme.23.2021.01.25.06.21.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Jan 2021 06:21:36 -0800 (PST) Subject: Re: bug#46048: split -n K/N loses data, sum of output files is smaller than input file. To: Paul Eggert References: From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <4f858cd0-19e4-d159-c2e7-51b3aad0b3b0@draigBrady.com> Date: Mon, 25 Jan 2021 14:21:35 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------16EBA0EE14DA5B8249E31D03" Content-Language: en-US X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 46048-done Cc: Paul Hirst , 46048-done@debbugs.gnu.org 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: -0.5 (/) This is a multi-part message in MIME format. --------------16EBA0EE14DA5B8249E31D03 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 24/01/2021 19:55, Paul Eggert wrote: > On 1/24/21 8:52 AM, Pádraig Brady wrote: >> -      if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0) >> +      if (lseek (STDIN_FILENO, start, SEEK_SET) < 0) > > Dumb question: will this handle the case where you're splitting from > stdin and stdin is a seekable file and its initial file offset is nonzero? Right. Following on the logic from input_file_size(), I'm going with the attached, which I'll push later. Marking this as done. thanks, Pádraig --------------16EBA0EE14DA5B8249E31D03 Content-Type: text/x-patch; charset=UTF-8; name="split-k_of_n.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="split-k_of_n.patch" >From 8741d726327bddce3271de23af4aae4cfc185774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Mon, 25 Jan 2021 14:12:48 +0000 Subject: [PATCH] split: fix --number=K/N to output correct part of file This functionality regressed with the adjustments in commit v8.25-4-g62e7af032 * src/split.c (bytes_chunk_extract): Account for already read data when seeking into the file. * tests/split/b-chunk.sh: Use the hidden ---io-blksize option, to test this functionality. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/46048 --- NEWS | 4 ++++ src/split.c | 2 +- tests/split/b-chunk.sh | 45 ++++++++++++++++++++++++------------------ 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/NEWS b/NEWS index c2474fee3..e7fbde8ed 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,10 @@ GNU coreutils NEWS -*- outline -*- rm no longer skips an extra file when the removal of an empty directory fails. [bug introduced by the rewrite to use fts in coreutils-8.0] + split --number=K/N will again correctly split chunk K of N to stdout. + Previously a chunk starting after 128KiB, output the wrong part of the file. + [bug introduced in coreutils-8.26] + tr no longer crashes when using --complement with certain invalid combinations of case character classes. [bug introduced in coreutils-8.6] diff --git a/src/split.c b/src/split.c index 0660da13f..59c234c12 100644 --- a/src/split.c +++ b/src/split.c @@ -1001,7 +1001,7 @@ bytes_chunk_extract (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, } else { - if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0) + if (lseek (STDIN_FILENO, start - initial_read, SEEK_CUR) < 0) die (EXIT_FAILURE, errno, "%s", quotef (infile)); initial_read = SIZE_MAX; } diff --git a/tests/split/b-chunk.sh b/tests/split/b-chunk.sh index 8238dcb6d..dbed681f7 100755 --- a/tests/split/b-chunk.sh +++ b/tests/split/b-chunk.sh @@ -35,32 +35,39 @@ split -e -n 10 /dev/null || fail=1 returns_ 1 stat x?? 2>/dev/null || fail=1 printf '1\n2\n3\n4\n5\n' > input || framework_failure_ +printf '1\n2' > exp-1 || framework_failure_ +printf '\n3\n' > exp-2 || framework_failure_ +printf '4\n5\n' > exp-3 || framework_failure_ for file in input /proc/version /sys/kernel/profiling; do test -f $file || continue - split -n 3 $file > out || fail=1 - split -n 1/3 $file > b1 || fail=1 - split -n 2/3 $file > b2 || fail=1 - split -n 3/3 $file > b3 || fail=1 + for blksize in 1 2 4096; do + if ! test "$file" = 'input'; then + # For /proc like files we must be able to read all + # into the internal buffer to be able to determine size. + test "$blksize" = 4096 || continue + fi - case $file in - input) - printf '1\n2' > exp-1 - printf '\n3\n' > exp-2 - printf '4\n5\n' > exp-3 + split -n 3 ---io-blksize=$blksize $file > out || fail=1 + split -n 1/3 ---io-blksize=$blksize $file > b1 || fail=1 + split -n 2/3 ---io-blksize=$blksize $file > b2 || fail=1 + split -n 3/3 ---io-blksize=$blksize $file > b3 || fail=1 - compare exp-1 xaa || fail=1 - compare exp-2 xab || fail=1 - compare exp-3 xac || fail=1 - ;; - esac + case $file in + input) + compare exp-1 xaa || fail=1 + compare exp-2 xab || fail=1 + compare exp-3 xac || fail=1 + ;; + esac - compare xaa b1 || fail=1 - compare xab b2 || fail=1 - compare xac b3 || fail=1 - cat xaa xab xac | compare - $file || fail=1 - test -f xad && fail=1 + compare xaa b1 || fail=1 + compare xab b2 || fail=1 + compare xac b3 || fail=1 + cat xaa xab xac | compare - $file || fail=1 + test -f xad && fail=1 + done done Exit $fail -- 2.26.2 --------------16EBA0EE14DA5B8249E31D03-- ------------=_1611584522-11996-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 23 Jan 2021 08:25:42 +0000 Received: from localhost ([127.0.0.1]:33616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3EEk-00031B-Be for submit@debbugs.gnu.org; Sat, 23 Jan 2021 03:25:42 -0500 Received: from lists.gnu.org ([209.51.188.17]:53206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3B0C-0004Jp-Ci for submit@debbugs.gnu.org; Fri, 22 Jan 2021 23:58:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3B0B-0001MV-Px for bug-coreutils@gnu.org; Fri, 22 Jan 2021 23:58:24 -0500 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]:43376) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3B09-0006ZQ-Rt for bug-coreutils@gnu.org; Fri, 22 Jan 2021 23:58:23 -0500 Received: by mail-io1-xd2a.google.com with SMTP id x21so15609175iog.10 for ; Fri, 22 Jan 2021 20:58:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=phirst-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=wVZ24DzQvUFfordsi0jdYSP3k0BHR1mWNqJH5cBzYTo=; b=TpyD454PhpTjhOS2m9lNXsFWCUQ/Ebc5s3vhCkqMLlwmNrn8nRePZtj2zGQFY9UtQg xonckCv26bQbqgIwF+1z/N0OCOPNfb5EFUGIrdLMmBq+/eKjLMC8vL+fFnLXin2JYshG /Ll3TcbtYiGVUTeVV+h+/0rOS+wr755vfa0Dknb68/zxZO2SxN3RfLolO2TnijAnsc6n ChBgFj2nHttr8krn1WeFBrwXArBmNdF9RNNEwfAe4c1POn8dxlG6A2Ir71xXA2WN2XBr WmYmM4mv4vVuS7+wd7ISRBfJ0hWOFxTM4HqL0GHEOWe0rQ/bdrkPg37ZLxs2ZD1aoTxu SR+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=wVZ24DzQvUFfordsi0jdYSP3k0BHR1mWNqJH5cBzYTo=; b=nxofmzJxaLwYvofYUb/x35J93J1ExKDejuKARQayrx4NpsaTW7nxgT+Dg6TcQo5LrP Jm53Oxmfz9+YS9iXuVeuB0fL9uYMulCGhQmYXlJMykzgTm+PMhIQJRl7hC4tGeqdctYS KVhUP42mzq3H1mjIk4YqcgI+qEpMeiW2QoqLc+K7aYGs8xE0BszOAkBu1IgHReTdrD+A xoSmIwM6DRNtJn8Wdro7m29X9AnYzIzDqPG3zKUddrdmY9rU6JKf6pabxNMH8ZJJqbaC K6egJNrc7SGjqIpEBg/4Tdq5h3iboxUs5p+xzJv+FTQyMJk//xiuc7PK2HSkw7FNRmmB BvgQ== X-Gm-Message-State: AOAM530PgYC6U3OvHrLeqjqF5BPLWCbDdsArmAjXhWSjtXtOIQA/7qCl MHk0kaB0nea7LCnuZoTwk7I3bK2J3aX4qnChj71qZ0iUyA6iGQ== X-Google-Smtp-Source: ABdhPJymCD4Au/aaQ7lWDJkisS20rF3e+vNX+nMXPd3hXsBP4LSVu6zflXGJWKXehGHEGGeTls/AjZCegK2nozBUnoc= X-Received: by 2002:a05:6e02:1447:: with SMTP id p7mr3863299ilo.93.1611377899661; Fri, 22 Jan 2021 20:58:19 -0800 (PST) MIME-Version: 1.0 From: Paul Hirst Date: Fri, 22 Jan 2021 18:58:03 -1000 Message-ID: Subject: split -n K/N loses data, sum of output files is smaller than input file. To: bug-coreutils@gnu.org Content-Type: multipart/alternative; boundary="0000000000004f03d305b98a27d5" Received-SPF: pass client-ip=2607:f8b0:4864:20::d2a; envelope-from=paul@phirst.org; helo=mail-io1-xd2a.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_05=-0.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 23 Jan 2021 03:25:38 -0500 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: -2.3 (--) --0000000000004f03d305b98a27d5 Content-Type: text/plain; charset="UTF-8" split --number K/N appears to lose data in, with the sum of the sizes of the output files being smaller than the original input file by 131072 bytes. $ split --version split (GNU coreutils) 8.30 ... $ head -c 1000000 < /dev/urandom > test.dat $ split --number=1/4 test.dat > t1 $ split --number=2/4 test.dat > t2 $ split --number=3/4 test.dat > t3 $ split --number=4/4 test.dat > t4 $ ls -l -rw-r--r-- 1 user user 250000 Jan 22 18:36 t1 -rw-r--r-- 1 user user 250000 Jan 22 18:36 t2 -rw-r--r-- 1 user user 250000 Jan 22 18:36 t3 -rw-r--r-- 1 user user 118928 Jan 22 18:36 t4 -rw-r--r-- 1 user user 1000000 Jan 22 18:33 test.dat Surely this should not be the case? Paul --0000000000004f03d305b98a27d5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
split --number K/N appears to lose data in, with the = sum of the sizes of the output files being smaller than the original input = file by 131072 bytes.

$ split --versionsplit (GNU coreutils) 8.30
...

$ head = -c 1000000 < /dev/urandom > test.dat
$ split --number=3D1/4= test.dat > t1
$ split --number=3D2/4 test.dat > t2
$ split --number=3D3/4 test.dat > t3
$ split --number=3D4/4= test.dat > t4

$ ls -l
-rw-r--r-- 1 user use= r=C2=A0 250000 Jan 22 18:36 t1
-rw-r--r-- 1 user user=C2=A0 250000 Jan 2= 2 18:36 t2
-rw-r--r-- 1 user user=C2=A0 250000 Jan 22 18:36 t3
-rw-r-= -r-- 1 user user=C2=A0 118928 Jan 22 18:36 t4
-rw-r--r-- 1 user user 100= 0000 Jan 22 18:33 test.dat

Surely this should not = be the case?

Paul
--0000000000004f03d305b98a27d5-- ------------=_1611584522-11996-1-- From unknown Tue Jun 17 01:34:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46048: split -n K/N loses data, sum of output files is smaller than input file. Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 08 Feb 2021 13:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46048 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 46048@debbugs.gnu.org Cc: Paul Hirst Received: via spool by 46048-submit@debbugs.gnu.org id=B46048.161279247930365 (code B ref 46048); Mon, 08 Feb 2021 13:55:01 +0000 Received: (at 46048) by debbugs.gnu.org; 8 Feb 2021 13:54:39 +0000 Received: from localhost ([127.0.0.1]:50169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l96zu-0007tg-Sh for submit@debbugs.gnu.org; Mon, 08 Feb 2021 08:54:39 -0500 Received: from mail-wm1-f41.google.com ([209.85.128.41]:37117) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l96zr-0007tP-0k for 46048@debbugs.gnu.org; Mon, 08 Feb 2021 08:54:37 -0500 Received: by mail-wm1-f41.google.com with SMTP id m1so13322429wml.2 for <46048@debbugs.gnu.org>; Mon, 08 Feb 2021 05:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=vlkEqojDzDXmaxCsOXuACVAXPMLz6aCRuxkfgki1sqY=; b=bkfCENcMfheFQ2Ndl7oE/ThNz+m9tlIQX8ImV3cti2qjrZFRJjEnR/iWVJLG7l46H6 808zqLFKc1f8/w0+GBW+GChxygPrFmvSiWZc4mdpPgffA88SETo0fAE3W6Zr4dOHQ/C+ //WWfAUoH+pz0/IVzrl9MLcyn9G/rnWbA/jTalvyorquSoMl280tpRcZuWI7QdXbtHQd EMAKfS8AedRf1mpkLT4QAVH5u6+/z688TU0dZPJiFu1Un0rhOcamejDpMf0RUbs2WZjC JEybbVfUo4Y/c2KjkZon6xcC61x+HjH0WvwyCqy6aDWJdNwCxG66aZQcjWdFNBgsId0V sKEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vlkEqojDzDXmaxCsOXuACVAXPMLz6aCRuxkfgki1sqY=; b=tRqV+xeAtfOBPLSs46K+hEwe1ZWxklf4Sqco8S7UKbhyt930Wjtx+APZRCglbSWKsV XlSm4AmFwfQ/DR1Rp8Vxr7fnMDIZkTTvieA3j61ev9Li4qEgYeX07ivSjMwkaCtk1SEk rqLjVNUQcTs5OGI89SMAqWpQgYUMNTWlTJndOoKQ/DbcP5lvlhRChPZpASfqD/9RyjHQ LaBplNv32t12TIZ1vpx3BgwG1W/c8lohdRzSnT0t+nTihrp59u2Ccljx88b84xUGKRq1 OnSQGze5sFU8DlOhNDszpj3FRVyZqEGx5nqmUizGObUbhrxawn6yDETyNcOEvVq8p4Fs 0lSA== X-Gm-Message-State: AOAM533YA6uWo7ReVy9k2t+1v1qPm19CrGFDv2rildSBn9MTQEjJ8kD2 hUzhVK004QUTfPMBrGenbaPzsmw2EOU= X-Google-Smtp-Source: ABdhPJzIqi7HEKpkfe8ZzvWjWaWpMRWOGqsVAqqanILIr7zXIHmRQjq0hUnja4kqcDb66zLTELAsaQ== X-Received: by 2002:a1c:5f54:: with SMTP id t81mr14350870wmb.160.1612792468862; Mon, 08 Feb 2021 05:54:28 -0800 (PST) Received: from localhost.localdomain (86-42-14-227-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.14.227]) by smtp.googlemail.com with UTF8SMTPSA id r11sm22248377wmh.9.2021.02.08.05.54.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Feb 2021 05:54:28 -0800 (PST) From: =?UTF-8?Q?P=C3=A1draig?= Brady References: <4f858cd0-19e4-d159-c2e7-51b3aad0b3b0@draigBrady.com> Message-ID: <295ad525-5f08-2a52-00f7-f33e4f2dc2f8@draigBrady.com> Date: Mon, 8 Feb 2021 13:54:27 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: <4f858cd0-19e4-d159-c2e7-51b3aad0b3b0@draigBrady.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) 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: -0.8 (/) On 25/01/2021 14:21, Pádraig Brady wrote: > On 24/01/2021 19:55, Paul Eggert wrote: >> On 1/24/21 8:52 AM, Pádraig Brady wrote: >>> -      if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0) >>> +      if (lseek (STDIN_FILENO, start, SEEK_SET) < 0) >> >> Dumb question: will this handle the case where you're splitting from >> stdin and stdin is a seekable file and its initial file offset is nonzero? > > Right. Following on the logic from input_file_size(), > I'm going with the attached, which I'll push later. > Marking this as done. Note this fix has now propagated to Fedora builds, and is in the process of propagating to RHEL/Centos. I've just logged a debian bug also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=982300 cheers, Pádraig