From 55732f445ab8a56fde246c82a69cc8c79143cf9d Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 30 Jul 2021 15:26:39 +0200 Subject: [PATCH] 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. --- src/builtin_set.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/builtin_set.cpp b/src/builtin_set.cpp index 4b27632fe..b74783f18 100644 --- a/src/builtin_set.cpp +++ b/src/builtin_set.cpp @@ -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()); // 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) { + if (env_var_t::flags_for(var_name) & env_var_t::flag_read_only) { streams.out.append(_(L"Variable is read-only\n")); }