Bug 274247 - mandoc produce noise on empty input
Summary: mandoc produce noise on empty input
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 15.0-CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks: 274423
  Show dependency treegraph
 
Reported: 2023-10-03 15:47 UTC by Wolfram Schneider
Modified: 2023-12-28 15:46 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfram Schneider freebsd_committer freebsd_triage 2023-10-03 15:47:36 UTC
For empty input, mandoc produce 3 lines output with brackets:

$ mandoc < /dev/null | wc -l
       3


$ mandoc < /dev/null        
()                                                                          ()

                                                                            ()


this looks strange.

GNU groff works fine: 
$ nroff -mandoc  < /dev/null  | wc -l
       0
Comment 1 Graham Perrin 2023-10-03 20:00:34 UTC
% mandoc < /dev/null | wc -l
       3
% sh
$ mandoc < /dev/null | wc -l
       3
$ uname -aKU
FreeBSD mowa219-gjp4-8570p-freebsd 15.0-CURRENT FreeBSD 15.0-CURRENT #15 main-n265538-915af883221a: Tue Sep 26 14:50:08 BST 2023     grahamperrin@mowa219-gjp4-8570p-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 1500001 1500000
$
Comment 2 Graham Perrin 2023-10-03 20:02:36 UTC
Sorry, ignore my comment 1. 

(In reply to Wolfram Schneider from comment #0)

> For empty input, 

I get the same.
Comment 3 Baptiste Daroussin freebsd_committer freebsd_triage 2023-10-13 07:30:32 UTC
patch sent upstream.
Comment 4 Ingo Schwarze 2023-10-13 11:47:54 UTC
Upstream talking here...

Why do you want this?
What is so special about empty input compared to other non-manual-page input that you want special handling for one but not for the other?

For example, doas it matter for you what

  echo foo | mandoc

does, and if it matters, why does that matter for you?

While mandoc(1) usually strives for groff compatibility *inside manual pages*, handling arbitrary low-level roff(7) input *outside manual pages* is not among the goals of mandoc(1).

I'm not saying what you are asking for is unreasonable.  What i'm trying to say is that i need to understand what you need this for before i can make up my mind whether and how your goals might be reached.  Bapt@'s very ad-hoc patch does not strike me as particularly useful as far as i can see so far.