Package: coreutils
Version: 9.1-1
Severity: normal

Dear Maintainer,

Consider the standard repetition:
-- >8 --
$ seq 999 | csplit - /10/1 {99}
21
271
8
8
8
8
8
400
400
400
400
400
400
400
400
csplit: ‘/10/1’: match not found on repetition 15
356
$ seq 999 | csplit - 88 {99}
252
340
352
352
352
352
352
352
352
352
352
csplit: ‘88’: line number out of range on repetition 11
128
-- >8 --

Good! POSIX agrees:
  An error shall be reported if an operand does not reference
  a line between the current position and the end of the file.
(the operand being /10/1 or 88, resp., as re-applied via {99}).

So why, then:
-- >8 --
$ seq 999 | csplit - /10/1 {*}
21
271
8
8
8
8
8
400
400
400
400
400
400
400
400
356
$ seq 999 | csplit - 88 {*}
252
340
352
352
352
352
352
352
352
352
352
csplit: ‘88’: line number out of range on repetition 11
128
-- >8 --

The manual defines {*} as
  {*}    repeat the previous pattern as many times as possible
but then inconsistently uses it as
  88    {∞}
  /10/1 {until no more matches}

Best,
наб

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: x32 (x86_64)
Foreign Architectures: amd64, i386

Kernel: Linux 6.0.0-6-amd64 (SMP w/2 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages coreutils depends on:
ii  libacl1      2.3.1-2
ii  libattr1     1:2.5.1-3
ii  libc6        2.36-7
ii  libgmp10     2:6.2.1+dfsg1-1.1
ii  libselinux1  3.4-1+b4

coreutils recommends no packages.

coreutils suggests no packages.

-- no debconf information

Attachment: signature.asc
Description: PGP signature

Reply via email to