[BUG] function CheckAndReportBinariesStatus cannot correctly check the number of processes when encountering symbolic link directory situation

Đang mở
#4 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
go
Lĩnh vực
build-system, cli

Hướng nghiên cứu

Bắt đầu từ hàm init của package mageutil và theo dõi cách OpenIMRoot được CheckBinariesRunning sử dụng bên trong CheckAndReportBinariesStatus. Tái hiện hành vi bằng cách truy cập project thông qua một thư mục liên kết tượng trưng, sau đó xác minh rằng mage start phát hiện các process và mage stop có thể dừng chúng bằng path đã được phân giải.

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

Mô tả

OpenIM Server Version

3.8.1

Operating System and CPU Architecture

macOS (ARM)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

If the project's directory is included in a symbolic link directory, after running mage start in the OpenIM project, CheckBinariesRunning(in CheckAndReportBinariesStatus) cannot correctly check the number of processes. The reason is that in the init function of the mageutil module, the value of the OpenIMRoot variable is obtained via os.Getwd(), which may return a path containing symbolic links, rather than the actual file path. But the underlying implementation of CheckBinariesRunning is based on the proc_pidpath function in C, which retrieves the process path as the true file path (not symbolic link paths).
It will also make the "mage stop" not work to stop processes.
It is recommended to modify the package's init function

func init() {
	currentDir, err := os.Getwd()
	if err != nil {
		panic("Error getting current directory: " + err.Error())
	}

        OpenIMRoot = currentDir

to

func init() {
	currentDir, err := os.Getwd()
	if err != nil {
		panic("Error getting current directory: " + err.Error())
	}
	currentDir, err = filepath.EvalSymlinks(currentDir)
	if err != nil {
		panic("Error resolving symlinks in current directory: " + err.Error())
	}

        OpenIMRoot = currentDir
Screenshots Link

No response

Ngôn ngữ chính
Go
Star
15
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

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 openimsdk/gomake

Tất cả issue của openimsdk/gomake

Issue tương tự

Thêm issue về Go

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.