[PATCH] reject-known-sha1-collisions.sh: shell language tweaks

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] reject-known-sha1-collisions.sh: shell language tweaks

Daniel Shahaf-2
[[[
* tools/hook-scripts/reject-known-sha1-collisions.sh
    Use a more portable syntax for the [(1) (test(1)) tool.
    Handle filenames with literal backslashes.
]]]

[[[
Index: tools/hook-scripts/reject-known-sha1-collisions.sh
===================================================================
--- tools/hook-scripts/reject-known-sha1-collisions.sh (revision 1784385)
+++ tools/hook-scripts/reject-known-sha1-collisions.sh (working copy)
@@ -39,9 +39,9 @@
   exit 2
 fi
 
-$SVNLOOK changed -t "$TXN" "$REPOS" | /usr/bin/grep -Ev '^D ' | /usr/bin/sed -e 's/^.   //' | /usr/bin/grep -v '/$' | while read FILE; do
+$SVNLOOK changed -t "$TXN" "$REPOS" | /usr/bin/grep -Ev '^D ' | /usr/bin/sed -e 's/^.   //' | /usr/bin/grep -v '/$' | while IFS= read -r FILE; do
   PREFIX=`$SVNLOOK cat -t "$TXN" "$REPOS" "$FILE" | $HEAD -c320 | $SHA1SUM | cut -c-40`
-  if [ "$PREFIX" == 'f92d74e3874587aaf443d1db961d4e26dde13e9c' ]; then
+  if [ x"$PREFIX" = x'f92d74e3874587aaf443d1db961d4e26dde13e9c' ]; then
         echo "known SHA-1 collision rejected" >&2
         exit 3
   fi
]]]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] reject-known-sha1-collisions.sh: shell language tweaks

Andreas Stieger
Hi,

Daniel Shahaf wrote:
> [[[
> * tools/hook-scripts/reject-known-sha1-collisions.sh
>     Use a more portable syntax for the [(1) (test(1)) tool.
>     Handle filenames with literal backslashes.
> ]]]

Thanks, r1784484.

Andreas