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

Aperta
#4 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
go
Ambito
build-system, cli

Direzione di ricerca

Inizia dalla funzione init del package mageutil e traccia come OpenIMRoot viene utilizzato da CheckBinariesRunning all'interno di CheckAndReportBinariesStatus. Riproduci il comportamento accedendo al progetto tramite una directory con collegamento simbolico, quindi verifica che mage start rilevi i processi e che mage stop possa arrestarli utilizzando il percorso risolto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Go
Stelle
15
Fork
31
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openimsdk/gomake

Tutte le issue di openimsdk/gomake

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.