[vim/vim] runtime(netrw): E46 when changing to an inaccessible directory (PR #21226)

2 views
Skip to first unread message

Qiming zhao

unread,
Sep 5, 2026, 6:57:47 AM (5 days ago) Sep 5
to vim/vim, Subscribed

Problem: When changing to an inaccessible directory fails with E472,
s:NetrwLcd() attempts to assign to the read-only a:newdir
argument and raises E46 instead of returning -1. The fallback
branch also refers to dirname, which is not defined on this path.
Solution: Remove both unused assignments and retain the existing option
restoration and failure return (Qiming zhao).

The failed :lcd leaves the current directory unchanged. Callers use the
function's return value; assigning to its argument cannot update the
caller's directory variable.

The regression test uses a directory without execute permission and covers
both the presence and absence of w:netrw_prvdir. It checks the failure
return, error notification, unchanged working directory, and buffer options.
The test reproduced E46 before the fix and passes after it. It is skipped
on non-Unix systems and when running as root.

Validation: make -j4 completed successfully, with linker warnings about
duplicate -lcairo and -lintl libraries. The full test_plugin_netrw suite
completed with 29 tests passing and 11 skipped for platform or missing
PowerShell dependencies. The new regression test also passed with the
freshly built Vim. All five make codestyle tests passed.

This contribution was developed with assistance from OpenAI Codex.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/21226

Commit Summary

  • a5b6660 patch 9.2.NNNN: netrw raises E46 when changing directory fails

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/21226@github.com>

Christian Brabandt

unread,
Sep 7, 2026, 5:18:11 PM (3 days ago) Sep 7
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#21226)

thanks


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/21226/c5575711058@github.com>

Reply all
Reply to author
Forward
0 new messages