WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: tce-load -w behaviour for already loaded, but corrupted extension  (Read 3685 times)

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Hi, Core people!

Of course, corruption of the local data occurs not frequent, but it is possible. tce-load treats such circumstances as missing extension - see "app_exists" function, and consequently calls "fetch_app" function. But "fetch_app" is not attended to treat corrupted data, this trouble must be cured by tce-update.

I think that it would be better, if "app_exists" in case of inconsistency of .tcz and .tcz.md5.txt will warn about necessity of tce-update calling and terminate.

Actual behaviour of tce-load -w may even worsen the situation of data been corrupted, because if file (.tcz or .tcz.md5.txt) became shorter it will append correct data to it to achieve required file lehgth (wget -c). In case corrupted files' sizes are equal or bigger than must be, You will see

"server returned error  416 Requested Range Not Satisfiable"

which tells nothing about tce-update needed.

Apps in such situation fails too, probably they are calling tce-load. If yes, adjustment of "app_exists" function in tce-load will eliminate the misleading too.

Regards!


Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #1 on: February 19, 2021, 02:48:03 AM »
Checking the md5sums of existing extensions at load time may take a really long time, consider libreoffice for example. So while it would indeed improve usability with nicer error messages, the slowdown would be too much IMHO.
The only barriers that can stop you are the ones you create yourself.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #2 on: February 19, 2021, 03:40:40 AM »
Hi, curaga!

Code: [Select]
app_exists() {
        [ -f "$2/$1" ] && [ -f "$2/$1".md5.txt ] && (cd "$2" && md5sum -cs "$1".md5.txt)
}
It seems to me, that this function already checks md5 sum in case both .tcz and .tcz.md5.txt files are found. Am I wrong?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #3 on: February 19, 2021, 12:11:16 PM »
Hi jazzbiker
Looking only at that function, and nothing else to provide additional context. It appears any one of 3 conditions can
return a failure, implying the application doe not exist without actually specifying why it failed.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #4 on: February 19, 2021, 12:43:53 PM »
Oh, indeed. Not sure it should exit if the md5sum doesn't match, as an interrupted download may be more common than another kind of corruption. Please send a patch if you want to add an error/warning msg.
The only barriers that can stop you are the ones you create yourself.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #5 on: February 19, 2021, 02:42:35 PM »
My disappointment was caused by never seen before "416 Requested Range Not Satisfiable" message without any other explanations. If "app_exists" returns false due to corrupted .tcz.md5.txt, then consequent call of "fetch_app" with "wget -c" commands intended to complete interrupted download can not cure it, but happily "fetch_app" ends with another md5sum test. But in case this second md5 check fails, the message issued is simply "Error on $1" without any explanations or assumptions. I think if this message will be something like "Error on $1. Use tce-update" it will be pointing to the right direction. Does this worth sending the patch?

In general, regular use of tce-update can help eliminate the possibility of such situation to appear. But I was at TC10 and was not waiting for any updates :)

Thanks for the discussion and sorry for noise.

Best regards!
« Last Edit: February 19, 2021, 02:52:53 PM by jazzbiker »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #6 on: February 20, 2021, 02:31:39 AM »
Adding "use tce-update" may not be that good, as it doesn't help on many of the error cases...
The only barriers that can stop you are the ones you create yourself.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #7 on: February 20, 2021, 05:20:18 AM »
I was sure that tce-update will cure corrupted extension data, but in fact it checks only md5 sums. So if .tcz data are corrupted (or substituted) while .tcz.md5.txt is correct, tce-update will not even warn.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #8 on: February 20, 2021, 06:42:55 AM »
Running the script attached showed a lot of damage...

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #9 on: February 20, 2021, 09:15:24 AM »
Hi, curaga!

Sorry for bothering, here is small patch for getlocale.sh. Present version writes full path to mylocale.tcz into the mylocale.tcz.md5.txt in contrast with other extensions, whose .md5.txt files include only the basenames of the corresponding extensions. Of course this patch don't solve any problems, simply for convenience of nomadic users :) I was not able to post it, so it is attached.

Best regards!

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #10 on: February 20, 2021, 12:31:06 PM »
Thanks, I'm uploading getlocale.tcz for 11.x and 12.x x86 and x86_64.
The only barriers that can stop you are the ones you create yourself.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: tce-load -w behaviour for already loaded, but corrupted extension
« Reply #11 on: February 20, 2021, 12:37:29 PM »
Muchos gracias!