[BUG] fileio add_mapping allows invalid physical path

Đang mở
#133 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
backend, compilers

Hướng nghiên cứu

Start with the file I/O implementation for add_mapping and get_info_physical, then reproduce the issue by creating a pdrive, adding a mapping with a trailing slash, and compiling the shown SQF file. Done means a physical mapping such as "P:/" is handled consistently so the include resolves instead of producing a not-found error.

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

Mô tả

bug

Describe the bug


code uses size + 1 (+1 for the ending slash) and thus expects that phys path doesn't have endling slash.
but add_mapping doesn't verify/fix that if you do
add_mapping("T:/", "/")
it keeps the ending slash, which makes this code in screenshot trim one character too many.

so tree->physical now has "T:/" entry, but should just be "T:"

To Reproduce
Steps to reproduce the behavior:

  1. Make pdrive
    2, add_mapping("P:/", "/")
  2. try to compile P:/a3/functions_f_enoch/em_core/fn_showspectrumanalyzer.sqf
  3. include not found error for #include "define.inc"

Expected behavior
add_mapping should verify/remove trailing slash on physical path.
or get_info_physical should assume that folder path always ends with trailing slash, and add_mapping should also be adjusted for that,

Ngôn ngữ chính
C++
Star
104
Fork
31
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 SQFvm/runtime

Tất cả issue của SQFvm/runtime

Issue tương tự

Thêm issue về C++

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.