haskell / ghcup-hs

https://www.haskell.org/ghcup/
GNU Lesser General Public License v3.0
284 stars 88 forks source link

Support for powershell 2.0 (default version in windows 7) (or document which versions are supported) #150

Open hasufell opened 3 years ago

hasufell commented 3 years ago

In GitLab by @jneira on Jun 7, 2021, 14:52

Hi, congrats for the new windows support. I've tried to run the bootstrap executable in windows 7 and i've got an error about missing powershell definitions. I guess the builtin powershell version of windows 7, 2.0 is not compatible with the tool usage (does it expect powershell-3.0, i guess?).

PS D:\> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
6      1      7601   65536

PS D:\> Get-Host | Select-Object Version

Version
-------
2.0

PS D:\> .\bootstrap-haskell-1.0.1.exe

Excepción no controlada: System.IO.FileNotFoundException: No se puede cargar el
archivo o ensamblado 'System.Management.Automation, Version=3.0.0.0, Culture=neu
tral, PublicKeyToken=31bf3856ad364e35' ni una de sus dependencias. El sistema no
 puede encontrar el archivo especificado.
   en PowerShellToolsPro.Packager.ConsoleHost.Program.Main(String[] args)
hasufell commented 3 years ago

In GitLab by @jneira on Jun 7, 2021, 15:10

In the wikipedia page for powershell we have the default ps version per os:

PowerShell 2.0 is integrated with Windows 7 and Windows Server 2008 R2[59] and is released for Windows XP with Service Pack 3, Windows Server 2003 with Service Pack 2, and Windows Vista with Service Pack 1

PowerShell 3.0 is integrated with Windows 8 and with Windows Server 2012. Microsoft has also made PowerShell 3.0 available for Windows 7 with Service Pack 1, for Windows Server 2008 with Service Pack 1, and for Windows Server 2008 R2 with Service Pack 1.[71][72]

ghc does not support windows vista anymore (since 8.6) but it does for vista and newer versions in its last versions (see https://gitlab.haskell.org/ghc/ghc/-/wikis/platforms/windows#versions-supported)

EDIT: "available" does not imply installed, so the immediate workaround is update powershell in windows 7 SP1

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 7, 2021, 15:29

Yeah, I'm using some powershell 3.0 features. If you know how to improve portability, have a look at the script: https://gitlab.haskell.org/haskell/ghcup-hs/-/blob/master/bootstrap-haskell.ps1

hasufell commented 3 years ago

In GitLab by @jneira on Jun 7, 2021, 19:02

Couriosly i've been able to run the entire bootstrap-haskell.ps1 after downloading it manually, log here: https://gist.github.com/jneira/74791d21893a61e1b7ff4cc4df28b302

It ended with a certificate error trying to get https://gitlab.haskell.org/haskell/ghcup-hs/-/raw/windows-support/bootstrap-haskell. Then i tried the same command standalone with -k and it failed cause cabal is not in PATH (although the script is supposed to install cabal at some point?):

PS D:\ws\haskell\hls> $GhcupDir = "C:\ghcup"; $MsysDir = ('{0}\msys64' -f $GhcupDir); $Bash = ('{0}\usr\bin\bash' -f $MsysDir)
PS D:\ws\haskell\hls> & "$Bash" -lc "export PATH=`"/c/ghcup/bin:`$PATH`" ; curl --proto =https --tlsv1.2 -sSf -k  https://gitlab.haskell.org/haskell/ghcup-hs/-/raw/windows-support/bootstrap-haskell | bash"

Welcome to Haskell!

This script will download and install the following binaries:
  * ghcup - The Haskell toolchain installer
  * ghc   - The Glasgow Haskell Compiler
  * cabal - The Cabal build tool for managing Haskell software
  * stack - (optional) A cross-platform program for developing Haskell projects
  * hls   - (optional) A language server for developers to integrate with their editor/IDE

ghcup installs only into the following directory, which can be removed anytime:
  C:\ghcup

Press ENTER to proceed or ctrl-c to abort.
Note that this script can be re-run at any given time.

Press ENTER to proceed or ctrl-c to abort.
Installation may take a while.

Create an initial cabal.config including relevant msys2 paths (recommended)?
[Y] Yes  [N] No  [?] Help (default is "Y").

Y
main: línea 63: cabal: orden no encontrada
"cabal user-config -a extra-prog-path: C:\ghcup\bin, C:\Users\user\AppData\Roaming\cabal\bin, C:\ghcup\msys64\usr\bin, C:\ghcup\msys64\mingw64\bin -a extra-include-dirs: C:\ghcup\msys64\mingw64\include -a extra-lib-dirs: C:\ghcup\msys64\mingw64\lib -f init" failed!

It worths to mention that i have cabal in PATH for the dos/ps console but no inside the mingw console (cause it does not inherit the windows system PATH by default i think). Maybe it is cause i executed the command standalone instead as part of the main bootstrap script?

Also note that i had to pulse enter two times, without any new message between both.

At this point i only has ghcup.exe in C:\ghcup\bin.

At last consideration, i already have a msys2 installation configured for my use cases, maybe it would be nice that ghcup reuses it instead download a new one?

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 7, 2021, 19:29

Couriosly i've been able to run the entire bootstrap-haskell.ps1 after downloading it manually, log here: https://gist.github.com/jneira/74791d21893a61e1b7ff4cc4df28b302

That may be related to how the executable is created via PowerShell Pro Tools: https://docs.poshtools.com/powershell-pro-tools-documentation/packaging/package-as-executable

https://docs.poshtools.com/powershell-pro-tools-documentation/packaging/package.psd1 is the packaging file that allows to set PowerShellVersion and Runtime etc... so maybe that has an impact on things. I haven't tried all options yet.

It ended with a certificate error trying to get https://gitlab.haskell.org/haskell/ghcup-hs/-/raw/windows-support/bootstrap-haskell.

That sounds weird. I've never got one and there shouldn't be one.

Then i tried the same command standalone with -k and it failed cause cabal is not in PATH (although the script is supposed to install cabal at some point?):

The command standalone from within powershell doesn't behave well (e.g. you're missing output). But it does work when converted to an executables. Running it directly from within powershell, you need something different:

