simon-git: filter (main): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Mon Mar 28 17:40:49 BST 2022


TL;DR:
  fd87c17 Reject excess positional arguments.

Repository:     https://git.tartarus.org/simon/filter.git
On the web:     https://git.tartarus.org/?p=simon/filter.git
Branch updated: main
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2022-03-28 17:40:49

commit fd87c179f33d80a5731d8e389abbe47c834fdeb7
web diff https://git.tartarus.org/?p=simon/filter.git;a=commitdiff;h=fd87c179f33d80a5731d8e389abbe47c834fdeb7;hp=aa49b40262e7e12cf7f3d7be57e6e86ce62f47c3
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Mar 28 17:37:52 2022 +0100

    Reject excess positional arguments.
    
    If you use 'record' and forget the '--' between the output file and
    the command, then record's tstate_argument receives two positional
    arguments in turn. Each of these was being interpreted as an output
    file, and the second one would silently overwrite the first. If the
    second argument was actually the name of a shell script you've just
    written, this would be particularly bad, because the recording of an
    unintended interactive shell session overwrites your script!
    
    Initially I considered making any attempt to provide two output file
    names _at all_, whether as positional arguments or via -o, trigger an
    error. But options really ought to override each other, so that you
    can append to an existing options string. So I've compromised by not
    changing the behaviour of -o, and instead, just rejecting an
    additional command-line option.
    
    While I'm at it, put in the same robustness in idlewrapper and deidle,
    which also had the bug that they would consume an arbitrary number of
    positional arguments and treat each as the first one. Now each one
    diagnoses having received too many arguments.

 deidle.c    | 8 ++++++++
 idletrans.c | 8 ++++++++
 record.c    | 8 ++++++++
 3 files changed, 24 insertions(+)



More information about the tartarus-commits mailing list