From 5f80147c55215469475876baaaf94712227dd424 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 27 Mar 2019 11:45:17 +0000 Subject: [PATCH] 'main': Follow-up to last commit: Fix stdbuf options spec. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The effect of the bug was that «-:» was considered an option taking an argument (see the parsing of the associative array in lines 692-693). As to preventing recurrence, add a warning comment. We _could_ change the separator from colon to something else, but colon is idiomatic for this use (see, e.g., passwd(5)), and the problem will be unlikely to recur if and when we add a third field to the assoc's values. (For example, jexec(1), chroot(1), and even ssh(1) would benefit from a third field saying how many positional arguments to skip before the positional argument that's to be the command word — though in the last two cases, specifying an "inner" command is optional.) --- highlighters/main/main-highlighter.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 7cca060..eb49d8a 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -295,7 +295,8 @@ _zsh_highlight_highlighter_main_paint() # that wouldn't be followed by a colon in a getopts specification. local flags_sans_argument # $precommand_options maps precommand name to values of $flags_with_argument and - # $flags_sans_argument for that precommand, joined by a colon. + # $flags_sans_argument for that precommand, joined by a colon. (The value is NOT + # a getopt(3) spec, although it resembles one.) # # Currently, setting $flags_sans_argument is only important for commands that # have a non-empty $flags_with_argument; see test-data/precommand4.zsh. @@ -313,7 +314,7 @@ _zsh_highlight_highlighter_main_paint() 'nice' n: # as of current POSIX spec 'pkexec' '' # doesn't take short options; immune to #121 because it's usually not passed --option flags 'sudo' Cgprtu:AEHKPSVbhiklnsv # as of sudo 1.8.21p2 - 'stdbuf' i:o:e: + 'stdbuf' ioe: ) if [[ $zsyh_user_options[ignorebraces] == on || ${zsyh_user_options[ignoreclosebraces]:-off} == on ]]; then