Skip to contentSkip to conversation

bpftool: fix build failure

PATCH Superseded Yonghong Song 4 participants 12 messages Sep 14, 2020

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpftool: fix build failure

When building bpf selftests like
make -C tools/testing/selftests/bpf -j20
I hit the following errors:
...
GEN /net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8
<stdin>:75: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<stdin>:71: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
<stdin>:85: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
<stdin>:57: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<stdin>:66: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:109: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:175: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:273: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12 make[1]: *** Waiting for unfinished jobs....
make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12 make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8] Error 12
...

I am using:
-bash-4.4$ rst2man --version
rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2) -bash-4.4$

Looks like that particular version of rst2man prefers to have a blank line after literal blocks. This patch added block lines in related .rst files and compilation can then pass.

Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE ALSO" sections in man pages")
---
 tools/bpf/bpftool/Documentation/bpftool-cgroup.rst     | 1 +
 tools/bpf/bpftool/Documentation/bpftool-feature.rst    | 1 +
 tools/bpf/bpftool/Documentation/bpftool-iter.rst       | 1 +
 tools/bpf/bpftool/Documentation/bpftool-link.rst       | 1 +
 tools/bpf/bpftool/Documentation/bpftool-map.rst        | 1 +
 tools/bpf/bpftool/Documentation/bpftool-net.rst        | 1 +
 tools/bpf/bpftool/Documentation/bpftool-perf.rst       | 1 +
 tools/bpf/bpftool/Documentation/bpftool-prog.rst       | 1 +
 tools/bpf/bpftool/Documentation/bpftool-struct_ops.rst | 1 +
 tools/bpf/bpftool/Documentation/bpftool.rst            | 1 +
 10 files changed, 10 insertions(+)
tools/bpf/bpftool/Documentation/bpftool-cgroup.rst +1 -0
index 790944c35602..5d01a74b7c57 100644
@@ -143,3 +143,4 @@ EXAMPLES
 ::
 
     ID       AttachType      AttachFlags     Name
+
tools/bpf/bpftool/Documentation/bpftool-feature.rst +1 -0
index dd3771bdbc57..e6b4b9efc6f7 100644
@@ -72,3 +72,4 @@ DESCRIPTION
 OPTIONS
 =======
 	.. include:: common_options.rst
+
tools/bpf/bpftool/Documentation/bpftool-iter.rst +1 -0
index 51f49bead619..30bfe3b1f529 100644
@@ -68,3 +68,4 @@ EXAMPLES
 
    Create a file-based bpf iterator from bpf_iter_hashmap.o and map with
    id 20, and pin it to /sys/fs/bpf/my_hashmap
+
tools/bpf/bpftool/Documentation/bpftool-link.rst +1 -0
index 5f7db2a837cc..6d1ff68c5d6f 100644
@@ -106,3 +106,4 @@ EXAMPLES
 ::
 
     -rw------- 1 root root 0 Apr 23 21:39 link
+
tools/bpf/bpftool/Documentation/bpftool-map.rst +1 -0
index dade10cdf295..6500612f4723 100644
@@ -270,3 +270,4 @@ would be lost as soon as bpftool exits).
 
   key: 00 00 00 00  value: 22 02 00 00
   Found 1 element
+
tools/bpf/bpftool/Documentation/bpftool-net.rst +1 -0
index d8165d530937..8450f7b9a10d 100644
@@ -172,3 +172,4 @@ EXAMPLES
 ::
 
       xdp:
+
tools/bpf/bpftool/Documentation/bpftool-perf.rst +1 -0
index e958ce91de72..1b5202d3d9ac 100644
@@ -63,3 +63,4 @@ EXAMPLES
      {"pid":21765,"fd":5,"prog_id":7,"fd_type":"kretprobe","func":"__x64_sys_nanosleep","offset":0}, \
      {"pid":21767,"fd":5,"prog_id":8,"fd_type":"tracepoint","tracepoint":"sys_enter_nanosleep"}, \
      {"pid":21800,"fd":5,"prog_id":9,"fd_type":"uprobe","filename":"/home/yhs/a.out","offset":1159}]
+
tools/bpf/bpftool/Documentation/bpftool-prog.rst +1 -0
index 358c7309d419..3c7a90915d45 100644
@@ -326,3 +326,4 @@ EXAMPLES
       40176203 cycles                                                 (83.05%)
       42518139 instructions    #   1.06 insns per cycle               (83.39%)
            123 llc_misses      #   2.89 LLC misses per million insns  (83.15%)
+
tools/bpf/bpftool/Documentation/bpftool-struct_ops.rst +1 -0
index 506e70ee78e9..ccfd215b17a0 100644
@@ -82,3 +82,4 @@ EXAMPLES
 ::
 
    Registered tcp_congestion_ops cubic id 110
+
tools/bpf/bpftool/Documentation/bpftool.rst +1 -0
index e7d949334961..1026f15b5c64 100644
@@ -54,3 +54,4 @@ OPTIONS
 	-n, --nomount
 		  Do not automatically attempt to mount any virtual file system
 		  (such as tracefs or BPF virtual file system) when necessary.
+
Signature · 1 line
2.24.1
#1 lore raw
Quoted 24 lines · Yonghong Song

When building bpf selftests like
make -C tools/testing/selftests/bpf -j20
I hit the following errors:
...
GEN /net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8
<stdin>:75: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<stdin>:71: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
<stdin>:85: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
<stdin>:57: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<stdin>:66: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:109: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:175: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:273: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12 make[1]: *** Waiting for unfinished jobs....
make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12 make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8] Error 12
...

I am using:
-bash-4.4$ rst2man --version
rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2) -bash-4.4$

Quoted 7 lines

Looks like that particular version of rst2man prefers to have a blank line after literal blocks. This patch added block lines in related .rst files and compilation can then pass.

Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE ALSO" sections in man pages")

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

	rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

------

(quoted diff) +0 -0

b/tools/bpf/bpftool/Documentation/Makefile
index 4c9dd1e45244..01b30ed86eac 100644

tools/bpf/bpftool/Documentation/Makefile +1 -1
@@ -32,7 +32,7 @@ RST2MAN_OPTS += --verbose
 
 list_pages = $(sort $(basename $(filter-out $(1),$(MAN8_RST))))
 see_also = $(subst " ",, \
-       "\n" \
+       "\n\n" \
        "SEE ALSO\n" \
        "========\n" \
        "\t**bpf**\ (2),\n" \
reviewer
#2 lore raw
Quoted 51 lines · Quentin Monnet
Quoted 24 lines · Yonghong Song

When building bpf selftests like
make -C tools/testing/selftests/bpf -j20
I hit the following errors:
...
GEN /net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8
<stdin>:75: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<stdin>:71: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
<stdin>:85: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
<stdin>:57: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<stdin>:66: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:109: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:175: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:273: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12 make[1]: *** Waiting for unfinished jobs....
make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12 make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8] Error 12
...

