Hi Colin, On Tue, Aug 26, 2025 at 06:33:23PM +0100, Colin Watson wrote: > > Hmmmm, that sounds not good at all. How about moving this to man(1)? > > That is, man(1) knows whether it is being piped or not, and thus can > > tell groff(1) to do OSC8 or not. And even for the case of the terminal, > > it is in a better position to pass the information to groff(1); we'd > > still need points 1 (modified for man(1)) and 2, but not 3, which is > > very ugly. > > Doesn't man(1) have most of the same problem?
The difference in man(1) is that it controls the entire pipeline, while in groff, troff(1) doesn't still know which output device you'll be using. So, you don't have problem 3. > It needs to know whether the > terminal emulator supports OSC 8, and I'm not aware of a way that it could > discover that at the moment; it's not just a question of whether it's piped. > I don't think that "put it in man-db's configuration file" or "require a > command-line option" would be particularly friendly solutions to that > problem. Yes, you can't currently implement a check to know if the terminal supports OSC 8. But whenever terminals have a way to tell you if they support OSC 8, you're in a better position to pass -rU0 to the entire groff(1) pipeline. And at the moment, you can at least already check if stdout is a pipe, and pass -rU0 if it is, which would at least improve the output for when I do `man foo | cat`, for example. It doesn't fix terminals, but it fixes pipes. So, maybe call isatty(3), and if it returns 0, pass -rU0 to groff(1)? > If points 1 and 2 were handled in groff, then I wouldn't be necessarily > opposed to having man(1) tell the formatter that rendered hyperlinks are > acceptable, but it's not an area I'm all that familiar with. I'd be happy > to review patches provided that they retain compatibility with reasonably > old groff versions (man-db currently supports groff >= 1.21). Thanks! > I could of course have man(1) unconditionally pass -rU0 to groff until the > problem is resolved properly, which would at least preserve existing > behaviour for users of unreleased groff 1.24. I'm not sure whether that > would be considered as playing Core War with the manual page system ... Hmmm, I don't know. I think that would be more easily fixed in the Debian package of groff(1). Have a lovely night! Alex -- <https://www.alejandro-colomar.es/>
signature.asc
Description: PGP signature