Skip to content

Commit 5e06dc3

Browse files
committed
topology_util.sh: Fix for xxd versions before 2022-01-14
Before 2022-01-14 xxd was adding new lines for every 256 columns with `-ps -c 0` flags. Before 2022-01-14: ``` echo test{1..10} | xxd -ps -c0 746573743120746573743220746573743320746573743420746573743520 746573743620746573743720746573743820746573743920746573743130 0a ``` Starting from 2022-01-14 and with the fix: ``` echo test{1..10} | xxd -ps -c0 7465737431207465737432207465737433207465737434207465737435207465737436207465737437207465737438207465737439207465737431300a ``` Signed-off-by: Stanislav German-Evtushenko <ginermail@gmail.com>
1 parent 42b9d08 commit 5e06dc3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sdk/canton/community/app/src/pack/scripts/topology/topology_util.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ decode_from_base64() {
2525

2626
# Encode bytes read from stdin to hexadecimal
2727
encode_to_hex() {
28-
xxd -ps -c 0
28+
local hex; hex=$(xxd -ps -c 0)
29+
hex="${hex//$'\n'/}" # Remove newlines for xxd < 2022-01-14, see https://github.com/vim/vim/commit/c0a1d370fa655cea9eaa74f5e605b95825dc9de1
30+
echo "$hex"
2931
}
3032
# [end byte utility functions]
3133

0 commit comments

Comments
 (0)