set: Use env_var_t::flags_for() to see if it's read-only

env_var_t::read_only() is basically broken.

It doesn't work for $PWD, as best as I can tell no variable is
read-only except for a hardcoded list of some of the electric ones.

So we should probably remove the entire read_only and
setting_read_only mechanism.
This commit is contained in:
Fabian Homborg 2021-07-30 15:26:39 +02:00
parent 09b8471f5c
commit 55732f445a

View File

@ -514,7 +514,7 @@ static void show_scope(const wchar_t *var_name, int scope, io_streams_t &streams
scope_name, exportv, pathvarv, vals.size()); scope_name, exportv, pathvarv, vals.size());
// HACK: PWD can be set, depending on how you ask. // HACK: PWD can be set, depending on how you ask.
// For our purposes it's read-only. // For our purposes it's read-only.
if (var->read_only() || wcscmp(var_name, L"PWD") == 0) { if (env_var_t::flags_for(var_name) & env_var_t::flag_read_only) {
streams.out.append(_(L"Variable is read-only\n")); streams.out.append(_(L"Variable is read-only\n"));
} }