Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Man pages: fix broken tables #18678

Merged

Conversation

edsantiago
Copy link
Member

@edsantiago edsantiago commented May 24, 2023

Work around a go-md2man bug, and add a check script to make sure
this doesn't hit us again.

Background: go-md2man can't deal with a left-hand column > 31 chars.
It produces man pages that look like:

| Something With >31 Character |                |
|                              | ..description  |

(should be all on one row). It also has trouble when the vertical
bars are misaligned: it completely removes the right-hand side.

There's almost certainly a better solution: fix go-md2man, or
use a different conversion tool, or maybe even pre/postprocess.
But this is a quick interim solution.

Sorry for the perl. This could be done in bash/sed/awk/grep,
but not with any sort of sane error messages.

Signed-off-by: Ed Santiago [email protected]

Fix broken tables in man pages

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 24, 2023
@edsantiago edsantiago marked this pull request as draft May 24, 2023 19:35
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 24, 2023
@edsantiago edsantiago force-pushed the gomd2man-workaround branch from 61bd3ac to 0056eca Compare May 24, 2023 20:52
@edsantiago
Copy link
Member Author

This is what the script output looks like on main right now:

man-page-table-check: docs/build/man/podman-events.1:
          |podman-inspect as described above |                                |

man-page-table-check: docs/build/man/podman-images.1:
          |digest       |                            |

man-page-table-check: docs/build/man/podman-network-ls.1:
          |regex).  |                            |

man-page-table-check: docs/build/man/podman-pod-create.1:
          |kube play.  |                            |

man-page-table-check: docs/build/man/podman-save.1:
          |docker load(1) (the default)                      |                            |
          |docker-dir                                        |                            |
          |dir transport (see                                |                            |
          |containers-transports(5)) with v2s2 manifest type |                            |

man-page-table-check: docs/build/man/podman-system-connection-list.1:
          |host[:port]                               |                            |
          |Unix domain socket[?secure=True], unix:// |                            |
          |Unix domain socket, and tcp://localhost[: |                            |
          |port]                                     |                            |

man-page-table-check: docs/build/man/podman-systemd.unit.5:
          |HealthStartupCmd="/usr/bin/command"                                 |                                                               |
          |                                                                    | --health-startup-cmd="/usr/bin/command"                       |
          |Mount=type=bind,source=/path/on/host,destination=/path/in/container |                                                               |
          |                                                                    | --mount                                                       |
          |PodmanArgs=--annotation=key=value |                              |
          |                                  | --annotation=key=value       |

man-page-table-check: found empty cells in the above man page(s)

This is a bug in go-md2man: it gets really confused when it sees
markdown characters inside tables, and splits those into multiple
rows, and yields unreadable man pages.

WORKAROUND: find the above line(s) in the docs/source/markdown
file, look for '*' or '-' or '<' or '`' (backtick), and remove them.
Look for '.' (dot), and backslash-escape them. Keep regenerating
docs until it passes:

    $ make -C docs clean;make docs

@edsantiago edsantiago marked this pull request as ready for review May 24, 2023 22:31
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 24, 2023
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 25, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edsantiago, vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [edsantiago,vrothberg]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Luap99
Copy link
Member

Luap99 commented May 25, 2023

Is this bug reported somewhere? I think it would make sense to fix it in go-md2man.

@edsantiago
Copy link
Member Author

I don't know if it's a known bug; it's on my low-priority TODO list to check and report it.

@edsantiago edsantiago marked this pull request as draft May 25, 2023 11:03
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 25, 2023
@edsantiago
Copy link
Member Author

Drafting again, to let #18671 go first

@edsantiago edsantiago force-pushed the gomd2man-workaround branch from 0056eca to 675de8d Compare May 25, 2023 20:21
@rhatdan
Copy link
Member

rhatdan commented May 26, 2023

LGTM. It would be nice to fix md2man, but for now this is good.

Update the PR and we can get this in.

Work around a go-md2man bug, and add a check script to make sure
this doesn't hit us again.

Background: go-md2man can't deal with a left-hand column > 31 chars.
It produces man pages that look like:

    | Something With >31 Character |                |
    |                              | ..description  |

(should be all on one row). It also has trouble when the vertical
bars are misaligned: it completely removes the right-hand side.

There's almost certainly a better solution: fix go-md2man, or
use a different conversion tool, or maybe even pre/postprocess.
But this is a quick interim solution.

Sorry for the perl. This could be done in bash/sed/awk/grep,
but not with any sort of sane error messages.

Signed-off-by: Ed Santiago <[email protected]>
@edsantiago edsantiago force-pushed the gomd2man-workaround branch from 675de8d to dfba6dd Compare May 26, 2023 12:09
@edsantiago edsantiago marked this pull request as ready for review May 26, 2023 12:38
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 26, 2023
@edsantiago
Copy link
Member Author

Update: go-md2man-2.02 fixes some, but not all, of the issues in my first push; so I've reduced the scope of my PR and amended the commit message accordingly. I genuinely don't understand some of the bugs (the "digest" one, and why backslashing dashes can in some cases allow a >31-character LHS).

@TomSweeneyRedHat
Copy link
Member

LGTM

@TomSweeneyRedHat
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 27, 2023
@openshift-merge-robot openshift-merge-robot merged commit 71c65c2 into containers:main May 27, 2023
@edsantiago edsantiago deleted the gomd2man-workaround branch May 30, 2023 12:12
edsantiago added a commit to edsantiago/libpod that referenced this pull request Jul 26, 2023
go-md2man is fragile, especially around tables (containers#18678, containers#19278).
Podman man pages are finely tuned to look OK using v2.02, which
is what we vendor in test/tools, so we should really use it
instead of whatever is installed on the system.

This fixes 'make docs' on RHEL8, broken as of containers#19278.

Signed-off-by: Ed Santiago <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Aug 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants