raspberrypi / hats

BSD 3-Clause "New" or "Revised" License
661 stars 144 forks source link

eepflash.sh not compatible with dd 8.23 (no status=progress) #57

Closed MarcDorval closed 3 years ago

MarcDorval commented 6 years ago

In eepflash.sh the lines calling dd contain 'status=progress'.

This option is not compatible with dd 8.23, which is by default on my setup (Linux raspberrypi 4.4.50-v7+), since the 'progress' option has only been introduced as from dd 8.24. apt-get update doesn't update dd to 8.24, so the script needs to be corrected.

The solution has been to replace 'status=progress' with 'status=none', as per the following patch.

In addition to this (since the above generates an error), I noticed that eepflash.sh is not robust to such errors: It locks the file but doesn't free it in case an error occurs (The eeprom appears with 'UU' when using i2cdetect -y 0).

The solution here consists in moving the 'closing' code before returning in case of an error.

I attach the patch I applied to get it to work.

eepflash_status_process.patch.gz

pelwell commented 6 years ago

sudo apt-get update only updates the database of packages. The minimal upgrade command for dd would be:

sudo apt-get update
sudo apt-get install coreutils

I'm not keen to reverse a UI improvement to support an old installation like this. An alternative would be to detect the version of dd installed and conditionally enable progress output.

MarcDorval commented 6 years ago

Fair enough. My 'patch' was just an example of what I needed to do to use the code. There are surely better ways to do that. I tested

sudo apt-get update sudo apt-get install coreutils

and I still get

dd (coreutils) 8.23

Here is another possible patch, checking the dd version to decide which status to use.

eepflash_status.patch.gz

pelwell commented 6 years ago

Nice. If you give me a Signed-off-by line with your name and email address you'll get the credit in the commit message. For reference, mine is:

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
MarcDorval commented 6 years ago

Cool. My signed off line would then be:

Signed-off-by: Marc Dorval <marc.dorval32@gmail.com

pelwell commented 6 years ago

See https://github.com/raspberrypi/hats/commit/8dbf6894706ea076811d8ecb3181f93a790499e0. Thanks.

mhei commented 3 years ago

I think this could be closed since the issue is fixed.