I am using:
-bash-4.4$ rst2man --version
rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2) -bash-4.4$

Quoted 7 lines

Looks like that particular version of rst2man prefers to have a blank line after literal blocks. This patch added block lines in related .rst files and compilation can then pass.

Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE ALSO" sections in man pages")

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

        rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

------

tools/bpf/bpftool/Documentation/Makefile +0 -0
index 4c9dd1e45244..01b30ed86eac 100644

tools/bpf/bpftool/Documentation/Makefile RST2MAN_OPTS += --verbose · line 38

Quoted 8 lines
tools/bpf/bpftool/Documentation/Makefile +1 -1
@@ -32,7 +32,7 @@ RST2MAN_OPTS += --verbose
 
 list_pages = $(sort $(basename $(filter-out $(1),$(MAN8_RST))))
 see_also = $(subst " ",, \
-       "\n" \
+       "\n\n" \
        "SEE ALSO\n" \
        "========\n" \
        "\t**bpf**\ (2),\n" \

Yes, this works (I am using the same rst2man as Yonghong's).

Thanks,
Song

#5 lore raw
In reply to Yonghong Song
Quoted 77 lines · Yonghong Song
Quoted 35 lines · Quentin Monnet
Quoted 25 lines · Yonghong Song

When building bpf selftests like
   make -C tools/testing/selftests/bpf -j20
I hit the following errors:
   ...
   GEN /net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8

   <stdin>:75: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
   <stdin>:71: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
   <stdin>:85: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
   <stdin>:57: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
   <stdin>:66: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:109: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:175: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:273: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
   make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12 make[1]: *** Waiting for unfinished jobs....
   make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12 make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8] Error 12
   ...

I am using:
   -bash-4.4$ rst2man --version
   rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2) -bash-4.4$

Quoted 7 lines

Looks like that particular version of rst2man prefers to have a blank line after literal blocks. This patch added block lines in related .rst files and compilation can then pass.

Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE ALSO" sections in man pages")
Quoted 7 lines

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

    rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

Thanks for the tip! I looked at the generated output again. My above fix can silent the warning, but certainly not correct.

With the following change, I captured the intermediate result of the .rst file.

 ifndef RST2MAN_DEP
        $(error "rst2man not found, but required to generate man pages") endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@
+       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | tee /tmp/tt | rst2man $(RST2MAN_OPTS) > $@

With below command,
   make clean && make bpftool-cgroup.8
I can get the new .rst file for bpftool-cgroup.

At the end of file /tmp/tt (changed bpftool-cgroup.rst), I see

    ID       AttachType      AttachFlags     Name
\n SEE ALSO\n========\n\t**bpf**\ (2),\n\t**bpf-helpers**\ (7),\n\t**bpftool**\ (8),\n\t**bpftool-btf**\ (8),\n\t**bpftool-feature**\ (8),\n\t**bpftool-gen**\ (8),\n\t**bpftool-iter**\ (8),\n\t**bpftool-link**\ (8),\n\t**bpftool-map**\ (8),\n\t**bpftool-net**\ (8),\n\t**bpftool-perf**\ (8),\n\t**bpftool-prog**\ (8),\n\t**bpftool-struct_ops**\ (8)\n

This sounds correct if we rst2man can successfully transforms '\n' or '\t' to proper encoding in the man page.

Unfortunately, with my version of rst2man, I got

.IP "System Message: WARNING/2 (<stdin>:, line 146)"
Literal block ends without a blank line; unexpected unindent.
.sp
n SEE ALSOn========nt**bpf**(2),nt**bpf\-helpers**(7),nt**bpftool**(8),nt**bpftool\-btf**(8),nt**bpftool\-feature**(8),nt**bpftool\-gen**(8),nt**bpftool\-iter**(8),nt**bpftool\-link**(8),nt**bpftool\-map**(8),nt**bpftool\-net**(8),nt**bpftool\-perf**(8),nt**bpftool\-prog**(8),nt**bpftool\-struct_ops**(8)n

Quoted 6 lines

.\" Generated by docutils manpage writer.

The rst2man simply considered \n as 'n'. The same for '\t' and this caused the issue.

I did not find a way to fix the problem yet.

The following change works for me.

@@ -44,7 +44,7 @@ $(OUTPUT)%.8: %.rst
ifndef RST2MAN_DEP

        $(error "rst2man not found, but required to generate man pages")
 endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@
+       $(QUIET_GEN)( cat $< ; echo -e $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@

clean: helpers-clean

        $(call QUIET_CLEAN, Documentation)

-bash-4.4$

I will send revision 2 shortly.

Quoted 19 lines
Quoted 19 lines

------

tools/bpf/bpftool/Documentation/Makefile +1 -1
index 4c9dd1e45244..01b30ed86eac 100644
@@ -32,7 +32,7 @@ RST2MAN_OPTS += --verbose
 
   list_pages = $(sort $(basename $(filter-out $(1),$(MAN8_RST))))
   see_also = $(subst " ",, \
-       "\n" \
+       "\n\n" \
          "SEE ALSO\n" \
          "========\n" \
          "\t**bpf**\ (2),\n" \
#3 lore raw
In reply to Song Liu
Quoted 53 lines · Song Liu
Quoted 52 lines · Quentin Monnet
Quoted 24 lines · Yonghong Song

When building bpf selftests like
make -C tools/testing/selftests/bpf -j20
I hit the following errors:
...
GEN /net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8
<stdin>:75: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<stdin>:71: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
<stdin>:85: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
<stdin>:57: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<stdin>:66: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:109: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:175: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:273: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12 make[1]: *** Waiting for unfinished jobs....
make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12 make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8] Error 12
...

I am using:

   -bash-4.4$ rst2man --version
   rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2)
   -bash-4.4$
Quoted 7 lines

Looks like that particular version of rst2man prefers to have a blank line after literal blocks. This patch added block lines in related .rst files and compilation can then pass.

Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE ALSO" sections in man pages")

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

         rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

------

tools/bpf/bpftool/Documentation/Makefile +0 -0
index 4c9dd1e45244..01b30ed86eac 100644
@@ -32,7 +32,7 @@ RST2MAN_OPTS += --verbose
 
