grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] docs: A note to cat that hexdump should be used for binary d


From: Glenn Washburn
Subject: [PATCH 2/2] docs: A note to cat that hexdump should be used for binary data
Date: Wed, 26 Jul 2023 13:50:12 -0500

The cat command should not be used to print binary data because it can
show bytes not in the binary data and not show bytes that are in the data,
which can lead to confusion. This happens because cat does some processing
of the data stream, namely trying to decode substrings as UTF-8.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 docs/grub.texi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/docs/grub.texi b/docs/grub.texi
index 5f6f0895ef4f..71bd578c7a11 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -4541,6 +4541,12 @@ will be displayed as a simple new line.  Otherwise, the 
carriage return will
 be displayed as a control character (@samp{<d>}) to make it easier to see
 when boot problems are caused by a file formatted using DOS-style line
 endings.
+
+Note: @command{cat} can be used to view the contents of devices using the
+block list syntax (@pxref{Block list syntax}). However, it is not advised
+to view binary data because it will try to decode UTF-8 strings, which can
+lead to some bytes missing or added in the output. Instead, use the
+@command{hexdump} command (@pxref{hexdump}).
 @end deffn
 
 
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]