Bug 24841 - "split" sets wrong restrictions for suffix length
Summary: "split" sets wrong restrictions for suffix length
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: coreutils (show other bugs)
Version: unstable
Hardware: all Linux
: P3 major
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL: http://debbugs.gnu.org/cgi/bugreport....
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-29 23:47 MSK by Sergey Vlasov
Modified: 2010-12-31 02:05 MSK (History)
4 users (show)

See Also:


Attachments
proposed fix (3.44 KB, patch)
2010-12-30 13:40 MSK, Pádraig Brady
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Vlasov 2010-12-29 23:47:28 MSK
coreutils-8.8-alt1

$ split -b 1024 -a 2
split: the suffix length needs to be at least 3
$ split -b 1G -a 2  
split: the suffix length needs to be at least 7

Without the explicit "-a 2" option the suffix length is set to some value depending on the "-b" option value. This behavior is obviously wrong (the suffix length should not depend on the block size) and violates POSIX (which specifies that the default suffix length is 2).

Looks like the block size is handled as the number of blocks somewhere.
Comment 1 Dmitry V. Levin 2010-12-30 00:12:33 MSK
Regression due to commit v8.7-25-gbe10739.
Comment 2 Dmitry V. Levin 2010-12-30 03:20:29 MSK
$ yes y | head -n340 | split -b 1
split: output file suffixes exhausted
$ split -a 2 -b 1E < /dev/null
split: the suffix length needs to be at least 13

Very nice bug indeed.
Comment 3 Pádraig Brady 2010-12-30 13:40:37 MSK
Created attachment 4727 [details]
proposed fix
Comment 4 Dmitry V. Levin 2010-12-30 20:19:21 MSK
(In reply to comment #3)
> Created an attachment (id=4727) [details]
> proposed fix

v8.8-7-g44dbcae works correct, thanks.
Comment 5 Repository Robot 2010-12-30 20:33:04 MSK
coreutils-8.8-alt2 -> sisyphus:

* Thu Dec 30 2010 Dmitry V. Levin <ldv@altlinux> 8.8-alt2
- Updated coreutils to v8.8-7-g44dbcae (closes: #24841).