[v3,5/5] configurehood: Don't remove timestamp for checksum comparison

Submitted by Adrian Schmutzler on July 8, 2018, 5:57 p.m.

Details

Message ID 1531072659-4217-5-git-send-email-freifunk@adrianschmutzler.de
State Accepted
Headers show

Commit Message

Adrian Schmutzler July 8, 2018, 5:57 p.m.
Timestamps in hood file currently only change if changes are
made. Thus, there is no reason to remove them for comparison.

This also fixes the wrong quote characters in the script, which
changed the script in a way the timestamps aren't removed right
now anyway.

After this change, a hood reconfiguration may be triggered by
just changing the timestamp at the keyxchange.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>

---

Changes in v2:
Rebase onto hood file rename
---
 src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
index de722f0..00e3641 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -106,10 +106,8 @@  if [ -s "$hoodfiletmp" ]; then
 	# https://pw.freifunk-franken.de/patch/205/
 	# but without signature, every hood file we get is valid!
 
-	catnew="$(cat "$hoodfiletmp" | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
-	catold="$(cat "$hoodfileref" 2>/dev/null | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
-	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
-	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
+	sumnew=$(cat "$hoodfiletmp" 2>/dev/null | sha256sum | cut -f1 -d " ")
+	sumold=$(cat "$hoodfileref" 2>/dev/null | sha256sum | cut -f1 -d " ")
 
 	json_load "$(cat "$hoodfiletmp")"
 

Comments

Fabian Blaese July 8, 2018, 7:44 p.m.
Bitte die Patches/Patchsets nicht vermischen, das macht das Verfolgen der Änderungen und reviewen schwer.

Ich hab mich schon immer gefragt, wozu das gut war, wahrscheinlich ist das noch vom dezentralen Keyxchange übrig.

Reviewed-by: Fabian Bläse <fabian@blaese.de>

Fabian

> On 8. Jul 2018, at 19:57, Adrian Schmutzler <freifunk@adrianschmutzler.de> wrote:
> 
> Timestamps in hood file currently only change if changes are
> made. Thus, there is no reason to remove them for comparison.
> 
> This also fixes the wrong quote characters in the script, which
> changed the script in a way the timestamps aren't removed right
> now anyway.
> 
> After this change, a hood reconfiguration may be triggered by
> just changing the timestamp at the keyxchange.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
> 
> ---
> 
> Changes in v2:
> Rebase onto hood file rename
> ---
> src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index de722f0..00e3641 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -106,10 +106,8 @@ if [ -s "$hoodfiletmp" ]; then
> 	# https://pw.freifunk-franken.de/patch/205/
> 	# but without signature, every hood file we get is valid!
> 
> -	catnew="$(cat "$hoodfiletmp" | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
> -	catold="$(cat "$hoodfileref" 2>/dev/null | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
> -	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
> -	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
> +	sumnew=$(cat "$hoodfiletmp" 2>/dev/null | sha256sum | cut -f1 -d " ")
> +	sumold=$(cat "$hoodfileref" 2>/dev/null | sha256sum | cut -f1 -d " ")
> 
> 	json_load "$(cat "$hoodfiletmp")"
> 
> --
> 2.7.4
>
Robert Langhammer July 9, 2018, 12:32 p.m.
Mir war auch nicht ganz klar, warum man den Timestamp raus genommen
hatte. Sieht gut aus.

Reviewed-by: Robert Langhammer <rlanghammer@web.de>


Am 08.07.2018 um 19:57 schrieb Adrian Schmutzler:
> Timestamps in hood file currently only change if changes are
> made. Thus, there is no reason to remove them for comparison.
>
> This also fixes the wrong quote characters in the script, which
> changed the script in a way the timestamps aren't removed right
> now anyway.
>
> After this change, a hood reconfiguration may be triggered by
> just changing the timestamp at the keyxchange.
>
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
>
> ---
>
> Changes in v2:
> Rebase onto hood file rename
> ---
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index de722f0..00e3641 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -106,10 +106,8 @@ if [ -s "$hoodfiletmp" ]; then
>  	# https://pw.freifunk-franken.de/patch/205/
>  	# but without signature, every hood file we get is valid!
>  
> -	catnew="$(cat "$hoodfiletmp" | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
> -	catold="$(cat "$hoodfileref" 2>/dev/null | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
> -	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
> -	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
> +	sumnew=$(cat "$hoodfiletmp" 2>/dev/null | sha256sum | cut -f1 -d " ")
> +	sumold=$(cat "$hoodfileref" 2>/dev/null | sha256sum | cut -f1 -d " ")
>  
>  	json_load "$(cat "$hoodfiletmp")"
>
Fabian Blaese July 10, 2018, 10:11 p.m.
Tested-by: Fabian Bläse <fabian@blaese.de>

