diff options
| author | qmuntal <quimmuntal@gmail.com> | 2024-03-12 12:26:53 +0100 |
|---|---|---|
| committer | Quim Muntal <quimmuntal@gmail.com> | 2024-03-18 18:31:42 +0000 |
| commit | 2e8d84f148c69404b8eec86d9149785a3f4e3e92 (patch) | |
| tree | a015722201f01fa62cce37fa484d8bcef638728a /src/database/sql | |
| parent | b40dc30d24afe877f4b7d80c69b827765531cdc7 (diff) | |
| download | go-2e8d84f148c69404b8eec86d9149785a3f4e3e92.tar.xz | |
os: support UNC paths and .. segments in fixLongPath
This CL reimplements fixLongPath using syscall.GetFullPathName instead
of a custom implementation that was not handling UNC paths and ..
segments correctly. It also fixes a bug here multiple trailing \
were removed instead of replaced by a single one.
The new implementation is slower than the previous one, as it does a
syscall and needs to convert UTF-8 to UTF-16 (and back), but it is
correct and should be fast enough for most use cases.
goos: windows
goarch: amd64
pkg: os
cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
LongPath-12 1.007µ ± 53% 4.093µ ± 109% +306.41% (p=0.000 n=10)
│ old.txt │ new.txt │
│ B/op │ B/op vs base │
LongPath-12 576.0 ± 0% 1376.0 ± 0% +138.89% (p=0.000 n=10)
│ old.txt │ new.txt │
│ allocs/op │ allocs/op vs base │
LongPath-12 2.000 ± 0% 3.000 ± 0% +50.00% (p=0.000 n=10)
Fixes #41734.
Change-Id: Iced5cf47f56f6ab0ca74a6e2374c31a75100902d
Reviewed-on: https://go-review.googlesource.com/c/go/+/570995
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/database/sql')
0 files changed, 0 insertions, 0 deletions
