Skip to content

fix: create all required data directories with recursive mkdir on container init#2962

Draft
Copilot wants to merge 2 commits intodevelopfrom
copilot/fix-relative-path-issue
Draft

fix: create all required data directories with recursive mkdir on container init#2962
Copilot wants to merge 2 commits intodevelopfrom
copilot/fix-relative-path-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 7, 2026

After rebuilding a container with a fresh data volume, initFile.ts could silently fail to create required directories (and subsequently required files like task_before.sh), causing scripts to crash with No such file or directory.

Changes

  • back/loaders/initFile.ts
    • Changed fs.mkdir(dirPath)fs.mkdir(dirPath, { recursive: true }), consistent with every other mkdir call in the codebase. Without this, any missing parent directory (e.g. a freshly mounted dataPath) causes the entire init loop to throw, leaving required config files uncreated.
    • Added missing directories to the initialization list that exist in config/index.ts and share.sh but were never created by the Node init path:
      • dbPath (data/db/)
      • repoPath (data/repo/)
      • rawPath (data/raw/)
      • dependenceCachePath (data/dep_cache/)
      • updateLogPath (data/log/update/)
// Before
await fs.mkdir(dirPath);

// After — matches all other mkdir calls in the codebase
await fs.mkdir(dirPath, { recursive: true });
Original prompt

This section details on the original issue you should resolve

<issue_title>重新建容器后No such file or directory:</issue_title>
<issue_description>### Qinglong version

all

Steps to reproduce

Traceback (most recent call last):
File "/ql/data/scripts/btdr/app.py", line 32, in
with open('config.yaml', 'r', encoding='utf-8') as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'config.yaml'

app.py和config.yaml在同一个文件夹目录下,
之前程序可以跑, 被攻击后删除重新建, 升级最新版本都一样, 执行python的路径正常, 但是python运行的时候它获取当前目录不是程序所在目录, 写出config.yaml的绝对路径是可以运行的, 因为很多脚本包括以后写的都使用程序所在目录读取文件,所以这个问题怎么解决 ,

What is expected?

如何配置实现相对路径读取

What is actually happening?

无法读取相对路径

System Info

Any additional comments?

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Mar 7, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
qinglong Ready Ready Preview, Comment Mar 7, 2026 1:44pm
qinglong-back Ready Ready Preview, Comment Mar 7, 2026 1:44pm

…n on container rebuild

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix file not found error for config.yaml fix: create all required data directories with recursive mkdir on container init Mar 7, 2026
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.

重新建容器后No such file or directory:

2 participants