I have just copied a file to three boards and only two picked it up. From the Windows host I have:
Code: Select all
PS C:\> Get-FileHash E:\code.py -Algorithm SHA256
Algorithm Hash Path
--------- ---- ----
SHA256 64AE73DFC4CCF42D86C94118A86E6932E197459F7DACE1D00EDAF970F1EE1492 E:\code.py
PS C:\> Get-FileHash F:\code.py -Algorithm SHA256
Algorithm Hash Path
--------- ---- ----
SHA256 64AE73DFC4CCF42D86C94118A86E6932E197459F7DACE1D00EDAF970F1EE1492 F:\code.py
PS C:\> Get-FileHash G:\code.py -Algorithm SHA256
Algorithm Hash Path
--------- ---- ----
SHA256 64AE73DFC4CCF42D86C94118A86E6932E197459F7DACE1D00EDAF970F1EE1492 G:\code.py
But I get a repeatable syntax error on one of the boards. I've just improvised the world's simplest checksum.
GOOD:
Code: Select all
>>> with open("code.py", "rb") as file_bin:
... filebindata = file_bin.read()
...
...
...
>>> total = 0
>>> for b in filebindata: total += b
...
>>> total
1891982
>>> len(filebindata)
24247
BAD (NB:
total is different by two digits):
Code: Select all
>>> with open("code.py", "rb") as file_bin:
... filebindata = file_bin.read()
...
...
...
>>> total = 0
>>> for b in filebindata: total += b
...
>>> total
1893582
>>> len(filebindata)
24247
Something has mashed up at least one line, 613 is the syntax error:
GOOD (this is what it looks like on the host):
Code: Select all
>>> file_byline[613-1]
' "{:d} and RpsKeyDataAdvertisement {:d}".format(len(cipher_ads), len(key_ads)))\n'
>>> file_byline[614-1]
' except KeyError:\n'
>>> file_byline[615-1]
' pass\n'
>>> file_byline[616-1]
' player_choices.append(opponent_choice)\n'
BAD:
Code: Select all
>>> file_byline[613-1]
' "{:d} and RpsKeyDataAdvertisement {:d}".format(len(cipher_ads), len(key_ player_choices.append(opponent_choice)\n'
>>> file_byline[614-1]
' pass\n'
>>> file_byline[615-1]
' p wins ayer_choices.append(opponent_choice)\n'
>>> file_byline[616-1]
'\n'
ADDED LATER: I pulled the file off the device by cutting and pasting the bytes printed on serial console and re-creating the corrupted code.py on another machine. Here's the diff, the area of damage is a very small portion.
Code: Select all
$ diff -c actual-code.py corrupted-code.py
*** actual-code.py 2020-06-01 15:58:06.804888912 +0100
--- corrupted-code.py 2020-06-01 16:49:41.767492516 +0100
***************
*** 610,619 ****
round, round_msg1, round_msg2)
else:
print("Wrong number of RpsEncDataAdvertisement "
! "{:d} and RpsKeyDataAdvertisement {:d}".format(len(cipher_ads), len(key_ads)))
! except KeyError:
! pass
! player_choices.append(opponent_choice)
### Chalk up wins and losses
for p_idx1, player in enumerate(players[1:], 1):
--- 610,618 ----
round, round_msg1, round_msg2)
else:
print("Wrong number of RpsEncDataAdvertisement "
! "{:d} and RpsKeyDataAdvertisement {:d}".format(len(cipher_ads), len(key_ player_choices.append(opponent_choice)
! pass
! p wins ayer_choices.append(opponent_choice)
### Chalk up wins and losses
for p_idx1, player in enumerate(players[1:], 1):
It looks like there's one damaged chunk starting on a 128 byte boundary (could be finer grain than that):
Code: Select all
$ for skip in {182..184}
> do
> echo ACTUAL ${skip}
> dd if=actual-code.py bs=128 skip=${skip} count=1 2> /dev/null ; echo
> echo CORRUPTED ${skip}
> dd if=corrupted-code.py bs=128 skip=${skip} count=1 2> /dev/null ; echo
> echo --------
> done
ACTUAL 182
of RpsEncDataAdvertisement "
"{:d} and RpsKeyDataAdvertisement {:d}".format(len(cipher_ads), len(key_
CORRUPTED 182
of RpsEncDataAdvertisement "
"{:d} and RpsKeyDataAdvertisement {:d}".format(len(cipher_ads), len(key_
--------
ACTUAL 183
ads)))
except KeyError:
pass
player_choices.append(opponent_choice)
### Chalk u
CORRUPTED 183
player_choices.append(opponent_choice)
pass
p wins ayer_choices.append(opponent_choice)
### Chalk u
--------
ACTUAL 184
p wins and losses
for p_idx1, player in enumerate(players[1:], 1):
(win, draw, void) = evaluateGame(my_choic
CORRUPTED 184
p wins and losses
for p_idx1, player in enumerate(players[1:], 1):
(win, draw, void) = evaluateGame(my_choic
--------