Repository: alacritty/alacritty (language: rust)

Issue:
migrate - strange error message
I started Alacritty on macOS and get the following warning at the bottom:

```
[WARN] Config warning: import has been deprecated; use general.import instead
use `alacritty migrate` to automatically resolve it
```

Then when I do that, I get the following:

```
$ alacritty migrate
Configuration file migration failed:
    "/Users/tessus/.config/alacritty/alacritty.toml": No such file or directory (os error 2)
```

However, this is absolutely wrong:

```
$ ll /Users/tessus/.config/alacritty/alacritty.toml
.rw-r--r-- 8,155 tessus staff 2024-07-20 17:57 /Users/tessus/.config/alacritty/alacritty.toml
```

### System

OS: macOS
Version: alacritty 0.14.0 (22a4475)


### Logs

Crashes: STDERR, STDOUT
Font/Terminal size: `alacritty -vv`
Keyboard and bindings: `alacritty --print-events`



Discussion / hints:
Can you share the full config? Are you making use of imports?
I think I got this config a while back from the Net, since alacritty does not create a default config file, nor does it come with a template.

Of course I could share my config file, but I won't. I don't want to distract from the issue at hand.
I am sure I can manually fix the config somehow. This is not the issue I have opened. This issue is not about deprecated config options.

The issue is that alacritty told me to use `migrate`. When I do, alacritty tells me that the config file does not exist even though it does.


Why did you close this issue? Because I didn't send the config file, so that you can deflect and tell me how to change the config manually?
I guess you really do not understand the issue I have opened. 

Thanks for making the decision easy for me not to use alacritty. Have a great day!
>Because I didn't send the config file, so that you can deflect and tell me how to change the config manually?

So one can run import on it and see the exact error and do necessary debugging. Maybe you have weird import setup that we don't account for, so given you know better how to proceed and don't want to cooperate, ofc the issue is closed.

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e78e82ba7c5..ed471ce741f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,8 @@ Notable changes to the `alacritty_terminal` crate are documented in its
 - Mouse/Vi cursor hint highlighting broken on the terminal cursor line
 - Hint launcher opening arbitrary text, when terminal content changed while opening
 - `SemanticRight`/`SemanticLeft` vi motions breaking with wide semantic escape characters
+- `alacritty migrate` crashing with recursive toml imports
+- Migrating nonexistent toml import breaking the entire migration
 
 ## 0.14.0
 
diff --git a/alacritty/src/migrate/mod.rs b/alacritty/src/migrate/mod.rs
index 42b51d27792..bfa72294a28 100644
--- a/alacritty/src/migrate/mod.rs
+++ b/alacritty/src/migrate/mod.rs
@@ -151,7 +151,15 @@ fn migrate_imports(
     // Migrate each import.
     for import in imports.into_iter().filter_map(|item| item.as_str()) {
         let normalized_path = config::normalize_import(path, import);
-        let migration = migrate_config(options, &normalized_path, recursion_limit)?;
+
+        if !normalized_path.exists() {
+            if options.dry_run {
+                println!("Skipping migration for nonexistent path: {}", normalized_path.display());
+            }
+            continue;
+        }
+
+        let migration = migrate_config(options, &normalized_path, recursion_limit - 1)?;
         if options.dry_run {
             println!("{}", migration.success_message(true));
         }


Test patch: