From 738769db4c79f82c2010f74b11563b6ecd71aaa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 13 Nov 2020 23:37:29 +0100 Subject: [PATCH] cmdlineTest.sh: Fix regex for bytecode removal removing only every other piece between two references - Matched fragments must not overlap for the regex to work correctly. --- test/cmdlineTests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index aa70e6d47..90e2d6520 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -118,7 +118,7 @@ function test_solc_behaviour() # Remove bytecode (but not linker references). sed -i.bak -E -e 's/(\"object\":\")[0-9a-f]+([^"]*\")/\1\2/g' "$stdout_path" sed -i.bak -E -e 's/(\"object\":\"[^"]+\$__)[0-9a-f]+(\")/\1\2/g' "$stdout_path" - sed -i.bak -E -e 's/(__\$[0-9a-f]{34}\$__)[0-9a-f]+(__\$[0-9a-f]{34}\$__)/\1\2/g' "$stdout_path" + sed -i.bak -E -e 's/([0-9a-f]{34}\$__)[0-9a-f]+(__\$[0-9a-f]{17})/\1\2/g' "$stdout_path" # Replace escaped newlines by actual newlines for readability sed -i.bak -E -e 's/\\n/\'$'\n/g' "$stdout_path" @@ -137,7 +137,7 @@ function test_solc_behaviour() # 64697066735822 = hex encoding of 0x64 'i' 'p' 'f' 's' 0x58 0x22 # 64736f6c63 = hex encoding of 0x64 's' 'o' 'l' 'c' sed -i.bak -E -e 's/[0-9a-f]*64697066735822[0-9a-f]+64736f6c63[0-9a-f]+//g' "$stdout_path" - sed -i.bak -E -e 's/(__\$[0-9a-f]{34}\$__)[0-9a-f]+(__\$[0-9a-f]{34}\$__)/\1\2/g' "$stdout_path" + sed -i.bak -E -e 's/([0-9a-f]{17}\$__)[0-9a-f]+(__\$[0-9a-f]{17})/\1\2/g' "$stdout_path" sed -i.bak -E -e 's/[0-9a-f]+((__\$[0-9a-f]{34}\$__)*)/\1/g' "$stdout_path" # Remove trailing empty lines. Needs a line break to make OSX sed happy.