Quoted 9 lines

tools/bpf/bpftool/Documentation/Makefile RST2MAN_OPTS += --verbose · line 38

Quoted 7 lines
tools/bpf/bpftool/Documentation/Makefile +1 -1
  list_pages = $(sort $(basename $(filter-out $(1),$(MAN8_RST))))
  see_also = $(subst " ",, \
-       "\n" \
+       "\n\n" \
         "SEE ALSO\n" \
         "========\n" \
         "\t**bpf**\ (2),\n" \

Yes, this works (I am using the same rst2man as Yonghong's).

Song, could you help check whether the following change works for you or not?

@@ -44,7 +44,7 @@ $(OUTPUT)%.8: %.rst
ifndef RST2MAN_DEP

        $(error "rst2man not found, but required to generate man pages")
 endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@
+       $(QUIET_GEN)( cat $< ; echo -e $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@

clean: helpers-clean

        $(call QUIET_CLEAN, Documentation)
Quoted 4 lines

Thanks,
Song

#4 lore raw
In reply to Quentin Monnet
Quoted 34 lines · Quentin Monnet
Quoted 24 lines · Yonghong Song

When building bpf selftests like
make -C tools/testing/selftests/bpf -j20
I hit the following errors:
...
GEN /net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8
<stdin>:75: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<stdin>:71: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
<stdin>:85: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
<stdin>:57: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<stdin>:66: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:109: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:175: (WARNING/2) Literal block ends without a blank line; unexpected unindent. <stdin>:273: (WARNING/2) Literal block ends without a blank line; unexpected unindent.
make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12 make[1]: *** Waiting for unfinished jobs....
make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12 make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8] Error 12
...

I am using:

   -bash-4.4$ rst2man --version
   rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2)
   -bash-4.4$
Quoted 7 lines

Looks like that particular version of rst2man prefers to have a blank line after literal blocks. This patch added block lines in related .rst files and compilation can then pass.

Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE ALSO" sections in man pages")
Quoted 7 lines

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

	rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

Thanks for the tip! I looked at the generated output again. My above fix can silent the warning, but certainly not correct.

With the following change, I captured the intermediate result of the .rst file.

ifndef RST2MAN_DEP

        $(error "rst2man not found, but required to generate man pages")
 endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@
+       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | tee /tmp/tt | rst2man $(RST2MAN_OPTS) > $@

With below command,
make clean && make bpftool-cgroup.8
I can get the new .rst file for bpftool-cgroup.

At the end of file /tmp/tt (changed bpftool-cgroup.rst), I see

ID AttachType AttachFlags Name
\n SEE ALSO\n========\n\t**bpf**\ (2),\n\t**bpf-helpers**\ (7),\n\t**bpftool**\ (8),\n\t**bpftool-btf**\ (8),\n\t**bpftool-feature**\ (8),\n\t**bpftool-gen**\ (8),\n\t**bpftool-iter**\ (8),\n\t**bpftool-link**\ (8),\n\t**bpftool-map**\ (8),\n\t**bpftool-net**\ (8),\n\t**bpftool-perf**\ (8),\n\t**bpftool-prog**\ (8),\n\t**bpftool-struct_ops**\ (8)\n

This sounds correct if we rst2man can successfully transforms '\n' or '\t' to proper encoding in the man page.

Unfortunately, with my version of rst2man, I got

.IP "System Message: WARNING/2 (<stdin>:, line 146)"
Literal block ends without a blank line; unexpected unindent.
.sp
n SEE ALSOn========nt**bpf**(2),nt**bpf\-helpers**(7),nt**bpftool**(8),nt**bpftool\-btf**(8),nt**bpftool\-feature**(8),nt**bpftool\-gen**(8),nt**bpftool\-iter**(8),nt**bpftool\-link**(8),nt**bpftool\-map**(8),nt**bpftool\-net**(8),nt**bpftool\-perf**(8),nt**bpftool\-prog**(8),nt**bpftool\-struct_ops**(8)n .\" Generated by docutils manpage writer.

The rst2man simply considered \n as 'n'. The same for '\t' and this caused the issue.

I did not find a way to fix the problem yet.

Quoted 18 lines

------

tools/bpf/bpftool/Documentation/Makefile +1 -1
index 4c9dd1e45244..01b30ed86eac 100644
@@ -32,7 +32,7 @@ RST2MAN_OPTS += --verbose
 
  list_pages = $(sort $(basename $(filter-out $(1),$(MAN8_RST))))
  see_also = $(subst " ",, \
-       "\n" \
+       "\n\n" \
         "SEE ALSO\n" \
         "========\n" \
         "\t**bpf**\ (2),\n" \
#6 lore raw
In reply to Yonghong Song
Quoted 125 lines · Yonghong Song
Quoted 104 lines · Yonghong Song
Quoted 53 lines · Quentin Monnet
Quoted 46 lines · Yonghong Song

When building bpf selftests like
   make -C tools/testing/selftests/bpf -j20
I hit the following errors:
   ...
   GEN /net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8

   <stdin>:75: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
   <stdin>:71: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   <stdin>:85: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   <stdin>:57: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
   <stdin>:66: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   <stdin>:109: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   <stdin>:175: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   <stdin>:273: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12
   make[1]: *** Waiting for unfinished jobs....
   make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12
   make[1]: *** [/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8] Error 12
   ...

I am using:
   -bash-4.4$ rst2man --version
   rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2) -bash-4.4$

Looks like that particular version of rst2man prefers to have a blank line
after literal blocks. This patch added block lines in related .rst files
and compilation can then pass.

Quoted 4 lines
Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE

ALSO" sections in man pages")

Quoted 7 lines

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

    rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

Thanks for the tip! I looked at the generated output again. My above fix can silent the warning, but certainly not correct.

With the following change, I captured the intermediate result of the .rst file.

  ifndef RST2MAN_DEP
         $(error "rst2man not found, but required to generate man pages") endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@
+       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | tee /tmp/tt | rst2man $(RST2MAN_OPTS) > $@

With below command,
    make clean && make bpftool-cgroup.8
I can get the new .rst file for bpftool-cgroup.

At the end of file /tmp/tt (changed bpftool-cgroup.rst), I see

     ID       AttachType      AttachFlags     Name \n SEE ALSO\n========\n\t**bpf**\ (2),\n\t**bpf-helpers**\