C:\ghcup\msys64\msys2_shell.cmd -mingw64 -mintty -c "export PATH=`"/c/ghcup/bin:`$PATH`" ; curl --proto =https --tlsv1.2 -sSf -k  https://gitlab.haskell.org/haskell/ghcup-hs/-/raw/windows-support/bootstrap-haskell | bash"

I didn't use that because it makes the script more difficult, since this is an interactive shell and now I have to set signal traps in place etc for the window to not vanish on errors and so on.

It worths to mention that i have cabal in PATH for the dos/ps console but no inside the mingw console (cause it does not inherit the windows system PATH by default i think). Maybe it is cause i executed the command standalone instead as part of the main bootstrap script?

C:\ghcup\bin is added to PATH in the above invocation you're running, so I don't see why it would not find cabal, unless the installation failed or the binary is broken. This isn't powershell environment, this is bash environment.

However, the powershell script also runs this, which you might have omitted:

Add-EnvPath -Path ('{0}\bin' -f $GhcupDir) -Container 'User'

At this point i only has ghcup.exe in C:\ghcup\bin.

That's definitely not right... so I'm assuming the shell is borked and you have to do the msys2_shell.cmd thing from above.

At last consideration, i already have a msys2 installation configured for my use cases, maybe it would be nice that ghcup reuses it instead download a new one?

Yes, I considered that, but currently C:\ghcup\msys64 is hardcoded. Power users could just download the ghcup binary and not do anything with the boostrap script.

If you have your own msys2, you have to understand:

  1. how to configure cabal.config to use those paths
  2. how to expose them temporarily in PATH in case you want to use ghcup compile

Just hardcoding seemed like the easiest solution, especially because you can get nasty problems if your msys2 path is too long, your installation isn't proper etc etc. That's gonna be support work for me.

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 7, 2021, 19:51

from https://docs.poshtools.com/powershell-pro-tools-documentation/packaging/package-as-executable

Packaging Requires .NET Core SDK version 1.0.0 or higher and the .NET 4.6.2 Developer Pack installed.
Resulting executables can be run on machines running PowerShell v3 or greater.
Resulting executables run under the .NET 4.6.2 framework.

So yes... the executable needs PowerShell v3.

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 7, 2021, 20:03

Also... Windows 7 can be upgraded to support Powershell v3, so I suggest you try a system upgrade.

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 7, 2021, 20:13

