akiomik / akiomik/nostui

A first run whose data directory is unwritable fails before anything can explain it

未关闭
#583 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Rust
星标
71
派生
5
平均合并
4 小时 2 分钟
30 天内合并 PR
31

描述

Found while reviewing [#576](https://github.com/akiomik/nostui/pull/576), and outside it.

## What happens

`initialize_logging` runs before `Config::new`, and opens its file under `get_data_dir()`. If that directory cannot be written, the run ends there:

```
Error: Permission denied (os error 13)

Location:
src/utils/logging.rs:16:20
```

No path, no mention of what was being opened, and nothing about configuration — a file location in a crate the reader does not have.

## Why #576 does not reach it

That PR makes the no-configuration message name the directory it looked in, including when the directory cannot be read. On a platform where the data and configuration directories are the same — macOS is one, `--version` prints the identical path for both — an unreadable directory means logging fails first and the new message is never printed at all. Its test only gets past this by pointing `NOSTUI_DATA` somewhere writable, which is not the shape a default install has.

So the work #576 did on the configuration side has a matching gap on the logging side, one call earlier.

## Shape

The same thing the configuration error now does: name the directory, and say what was being opened in it. Whether logging should refuse to start at all when it cannot write — rather than carrying on without a log file — is the part worth deciding first, since a first run that cannot log is not obviously a first run that cannot proceed.

## Acceptance

- A data directory that cannot be written produces a message naming it.
- A fresh install on a platform where the two directories coincide reaches the configuration message rather than stopping before it.

贡献指南

打开贡献指南

调研方向

Start in src/utils/logging.rs at initialize_logging and trace its call before Config::new, then compare the existing configuration-side behavior from #576. Reproduce a first run with an unwritable data directory, including a platform where data and configuration directories coincide. Done means the error names the directory and opened item, and a fresh install can reach the configuration message when appropriate.

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
cli
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。