mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 06:20:23 +08:00
Hardcode $PWD as read-only for set --show
Through a mechanism I don't entirely understand, $PWD is sometimes writable (so that `cd` can change it) and sometimes not. In this case we ended up with it writable, which is wrong. See #8179.
This commit is contained in:
parent
3db78232c6
commit
b3cdf4afe1
@ -512,7 +512,9 @@ static void show_scope(const wchar_t *var_name, int scope, io_streams_t &streams
|
||||
wcstring_list_t vals = var->as_list();
|
||||
streams.out.append_format(_(L"$%ls: set in %ls scope, %ls,%ls with %d elements\n"), var_name,
|
||||
scope_name, exportv, pathvarv, vals.size());
|
||||
if (var->read_only()) {
|
||||
// HACK: PWD can be set, depending on how you ask.
|
||||
// For our purposes it's read-only.
|
||||
if (var->read_only() || wcscmp(var_name, L"PWD") == 0) {
|
||||
streams.out.append(_(L"Variable is read-only\n"));
|
||||
}
|
||||
|
||||
|
@ -667,6 +667,12 @@ set -S status
|
||||
#CHECK: Variable is read-only
|
||||
#CHECK: $status[1]: |0|
|
||||
|
||||
# PWD is also read-only.
|
||||
set -S PWD
|
||||
#CHECK: $PWD: set in global scope, exported, with 1 elements
|
||||
#CHECK: Variable is read-only
|
||||
#CHECK: $PWD[1]: |{{.*}}|
|
||||
|
||||
set -ql history
|
||||
echo $status
|
||||
#CHECK: 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user