Bug#1061550: elan: creates invalid settings file on startup

2024-01-27 Thread Peter Green

It seems that the cause of this bug is probably the Debian patch that
changes the version of the toml crate.  There are breaking changes, so
the toml functions used in elan need to be updated to reflect these
changes.


We have a rust-toml-0.5 package in Debian and you are welcome to use it,
we have no immediate plans to get rid of it. toml 0.5 has more rdeps tha
toml 0.7 at the moment and toml 0.7 is going to be replaced by 0.8 and
probablly beyond before 0.5 goes away.

And I just tested and confirmed that rebuilding with toml 0.5 makes this
problem go away.

A debdiff is attached.diff -Nru elan-3.0.0/debian/changelog elan-3.0.0/debian/changelog
--- elan-3.0.0/debian/changelog 2024-01-12 07:48:39.0 +
+++ elan-3.0.0/debian/changelog 2024-01-27 07:49:52.0 +
@@ -1,3 +1,11 @@
+elan (3.0.0-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Switch back to using toml-0.5, toml-0.7 seems to cause incorrect config
+generation (Closes: #1061550).
+
+ -- Peter Michael Green   Sat, 27 Jan 2024 07:49:52 +
+
 elan (3.0.0-2) unstable; urgency=medium
 
   [ Peter Michael Green ]
diff -Nru elan-3.0.0/debian/control elan-3.0.0/debian/control
--- elan-3.0.0/debian/control   2024-01-12 07:34:29.0 +
+++ elan-3.0.0/debian/control   2024-01-27 07:48:36.0 +
@@ -21,7 +21,7 @@
  librust-tempfile-dev,
  librust-term-0.7+default-dev,
  librust-time-dev,
- librust-toml-0.7+default-dev (>= 0.7.6),
+ librust-toml-0.5+default-dev (>= 0.5.8),
  librust-url-dev,
  librust-wait-timeout-dev,
  librust-zip-dev,
diff -Nru elan-3.0.0/debian/patches/0002-dependencies.patch 
elan-3.0.0/debian/patches/0002-dependencies.patch
--- elan-3.0.0/debian/patches/0002-dependencies.patch   2024-01-12 
07:34:29.0 +
+++ elan-3.0.0/debian/patches/0002-dependencies.patch   2024-01-27 
07:49:52.0 +
@@ -13,7 +13,7 @@
 index 6bf922e..def0d9f 100644
 --- a/Cargo.toml
 +++ b/Cargo.toml
-@@ -34,17 +34,17 @@ libc = "0.2.82"
+@@ -34,13 +34,13 @@ libc = "0.2.82"
  markdown = "0.3.0"
  rand = "0.8.2"
  regex = "1.4.3"
@@ -29,11 +29,6 @@
  tempfile = "3.2.0"
  term = "0.7.0"
  time = "0.3.4"
--toml = "0.5.8"
-+toml = "0.7.6"
- url = "2.2.0"
- wait-timeout = "0.2.0"
- zip = "0.6"
 @@ -52,11 +52,6 @@ tar = ">=0.4.36"
  flate2 = "1.0.14"
  json = "0.12.4"
@@ -61,10 +56,9 @@
 -zstd = "0.10"
 +zstd = "0.12.1"
  walkdir = "2.3.1"
--toml = "0.5.8"
+ toml = "0.5.8"
 -sha2 = "0.9.3"
 -remove_dir_all = "0.8.0"
-+toml = "0.7.6"
 +sha2 = "0.10.5"
 +remove_dir_all = "0.8.2"
  elan-utils = { path = "../elan-utils" }
@@ -94,10 +88,9 @@
  scopeguard = "1.1.0"
 -semver = "0.11.0"
 -sha2 = "0.9.3"
--toml = "0.5.8"
 +semver = "0.9.0"
 +sha2 = "0.10.5"
-+toml = "0.7.6"
+ toml = "0.5.8"
  url = "2.2.1"
  curl = "0.4.34"
  openssl = { version = "0.10", features = ["vendored"] }


Bug#1061550: elan: creates invalid settings file on startup

2024-01-26 Thread Julian Gilbey
On Fri, Jan 26, 2024 at 09:36:07AM +, Julian Gilbey wrote:
> [...]
> 
> The settings file, ~/.elan/settings.toml, contains the single line:
> 
> { telemetry = false, version = "12", overrides = {} }
> 
> which is clearly in JSON format rather than TOML format.
> [...]

It seems that the cause of this bug is probably the Debian patch that
changes the version of the toml crate.  There are breaking changes, so
the toml functions used in elan need to be updated to reflect these
changes.

Best wishes,

   Julian



Bug#1061550: elan: creates invalid settings file on startup

2024-01-26 Thread Julian Gilbey
Package: elan
Version: 3.0.0-2
Severity: important

I installed elan, and had no ~/.elan directory.  I created an empty
directory ~/leantest, changed into it and ran the command "elan
default stable".  This creates the ~/.elan directory and populates
it.  However, the output of this command was:

info: syncing channel updates for 'stable'
info: latest update on stable, lean version v4.4.0
info: downloading component 'lean'
Total: 182.6 MiB Speed:   8.0 MiB/s
info: installing component 'lean'
error: error parsing settings

The settings file, ~/.elan/settings.toml, contains the single line:

{ telemetry = false, version = "12", overrides = {} }

which is clearly in JSON format rather than TOML format.

Manually editing the file to read:

telemetry = false
version = "12"
overrides = { }

allows "elan default stable" to work, though it then modifies
~/.elan/settings.toml to read:

{ default_toolchain = "stable", telemetry = false, version = "12", overrides = 
{} }

which then breaks the next attempt to use elan:

euler:~/leantest $ elan default stable
info: using existing install for 'stable'
error: error parsing settings

So it seems that elan is for some reason writing out the settings in
JSON rather than TOML format every time it touches them.

As a data point, the settings.toml on a Mac reads (between the "---"
lines):

---
default_toolchain = "stable"
telemetry = false
version = "12"

[overrides]
---

So something is very wrong here.

Best wishes,

   Julian