Commit 7e2af0d
committed
fix: strip trailing slash from argument before path operations (closes #450)
A trailing slash on a symlink caused rename() to fail with ENOTDIR
because
the kernel dereferenced the symlink. Strip any trailing slash from the
argument early, before check_pathname_state, lstat, resolve_path, and
rename, so "foo/" is treated identically to "foo".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixes #4501 parent 5b36817 commit 7e2af0d
2 files changed
Lines changed: 19 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
292 | 301 | | |
293 | 302 | | |
294 | 303 | | |
| |||
309 | 318 | | |
310 | 319 | | |
311 | 320 | | |
312 | | - | |
| 321 | + | |
313 | 322 | | |
314 | 323 | | |
315 | 324 | | |
| |||
319 | 328 | | |
320 | 329 | | |
321 | 330 | | |
322 | | - | |
| 331 | + | |
323 | 332 | | |
324 | 333 | | |
325 | | - | |
| 334 | + | |
326 | 335 | | |
327 | 336 | | |
328 | 337 | | |
| |||
411 | 420 | | |
412 | 421 | | |
413 | 422 | | |
414 | | - | |
| 423 | + | |
415 | 424 | | |
416 | 425 | | |
417 | 426 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
155 | 158 | | |
156 | 159 | | |
157 | 160 | | |
| |||
0 commit comments