swaywm / swayidle

Idle management daemon for Wayland
MIT License
550 stars 50 forks source link

`‐` in the man page is not equal to `-` used in CLI args #148

Closed zefr0x closed 1 year ago

zefr0x commented 1 year ago

(HYPHEN) is U+2010 while - (HYPHEN-MINUS) is U+002D.

For example, if I copy before‐sleep option from the man page (it will have U+2010), it will not work and it will give me Unsupported command 'before‐sleep' error, because the characters are not the same.

This might be an issue with scdoc since in the source code U+002D is used and I found this happening with other man pages generated using it.

kennylevinsen commented 1 year ago

scdoc generates roff output, which your man package reads. On systems with GNU userspace, groff is used which is known to do other weird things like turning ~ in sr.ht urls into ˜, so I wouldn't be surprised if that was the culprit here as well.

Could you check the scdoc roff output (scdoc < input.scd > output.roff) for the U+2010, and then check that file with man (man ./output.roff) to see where the symbol appears?

zefr0x commented 1 year ago

I'm using ArchLinux, which is a GNU userspace and groff is used by the man-db package.


Could you check the scdoc roff output (scdoc < input.scd > output.roff) for the U+2010, and then check that file with man (man ./output.roff) to see where the symbol appears?

When using input.scd with U+2010 in it, scdoc will give an error:

Error at 1:2: Name characters must be A-Z, a-z, 0-9, `-`, `_`, or `.`

and output.roff will contain:

.\" Generated by scdoc 1.11.2
.\" Complete documentation for this program is not available as a GNU info page
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.nh
.ad l
.\" Begin generated content:
smlx commented 1 year ago

groff distinguishes between different similar hyphen characters. I don't know if scdoc supports compatible roff output.

For best results in roff systems, use the “-” character in input outside an escape sequence only to mean a hyphen, as in the phrase “long-term”. For a minus sign in running text or a Unix command-line option dash, use \- (or \[-] in groff if you find it helps the clarity of the source document).

https://man7.org/linux/man-pages/man7/groff_char.7.html

rpigott commented 1 year ago

Until recently, Arch transformed hyphen to minus for man pages with a custom troff transform in /usr/share/groff/site-tmac/man.local. It was changed not to include this fixup in more recent packages of groff on Arch though.

rpigott commented 1 year ago

This has since been corrected in groff 1.23.0-5 on Arch.

[1] https://bugs.archlinux.org/task/79664

smlx commented 1 year ago

This is not fixed on any other distro than Arch though, right?

rpigott commented 1 year ago

It was only a problem on Arch to begin with I thought? It happened because they dropped a section from man.local two releases ago and it was re-added in the latest release.

smlx commented 1 year ago

Oh, right you are. I thought I reproduced this on Debian, but I cannot do so now. My mistake, sorry for the noise.