(7),\n\t**bpftool**\ (8),\n\t**bpftool-btf**\
(8),\n\t**bpftool-feature**\ (8),\n\t**bpftool-gen**\
(8),\n\t**bpftool-iter**\ (8),\n\t**bpftool-link**\
(8),\n\t**bpftool-map**\ (8),\n\t**bpftool-net**\
(8),\n\t**bpftool-perf**\ (8),\n\t**bpftool-prog**\
(8),\n\t**bpftool-struct_ops**\ (8)\n

This sounds correct if we rst2man can successfully transforms '\n' or '\t' to proper encoding in the man page.

Unfortunately, with my version of rst2man, I got

.IP "System Message: WARNING/2 (<stdin>:, line 146)"
Literal block ends without a blank line; unexpected unindent.
.sp
n SEE ALSOn========nt**bpf**(2),nt**bpf\-helpers**(7),nt**bpftool**(8),nt**bpftool\-btf**(8),nt**bpftool\-feature**(8),nt**bpftool\-gen**(8),nt**bpftool\-iter**(8),nt**bpftool\-link**(8),nt**bpftool\-map**(8),nt**bpftool\-net**(8),nt**bpftool\-perf**(8),nt**bpftool\-prog**(8),nt**bpftool\-struct_ops**(8)n

Quoted 6 lines

.\" Generated by docutils manpage writer.

The rst2man simply considered \n as 'n'. The same for '\t' and this caused the issue.

I did not find a way to fix the problem https://www.google.com/url?q=https://zoom.us/j/94864957378?pwd%3DbXFRL1ZaRUxTbDVKcm9uRitpTXgyUT09&sa=D&source=calendar&ust=1600532408208000&usg=AOvVaw3SJ0i8oz4ZM-GRb7hYkrYlyet.

The following change works for me.

(quoted diff) +0 -0
@@ -44,7 +44,7 @@ $(OUTPUT)%.8: %.rst

 ifndef RST2MAN_DEP
        $(error "rst2man not found, but required to generate man pages") endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@
+       $(QUIET_GEN)( cat $< ; echo -e $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@

Quoted 5 lines

 clean: helpers-clean
        $(call QUIET_CLEAN, Documentation)
-bash-4.4$

I will send revision 2 shortly.

Thanks Yonghong, but this does not work on my setup :/. The version of echo which is called on my machine from the Makefile does not seem to interpret the "-e" option and writes something like "-e\nSEE ALSO", which causes rst2man to complain.

I suspect the portable option here would be printf, even though Andrii had some concerns that we could pass a format specifier through the file names [0].

Would this work on your setup?

	$(QUIET_GEN)( cat $< ; printf $(call see_also,$<) ) | rst2man...

Would that be acceptable?

[0]
https://lore.kernel.org/bpf/[email protected]/T/#m01bb298fd512121edd5e77a26ed5382c0c53939e

Quentin

#7 lore raw
Quoted 141 lines · Quentin Monnet
Quoted 125 lines · Yonghong Song
Quoted 104 lines · Yonghong Song
Quoted 53 lines · Quentin Monnet
Quoted 46 lines · Yonghong Song

When building bpf selftests like
   make -C tools/testing/selftests/bpf -j20
I hit the following errors:
   ...
   GEN
/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8

   <stdin>:75: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
   <stdin>:71: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   <stdin>:85: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   <stdin>:57: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
   <stdin>:66: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   <stdin>:109: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   <stdin>:175: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   <stdin>:273: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
   make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12
   make[1]: *** Waiting for unfinished jobs....
   make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12
   make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8] Error 12
   ...

I am using:
   -bash-4.4$ rst2man --version
   rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2) -bash-4.4$

Looks like that particular version of rst2man prefers to have a blank line
after literal blocks. This patch added block lines in related .rst files
and compilation can then pass.

Quoted 4 lines
Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE

ALSO" sections in man pages")

Quoted 7 lines

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

    rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

Thanks for the tip! I looked at the generated output again. My above fix can silent the warning, but certainly not correct.

With the following change, I captured the intermediate result of the .rst file.

  ifndef RST2MAN_DEP
         $(error "rst2man not found, but required to generate man pages") endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@
+       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | tee /tmp/tt | rst2man $(RST2MAN_OPTS) > $@

With below command,
    make clean && make bpftool-cgroup.8
I can get the new .rst file for bpftool-cgroup.

At the end of file /tmp/tt (changed bpftool-cgroup.rst), I see

     ID       AttachType      AttachFlags     Name
\n SEE ALSO\n========\n\t**bpf**\ (2),\n\t**bpf-helpers**\
(7),\n\t**bpftool**\ (8),\n\t**bpftool-btf**\
(8),\n\t**bpftool-feature**\ (8),\n\t**bpftool-gen**\
(8),\n\t**bpftool-iter**\ (8),\n\t**bpftool-link**\
(8),\n\t**bpftool-map**\ (8),\n\t**bpftool-net**\
(8),\n\t**bpftool-perf**\ (8),\n\t**bpftool-prog**\
(8),\n\t**bpftool-struct_ops**\ (8)\n

This sounds correct if we rst2man can successfully transforms '\n' or '\t' to proper encoding in the man page.

Unfortunately, with my version of rst2man, I got

.IP "System Message: WARNING/2 (<stdin>:, line 146)"
Literal block ends without a blank line; unexpected unindent.
.sp
n SEE ALSOn========nt**bpf**(2),nt**bpf\-helpers**(7),nt**bpftool**(8),nt**bpftool\-btf**(8),nt**bpftool\-feature**(8),nt**bpftool\-gen**(8),nt**bpftool\-iter**(8),nt**bpftool\-link**(8),nt**bpftool\-map**(8),nt**bpftool\-net**(8),nt**bpftool\-perf**(8),nt**bpftool\-prog**(8),nt**bpftool\-struct_ops**(8)n

Quoted 6 lines

.\" Generated by docutils manpage writer.

The rst2man simply considered \n as 'n'. The same for '\t' and this caused the issue.

I did not find a way to fix the problem https://urldefense.proofpoint.com/v2/url?u=https-3A__www.google.com_url-3Fq-3Dhttps-3A__zoom.us_j_94864957378-3Fpwd-253DbXFRL1ZaRUxTbDVKcm9uRitpTXgyUT09-26sa-3DD-26source-3Dcalendar-26ust-3D1600532408208000-26usg-3DAOvVaw3SJ0i8oz4ZM-2DGRb7hYkrYlyet&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=DA8e1B5r073vIqRrFz7MRA&m=kEK7ScPMF-y-i8dli-or8wWEGREW5V4qPB7UqHqDnkg&s=Br0g0MFXxL_pJuDVTOY5UrmvfD2ru_6Uf_X_8Nr2Rhk&e= .

