amber-lang / amber-lang/amber

[BUG] Build panics when output permissions cannot be changed

Ouverte Adaptée aux débutants
#1,161 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug rust syntax
Langage dominant
Rust
Étoiles
5.2k
Forks
145
Merge moyen
5 j 3 h
PR mergées (30 j)
7

Description

> *This was generated by AI during triage.*

**Describe the bug**

Amber panics after it writes build output when the output target does not permit `chmod`. The panic comes from `file.set_permissions(perm).unwrap()` in `src/main.rs`.

Version: `amber fd743bd` (`fd743bd829af9e24705e1b855448757684112b95`) on Linux.

**To Reproduce**

```bash
cargo run --quiet -- build src/tests/validity/variable_simple.ab /dev/null --no-proc '*'
```

Actual result:

```text
thread 'main' panicked at src/main.rs:215:32:
called `Result::unwrap()` on an `Err` value: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }
```

**Expected behavior**

Amber should report a normal CLI error and exit with a non-zero status. It should not expose a Rust panic.

**Additional context**

`set_file_permission()` also unwraps `fs::metadata(path)`. Both filesystem errors can panic. Returning `io::Result` from permission and output helpers would let the CLI report these errors. Using `file.metadata()` would also avoid reading metadata through the path again.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Start in src/main.rs at set_file_permission() and the file.set_permissions(perm).unwrap() call around line 215, then trace the permission and output helpers mentioned in the issue. Run the provided cargo build command against /dev/null and verify that filesystem failures produce a normal CLI error with a non-zero exit status instead of a Rust panic.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
rust
Domaine
cli, compilers
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
Active
Clarté
Clairement spécifiée
Accessibilité débutants
78/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.