Fabian

> On 8. Jul 2018, at 21:44, Fabian Bläse <fabian@blaese.de> wrote:
> 
> Bitte die Patches/Patchsets nicht vermischen, das macht das Verfolgen der Änderungen und reviewen schwer.
> 
> Ich hab mich schon immer gefragt, wozu das gut war, wahrscheinlich ist das noch vom dezentralen Keyxchange übrig.
> 
> Reviewed-by: Fabian Bläse <fabian@blaese.de>
> 
> Fabian
> 
>> On 8. Jul 2018, at 19:57, Adrian Schmutzler <freifunk@adrianschmutzler.de> wrote:
>> 
>> Timestamps in hood file currently only change if changes are
>> made. Thus, there is no reason to remove them for comparison.
>> 
>> This also fixes the wrong quote characters in the script, which
>> changed the script in a way the timestamps aren't removed right
>> now anyway.
>> 
>> After this change, a hood reconfiguration may be triggered by
>> just changing the timestamp at the keyxchange.
>> 
>> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
>> 
>> ---
>> 
>> Changes in v2:
>> Rebase onto hood file rename
>> ---
>> src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>> 
>> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> index de722f0..00e3641 100755
>> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> @@ -106,10 +106,8 @@ if [ -s "$hoodfiletmp" ]; then
>> 	# https://pw.freifunk-franken.de/patch/205/
>> 	# but without signature, every hood file we get is valid!
>> 
>> -	catnew="$(cat "$hoodfiletmp" | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
>> -	catold="$(cat "$hoodfileref" 2>/dev/null | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
>> -	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
>> -	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
>> +	sumnew=$(cat "$hoodfiletmp" 2>/dev/null | sha256sum | cut -f1 -d " ")
>> +	sumold=$(cat "$hoodfileref" 2>/dev/null | sha256sum | cut -f1 -d " ")
>> 
>> 	json_load "$(cat "$hoodfiletmp")"
>> 
>> --
>> 2.7.4
>> 
>
Tim Niemeyer July 25, 2018, 8:57 p.m.
Hi

Genau das war ein überbleibsel ..

Reviewed-by: Tim Niemeyer <tim@tn-x.org>

Tim

Am Sonntag, den 08.07.2018, 19:57 +0200 schrieb Adrian Schmutzler:
> Timestamps in hood file currently only change if changes are
> made. Thus, there is no reason to remove them for comparison.
> 
> This also fixes the wrong quote characters in the script, which
> changed the script in a way the timestamps aren't removed right
> now anyway.
> 
> After this change, a hood reconfiguration may be triggered by
> just changing the timestamp at the keyxchange.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
> 
> ---
> 
> Changes in v2:
> Rebase onto hood file rename
> ---
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index de722f0..00e3641 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -106,10 +106,8 @@ if [ -s "$hoodfiletmp" ]; then
>  	# https://pw.freifunk-franken.de/patch/205/
>  	# but without signature, every hood file we get is valid!
>  
> -	catnew="$(cat "$hoodfiletmp" | sed 's/"timestamp”: *"[0-
> 9]*"/"timestamp":0/')"
> -	catold="$(cat "$hoodfileref" 2>/dev/null | sed
> 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
> -	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
> -	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
> +	sumnew=$(cat "$hoodfiletmp" 2>/dev/null | sha256sum | cut
> -f1 -d " ")
> +	sumold=$(cat "$hoodfileref" 2>/dev/null | sha256sum | cut
> -f1 -d " ")
>  
>  	json_load "$(cat "$hoodfiletmp")"
>