The following change works for me.

(quoted diff) +0 -1
@@ -44,7 +44,7 @@ $(OUTPUT)%.8: %.rst
  ifndef RST2MAN_DEP
         $(error "rst2man not found, but required to generate man pages")
  endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man

$(RST2MAN_OPTS) > $@
+       $(QUIET_GEN)( cat $< ; echo -e $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@

Quoted 5 lines

 clean: helpers-clean
        $(call QUIET_CLEAN, Documentation)
-bash-4.4$

I will send revision 2 shortly.

Thanks Yonghong, but this does not work on my setup :/. The version of echo which is called on my machine from the Makefile does not seem to interpret the "-e" option and writes something like "-e\nSEE ALSO", which causes rst2man to complain.

I suspect the portable option here would be printf, even though Andrii had some concerns that we could pass a format specifier through the file names [0].

Quoted 5 lines

Would this work on your setup?

	$(QUIET_GEN)( cat $< ; printf $(call see_also,$<) ) | rst2man...

Would that be acceptable?

It works for me. Andrii originally suggested echo -e, but since echo -e does not work in your environment let us use printf then. I will add a comment about '%' in the bpftool man page name.

Quoted 6 lines

[0]
https://lore.kernel.org/bpf/[email protected]/T/#m01bb298fd512121edd5e77a26ed5382c0c53939e

Quentin

#8 lore raw
Quoted 147 lines · Yonghong Song
Quoted 143 lines · Quentin Monnet
Quoted 125 lines · Yonghong Song
Quoted 104 lines · Yonghong Song
Quoted 53 lines · Quentin Monnet
Quoted 46 lines · Yonghong Song

When building bpf selftests like
make -C tools/testing/selftests/bpf -j20
I hit the following errors:

    ...
    GEN

/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8

    <stdin>:75: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
    <stdin>:71: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
    <stdin>:85: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
    <stdin>:57: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
    <stdin>:66: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
    <stdin>:109: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
    <stdin>:175: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
    <stdin>:273: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
    make[1]: ***

[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12
make[1]: *** Waiting for unfinished jobs....
make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12

    make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8]
Error 12
    ...

I am using:

    -bash-4.4$ rst2man --version
    rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2)
    -bash-4.4$

Looks like that particular version of rst2man prefers to have a blank line
after literal blocks. This patch added block lines in related .rst files
and compilation can then pass.

Quoted 4 lines
Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE

ALSO" sections in man pages")

Quoted 7 lines

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

     rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

Thanks for the tip! I looked at the generated output again. My above fix can silent the warning, but certainly not correct.

With the following change, I captured the intermediate result of the .rst file.

ifndef RST2MAN_DEP

          $(error "rst2man not found, but required to generate man pages")

endif
- $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man
$(RST2MAN_OPTS) > $@
+ $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | tee
/tmp/tt | rst2man $(RST2MAN_OPTS) > $@

With below command,

     make clean && make bpftool-cgroup.8

I can get the new .rst file for bpftool-cgroup.

At the end of file /tmp/tt (changed bpftool-cgroup.rst), I see

ID AttachType AttachFlags Name
\n SEE ALSO\n========\n\t**bpf**\ (2),\n\t**bpf-helpers**\
(7),\n\t**bpftool**\ (8),\n\t**bpftool-btf**\
(8),\n\t**bpftool-feature**\ (8),\n\t**bpftool-gen**\
(8),\n\t**bpftool-iter**\ (8),\n\t**bpftool-link**\
(8),\n\t**bpftool-map**\ (8),\n\t**bpftool-net**\
(8),\n\t**bpftool-perf**\ (8),\n\t**bpftool-prog**\
(8),\n\t**bpftool-struct_ops**\ (8)\n

This sounds correct if we rst2man can successfully transforms '\n' or '\t' to proper encoding in the man page.

Unfortunately, with my version of rst2man, I got

.IP "System Message: WARNING/2 (<stdin>:, line 146)"
Literal block ends without a blank line; unexpected unindent.
.sp
n SEE ALSOn========nt**bpf**(2),nt**bpf\-helpers**(7),nt**bpftool**(8),nt**bpftool\-btf**(8),nt**bpftool\-feature**(8),nt**bpftool\-gen**(8),nt**bpftool\-iter**(8),nt**bpftool\-link**(8),nt**bpftool\-map**(8),nt**bpftool\-net**(8),nt**bpftool\-perf**(8),nt**bpftool\-prog**(8),nt**bpftool\-struct_ops**(8)n

Quoted 6 lines

.\" Generated by docutils manpage writer.

The rst2man simply considered \n as 'n'. The same for '\t' and this caused the issue.

I did not find a way to fix the problem https://urldefense.proofpoint.com/v2/url?u=https-3A__www.google.com_url-3Fq-3Dhttps-3A__zoom.us_j_94864957378-3Fpwd-253DbXFRL1ZaRUxTbDVKcm9uRitpTXgyUT09-26sa-3DD-26source-3Dcalendar-26ust-3D1600532408208000-26usg-3DAOvVaw3SJ0i8oz4ZM-2DGRb7hYkrYlyet&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=DA8e1B5r073vIqRrFz7MRA&m=kEK7ScPMF-y-i8dli-or8wWEGREW5V4qPB7UqHqDnkg&s=Br0g0MFXxL_pJuDVTOY5UrmvfD2ru_6Uf_X_8Nr2Rhk&e= .

The following change works for me.

(quoted diff) +0 -1
@@ -44,7 +44,7 @@ $(OUTPUT)%.8: %.rst
  ifndef RST2MAN_DEP
         $(error "rst2man not found, but required to generate man pages")
  endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man

$(RST2MAN_OPTS) > $@
+ $(QUIET_GEN)( cat $< ; echo -e $(call see_also,$<) ) | rst2man
$(RST2MAN_OPTS) > $@

Quoted 5 lines

clean: helpers-clean

         $(call QUIET_CLEAN, Documentation)

-bash-4.4$

I will send revision 2 shortly.

Thanks Yonghong, but this does not work on my setup :/. The version of echo which is called on my machine from the Makefile does not seem to interpret the "-e" option and writes something like "-e\nSEE ALSO", which causes rst2man to complain.

I suspect the portable option here would be printf, even though Andrii had some concerns that we could pass a format specifier through the file names [0].

Would this work on your setup?

Quoted 7 lines
Quoted 3 lines
      $(QUIET_GEN)( cat $< ; printf $(call see_also,$<) ) | rst2man...

