This is better than printing random bytes in the terminal.
Note Jakub suggested 'hexdump', but Mat found out that this tool is not
often installed by default. 'od' can do a similar job, and it is in the
POSIX specs and available in coreutils, so it should be on more systems.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Suggested-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
v2: switch to 'od', and no more check for its presence (Mat)
---
tools/testing/selftests/net/mptcp/mptcp_lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
index 09cd24b2ae466205dacbdf8289eb86c08534c475..d62e653d48b0f2ef7a01e289fa0be8907825667d 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
@@ -384,7 +384,7 @@ mptcp_lib_make_file() {
mptcp_lib_print_file_err() {
ls -l "${1}" 1>&2
echo "Trailing bytes are: "
- tail -c 27 "${1}"
+ tail -c 32 "${1}" | od -x | head -n2
}
# $1: input file ; $2: output file ; $3: what kind of file
--
2.51.0
On Fri, 2025-09-05 at 20:18 +0200, Matthieu Baerts (NGI0) wrote: > This is better than printing random bytes in the terminal. > > Note Jakub suggested 'hexdump', but Mat found out that this tool is > not > often installed by default. 'od' can do a similar job, and it is in > the > POSIX specs and available in coreutils, so it should be on more > systems. > > Suggested-by: Jakub Kicinski <kuba@kernel.org> > Suggested-by: Mat Martineau <martineau@kernel.org> > Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> > --- > v2: switch to 'od', and no more check for its presence (Mat) > --- > tools/testing/selftests/net/mptcp/mptcp_lib.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh > b/tools/testing/selftests/net/mptcp/mptcp_lib.sh > index > 09cd24b2ae466205dacbdf8289eb86c08534c475..d62e653d48b0f2ef7a01e289fa0 > be8907825667d 100644 > --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh > +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh > @@ -384,7 +384,7 @@ mptcp_lib_make_file() { > mptcp_lib_print_file_err() { > ls -l "${1}" 1>&2 > echo "Trailing bytes are: " > - tail -c 27 "${1}" > + tail -c 32 "${1}" | od -x | head -n2 nit: It shows more bytes (32) here, but it wasn't mentioned in the commit log. Thanks, -Geliang > } > > # $1: input file ; $2: output file ; $3: what kind of file
Hi Geliang, On 06/09/2025 01:42, Geliang Tang wrote: > On Fri, 2025-09-05 at 20:18 +0200, Matthieu Baerts (NGI0) wrote: >> This is better than printing random bytes in the terminal. >> >> Note Jakub suggested 'hexdump', but Mat found out that this tool is >> not >> often installed by default. 'od' can do a similar job, and it is in >> the >> POSIX specs and available in coreutils, so it should be on more >> systems. >> >> Suggested-by: Jakub Kicinski <kuba@kernel.org> >> Suggested-by: Mat Martineau <martineau@kernel.org> >> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> >> --- >> v2: switch to 'od', and no more check for its presence (Mat) >> --- >> tools/testing/selftests/net/mptcp/mptcp_lib.sh | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh >> b/tools/testing/selftests/net/mptcp/mptcp_lib.sh >> index >> 09cd24b2ae466205dacbdf8289eb86c08534c475..d62e653d48b0f2ef7a01e289fa0 >> be8907825667d 100644 >> --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh >> +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh >> @@ -384,7 +384,7 @@ mptcp_lib_make_file() { >> mptcp_lib_print_file_err() { >> ls -l "${1}" 1>&2 >> echo "Trailing bytes are: " >> - tail -c 27 "${1}" >> + tail -c 32 "${1}" | od -x | head -n2 > > nit: > > It shows more bytes (32) here, but it wasn't mentioned in the commit > log. Good point, I can add this when applying the patches: Show a few more bytes, just to fill in the two lines. Would that be OK? Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Matt, On Sat, 2025-09-06 at 15:56 +0200, Matthieu Baerts wrote: > Hi Geliang, > > On 06/09/2025 01:42, Geliang Tang wrote: > > On Fri, 2025-09-05 at 20:18 +0200, Matthieu Baerts (NGI0) wrote: > > > This is better than printing random bytes in the terminal. > > > > > > Note Jakub suggested 'hexdump', but Mat found out that this tool > > > is > > > not > > > often installed by default. 'od' can do a similar job, and it is > > > in > > > the > > > POSIX specs and available in coreutils, so it should be on more > > > systems. > > > > > > Suggested-by: Jakub Kicinski <kuba@kernel.org> > > > Suggested-by: Mat Martineau <martineau@kernel.org> > > > Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> > > > --- > > > v2: switch to 'od', and no more check for its presence (Mat) > > > --- > > > tools/testing/selftests/net/mptcp/mptcp_lib.sh | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh > > > b/tools/testing/selftests/net/mptcp/mptcp_lib.sh > > > index > > > 09cd24b2ae466205dacbdf8289eb86c08534c475..d62e653d48b0f2ef7a01e28 > > > 9fa0 > > > be8907825667d 100644 > > > --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh > > > +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh > > > @@ -384,7 +384,7 @@ mptcp_lib_make_file() { > > > mptcp_lib_print_file_err() { > > > ls -l "${1}" 1>&2 > > > echo "Trailing bytes are: " > > > - tail -c 27 "${1}" > > > + tail -c 32 "${1}" | od -x | head -n2 > > > > nit: > > > > It shows more bytes (32) here, but it wasn't mentioned in the > > commit > > log. > > Good point, I can add this when applying the patches: > > Show a few more bytes, just to fill in the two lines. > > Would that be OK? That would be great. Thanks, -Geliang > > Cheers, > Matt
© 2016 - 2025 Red Hat, Inc.