Bug 24841

Summary: "split" sets wrong restrictions for suffix length
Product: Sisyphus Reporter: Sergey Vlasov <vsu>
Component: coreutilsAssignee: placeholder <placeholder>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: major    
Priority: P3 CC: glebfm, ldv, mike, placeholder
Version: unstable   
Hardware: all   
OS: Linux   
URL: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7759
Attachments:
Description Flags
proposed fix none

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).