Would that be acceptable?

It works for me. Andrii originally suggested echo -e, but since echo -e does not work in your environment let us use printf then. I will add a comment about '%' in the bpftool man page name.

It's amazing how incompatible echo can be. But that aside, I have nothing against printf itself, but:

printf "%s" "whatever we want to print out"

seems like the way to go, similarly how you'd do it in your C code, no?

Quoted 7 lines
Quoted 7 lines

[0]
https://lore.kernel.org/bpf/[email protected]/T/#m01bb298fd512121edd5e77a26ed5382c0c53939e

Quentin

#9 lore raw
Quoted 156 lines · Andrii Nakryiko
Quoted 147 lines · Yonghong Song
Quoted 143 lines · Quentin Monnet
Quoted 125 lines · Yonghong Song
Quoted 104 lines · Yonghong Song
Quoted 53 lines · Quentin Monnet
Quoted 46 lines · Yonghong Song

When building bpf selftests like
make -C tools/testing/selftests/bpf -j20
I hit the following errors:

     ...
     GEN

/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8

     <stdin>:75: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
     <stdin>:71: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     <stdin>:85: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     <stdin>:57: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
     <stdin>:66: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     <stdin>:109: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     <stdin>:175: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     <stdin>:273: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     make[1]: ***

[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12
make[1]: *** Waiting for unfinished jobs....
make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12

     make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8]
Error 12
     ...

I am using:

     -bash-4.4$ rst2man --version
     rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2)
     -bash-4.4$

Looks like that particular version of rst2man prefers to have a blank line
after literal blocks. This patch added block lines in related .rst files
and compilation can then pass.

Quoted 4 lines
Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE

ALSO" sections in man pages")

Quoted 7 lines

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

      rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

Thanks for the tip! I looked at the generated output again. My above fix can silent the warning, but certainly not correct.

With the following change, I captured the intermediate result of the .rst file.

    ifndef RST2MAN_DEP
           $(error "rst2man not found, but required to generate man pages")
    endif

- $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man
$(RST2MAN_OPTS) > $@
+ $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | tee
/tmp/tt | rst2man $(RST2MAN_OPTS) > $@

With below command,

      make clean && make bpftool-cgroup.8

I can get the new .rst file for bpftool-cgroup.

At the end of file /tmp/tt (changed bpftool-cgroup.rst), I see

ID AttachType AttachFlags Name
\n SEE ALSO\n========\n\t**bpf**\ (2),\n\t**bpf-helpers**\
(7),\n\t**bpftool**\ (8),\n\t**bpftool-btf**\
(8),\n\t**bpftool-feature**\ (8),\n\t**bpftool-gen**\
(8),\n\t**bpftool-iter**\ (8),\n\t**bpftool-link**\
(8),\n\t**bpftool-map**\ (8),\n\t**bpftool-net**\
(8),\n\t**bpftool-perf**\ (8),\n\t**bpftool-prog**\
(8),\n\t**bpftool-struct_ops**\ (8)\n

This sounds correct if we rst2man can successfully transforms '\n' or '\t' to proper encoding in the man page.

Unfortunately, with my version of rst2man, I got

.IP "System Message: WARNING/2 (<stdin>:, line 146)"
Literal block ends without a blank line; unexpected unindent.
.sp
n SEE ALSOn========nt**bpf**(2),nt**bpf\-helpers**(7),nt**bpftool**(8),nt**bpftool\-btf**(8),nt**bpftool\-feature**(8),nt**bpftool\-gen**(8),nt**bpftool\-iter**(8),nt**bpftool\-link**(8),nt**bpftool\-map**(8),nt**bpftool\-net**(8),nt**bpftool\-perf**(8),nt**bpftool\-prog**(8),nt**bpftool\-struct_ops**(8)n

Quoted 6 lines

.\" Generated by docutils manpage writer.

The rst2man simply considered \n as 'n'. The same for '\t' and this caused the issue.

I did not find a way to fix the problem https://urldefense.proofpoint.com/v2/url?u=https-3A__www.google.com_url-3Fq-3Dhttps-3A__zoom.us_j_94864957378-3Fpwd-253DbXFRL1ZaRUxTbDVKcm9uRitpTXgyUT09-26sa-3DD-26source-3Dcalendar-26ust-3D1600532408208000-26usg-3DAOvVaw3SJ0i8oz4ZM-2DGRb7hYkrYlyet&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=DA8e1B5r073vIqRrFz7MRA&m=kEK7ScPMF-y-i8dli-or8wWEGREW5V4qPB7UqHqDnkg&s=Br0g0MFXxL_pJuDVTOY5UrmvfD2ru_6Uf_X_8Nr2Rhk&e= .

The following change works for me.

(quoted diff) +0 -1
@@ -44,7 +44,7 @@ $(OUTPUT)%.8: %.rst
   ifndef RST2MAN_DEP
          $(error "rst2man not found, but required to generate man pages")
   endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man

$(RST2MAN_OPTS) > $@
+ $(QUIET_GEN)( cat $< ; echo -e $(call see_also,$<) ) | rst2man
$(RST2MAN_OPTS) > $@

Quoted 5 lines
   clean: helpers-clean
          $(call QUIET_CLEAN, Documentation)

-bash-4.4$

I will send revision 2 shortly.

Thanks Yonghong, but this does not work on my setup :/. The version of echo which is called on my machine from the Makefile does not seem to interpret the "-e" option and writes something like "-e\nSEE ALSO", which causes rst2man to complain.

I suspect the portable option here would be printf, even though Andrii had some concerns that we could pass a format specifier through the file names [0].

Would this work on your setup?

Quoted 7 lines
Quoted 3 lines
       $(QUIET_GEN)( cat $< ; printf $(call see_also,$<) ) | rst2man...

Would that be acceptable?

It works for me. Andrii originally suggested echo -e, but since echo -e does not work in your environment let us use printf then. I will add a comment about '%' in the bpftool man page name.

Quoted 6 lines

It's amazing how incompatible echo can be. But that aside, I have nothing against printf itself, but:

printf "%s" "whatever we want to print out"

seems like the way to go, similarly how you'd do it in your C code, no?

This won't really work :-(

-bash-4.4$ printf "%s" "\n\n"
\n\n-bash-4.4$ printf "\n\n"

-bash-4.4$

Looks like "\n" needs to be in format string to make a difference.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

[0]
https://lore.kernel.org/bpf/[email protected]/T/#m01bb298fd512121edd5e77a26ed5382c0c53939e

Quentin

