diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2019-05-12 14:57:31 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2019-05-12 14:57:31 +0000 |
commit | d6b0b9fdb72eeb7618c1765045fa8fae263981b2 (patch) | |
tree | 04bad3c0ff1411847a798850c85524a9e6707245 /distrib/syspatch | |
parent | bc8834c8f955f85d8e531ac906b5dab443f84933 (diff) |
use readlink(1) on each file that we think is different to ensure that
only the resolved path is included
ok ajacoutot@, tb@
Diffstat (limited to 'distrib/syspatch')
-rwxr-xr-x | distrib/syspatch/diff.sh | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/distrib/syspatch/diff.sh b/distrib/syspatch/diff.sh index ead3dc160de..c992e3bd077 100755 --- a/distrib/syspatch/diff.sh +++ b/distrib/syspatch/diff.sh @@ -1,8 +1,8 @@ #!/bin/ksh # -# $OpenBSD: diff.sh,v 1.5 2017/08/21 15:02:58 ajacoutot Exp $ +# $OpenBSD: diff.sh,v 1.6 2019/05/12 14:57:30 robert Exp $ # -# Copyright (c) 2017 Robert Nagy <robert@openbsd.org> +# Copyright (c) 2017, 2019 Robert Nagy <robert@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -20,7 +20,19 @@ umask 0022 trap exit HUP INT TERM -diff -Parq $1 $2 2>&1 | grep ' differ$' | \ +[[ "$1" != /* ]] || [[ "$2" != /* ]] && + echo "paths have to be absolute" && + exit 1 + +plist=$(mktemp) +trap 'rm -f ${plist}' EXIT + +padd() { + local _path=$1 + readlink -f ${_path} >> ${plist} +} + +diff -Parq $1 $2 2>&1 | grep ' differ$' | while IFS= read -r _d do _o=$(echo $_d | cut -d ' ' -f2) @@ -28,7 +40,7 @@ do case "${_o##*.}" in a) - cmp -s ${_o} ${_n} 34 34 || echo ${_n} + cmp -s ${_o} ${_n} 34 34 || padd ${_n} ;; 1|3p) # Needed for perl(1) because Pod::Man adds the build @@ -39,13 +51,15 @@ do trap 'rm -f ${_onm} ${_nnm}' EXIT sed -E '/([0-9]+-[0-9]+-[0-9]+|=+)/d' ${_o} > ${_onm} sed -E '/([0-9]+-[0-9]+-[0-9]+|=+)/d' ${_n} > ${_nnm} - diff -q ${_onm} ${_nnm} >/dev/null || echo ${_n} + diff -q ${_onm} ${_nnm} >/dev/null || padd ${_n} rm -f ${_onm} ${_nnm} ;; EFI|dat|db|tgz|*void|*dir|mk|cache-4) ;; *) - echo ${_n} + padd ${_n} ;; esac done + +sort -u ${plist} |