Long Path Bug
Wavpack (and possibly wvunpack and other tools), do not tolerate very long absolute paths, not even relative execution.
example
Absolute path (maximum allowed)
r"O:\rutaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\Kamchatka, Distant Cargo Port. Wind, Prop Planes Overhead, Mechanisms, Distant Dogs, Transportation Truck Pass By.wav"
length = 259 (each subfolder subtract 2 characters, "\\" count as one char)
full command (added one "a")= & D:\Descargas\wavpack-5.8.0-x64\wavpack.exe 'O:\rutaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\Kamchatka, Distant Cargo Port. Wind, Prop Planes Overhead, Mechanisms, Distant Dogs, Transportation Truck Pass By.wav'
relative command = D:\Descargas\wavpack-5.8.0-x64\wavpack.exe '.\Kamchatka, Distant Cargo Port. Wind, Prop Planes Overhead, Mechanisms, Distant Dogs, Transportation Truck Pass By.wav'
both return
can't open file O:\rutaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\Kamchatka, Distant Cargo Port. Wind, Prop Planes Overhead, Mechanisms, Distant Dogs, Transportation Truck Pass By.wav!
The problem seems to go away when adding “something” at the start ("\\?\” at the beginning)
& D:\Descargas\wavpack-5.8.0-x64\wavpack.exe '\\?\O:\rutaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\Kamchatka, Distant Cargo Port. Wind, Prop Planes Overhead, Mechanisms, Distant Dogs, Transportation Truck Pass By.wav'
return
& D:\Descargas\wavpack-5.8.0-x64\wavpack.exe '\\?\O:\rutaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\Kamchatka, Distant Cargo Port. Wind, Prop Planes Overhead, Mechanisms, Distant Dogs, Transportation Truck Pass By.wav'
WAVPACK Hybrid Lossless Audio Compressor Win64 Version 5.8.0
Copyright (c) 1998 - 2025 David Bryant. All Rights Reserved.
creating Kamchatka, Distant Cargo Port. Wind, Prop Planes Overhead, Mechanisms, Distant Dogs, Transportation Truck Pass created Kamchatka, Distant Cargo Port. Wind, Prop Planes Overhead, Mechanisms, Distant Dogs, Transportation Truck Pass By.wv in 4.20 secs (lossless, 40.12%)
Although ideally the tool should natively tolerate it.
I've taken a look and it's not obvious to me what's going on. I will not be able to investigate this further for a week, and at that time I will let you know if I have trouble reproducing it.
Thanks for reporting!
Windows has a path length limit of 260 characters (although it is documented to be 256).
Windows also has a feature called Extended-Length Paths that increases the maximum path length considerably. (default enabled in windows 11)
A quick solution would be, before processing a path, to check if the absolute path length is greater than 255 characters, if it is, work with the absolute path with “\\?\” at the beginning, as long as the path passed as a parameter does not contain that beginning (prevent “\\?\...” from becoming “\\?\\\?\...”).
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
Okay, that saved me some time. I'll look into implementing what you suggest, probably in the command-line programs. Thanks!
I finally got a chance to look into this deeper. Unfortunately it would not be as easy a fix as you suggest. As you say, it also affects relative paths, which means that to fix it properly I would have to expand every filename to its full path representation to check the length. Even something like "wavpack hello.wav" would need the check, and there are file operations like this all over the place in WavPack.
Also, I noticed that even Windows Console commands like copy, move, and even dir do not properly handle these long file paths unless you manually prepend the "\\?\", and they also fail on relative paths. If Microsoft can't (or won't) make its own tools work correctly, I don't think I should be too concerned about it.
But thanks for pointing this out as I was not at all familiar with it, and I'll be prepared if it actually ever comes up in use.