#10 lore raw
Quoted 169 lines · Yonghong Song
Quoted 156 lines · Andrii Nakryiko
Quoted 147 lines · Yonghong Song
Quoted 143 lines · Quentin Monnet
Quoted 125 lines · Yonghong Song
Quoted 104 lines · Yonghong Song
Quoted 53 lines · Quentin Monnet
Quoted 46 lines · Yonghong Song

When building bpf selftests like
make -C tools/testing/selftests/bpf -j20
I hit the following errors:

     ...
     GEN

/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8

     <stdin>:75: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
     <stdin>:71: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     <stdin>:85: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     <stdin>:57: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
     <stdin>:66: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     <stdin>:109: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     <stdin>:175: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     <stdin>:273: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
     make[1]: ***

[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12
make[1]: *** Waiting for unfinished jobs....
make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12

     make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8]
Error 12
     ...

I am using:

     -bash-4.4$ rst2man --version
     rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2)
     -bash-4.4$

Looks like that particular version of rst2man prefers to have a blank line
after literal blocks. This patch added block lines in related .rst files
and compilation can then pass.

Quoted 4 lines
Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE

ALSO" sections in man pages")

Quoted 7 lines

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

      rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

Thanks for the tip! I looked at the generated output again. My above fix can silent the warning, but certainly not correct.

With the following change, I captured the intermediate result of the .rst file.

    ifndef RST2MAN_DEP
           $(error "rst2man not found, but required to generate man pages")
    endif

- $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man
$(RST2MAN_OPTS) > $@
+ $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | tee
/tmp/tt | rst2man $(RST2MAN_OPTS) > $@

With below command,

      make clean && make bpftool-cgroup.8

I can get the new .rst file for bpftool-cgroup.

At the end of file /tmp/tt (changed bpftool-cgroup.rst), I see

ID AttachType AttachFlags Name
\n SEE ALSO\n========\n\t**bpf**\ (2),\n\t**bpf-helpers**\
(7),\n\t**bpftool**\ (8),\n\t**bpftool-btf**\
(8),\n\t**bpftool-feature**\ (8),\n\t**bpftool-gen**\
(8),\n\t**bpftool-iter**\ (8),\n\t**bpftool-link**\
(8),\n\t**bpftool-map**\ (8),\n\t**bpftool-net**\
(8),\n\t**bpftool-perf**\ (8),\n\t**bpftool-prog**\
(8),\n\t**bpftool-struct_ops**\ (8)\n

This sounds correct if we rst2man can successfully transforms '\n' or '\t' to proper encoding in the man page.

Unfortunately, with my version of rst2man, I got

.IP "System Message: WARNING/2 (<stdin>:, line 146)"
Literal block ends without a blank line; unexpected unindent.
.sp
n SEE ALSOn========nt**bpf**(2),nt**bpf\-helpers**(7),nt**bpftool**(8),nt**bpftool\-btf**(8),nt**bpftool\-feature**(8),nt**bpftool\-gen**(8),nt**bpftool\-iter**(8),nt**bpftool\-link**(8),nt**bpftool\-map**(8),nt**bpftool\-net**(8),nt**bpftool\-perf**(8),nt**bpftool\-prog**(8),nt**bpftool\-struct_ops**(8)n

Quoted 6 lines

.\" Generated by docutils manpage writer.

The rst2man simply considered \n as 'n'. The same for '\t' and this caused the issue.

I did not find a way to fix the problem https://urldefense.proofpoint.com/v2/url?u=https-3A__www.google.com_url-3Fq-3Dhttps-3A__zoom.us_j_94864957378-3Fpwd-253DbXFRL1ZaRUxTbDVKcm9uRitpTXgyUT09-26sa-3DD-26source-3Dcalendar-26ust-3D1600532408208000-26usg-3DAOvVaw3SJ0i8oz4ZM-2DGRb7hYkrYlyet&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=DA8e1B5r073vIqRrFz7MRA&m=kEK7ScPMF-y-i8dli-or8wWEGREW5V4qPB7UqHqDnkg&s=Br0g0MFXxL_pJuDVTOY5UrmvfD2ru_6Uf_X_8Nr2Rhk&e= .

The following change works for me.

(quoted diff) +0 -1
@@ -44,7 +44,7 @@ $(OUTPUT)%.8: %.rst
   ifndef RST2MAN_DEP
          $(error "rst2man not found, but required to generate man pages")
   endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man

$(RST2MAN_OPTS) > $@
+ $(QUIET_GEN)( cat $< ; echo -e $(call see_also,$<) ) | rst2man
$(RST2MAN_OPTS) > $@

Quoted 5 lines
   clean: helpers-clean
          $(call QUIET_CLEAN, Documentation)

-bash-4.4$

I will send revision 2 shortly.

Thanks Yonghong, but this does not work on my setup :/. The version of echo which is called on my machine from the Makefile does not seem to interpret the "-e" option and writes something like "-e\nSEE ALSO", which causes rst2man to complain.

I suspect the portable option here would be printf, even though Andrii had some concerns that we could pass a format specifier through the file names [0].

Would this work on your setup?

Quoted 7 lines
Quoted 3 lines
       $(QUIET_GEN)( cat $< ; printf $(call see_also,$<) ) | rst2man...

Would that be acceptable?

It works for me. Andrii originally suggested echo -e, but since echo -e does not work in your environment let us use printf then. I will add a comment about '%' in the bpftool man page name.

Quoted 6 lines

It's amazing how incompatible echo can be. But that aside, I have nothing against printf itself, but:

printf "%s" "whatever we want to print out"

seems like the way to go, similarly how you'd do it in your C code, no?

This won't really work :-(

Quoted 8 lines

-bash-4.4$ printf "%s" "\n\n"
\n\n-bash-4.4$ printf "\n\n"

-bash-4.4$

Looks like "\n" needs to be in format string to make a difference.

I just learned that %b was added specifically for that case:

$ printf "%b" "\n\n"

$

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

[0]
https://lore.kernel.org/bpf/[email protected]/T/#m01bb298fd512121edd5e77a26ed5382c0c53939e

Quentin

#11 lore raw
Quoted 174 lines · Andrii Nakryiko
Quoted 173 lines · Yonghong Song
Quoted 156 lines · Andrii Nakryiko
Quoted 147 lines · Yonghong Song
Quoted 143 lines · Quentin Monnet
Quoted 125 lines · Yonghong Song
Quoted 104 lines · Yonghong Song
Quoted 53 lines · Quentin Monnet
Quoted 46 lines · Yonghong Song

