Apr 112020
 

Last updated on April 17th, 2020

Addendum 17th April 2020

Error after Sandbox opens

Today the FaH team issued a new client, version 7.6. The Windows Sandbox install detailed above now failed for me. The error shows in the above screenshot.

I’ve checked the code and you’ll see that it fails because 7.6 is parsed out to a zillion decimal points as seen in my screenshot below:

The new version can be seen here and the folder structure can be seen in the screenshot below:

Essentially, the code cannot find the download location it wants even though it apparently exists and in the same format as the earlier version, v7.5. This number conversion thing can be a bit of a pain at times and pops up in a lot of places, all the time when I was automating Microsoft Office while it chatted to Otacle databases some years ago. 🙂

I’ve managed to stick a Round function in which rounds up to 7.6 from 7.599999990463257. Initially this didn’t work yet adding small numbers like 0.001 still made it fail.

I’ve added it to GitHub, my first venture there, as a suggestion. I’m sure there’s a better way for for now it’ll have to wait.

I’ve a hunch that it may be connected to the recent windows update this week. Who knows? If you look closely at my screenshot I’ve remmed out my fix to get the original error to act. This is the line I have fixed in my own Powershell script:

$version = ((Invoke-WebRequest -Uri $installer_url -UseBasicParsing).Links | Where-Object {$_.href -match '^v\d+([.]\d+)?'} | ForEach-Object {[math]::Round([float]($_.href -replace '[^.\d]', ''),1)} | Measure-Object -Max).Maximum

I tested changing the [float] to a variety of integer types and none worked. I then tested the Round command which should have worked as the documentation says as here, but that didn’t work properly either. Taking out the addition of a small value actually worked, but it should’t…!! Typical code weirdness, huh?.

Showing default suggested behaviour of the Round function

Addendum #2 17 April 2020

A bug fix has just come back on the offending line. I can confirm it now works. In essence, the type conversion to “float” has been removed. The line now looks like:

$version = ((Invoke-WebRequest -Uri $installer_url -UseBasicParsing).Links | Where-Object  {$_.href -match '^v\d+([.]\d+)?'} | ForEach-Object {($_.href -replace '[^.\d]', '')} | Measure-Object -Max).Maximum

I’m glad about this, although it is still weird. The souce code for the download URL folder tree looks like:

<html>
<head><title>Index of /releases/public/release/fah-installer/windows-10-32bit/</title></head>
<body bgcolor="white">
<h1>Index of /releases/public/release/fah-installer/windows-10-32bit/</h1><hr><pre><a href="../">../</a>
<a href="v7.5/">v7.5/</a>                                              31-May-2018 19:22                   -
<a href="v7.6/">v7.6/</a>                                              17-Apr-2020 03:32                   -
</pre><hr></body>
</html>

You’ll see that there are no spaces or anything that might trip up the parsing code – i.e. v7.5 looks the same as v7.6 textually.

The original code worked for v7.5 yet not for v7.6 – it’s a mystery to me.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

© 1977, Strangely Perfect.