From 895f712df8afc053b59783189954e665ccd21dab Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 25 Jun 2016 23:39:16 +0300 Subject: option: Do not expand options, obtained from XDG vars It is a wrong thing to do, this makes valid variable values be treated incorrectly: in XDG_DATA_HOME='/home/$foo/.local/share' `$foo` should be treated literally and not expanded to `foo` environment variable value. Also makes option_expand not try to expand too long strings even if these too long strings are default values. Previously it thought that default values should always be expanded. Also does not try to expand NULL should it be the default value just in case. Fixes #4961 --- scripts/genoptions.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/genoptions.lua b/scripts/genoptions.lua index da53d010bd..9f7d94969d 100644 --- a/scripts/genoptions.lua +++ b/scripts/genoptions.lua @@ -57,9 +57,14 @@ local get_flags = function(o) add_flag(redraw_flags[r_flag]) end end + if o.expand then + add_flag('P_EXPAND') + if o.expand == 'nodefault' then + add_flag('P_NO_DEF_EXP') + end + end for _, flag_desc in ipairs({ {'alloced'}, - {'expand'}, {'nodefault'}, {'no_mkrc'}, {'vi_def'}, -- cgit