When building bpf selftests like
make -C tools/testing/selftests/bpf -j20
I hit the following errors:

      ...
      GEN

/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-gen.8

      <stdin>:75: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
      <stdin>:71: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
      <stdin>:85: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
      <stdin>:57: (WARNING/2) Block quote ends without a blank line;
unexpected unindent.
      <stdin>:66: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
      <stdin>:109: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
      <stdin>:175: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
      <stdin>:273: (WARNING/2) Literal block ends without a blank line;
unexpected unindent.
      make[1]: ***

[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-perf.8] Error 12
make[1]: *** Waiting for unfinished jobs....
make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-iter.8] Error 12

      make[1]: ***
[/net-next/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpftool-struct_ops.8]
Error 12
      ...

I am using:

      -bash-4.4$ rst2man --version
      rst2man (Docutils 0.11 [repository], Python 2.7.5, on linux2)
      -bash-4.4$

Looks like that particular version of rst2man prefers to have a blank line
after literal blocks. This patch added block lines in related .rst files
and compilation can then pass.

Quoted 4 lines
Cc Quentin Monnet <[email protected]>
Fixes 18841da98100 ("tools: bpftool: Automate generation for "SEE

ALSO" sections in man pages")

Quoted 7 lines

Hi Yonghong, thanks for the fix! I didn't see those warnings on my setup. For the record my rst2man version is:

       rst2man (Docutils 0.16 [release], Python 3.8.2, on linux)

Your patch looks good, but instead of having blank lines at the end of most files, could you please check if the following works?

Thanks for the tip! I looked at the generated output again. My above fix can silent the warning, but certainly not correct.

With the following change, I captured the intermediate result of the .rst file.

     ifndef RST2MAN_DEP
            $(error "rst2man not found, but required to generate man pages")
     endif

- $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man
$(RST2MAN_OPTS) > $@
+ $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | tee
/tmp/tt | rst2man $(RST2MAN_OPTS) > $@

With below command,

       make clean && make bpftool-cgroup.8

I can get the new .rst file for bpftool-cgroup.

At the end of file /tmp/tt (changed bpftool-cgroup.rst), I see

ID AttachType AttachFlags Name
\n SEE ALSO\n========\n\t**bpf**\ (2),\n\t**bpf-helpers**\
(7),\n\t**bpftool**\ (8),\n\t**bpftool-btf**\
(8),\n\t**bpftool-feature**\ (8),\n\t**bpftool-gen**\
(8),\n\t**bpftool-iter**\ (8),\n\t**bpftool-link**\
(8),\n\t**bpftool-map**\ (8),\n\t**bpftool-net**\
(8),\n\t**bpftool-perf**\ (8),\n\t**bpftool-prog**\
(8),\n\t**bpftool-struct_ops**\ (8)\n

This sounds correct if we rst2man can successfully transforms '\n' or '\t' to proper encoding in the man page.

Unfortunately, with my version of rst2man, I got

.IP "System Message: WARNING/2 (<stdin>:, line 146)"
Literal block ends without a blank line; unexpected unindent.
.sp
n SEE ALSOn========nt**bpf**(2),nt**bpf\-helpers**(7),nt**bpftool**(8),nt**bpftool\-btf**(8),nt**bpftool\-feature**(8),nt**bpftool\-gen**(8),nt**bpftool\-iter**(8),nt**bpftool\-link**(8),nt**bpftool\-map**(8),nt**bpftool\-net**(8),nt**bpftool\-perf**(8),nt**bpftool\-prog**(8),nt**bpftool\-struct_ops**(8)n

Quoted 6 lines

.\" Generated by docutils manpage writer.

The rst2man simply considered \n as 'n'. The same for '\t' and this caused the issue.

I did not find a way to fix the problem https://urldefense.proofpoint.com/v2/url?u=https-3A__www.google.com_url-3Fq-3Dhttps-3A__zoom.us_j_94864957378-3Fpwd-253DbXFRL1ZaRUxTbDVKcm9uRitpTXgyUT09-26sa-3DD-26source-3Dcalendar-26ust-3D1600532408208000-26usg-3DAOvVaw3SJ0i8oz4ZM-2DGRb7hYkrYlyet&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=DA8e1B5r073vIqRrFz7MRA&m=kEK7ScPMF-y-i8dli-or8wWEGREW5V4qPB7UqHqDnkg&s=Br0g0MFXxL_pJuDVTOY5UrmvfD2ru_6Uf_X_8Nr2Rhk&e= .

The following change works for me.

(quoted diff) +0 -1
@@ -44,7 +44,7 @@ $(OUTPUT)%.8: %.rst
    ifndef RST2MAN_DEP
           $(error "rst2man not found, but required to generate man pages")
    endif
-       $(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man

$(RST2MAN_OPTS) > $@
+ $(QUIET_GEN)( cat $< ; echo -e $(call see_also,$<) ) | rst2man
$(RST2MAN_OPTS) > $@

Quoted 5 lines
    clean: helpers-clean
           $(call QUIET_CLEAN, Documentation)

-bash-4.4$

I will send revision 2 shortly.

Thanks Yonghong, but this does not work on my setup :/. The version of echo which is called on my machine from the Makefile does not seem to interpret the "-e" option and writes something like "-e\nSEE ALSO", which causes rst2man to complain.

I suspect the portable option here would be printf, even though Andrii had some concerns that we could pass a format specifier through the file names [0].

Would this work on your setup?

Quoted 7 lines
Quoted 3 lines
        $(QUIET_GEN)( cat $< ; printf $(call see_also,$<) ) | rst2man...

Would that be acceptable?

It works for me. Andrii originally suggested echo -e, but since echo -e does not work in your environment let us use printf then. I will add a comment about '%' in the bpftool man page name.

Quoted 6 lines

It's amazing how incompatible echo can be. But that aside, I have nothing against printf itself, but:

printf "%s" "whatever we want to print out"

seems like the way to go, similarly how you'd do it in your C code, no?

This won't really work :-(

-bash-4.4$ printf "%s" "\n\n"
\n\n-bash-4.4$ printf "\n\n"

Quoted 8 lines
Quoted 4 lines

-bash-4.4$

Looks like "\n" needs to be in format string to make a difference.

I just learned that %b was added specifically for that case:

$ printf "%b" "\n\n"

Great! I learned some bash magic today... Will send v3.

Quoted 13 lines

$

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

[0]
https://lore.kernel.org/bpf/[email protected]/T/#m01bb298fd512121edd5e77a26ed5382c0c53939e

Quentin