Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade electron to version 22 #2444

Merged
merged 3 commits into from
Nov 14, 2023
Merged

Conversation

Phylu
Copy link
Contributor

@Phylu Phylu commented Jan 9, 2023

I have updated electron to its latest version and bumped several connected dependencies as well.

Currently tested on Linux & Mac. I will try to test this on Windows within the next days and hope that everything there works as well.

@Phylu Phylu requested a review from bengotow January 9, 2023 21:27
@Phylu Phylu self-assigned this Jan 9, 2023
@Phylu
Copy link
Contributor Author

Phylu commented Jan 19, 2023

@bengotow I am trying to remove keytar, as I don't get Mailspring to build on Windows otherwise. Keytar is deprecated. See:

I tried to simply encrypt the credentials using the safeStorage method to encrypt the credentials nicely and then store them in the config. See: app/src/flux/stores/credential-store.ts

However, this does not work whatsoever. When creating a new mail account, I simply get the error message Your Mailspring ID is missing required fields - you may need to reset Mailspring.

If you can give me pointers of what may work, I would be grateful.

Trying to build with keytar included, I get the following error on Windows:

Error Log
PS C:\Users\phylu\Documents\git\Mailspring> npm install
npm WARN deprecated [email protected]: This module relies on Node.js's internals and will break at some point. Do not use it, and update to [email protected].
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.      
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Support has ended for 9.x series. Upgrade to @latest

> [email protected] postinstall
> node scripts/postinstall.js


-- Clearing app/node_modules (false !== 22.0.0) --

