check_for_release: the /opt/*_version.txt migration gives the app's version to any component

Đang mở Phù hợp với người mới
#303 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
shell
Lĩnh vực
cli

Hướng nghiên cứu

Báo cáo xác định lib/forge.func và check_for_release() là mã bị ảnh hưởng, đồng thời đưa ra cách tái hiện bằng check_for_gh_release. Đọc phần di chuyển /opt/*_version.txt của hàm đó và so sánh với phạm vi theo ứng dụng được dùng bởi var_appversion. Tái hiện bằng ví dụ Odoo và PDFKiln được cung cấp; hoàn tất khi bước kiểm tra của PDFKiln không còn dùng tệp phiên bản của Odoo, trong khi tệp cũ riêng của một ứng dụng vẫn được di chuyển.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

🔎 Did you run the script with verbose mode enabled?

Yes, verbose mode was enabled and the output is included below

🏷️ Which core version or commit are you on?

1b2c59e

🏗️ Host CPU architecture

amd64

📜 Which script (and repo) were you running when you hit this?

ct/odoo.sh (update) in community-scripts/ProxmoxVE, reproduced below with check_for_gh_release alone

🧩 Which engine file or function is affected, if known?

lib/forge.func, check_for_release(): the /opt/*_version.txt migration

🖥️ Which backend is this on?

Proxmox VE

🐧 Which container/VM OS and version?

Debian 13

📝 Provide a clear and concise description of the issue.

Without ~/.<app>, check_for_release takes the only /opt/*_version.txt as the version of <app>, copies it to ~/.<app> and deletes it, whichever app the file belongs to. So the first check of a second component takes the container's own version.

In an Odoo container (odoo-install.sh still writes /opt/Odoo_version.txt), check_for_gh_release "pdfkiln" "pdfkiln/pdfkiln" answered "No update available: pdfkiln (20.0.20261125)": PDFKiln was not installed, and Odoo's file, which ct/odoo.sh reads on its next update, was gone. community-scripts/ProxmoxVE#19035 works around it with [[ ! -f ~/.pdfkiln ]] ||. Any update that checks a component before the app itself hits the same on a container that still has its legacy file.

🔄 Steps to reproduce the issue.

Debian 13 with jq and curl (WSL2 here; the function does not depend on the backend), lib/forge.func at 1b2c59e, msg_* and ensure_dependencies stubbed, VERBOSE=yes:

echo 20.0.20261125 > /opt/Odoo_version.txt
NSAPP=odoo; source lib/forge.func
check_for_gh_release pdfkiln pdfkiln/pdfkiln; echo "rc=$?"
ls /opt; cat ~/.pdfkiln
❌ Paste the full error output (if available).
Checking for update: pdfkiln
No update available: pdfkiln (20.0.20261125)
rc=1
20.0.20261125

/opt is empty afterwards.

🖼️ Additional context (optional).

Scoping the migration to the script's own app, as var_appversion already is, fixes it:

-  else
+  elif _forge_is_script_app "$app" "${NSAPP:-$app}"; then
     mapfile -t legacy_files < <(find /opt -maxdepth 1 -type f -name "*_version.txt" 2>/dev/null)

The same steps then give "Update available: pdfkiln not installed -> 1.5.0" and keep /opt/Odoo_version.txt, and an app's own check still migrates its file (restic: 0.17.0 -> 0.20.0, moved to ~/.restic). I can open a PR with a test if that helps.

Ngôn ngữ chính
Shell
Star
14
Fork
20
Merge trung bình
8 giờ 8 phút
Pull request đã merge (30 ngày)
125

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của community-scripts/core

Tất cả issue của community-scripts/core

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.