https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/install/installing-windows-powershell?view=powershell-7.1#upgrading-existing-windows-powershell

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 7, 2021, 20:48

This should help as well: https://gitlab.haskell.org/haskell/ghcup-hs/-/commit/9061e60518e8cb683608c77d6ebc1fbc77e8c1b2

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 7, 2021, 23:07

https://gitlab.haskell.org/haskell/ghcup-hs/-/merge_requests/93

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 8, 2021, 04:00

Ok, you may try:

  1. https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1
  2. and the exe version of it https://www.haskell.org/ghcup/sh/bootstrap-haskell-1.0.4.exe

These should also be aware of an existing msys2.

hasufell commented 3 years ago

In GitLab by @jneira on Jun 8, 2021, 04:11

Many thanks for take care and the quick response, i will give a try asap

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 8, 2021, 04:58

marked this issue as related to #142

hasufell commented 3 years ago

In GitLab by @jneira on Jun 9, 2021, 14:17

Hi, i've tried the new brand script from master in windows 7 and i've hit an error which was not thrown previously:

No se encuentra ninguna sobrecarga para "PromptForChoice" y el número de argumentos "4".
En D:\ws\haskell\issues\ghcup-sandbox\bootstrap-haskell.ps1: 105 Carácter: 39
+   $decision = $Host.UI.PromptForChoice <<<< ('Install GHCup'
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest
hasufell commented 3 years ago

In GitLab by @jneira on Jun 9, 2021, 14:48

It seems an explicit casting works for ps 2.0:

$decision = $Host.UI.PromptForChoice('Install GHCup'
                                      , 'GHCup is already installed, what do you want to do?'
                                      , [System.Management.Automation.Host.ChoiceDescription[]] @('&Reinstall'
                                          '&Continue'
                                          '&Abort'), 1)

changing the two existing calls to $Host.UI.PromptForChoice made the script work

hasufell commented 3 years ago

In GitLab by @jneira on Jun 9, 2021, 16:16

Ok, the bash script launched at final step failed due to the lack of the haskell.org server certificate in the ghcup msys installation. The initial -k did the trick for the very first fetch of https://www.haskell.org/ghcup/sh/bootstrap-haskell-windows but the script itself does several calls to haskell.org, so you need to have the server certificate installed. Dont know why firefox accepts the certificate with no problem but msys2 curl doesnt.

After installing the server certificates following https://stackoverflow.com/a/26590440/49554 and apply the workaround to update the main certificate bundles following: https://github.com/msys2/MSYS2-packages/issues/1222#issue-315545945

rm -f /usr/ssl/certs/ca-bundle.{,trust.}crt
rm -f /usr/ssl/cert.pem
ln -s /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /usr/ssl/certs/ca-bundle.crt
ln -s /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /usr/ssl/cert.pem
ln -s /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt /usr/ssl/certs/ca-bundle.trust.crt

the ghcup installation has started and seems fine for now

hasufell commented 3 years ago

In GitLab by @jneira on Jun 9, 2021, 16:19

[ Info ] Installing GHC (this may take a while)

Maybe it is asking for too much but any chance to show some progress bar while installing it?

hasufell commented 3 years ago

In GitLab by @jneira on Jun 9, 2021, 17:34

So the bootstrap-haskell-windows sh script has finished succesfully installing all the things. :fireworks:

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 9, 2021, 18:43

Ok, the bash script launched at final step failed due to the lack of the haskell.org server certificate in the ghcup msys installation.

That's very odd, since we do install certificates!

    Print-Msg -msg 'Updating SSL root certificate authorities...'
    & "$Bash" -lc 'pacman --noconfirm -S ca-certificates'

Are you sure that step didn't silently fail?

hasufell commented 3 years ago

In GitLab by @jneira on Jun 10, 2021, 13:54

Hi, i am trying the last ps script version. certificate updating seems to be succesfully:

Updating SSL root certificate authorities...
advertencia: ca-certificates-20210119-1 está actualizado -- reinstalándolo
resolviendo dependencias...
buscando conflictos entre paquetes...

Paquetes (1) ca-certificates-20210119-1

Tamaño total de la descarga:    0,31 MiB
Tamaño total de la instalación:  0,85 MiB
Tamaño neto tras actualizar:    0,00 MiB

:: ¿Continuar con la instalación? [S/n]
:: Obteniendo los paquetes...
error: no se pudo obtener el archivo «ca-certificates-20210119-1-any.pkg.tar.zs
» desde repo.msys2.org: SSL certificate problem: self signed certificate in cer
ificate chain
error: no se pudo obtener el archivo «ca-certificates-20210119-1-any.pkg.tar.zs
» desde downloads.sourceforge.net: SSL certificate problem: self signed certifi
ate in certificate chain
error: no se pudo obtener el archivo «ca-certificates-20210119-1-any.pkg.tar.zs
» desde www2.futureware.at: SSL certificate problem: self signed certificate in
certificate chain
error: no se pudo obtener el archivo «ca-certificates-20210119-1-any.pkg.tar.zs
» desde mirror.yandex.ru: SSL certificate problem: self signed certificate in c
rtificate chain
error: no se pudo obtener el archivo «ca-certificates-20210119-1-any.pkg.tar.zs
» desde mirrors.tuna.tsinghua.edu.cn: SSL certificate problem: self signed cert
ficate in certificate chain
 ca-certificates-...   322,0 KiB  10,5 MiB/s 00:00 [#####################] 100%
(1/1) comprobando las claves del depósito          [#####################] 100%
(1/1) verificando la integridad de los paquetes    [#####################] 100%
(1/1) cargando los archivos de los paquetes        [#####################] 100%
(1/1) comprobando conflictos entre archivos        [#####################] 100%
(1/1) comprobando el espacio disponible en el ...  [#####################] 100%
:: Procesando los cambios de los paquetes...
(1/1) reinstalando ca-certificates                 [#####################] 100%

but i am not being able to test curl cause the script failed with:

Error en la invocación del método porque [Microsoft.Win32.RegistryKey] no contiene ningún método llamado 'OpenBaseKey'.
En D:\ws\haskell\issues\ghcup-sandbox\bootstrap-haskell.ps1: 68 Carácter: 64
    + $hiveKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey <<<< ($hive,'Default')
    + CategoryInfo          : InvalidOperation: (OpenBaseKey:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MethodNotFound
hasufell commented 3 years ago

In GitLab by @jneira on Jun 10, 2021, 18:21

After change the script to adapt it to windows 7 api:

function Add-EnvPath {
  param(
      [Parameter(Mandatory=$true,HelpMessage='The Path to add to Users environment')]
      [string] $Path,

      [ValidateSet('Machine', 'User', 'Session')]
      [string] $Container = 'Session'
  )

  if ($Container -eq 'Session') {
      $envPaths = [Collections.Generic.List[String]]($env:Path -split ([IO.Path]::PathSeparator))
      if ($envPaths -notcontains $Path) {
          $envPaths.Add($Path)
          $env:PATH = $envPaths -join ([IO.Path]::PathSeparator)
      }
  }
  else {
      [Microsoft.Win32.RegistryHive]$hive, $keyPath = switch ($Container) {
          'Machine' { 'LocalMachine', 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment' }
          'User' { 'CurrentUser', 'Environment' }
      }

      $hiveKey = $envKey = $null
      try {
          $hiveKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($hive, '')
          $envKey = $hiveKey.OpenSubKey($keyPath, $true)
          $rawPath = $envKey.GetValue('PATH', '', 'DoNotExpandEnvironmentNames')

          $envPaths = [Collections.Generic.List[String]]($rawPath -split ([IO.Path]::PathSeparator))
          if ($envPaths -notcontains $Path) {
              $envPaths.Add($Path)
              $envKey.SetValue('PATH', ($envPaths -join ([IO.Path]::PathSeparator)), 'ExpandString')
          }
      }
      finally {
          if ($envKey) { $envKey.Close() }
          if ($hiveKey) { $hiveKey.Close() }
      }
  }
}

and check that the PATH has been changed succesfully, i've hit the certificate error in the bash script:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
"curl -Lf https://downloads.haskell.org/~ghcup/tmp/x86_64-mingw64-ghcup-9.exe" failed!
Press any key to exit

This error doesnt happen with windows 10 so maybe it is related with the network env on windows 7

hasufell commented 3 years ago

In GitLab by @jneira on Jun 10, 2021, 18:25

The curl command with -v

# curl -Lf -v https://downloads.haskell.org/~ghcup/tmp/x86_64-mingw64-ghcup-9.exe
*   Trying 151.101.129.175:443...
* Connected to downloads.haskell.org (151.101.129.175) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /usr/ssl/certs/ca-bundle.crt
*  CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS alert, unknown CA (560):
* SSL certificate problem: self signed certificate in certificate chain
* Closing connection 0
curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

more info

# where curl
D:\ghcup\msys64\usr\bin\curl.exe

# curl --version
curl 7.76.1 (x86_64-pc-msys) libcurl/7.76.1 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 zstd/1.5.0 libidn2/2.3.1 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0
Release-Date: 2021-04-14
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz Metalink NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd
hasufell commented 3 years ago

In GitLab by @jneira on Jun 10, 2021, 18:38

Using the server certificate authority of fortinet with name FGT6HD3916800469 (extracted with firefox) it success:

# curl -Lf -v --cacert /d/ws/haskell/www-haskell-org.fortinet.pem https://downloads.haskell.org/~ghcup/tmp/x86_64-mingw64-ghcup-9.exe
[www-haskell-org.fortinet.pem](https://gitlab.haskell.org/haskell/ghcup-hs/uploads/80db6bb57b8ac32c7cf532d4c4d7d0ac/www-haskell-org.fortinet.pem)*   Trying 151.101.1.175:443...
* Connected to downloads.haskell.org (151.101.1.175) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /d/ws/haskell/www-haskell-org-chain.fortinet.pem
*  CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=*.haskell.org
*  start date: Mar 22 19:59:01 2021 GMT
*  expire date: Apr 23 19:59:00 2022 GMT
*  subjectAltName: host "downloads.haskell.org" matched cert's "*.haskell.org"
*  issuer: C=US; ST=California; L=Sunnyvale; O=Fortinet; OU=Certificate Authority; CN=FGT6HD3916800469; emailAddress=support@fortinet.com
*  SSL certificate verify ok.
> GET /~ghcup/tmp/x86_64-mingw64-ghcup-9.exe HTTP/1.1
> Host: downloads.haskell.org
> User-Agent: curl/7.76.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Length: 61348631
< Server: nginx
< Content-Type: application/octet-stream
< Last-Modified: Tue, 08 Jun 2021 14:04:02 GMT
< ETag: "60bf78d2-3a81b17"
< Expires: Fri, 09 Jul 2021 08:10:31 GMT
< Cache-Control: max-age=2592000, public
< Via: 1.1 varnish, 1.1 varnish
< Accept-Ranges: bytes
< Age: 95538
< Date: Thu, 10 Jun 2021 10:42:48 GMT
< X-Served-By: cache-dfw18647-DFW, cache-cdg20720-CDG
< X-Cache: MISS, HIT
< X-Cache-Hits: 0, 0
< X-Timer: S1623321769.972536,VS0,VE0
<
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
* Failure writing output to destination
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, close notify (256):
hasufell commented 3 years ago

In GitLab by @jneira on Jun 10, 2021, 18:46

It seems that fortinet certicate is not in /usr/ssl/certs/ca-bundle.crt

hasufell commented 3 years ago

In GitLab by @jneira on Jun 10, 2021, 19:10

After change the script to adapt it to windows 7 api

I will check if the working script for windows 7 works for windows 10. Otherwise we will have to check if the win 10 methods exist and fallback to win 7 ones

hasufell commented 3 years ago

In GitLab by @jneira on Jun 11, 2021, 03:35

This the log of the curl call in windows 10:

$ curl -Lf -v https://downloads.haskell.org/~ghcup/tmp/x86_64-mingw64-ghcup-9.exe
*   Trying 151.101.133.175:443...
* Connected to downloads.haskell.org (151.101.133.175) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /usr/ssl/certs/ca-bundle.crt
*  CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=*.haskell.org
*  start date: Mar 22 19:59:01 2021 GMT
*  expire date: Apr 23 19:59:00 2022 GMT
*  subjectAltName: host "downloads.haskell.org" matched cert's "*.haskell.org"
*  issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Atlas R3 DV TLS CA 2020
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x8000924f0)
> GET /~ghcup/tmp/x86_64-mingw64-ghcup-9.exe HTTP/2
> Host: downloads.haskell.org
> user-agent: curl/7.76.1
> accept: */*
>
< HTTP/2 200
< server: nginx
< content-type: application/octet-stream
< last-modified: Tue, 08 Jun 2021 14:04:02 GMT
< etag: "60bf78d2-3a81b17"
< expires: Fri, 09 Jul 2021 08:10:31 GMT
< cache-control: max-age=2592000, public
< via: 1.1 varnish, 1.1 varnish
< accept-ranges: bytes
< age: 127389
< date: Thu, 10 Jun 2021 19:33:40 GMT
< x-served-by: cache-dfw18633-DFW, cache-mad22070-MAD
< x-cache: HIT, HIT
< x-cache-hits: 0, 0
< x-timer: S1623353621.665768,VS0,VE2
< content-length: 61348631
<
hasufell commented 3 years ago

In GitLab by @jneira on Jun 11, 2021, 03:40

Mmm as we can see the certificate issuer is different, i think the win 7 special network is the responsive of that. So i would not worry about, given there is a workaround.

hasufell commented 3 years ago

In GitLab by @maerwald on Jun 12, 2021, 02:30

Yeah, I think this is fine for now.

hasufell commented 3 years ago

In GitLab by @jneira on Jul 22, 2021, 20:04

The one liner from the ghcup install page does not work in windows 7:

PS D:\ws\haskell\hls> Set-ExecutionPolicy Bypass -Scope Process -Force;[System.N
et.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::Se
curityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Inv
oke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicP
arsing))) -ArgumentList $true
Excepción al establecer "SecurityProtocol": "No se puede convertir el valor "33
12" al tipo "System.Net.SecurityProtocolType" porque hay valores no válidos en
la enumeración. Especifique uno de los valores de enumeración siguientes e inté
ntelo de nuevo. Los valores de enumeración posibles son "Ssl3, Tls"."
En línea: 1 Carácter: 84
+ Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointMana
ger]:: <<<< SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtoc
ol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequ
est https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing)))
-ArgumentList $true
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

El término 'Invoke-WebRequest' no se reconoce como nombre de un cmdlet, función
, archivo de script o programa ejecutable. Compruebe si escribió correctamente
el nombre o, si incluyó una ruta de acceso, compruebe que dicha ruta es correct
a e inténtelo de nuevo.
En línea: 1 Carácter: 233
+ Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointMana
ger]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bo
r 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest <<
<<  https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing)))
-ArgumentList $true
    + CategoryInfo          : ObjectNotFound: (Invoke-WebRequest:String) [], C
   ommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
hasufell commented 3 years ago

In GitLab by @jneira on Jul 22, 2021, 20:12

The workaround is download directly the script and execute it

hasufell commented 3 years ago

In GitLab by @maerwald on Jul 23, 2021, 01:55

Can you try

Set-ExecutionPolicy Bypass -Scope Process -Force;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Inv
oke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicP
arsing))) -ArgumentList $true
hasufell commented 3 years ago

In GitLab by @jneira on Jul 23, 2021, 14:29

Hi, that version removes the first error:

PS D:\> Set-ExecutionPolicy Bypass -Scope Process -Force;Invoke-Command -ScriptB
lock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/
bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $true
El término 'Invoke-WebRequest' no se reconoce como nombre de un cmdlet, función
, archivo de script o programa ejecutable. Compruebe si escribió correctamente
el nombre o, si incluyó una ruta de acceso, compruebe que dicha ruta es correct
a e inténtelo de nuevo.
En línea: 1 Carácter: 119
+ Set-ExecutionPolicy Bypass -Scope Process -Force;Invoke-Command -ScriptBlock
([ScriptBlock]::Create((Invoke-WebRequest <<<<  https://www.haskell.org/ghcup/s
h/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $true
    + CategoryInfo          : ObjectNotFound: (Invoke-WebRequest:String) [], C
   ommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I am afraid that Invoke-WebRequest simply does not exist in powershell v1 or v2. The alternative is not straightforward: https://stackoverflow.com/questions/25120703/invoke-webrequest-equivalent-in-powershell-v2

hasufell commented 3 years ago

In GitLab by @jneira on Jul 23, 2021, 15:28

@maerwald the installer exe is still available? Maybe we could use it in this case

hasufell commented 2 years ago

In GitLab by @jneira on Feb 21, 2022, 15:05

shortcut creation is failing in my win 7 casue [Environment]::GetFolderPath("Desktop") is returning an empty string

EDIT: changing it by "~\Desktop" made it work