Skip to content

cmd/livepeer_bench: fix segment path handling on Windows - #4033

Open
lukiod wants to merge 1 commit into
livepeer:masterfrom
lukiod:fix/livepeer_bench-windows-backslash
Open

cmd/livepeer_bench: fix segment path handling on Windows#4033
lukiod wants to merge 1 commit into
livepeer:masterfrom
lukiod:fix/livepeer_bench-windows-backslash

Conversation

@lukiod

@lukiod lukiod commented Aug 23, 2026

Copy link
Copy Markdown

Fixes #1844

Problem

livepeer_bench builds the path to each playlist segment from the input manifest's directory using Go's path package (path.Dir / path.Join). The path package assumes forward-slash separators, so a Windows-style manifest path (e.g. C:\bench\media\input.m3u8) makes path.Dir return . and produces a broken segment path, failing the benchmark on Windows.

Approach

Switch to path/filepath, which is OS-aware and treats \ as a path separator on Windows. The directory/URI join is extracted into a small segmentPath helper so it can be unit-tested.

Tests

Added TestSegmentPath in cmd/livepeer_bench/livepeer_bench_test.go:

  • On Windows it exercises the exact backslash case from the issue and asserts the correct segment path.
  • On other platforms it asserts the forward-slash case still produces the correct path.

The backslash assertion is necessarily Windows-gated: on Linux/macOS filepath and path are identical for backslashes, so the bug is only observable (and testable) on a Windows host.

Notes

I could not run go build ./... / go test locally: the pinned github.com/livepeer/lpms/ffmpeg cgo bindings fail to compile against this machine's FFmpeg 9.0.1 (undeclared avfilter_compare_sign_bypath, avformat_transfer_internal_stream_timing_info, AVFMT_TBCF_DEMUXER, av_opt_set_int_list). This is a pre-existing dependency/environment mismatch unrelated to this change. I verified the change with gofmt (clean), a standalone stdlib-only compile/run of the helper (POSIX case correct), and a GOOS=windows cross-compile (succeeds).

Use filepath instead of path when deriving the segment path from the
input manifest, so that Windows-style backslash separators work. The
path package assumes forward slashes and breaks on Windows paths.

Extract the directory/URI join into a small segmentPath helper and add
a regression test that exercises the backslash case on Windows (and the
forward-slash case everywhere).

Fixes livepeer#1844
@github-actions github-actions Bot added the go Pull requests that update Go code label Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

livepeer_bench: back-slashes in the file path don't work

1 participant