hashicorp / hashicorp/nomad

operator debug uses platform-specific separators in bundle

Open
#10,173 0 comments 0 reactions 0 assignees View on GitHub
theme/cli theme/platform-windows type/bug
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

When `nomad operator debug` is used on Windows, the file paths in the resulting `.tar.gz` file use the platform-specific separator. This results in a single flat hierarchy like this when they're opened up on Unixish machines:

```
nomad-debug-2021-03-09-014419Z\nomad\0003\nodes.json
nomad-debug-2021-03-09-014419Z\nomad\0003\operator-autopilot-health.json
nomad-debug-2021-03-09-014419Z\nomad\0003\operator-raft.json
nomad-debug-2021-03-09-014419Z\nomad\0003\operator-scheduler.json
nomad-debug-2021-03-09-014419Z\nomad\0003\plugins.json
nomad-debug-2021-03-09-014419Z\server\us04pB-nmd1.global\agent-host.json
nomad-debug-2021-03-09-014419Z\server\us04pB-nmd1.global\goroutine-debug1.txt
nomad-debug-2021-03-09-014419Z\server\us04pB-nmd1.global\goroutine-debug2.txt
nomad-debug-2021-03-09-014419Z\server\us04pB-nmd1.global\goroutine.prof
```

A quick glance at the code suggests we might be handling the paths as strings at once point, but I'm not sure whether or not that makes a difference. At the end of the day this is at best a papercut, so long as no one handles the paths as strings instead of paths (ex. `\nodes.json` could get read in as an escaped newline with an unforgiving script).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the implementation of `nomad operator debug` and trace how paths are constructed before they are written into the `.tar.gz` archive. Reproduce the command on Windows and inspect the archive on a Unix-like system; done means archive entries use portable separators and preserve the intended directory hierarchy.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.