-- Running npm install --no-audit in ./app with electron config (arch=x64) --
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules',
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\Users\phylu\Documents\git\Mailspring\app\node_modules\cld'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\cld'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\phylu\Documents\git\Mailspring\app\node_modules\keytar
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install || npm run build
npm ERR! > [email protected] build
npm ERR! > node-gyp rebuild
npm ERR!
npm ERR! Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu erm�glichen, m�ssen Sie den Schalter "-m" hinzuf�gen.
npm ERR!   async.cc
npm ERR! C:\Users\phylu\AppData\Local\node-gyp\Cache\22.0.0\include\node\node_api.h(12,10): fatal error C1083: Datei (Include) kann nicht ge�ffnet werden: "js_native_api.h": No such file or directory [C:\Users\phylu\Documents\git\Mailspring\app\node_modules\keytar\build\keytar.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "C:\Python310\python.exe"
npm ERR! gyp info find VS using VS2019 (16.11.32228.343) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'msvs',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\keytar\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\AppData\\Local\\node-gyp\\Cache\\22.0.0\\include\\node\\common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\phylu\\AppData\\Local\\node-gyp\\Cache\\22.0.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\phylu\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\22.0.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\keytar',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\keytar\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'build/binding.sln',
npm ERR! gyp info spawn args   '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args   '/nologo',
npm ERR! gyp info spawn args   '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\phylu\Documents\git\Mailspring\node_modules\node-gyp\lib\build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\phylu\Documents\git\Mailspring\app\node_modules\keytar
npm ERR! gyp ERR! node -v v16.17.1
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\phylu\AppData\Local\npm-cache\_logs\2023-09-30T09_13_18_045Z-debug.log
safeExec: the command exited with Error: Command failed: npm install --no-audit
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.      
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules',
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\Users\phylu\Documents\git\Mailspring\app\node_modules\cld'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\cld'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\phylu\Documents\git\Mailspring\app\node_modules\keytar
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install || npm run build
npm ERR! > [email protected] build
npm ERR! > node-gyp rebuild
npm ERR!
npm ERR! Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu erm�glichen, m�ssen Sie den Schalter "-m" hinzuf�gen.
npm ERR!   async.cc
npm ERR! C:\Users\phylu\AppData\Local\node-gyp\Cache\22.0.0\include\node\node_api.h(12,10): fatal error C1083: Datei (Include) kann nicht ge�ffnet werden: "js_native_api.h": No such file or directory [C:\Users\phylu\Documents\git\Mailspring\app\node_modules\keytar\build\keytar.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "C:\Python310\python.exe"
npm ERR! gyp info find VS using VS2019 (16.11.32228.343) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'msvs',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\keytar\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\AppData\\Local\\node-gyp\\Cache\\22.0.0\\include\\node\\common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\phylu\\AppData\\Local\\node-gyp\\Cache\\22.0.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\phylu\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\22.0.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\keytar',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\keytar\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'build/binding.sln',
npm ERR! gyp info spawn args   '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args   '/nologo',
npm ERR! gyp info spawn args   '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\phylu\Documents\git\Mailspring\node_modules\node-gyp\lib\build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\phylu\Documents\git\Mailspring\app\node_modules\keytar
npm ERR! gyp ERR! node -v v16.17.1
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\phylu\AppData\Local\npm-cache\_logs\2023-09-30T09_13_18_045Z-debug.log
 1
`------------- stderr ------------
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.      
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules',
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\Users\phylu\Documents\git\Mailspring\app\node_modules\cld'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\cld'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\phylu\Documents\git\Mailspring\app\node_modules\keytar
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install || npm run build
npm ERR! > [email protected] build
npm ERR! > node-gyp rebuild
npm ERR!
npm ERR! Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu erm�glichen, m�ssen Sie den Schalter "-m" hinzuf�gen.
npm ERR!   async.cc
npm ERR! C:\Users\phylu\AppData\Local\node-gyp\Cache\22.0.0\include\node\node_api.h(12,10): fatal error C1083: Datei (Include) kann nicht ge�ffnet werden: "js_native_api.h": No such file or directory [C:\Users\phylu\Documents\git\Mailspring\app\node_modules\keytar\build\keytar.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "C:\Python310\python.exe"
npm ERR! gyp info find VS using VS2019 (16.11.32228.343) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'msvs',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\keytar\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\AppData\\Local\\node-gyp\\Cache\\22.0.0\\include\\node\\common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\phylu\\AppData\\Local\\node-gyp\\Cache\\22.0.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\phylu\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\22.0.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\keytar',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'C:\\Users\\phylu\\Documents\\git\\Mailspring\\app\\node_modules\\keytar\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'build/binding.sln',
npm ERR! gyp info spawn args   '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args   '/nologo',
npm ERR! gyp info spawn args   '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\phylu\Documents\git\Mailspring\node_modules\node-gyp\lib\build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\phylu\\Documents\\git\\Mailspring\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\phylu\Documents\git\Mailspring\app\node_modules\keytar
npm ERR! gyp ERR! node -v v16.17.1
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\phylu\AppData\Local\npm-cache\_logs\2023-09-30T09_13_18_045Z-debug.log

@SebTM
Copy link

SebTM commented Sep 25, 2023

Hey, regarding the mentioned CVE above this gets more time-sensitive to us (NixOS maintainers) what are your plans on moving forward here or updating to a non affected version? :)

@Phylu Phylu force-pushed the electron-22 branch 2 times, most recently from 7fad10b to c2ff2a2 Compare September 30, 2023 09:37
@MikaelFangel
Copy link

@Phylu - May suggest that you update the title to something like: Upgrade electron to version 22.x.x or maybe just upgrade electron to version 22. So it's more clear that you try to upgrade to a recently patched version of Electron and not to 22.0.0.

@Phylu Phylu changed the title Upgrade electron to version 22.0.0 Upgrade electron to version 22 Oct 1, 2023
@Phylu
Copy link
Contributor Author

Phylu commented Oct 7, 2023

I think, I have found a solution on the keytar issue. The problem was, that I forgot about the Mailspring ID which could also be stored using keytar.

However, to write a proper migration we need at least one version that contains the new logic using the safeStorage method as well as keytar to move all the credentials to the new storage.

Therefore, I am now working on the migration step. We will need to have an intermediary Mailspring version then to prepare for this upgrade.

@Phylu Phylu marked this pull request as ready for review November 12, 2023 21:45
@Phylu
Copy link
Contributor Author

Phylu commented Nov 12, 2023

@bengotow This should now be ready to go after we have the intermediary 1.12 version shipped. I successfully tested these changes on Linux (.deb & snap), Mac and Windows and could not find any further issues.

@Tamriel
Copy link

Tamriel commented Nov 12, 2023

@Phylu Thank you for this PR!
I unsuccessfully tried building your fork. Could you share the .deb file as a release in the fork?

@Phylu
Copy link
Contributor Author

Phylu commented Nov 12, 2023

@Tamriel You can find a fresh temporary build here: https://nextcloud.phynformatik.de/index.php/s/GbATAMr4dofL327

@Tamriel
Copy link

Tamriel commented Nov 12, 2023

I tried it on Manjaro. My mail accounts cannot connect. I get Your Mailspring ID is missing required fields. The doc says 'This error message appears when Mailspring was unable to save your Mailspring ID password to your system keychain or keyring.'
I installed the same dependencies as with Mailspring 1.11
Ideas?

@Phylu
Copy link
Contributor Author

Phylu commented Nov 13, 2023

Try to follow these steps: https://community.getmailspring.com/t/password-management-error-after-the-latest-upgrade/7298

Logging out of your Mailspring ID temporarily should fix the issue.

@Tamriel
Copy link

Tamriel commented Nov 13, 2023

I deleted the Mailspring folder ~/.config and have installed gnome-keyring and libsecret. Nonetheless I cannot login with Mailspring ID because the credentials cannot be stored on my computer’s keyring. Mailspring 1.11 works.
The log in the console says:

Error: Could not call remote method 'encryptString'. Check that the method signature is correct. Underlying error: Error: Error while decrypting the ciphertext provided to safeStorage.decryptString. Encryption is not available.Underlying stack: Error: Error while decrypting the ciphertext provided to safeStorage.decryptString. Encryption is not available.
    at /usr/share/mailspring/resources/app.asar/node_modules/@electron/remote/dist/src/main/server.js:465:71
    at IpcMainImpl.<anonymous> (/usr/share/mailspring/resources/app.asar/node_modules/@electron/remote/dist/src/main/server.js:323:27)
    at IpcMainImpl.emit (node:events:513:28)
    at IpcMainImpl.emit (node:domain:489:12)
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:2:82058)
    at EventEmitter.emit (node:events:513:28)
    at EventEmitter.emit (node:domain:489:12)

    at /usr/share/mailspring/resources/app.asar/node_modules/@electron/remote/dist/src/main/server.js:468:25
    at IpcMainImpl.<anonymous> (/usr/share/mailspring/resources/app.asar/node_modules/@electron/remote/dist/src/main/server.js:323:27)
    at IpcMainImpl.emit (node:events:513:28)
    at IpcMainImpl.emit (node:domain:489:12)
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:2:82058)
    at EventEmitter.emit (node:events:513:28)
    at EventEmitter.emit (node:domain:489:12) {
  cause: {
    stack: 'Error: Error while decrypting the ciphertext provided to safeStorage.decryptString. Encryption is not available.\n' +
      '    at /usr/share/mailspring/resources/app.asar/node_modules/@electron/remote/dist/src/main/server.js:465:71\n' +
      '    at IpcMainImpl.<anonymous> (/usr/share/mailspring/resources/app.asar/node_modules/@electron/remote/dist/src/main/server.js:323:27)\n' +
      '    at IpcMainImpl.emit (node:events:513:28)\n' +
      '    at IpcMainImpl.emit (node:domain:489:12)\n' +
      '    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:2:82058)\n' +
      '    at EventEmitter.emit (node:events:513:28)\n' +
      '    at EventEmitter.emit (node:domain:489:12)',
    message: 'Error while decrypting the ciphertext provided to safeStorage.decryptString. Encryption is not available.'
  }
} { pluginIds: [] }
(node:978529) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `mailspring --trace-deprecation ...` to show where the warning was created)

@Phylu
Copy link
Contributor Author

Phylu commented Nov 13, 2023

@Tamriel Can you try to start mailspring with the following parameter from the command line?

--password-store="gnome-libsecret"

Which desktop environment is Manjaro using? Maybe we need to hardcode this parameter in the Mailspring startup if there are desktop environments that are not able to be properly recognized. I happened to run in this issue on Lubunt for testing now as well. Unfortunately, this might break (newly created) compatability on KDE environments...

See also: https://www.electronjs.org/docs/latest/api/safe-storage#safestoragegetselectedstoragebackend-linux

@Tamriel
Copy link

Tamriel commented Nov 13, 2023

There are different flavors of Manjaro. I use the sway desktop environment. It worked with --password-store="gnome-libsecret". Thanks a lot!

@Phylu
Copy link
Contributor Author

Phylu commented Nov 14, 2023

I just did some more testing. If you run Mailspring on a KDE5 based desktop, the safeStorage will use the correct kwallet5 option which removes the need for the gnome wallet bindings (which I think were necessary in older Mailspring versions due to keytar).

I am not sure if there is a proper way to figure out if we are on a desktop environment that is unknown by Electron in order to automatically add the gnome-libsecret option. Any ideas @Tamriel @bengotow? Maybe adjusting the .desktop file in the post install routine or something like this?

Otherwise, I think it needs to be put on the help page that for these (most likely less common) desktop environments the flag should be added manually to the .desktop file. However this is something that may not be kept on an upgrade.

@Tamriel
Copy link

Tamriel commented Nov 14, 2023

I installed Mailspring with an Arch User Repository package. In the package definition it is surely possible to add the flag to .desktop file file. I will add a comment the current Mailspring package, so the owner knows what to do when he updates to 1.12.

@Phylu
Copy link
Contributor Author

Phylu commented Nov 14, 2023

I have added some more details to the corresponding help page: https://community.getmailspring.com/t/password-management-error/199/2

@bengotow
Copy link
Collaborator

Hey @Phylu! All the changes here look great - I shipped the 1.12.0 release which is the stepping stone to this one, and I think we should go ahead and merge this! I'll start testing off master and using the Electron 22 one as my daily email client, and we can make smaller PRs to fix anything we run in to. Thanks for all the help with this!

@bengotow bengotow merged commit a1998fc into Foundry376:master Nov 14, 2023
@Phylu Phylu deleted the electron-22 branch November 14, 2023 21:17
@bengotow
Copy link
Collaborator

Hey folks,

I merged this and fixed a few issues with the Travis / AppVeyor CI builds -- I've been testing the new Electron 22 version on Mac for the last day or so, and it's working great! Here are some new builds. It'd be great if you could give it a spin and let me know if there are any issues -

Ben

Windows:

Mac:

Linux:

@Tamriel
Copy link

Tamriel commented Nov 15, 2023

@Phylu
Copy link
Contributor Author

Phylu commented Nov 18, 2023

When running the .deb version of Mailspring on one of my test systems, Zorin OS based on Ubuntu 22.04, I get the following error. It seems that the latest version of better-sqlite3 is linked against glibc 2.33 wheras the older Ubuntu version(s) are shipped with glibc 2.31.

Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/share/mailspring/resources/app.asar.unpacked/node_modules/better-sqlite3/build/Release/better_sqlite3.node)
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1869)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1226:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:2:2096)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at bindings (/usr/share/mailspring/resources/app.asar/node_modules/bindings/bindings.js:112:48)
    at new Database (/usr/share/mailspring/resources/app.asar/node_modules/better-sqlite3/lib/database.js:48:64)
    at openDatabase (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/flux/stores/database-store.ts:53:16)
    at DatabaseStore.open (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/flux/stores/database-store.ts:149:22)
    at new DatabaseStore (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/flux/stores/database-store.ts:144:12)
    at Object.<anonymous> (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/flux/stores/database-store.ts:532:16)
    at Object.<anonymous> (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/flux/stores/database-store.ts:532:36)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/flux/models/query-subscription.ts:1:1)
    at Object.<anonymous> (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/flux/models/query-subscription.ts:330:2)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/flux/models/query-subscription-pool.ts:2:1)
    at Object.<anonymous> (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/flux/models/query-subscription-pool.ts:119:21)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/global/mailspring-observables.ts:4:1)
    at Object.<anonymous> (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/global/mailspring-observables.ts:171:3)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at new AppEnvConstructor (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/app-env.ts:116:5)
    at Object.<anonymous> (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/secondary-window-bootstrap.ts:30:17)
    at Object.<anonymous> (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-KEmML7/resources/app/src/secondary-window-bootstrap.ts:38:49)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at setupWindow (file:///usr/share/mailspring/resources/app.asar/static/index.js:46:3)
    at window.onload (file:///usr/share/mailspring/resources/app.asar/static/index.js:74:5) {
  code: 'ERR_DLOPEN_FAILED'
} {}

@Phylu
Copy link
Contributor Author

Phylu commented Nov 18, 2023

On my Ubuntu 23.10 computer, I encounter the following issue after installing Mailspring 1.13 from the .deb file.

Bildschirmaufzeichnung.vom.2023-11-18.16-03-30.webm

This seems to be spellcheck related, happening when the spellchecker wants to highlight a word or part of a sentence, deleting it instead. If I write in German as the spellchecker is configured, the text won't be touched.

@Phylu
Copy link
Contributor Author

Phylu commented Nov 19, 2023

This seems to be spellcheck related, happening when the spellchecker wants to highlight a word or part of a sentence, deleting it instead.

@bengotow: I could boil this one down to an issue in adding the decorators for spelling errors. If I uncomment the editor.setDecorations() method call at these locations, there is no more text getting deleted (while no spellcheck happens anymore - of course). I saw, that the version of slate in use is customized in https://github.com/bengotow/slate. Maybe you can have a look at this and maybe even get back onto the main version, to be able to upgrade this dependency.

@bengotow
Copy link
Collaborator

Hey hey! Taking a look at the spellcheck issue now -- I was able to fix the GLIBC compatibility problem (at least on my Ubuntu 18 machine) by using an older linux to build the app in CI. Want to try this file and see if it works for you as well?

https://mailspring-builds.s3.amazonaws.com/client/fbb68340/linux/mailspring-1.13.0-amd64.deb

@Phylu
Copy link
Contributor Author

Phylu commented Nov 20, 2023

Taking a look at the spellcheck issue now

Looking forward to seeing this fixed!

I was able to fix the GLIBC compatibility problem (at least on my Ubuntu 18 machine) by using an older linux to build the app in CI. Want to try this file and see if it works for you as well?

@bengotow Nice. I can confirm that this version runs on both my Ubuntu 23.10 as well as my 22.04 test system (which did not run the build that was linked against the newer glibc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants