Hi, sorry, me again, this also affects .TS requests in mdoc mode,
and minimises to:
-- >8 --
.TS
l .
a
.TE
-- >8 --
which dies as such:
-- >8 --
$ { echo '.TS'; echo 'l .'; echo 'a'; echo '.TE'; } | mandoc -Tman -mdoc
.\" Automatically generated from an mdoc input file.  Do not edit.
.TH "UNTITLED" "" "July 3, 2021" "" "LOCAL"
.nh
mandoc: mdoc_man.c:300: mdoc_man_act: Assertion `tok >= MDOC_Dd && tok <= 
MDOC_MAX' failed.
Aborted
-- >8 --
(original and minimal pages attached)

Attaching GDB yields, rather similarly,
  tok = TOKEN_NONE, type = ROFFT_TBL,

Would it make sense to pass tbl(7) and eqn(7) through,
like it's done in man input mode?

Best,
наб
.TS
l .
a
.TE
.\" SPDX-License-Identifier: 0BSD
.\"
.Dd
.Dt SHA1SUM 1
.Os
.
.Sh NAME
.Nm sha*sum , b2sum , md5sum
.Nd generate or verify cryptographic hashes
.Sh SYNOPSIS
.Nm sha1sum
.Op Fl ztb
.Op Fl -tag
.Oo Ar file Oc Ns …
.Nm sha224sum
.Op Fl ztb
.Op Fl -tag
.Oo Ar file Oc Ns …
.Nm sha256sum
.Op Fl ztb
.Op Fl -tag
.Oo Ar file Oc Ns …
.Nm sha384sum
.Op Fl ztb
.Op Fl -tag
.Oo Ar file Oc Ns …
.Nm sha512sum
.Op Fl ztb
.Op Fl -tag
.Oo Ar file Oc Ns …
.Nm b2sum
.Op Fl ztb
.Op Fl l Ar BITS
.Op Fl -tag
.Oo Ar file Oc Ns …
.Nm md5sum
.Op Fl ztb
.Op Fl -tag
.Oo Ar file Oc Ns …
.Pp
.Nm sha1sum
.Fl c
.Op Fl w
.Op Fl -strict
.Op Fl -quiet
.Op Fl -status
.Op Fl -ignore-missing
.Oo Ar file Oc Ns …
.Nm sha224sum
.Fl c
.Op Fl w
.Op Fl -strict
.Op Fl -quiet
.Op Fl -status
.Op Fl -ignore-missing
.Oo Ar file Oc Ns …
.Nm sha256sum
.Fl c
.Op Fl w
.Op Fl -strict
.Op Fl -quiet
.Op Fl -status
.Op Fl -ignore-missing
.Oo Ar file Oc Ns …
.Nm sha384sum
.Fl c
.Op Fl w
.Op Fl -strict
.Op Fl -quiet
.Op Fl -status
.Op Fl -ignore-missing
.Oo Ar file Oc Ns …
.Nm sha512sum
.Fl c
.Op Fl w
.Op Fl -strict
.Op Fl -quiet
.Op Fl -status
.Op Fl -ignore-missing
.Oo Ar file Oc Ns …
.Nm b2sum
.Fl c
.Op Fl l Ar BITS
.Op Fl w
.Op Fl -strict
.Op Fl -quiet
.Op Fl -status
.Op Fl -ignore-missing
.Oo Ar file Oc Ns …
.Nm md5sum
.Fl c
.Op Fl w
.Op Fl -strict
.Op Fl -quiet
.Op Fl -status
.Op Fl -ignore-missing
.Oo Ar file Oc Ns …
.
.Sh DESCRIPTION
Without
.Fl c ,
hash
.Ar file Ns s Pq the standard input stream if Qo Sy - Qc , the default ,
writing the hashes to the standard output stream.
With
.Fl c ,
verify a hash set from
.Ar file Ns s Pq likewise ,
against on-disk state.
.Pp
.TS
lb lb lb lb
l l l l l .
Program Digest  Standard        Length
_
\fBsha1sum\fP   SHA-1   FIPS PUB 180    160 bits        avoid use in security 
applications
\fBsha224sum\fP, \fBsha256sum\fP,
\fBsha384sum\fP, \fBsha512sum\fP        SHA-2   FIPS PUB 180-2  respective
\fBb2sum\fP     BLAKE2b RFC 7693        8-512 bits
\fBmd5sum\fP    MD5     RFC 1321        128 bits        \fINOT\fP suitable for 
any application
.TE
.
.Ss Generation
When run without
.Fl c
nor
.Fl -tag ,
a listing is produced in the following form:
.Bd -literal -compact -offset Ds
.Li $ Nm sha1sum Li README.md
.Li 22eb73bd30d47540a4e05781f0f6e07640857cae Sy "\ " Ns Ar LICENCE
.Ed
With
.Fl b ,
an asterisk replaces the second space:
.Bd -literal -compact -offset Ds
.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm sha1sum Fl b
.Li 33210013f52127d6ada425601f16bbb62e85f3be Sy "*" Ns Ar -
.Ed
.Pp
With
.Fl -tag ,
the output is in the form
.Bd -literal -compact -offset Ds
.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm sha1sum Fl -tag Li LICENCE -
.Sy SHA1 Ns Li \&( Ns Ar LICENCE Ns Li )\& Sy = Li 
bd25664d6e803060dcb31bfdd9642ba9d8a3f1b9
.Sy SHA1 Ns Li \&( Ns Ar - Ns Li )\& Sy = Li 
33210013f52127d6ada425601f16bbb62e85f3be
.Ed
A dash and width in bits is appended for non-default digest lengths:
.Bd -literal -compact -offset Ds
.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm b2sum Fl -tag l Ar 96
.Sy BLAKE2b- Ns Ar 96 Ns Li \&( Ns Ar - Ns Li )\& Sy = Li 
386b90bea2a1e566249cdb96
.Ed
.Pp
If the filename contains a backslash or newline characters, they're replaced 
with
.Qq Sy \e\e
and
.Qq Sy \en ,
respectively, and a backslash is prepended to the line:
.Bd -literal -compact -offset Ds
.Li $ Nm echo Li 'trademark of AT&T' Sy > Li \&"$(printf 'UNIX\enregistered')"
.Li $ Nm sha1sum Li \&"$(printf 'UNIX\enregistered')"
.Sy \e Ns Li 7390a4a0bfb7c6da55d6f5f3db4e42c534271363 Sy "\ " Ns Ar 
UNIX\enregistered
.Li $ Nm sha1sum Fl -tag Li \&"$(printf 'UNIX\enregistered')"
.Sy \eSHA1 Ns Li \&( Ns Ar UNIX\enregistered Ns Li )\& Sy = Li 
7390a4a0bfb7c6da55d6f5f3db4e42c534271363
.Ed
With
.Fl z ,
lines are separated by NUL bytes and escaping does not occur.
.
.Ss Verification
With
.Fl c ,
the
.Ar file Ns s
are instead the output in the default format:
lines consisting of a nonzero, even amount of hexadecimal digits (any case), a 
space, a space or an asterisk and a filename
(if the first character of a line is a backslash, it's skipped and the filename 
is de-escaped).
With
.Fl w ,
an error is written to the standard error stream for each invalid line.
With
.Fl -strict ,
invalid lines yield a non-zero exit code.
Be wary of using
.Qq Sy -
.Ar file Ns s
and
.Qq Sy -
hashed files.
.Pp
For each valid line, the file is hashed, compared to the listed hash, and a 
verdict is issued to the standard output stream:
.Dl Ar file Ns Sy \&: Ar verdict comment
Where
.Ar verdict
is either
.Sy OK
or
.Sy FAILED ,
and the
.Ar comment
is
.Sy (I/O)
if the file couldn't be hashed (a diagnostic is also issued in this case).
If
.Fl -ignore-missing
is specified and the error is
.Er ENOENT ,
the file is silently ignored.
With
.Fl -quiet ,
.Ar verdict Ns s
of
.Sy OK
are skipped.
.Pp
After each
.Ar file ,
a summary is printed to the standard error stream if it had any errors.
.Pp
With
.Fl -status ,
all output, except for diagnostics, is suppressed.
.Pp
Consider the following shell session:
.Bd -literal -compact -offset Ds
.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm sha1sum Li LICENCE - \&"$(printf 
'UNIX\enregistered')" Sy \&| Nm tee Ar sum
.Li 22eb73bd30d47540a4e05781f0f6e07640857cae Sy " " Ns Ar LICENCE
.Li 33210013f52127d6ada425601f16bbb62e85f3be Sy " " Ns Ar -
.Sy \e Ns Li 7390a4a0bfb7c6da55d6f5f3db4e42c534271363 Sy " " Ns Ar 
UNIX\enregistered

.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm sha1sum Fl c Ar sum Ns Sy \&; Nm echo Li 
$?
.Li LICENCE : Sy OK
.Li - : Sy OK
.Li UNIX\enregistered : Sy OK
0

.Li $ Nm rm Ar UNIX* LICENCE
.Li $ Nm ln Fl s Ar LICENCE LICENCE
.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm sha1sum Fl c Ar sum Ns Sy \&; Nm echo Li 
$?
.Nm sha1sum : Ar sum : Li LICENCE: Too many levels of symbolic links
.Li LICENCE : Sy FAILED (I/O)
.Li - : Sy OK
.Nm sha1sum : Ar sum : Li UNIX\enregistered: \&No such file or directory
.Li UNIX\enregistered : Sy FAILED (I/O)
.Nm sha1sum : Ar sum : Li 1/3 files OK (2 missing, 0 bad lines)
1

.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm sha1sum Fl c -ignore-missing Ar sum Ns Sy 
\&; Nm echo Li $?
.Nm sha1sum : Ar sum : Li LICENCE: Too many levels of symbolic links
.Li LICENCE : Sy FAILED (I/O)
.Li - : Sy OK
.Nm sha1sum : Ar sum : Li 2/3 files OK (2 missing, 0 bad lines)
1

.Li $ Nm sed Fl i Ns Ar B Li 's/22eb73bd/22eb73bd /' Ar sum
.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm sha1sum Fl c -ignore-missing Ar sum Ns Sy 
\&; Nm echo Li $?
.Li - : Sy OK
.Nm sha1sum : Ar sum : Li 2/2 files OK (1 missing, 1 bad lines)
0

.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm sha1sum Fl c -ignore-missing -quiet Ar 
sum Ns Sy \&; Nm echo Li $?
.Nm sha1sum : Ar sum : Li 2/2 files OK (1 missing, 1 bad lines)
0

.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm sha1sum Fl cw -ignore-missing -quiet Ar 
sum Ns Sy \&; Nm echo Li $?
.Nm sha1sum : Ar sum : Li 1: invalid line
.Nm sha1sum : Ar sum : Li 2/2 files OK (1 missing, 1 bad lines)
0

.Li $ Nm echo Qo POSIX.2 Qc Sy \&| Nm sha1sum Fl cw -ignore-missing -quiet 
-strict Ar sum Ns Sy \&; Nm echo Li $?
.Nm sha1sum : Ar sum : Li 1: invalid line
.Nm sha1sum : Ar sum : Li 2/2 files OK (1 missing, 1 bad lines)
1
.Ed
.
.Sh OPTIONS
.Bl -tag -compact -width "-l, --length=BITS"
.It Fl l , -length Ns Sy = Ns Ar BITS
For variable-length hashes
.Pq BLAKE2b ,
select the digest length.
Must be a positive multiple of
.Em 8
and fall within the algorithm's domain.
Default: maximum.
.El
.Pp
For generation:
.Bl -tag -compact -width "-l, --length=BITS"
.It Fl z , -zero
Separate lines with the NUL byte and suppress filename escaping.
.It Fl t , -text
Prefix filename with a space in the default output format.
This is the default.
.It Fl b , -binary
Prefix filename with an asterisk in the default output format.
.It Fl -tag
Use the alternative output format.
.El
.Pp
For verification:
.Bl -tag -compact -width "-l, --length=BITS"
.It Fl c , -check
Verify
.Ar file Ns s .
Implies
.Fl b .
.It Fl w , -warn
Write errors for invalid lines.
.It Fl -strict
Exit nonzero for invalid lines.
.It Fl -quiet
Skip printing
.Sy OK
verifications.
.It Fl -status
Suppress all output (the exit status remains unchanged).
.It Fl -ignore-missing
Completely ignore files that don't exist.
.El
.
.Sh EXIT STATUS
.Sy 1
if
one of the
.Ar file Ns s
didn't exist,
an invalid line was encountered with
.Fl -strict ,
or
a file failed verification (its hash was different than listed).
.
.Sh SEE ALSO
.Bl -tag -compact -width "BLAKE2"
.It BLAKE2
.Lk http://tools.ietf.org/html/7693 "RFC 7693"
.It MD5
.Lk http://tools.ietf.org/html/1321 "RFC 1321"
.It SHA
.Lk https://csrc.nist.gov/publications/detail/fips/180/4/final "FIPS PUB 180-4"
.El
.
.Sh HISTORY
Оriginates from the GNU system.
.Nm b2sum
appeared in coreutils 8.26.
.Pp
The handling of the
.Fl c
output options is more fine-grained than on the GNU system, which has a 
tendency to only use the final one.
.Pp
The
.Fl -tag
format, indicating the algorithm, appeared in coreutils 8.20 as a "BSD-style" 
checksum.
It's not clear what that means.
.Pp
Do not rely on the format of
.Ar comment
or the
.No end-of- Ns Ar file
summary across systems.
.Pp
.Fl tb
have no effect on UNIX, as it doesn't have file (description) types.
The distinction is purely cosmetic.

Attachment: signature.asc
Description: PGP signature

Reply via email to