Skip to content

Validate entries in jobPorts() function #3351

@Kunal1522

Description

@Kunal1522

Description

The jobPorts() function reads .func/runs/ to find running instances but doesn't validate entries. It could return files or non-port directories as "ports".

Current Behavior

Returns all entries without checking if they're valid port directories:

// TODO: validate it's a directory whose name parses as an integer?

Proposed Fix

Add filtering to only include directories with integer names (valid ports):

if !f.IsDir() || !isValidPort(f.Name()) {
    continue
}

This matches the validation already in cleanupJobDirs().
/kind cleanup

Metadata

Metadata

Assignees

Labels

kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions