Package: coreutils
Version: 9.1-1
Severity: normal

Dear Maintainer,

POSIX very clearly says (Issue 8 Draft 2.1, same as Issue 7):
100982  The nl utility views the text it reads in terms of logical pages. Line 
numbering shall be reset at
100983  the start of each logical page. A logical page consists of a header, a 
body, and a footer section.
100984  Empty sections are valid. Different line numbering options are 
independently available for
100985  header, body, and footer (for example, no numbering of header and 
footer lines while
100986  numbering blank lines only in the body).

100987 The starts of logical page sections shall be signaled by input lines 
containing nothing but the
100988 following delimiter characters:
100989   Line     Start of
100990   \:\:\:   Header
100991   \:\:     Body
100992   \:       Footer
100993 Unless otherwise specified, nl shall assume the text being read is in a 
single logical page body.

101021  −p  Specify that numbering should not be restarted at logical page 
delimiters.


Indeed, both illumos-gate nl and SysVr4 nl behave like this:
-- >8 --
$ printf '%s\n' a '\:\:\:' b '\:\:' c '\:' d '\:\:\:' e '\:\:\:' f | ./a.out 
-ht -ft
     1  a

     1  b

     2  c

     3  d

     1  e

     1  f
$ printf '%s\n' a '\:\:\:' b '\:\:' c '\:' d '\:\:\:' e '\:\:\:' f | ./a.out 
-ht -ft -p
     1  a

     2  b

     3  c

     4  d

     5  e

     6  f
-- >8 --

But coreutils nl resets the line number at the start of each section?
-- >8 --
$ printf '%s\n' a '\:\:\:' b '\:\:' c '\:' d '\:\:\:' e '\:\:\:' f | nl -ht -ft
     1  a

     1  b

     1  c

     1  d

     1  e

     1  f
$ printf '%s\n' a '\:\:\:' b '\:\:' c '\:' d '\:\:\:' e '\:\:\:' f | nl -ht -ft 
-p
     1  a

     2  b

     3  c

     4  d

     5  e

     6  f
-- >8 --


Best,
наб

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

Kernel: Linux 6.1.0-2-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-3
ii  libattr1     1:2.5.1-4
ii  libc6        2.36-9
ii  libgmp10     2:6.2.1+dfsg1-1.1
ii  libselinux1  3.4-1+b5

coreutils recommends no packages.

coreutils suggests no packages.

-- no debconf information

Attachment: signature.asc
Description: PGP signature

Reply via email to