cmd/livepeer_bench: fix segment path handling on Windows - #4033
Open
lukiod wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1844
Problem
livepeer_benchbuilds the path to each playlist segment from the input manifest's directory using Go'spathpackage (path.Dir/path.Join). Thepathpackage assumes forward-slash separators, so a Windows-style manifest path (e.g.C:\bench\media\input.m3u8) makespath.Dirreturn.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 smallsegmentPathhelper so it can be unit-tested.Tests
Added
TestSegmentPathincmd/livepeer_bench/livepeer_bench_test.go:The backslash assertion is necessarily Windows-gated: on Linux/macOS
filepathandpathare identical for backslashes, so the bug is only observable (and testable) on a Windows host.Notes
I could not run
go build ./.../go testlocally: the pinnedgithub.com/livepeer/lpms/ffmpegcgo bindings fail to compile against this machine's FFmpeg 9.0.1 (undeclaredavfilter_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 withgofmt(clean), a standalone stdlib-only compile/run of the helper (POSIX case correct), and aGOOS=windowscross-compile (succeeds).