simon-git: putty (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Thu Jan 30 06:41:06 GMT 2020


TL;DR:
  d20d3b20 Remove FLAG_VERBOSE.
  dc59fcf8 Remove FLAG_INTERACTIVE.
  6e85d3fe Remove FLAG_STDERR_TTY.
  e5f85fc2 Remove FLAG_SYNCAGENT.
  33715c07 Fix two accidental overwrites of 'flags'.
  4ea811a0 Remove 'GLOBAL int flags' completely!
  9da36bd8 Remove agent_schedule_callback().
  575ee4f8 Make cmdline_tooltype a const int.
  492e6b11 Remove cmdline_session_name.
  22deebfc Move 'loaded_session' into cmdline.c.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2020-01-30 06:41:06

commit d20d3b20fd06c3792021367cfaf95240457ba51f
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=d20d3b20fd06c3792021367cfaf95240457ba51f;hp=06e9f7115317ea9684ea707ba203c7ed79ea90b1
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 30 06:40:21 2020 +0000

    Remove FLAG_VERBOSE.
    
    The global 'int flags' has always been an ugly feature of this code
    base, and I suddenly thought that perhaps it's time to start throwing
    it out, one flag at a time, until it's totally unused.
    
    My first target is FLAG_VERBOSE. This was usually set by cmdline.c
    when it saw a -v option on the program's command line, except that GUI
    PuTTY itself sets it unconditionally on startup. And then various bits
    of the code would check it in order to decide whether to print a given
    message.
    
    In the current system of front-end abstraction traits, there's no
    _one_ place that I can move it to. But there are two: every place that
    checked FLAG_VERBOSE has access to either a Seat or a LogPolicy. So
    now each of those traits has a query method for 'do I want verbose
    messages?'.
    
    A good effect of this is that subsidiary Seats, like the ones used in
    Uppity for the main SSH server module itself and the server end of
    shell channels, now get to have their own verbosity setting instead of
    inheriting the one global one. In fact I don't expect any code using
    those Seats to be generating any messages at all, but if that changes
    later, we'll have a way to control it. (Who knows, perhaps logging in
    Uppity might become a thing.)
    
    As part of this cleanup, I've added a new flag to cmdline_tooltype,
    called TOOLTYPE_NO_VERBOSE_OPTION. The unconditionally-verbose tools
    now set that, and it has the effect of making cmdline.c disallow -v
    completely. So where 'putty -v' would previously have been silently
    ignored ("I was already verbose"), it's now an error, reminding you
    that that option doesn't actually do anything.
    
    Finally, the 'default_logpolicy' provided by uxcons.c and wincons.c
    (with identical definitions) has had to move into a new file of its
    own, because now it has to ask cmdline.c for the verbosity setting as
    well as asking console.c for the rest of its methods. So there's a new
    file clicons.c which can only be included by programs that link
    against both cmdline.c _and_ one of the *cons.c, and I've renamed the
    logpolicy to reflect that.

 Recipe             | 11 +++++++----
 clicons.c          | 14 ++++++++++++++
 cmdline.c          |  7 ++++++-
 misc.c             |  5 +++++
 pscp.c             |  7 ++++---
 psftp.c            |  7 ++++---
 psftp.h            |  2 +-
 putty.h            | 37 ++++++++++++++++++++++++++++++-------
 sesschan.c         |  2 ++
 ssh.c              |  2 +-
 ssh1login.c        | 12 ++++++------
 ssh2userauth.c     |  8 ++++----
 sshserver.c        |  1 +
 unix/gtkwin.c      |  2 ++
 unix/uxcons.c      | 18 +++++-------------
 unix/uxplink.c     |  3 ++-
 unix/uxputty.c     |  5 +++--
 unix/uxserver.c    |  1 +
 unix/uxsftp.c      |  2 +-
 windows/wincons.c  |  9 +--------
 windows/windlg.c   |  5 +++--
 windows/window.c   | 14 +++++++++-----
 windows/winplink.c |  6 ++++--
 windows/winsftp.c  |  4 ++--
 24 files changed, 118 insertions(+), 66 deletions(-)

commit dc59fcf8e3a959f48d65ba3ba392761959132c8e
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=dc59fcf8e3a959f48d65ba3ba392761959132c8e;hp=d20d3b20fd06c3792021367cfaf95240457ba51f
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 30 06:40:21 2020 +0000

    Remove FLAG_INTERACTIVE.
    
    This is simpler than FLAG_VERBOSE: everywhere we need to check it, we
    have a Seat available, so we can just make it a Seat query method.

 misc.c             |  2 ++
 pscp.c             |  1 +
 psftp.c            |  3 ++-
 putty.h            | 15 +++++++++------
 sesschan.c         |  1 +
 ssh.c              |  2 +-
 ssh1login.c        |  4 ++--
 ssh2userauth.c     |  4 ++--
 sshserver.c        |  1 +
 unix/gtkwin.c      |  1 +
 unix/uxplink.c     | 13 ++++++++-----
 unix/uxputty.c     |  1 -
 windows/window.c   |  2 +-
 windows/winplink.c | 13 ++++++++-----
 14 files changed, 39 insertions(+), 24 deletions(-)

commit 6e85d3fe60e3356a35de42aaa0ccf26c78503b29
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=6e85d3fe60e3356a35de42aaa0ccf26c78503b29;hp=dc59fcf8e3a959f48d65ba3ba392761959132c8e
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 30 06:40:21 2020 +0000

    Remove FLAG_STDERR_TTY.
    
    It really had no need to be a global process flag at all: it's used to
    signal to uxcons.c that stderr_tty_init() ought to check whether
    stderr is a tty (in order to save its termios across interactive
    prompts and so forth). But the only _caller_ of stderr_tty_init is
    Unix Plink, which always sets that flag! So we already have a
    perfectly good system for signalling to uxcons.c that you'd like
    stderr_tty_init to do something: _whether you call it or not_.

 unix/unix.h    | 14 +-------------
 unix/uxcons.c  |  2 +-
 unix/uxplink.c |  2 +-
 3 files changed, 3 insertions(+), 15 deletions(-)

commit e5f85fc2694c432718117c42c314097e7e9ed938
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=e5f85fc2694c432718117c42c314097e7e9ed938;hp=6e85d3fe60e3356a35de42aaa0ccf26c78503b29
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 30 06:40:21 2020 +0000

    Remove FLAG_SYNCAGENT.
    
    This was the easiest flag to remove: nothing ever checks it at all!
    
    It was part of an abandoned early attempt to make Pageant requests
    asynchronous. The flag was added in commit 135abf244 (April 2003); the
    code that used it was #ifdef-ed out in commit 98d735fde (January 2004),
    and removed completely in commit f864265e3 (January 2017).
    
    We now have an actually working system for async agent requests on
    Windows, via the new named-pipe IPC. And we also have a perfectly good
    way to force a particular agent request to work synchronously: just
    pass NULL as the callback function pointer. All of that works just
    fine, without ever using this flag. So begone!

 pscp.c             | 6 +-----
 psftp.c            | 6 +-----
 windows/winpgnt.c  | 2 +-
 windows/winstuff.h | 4 ----
 4 files changed, 3 insertions(+), 15 deletions(-)

commit 33715c07e342248c5dfbfb38ad30707566453cc4
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=33715c07e342248c5dfbfb38ad30707566453cc4;hp=e5f85fc2694c432718117c42c314097e7e9ed938
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 30 06:40:21 2020 +0000

    Fix two accidental overwrites of 'flags'.
    
    When I came to actually remove the global 'flags' word, I found that I
    got compile failures in two functions that should never have been
    accessing it at all, because they forgot to declare _local_ variables
    of the same name. Yikes!
    
    (Of course, _now_ that's harmless, because I've just removed all the
    actual semantics from the global variable. But I'm about to remove the
    variable too, so these bugs would become compile failures.)

 sftpserver.c   | 1 +
 unix/gtkfont.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

commit 4ea811a0bf03432df67d98cd67d47921f4e532a1
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=4ea811a0bf03432df67d98cd67d47921f4e532a1;hp=33715c07e342248c5dfbfb38ad30707566453cc4
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 30 06:40:21 2020 +0000

    Remove 'GLOBAL int flags' completely!
    
    It no longer has any flags in it at all, so its day is done.

 pscp.c             |  1 -
 psftp.c            |  1 -
 putty.h            | 13 -------------
 unix/uxplink.c     |  1 -
 windows/winpgnt.c  |  2 --
 windows/winplink.c |  1 -
 6 files changed, 19 deletions(-)

commit 9da36bd897533db6811fefb7954ff81ab2dfbb63
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=9da36bd897533db6811fefb7954ff81ab2dfbb63;hp=4ea811a0bf03432df67d98cd67d47921f4e532a1
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 30 06:40:21 2020 +0000

    Remove agent_schedule_callback().
    
    This is another piece of the old 2003 attempt at async agent requests.
    Nothing ever calls this function (in particular, the new working
    version of async-agent doesn't need it). Remove it completely, and all
    its special-window-message implementations too.
    
    (If we _were_ still using this function, then it would surely be
    possible to fold it into the more recently introduced general
    toplevel-callback system, and get rid of all this single-use special
    code. But we're not, so removing it completely is even easier.)
    
    In particular, this system was the only reason why Windows Plink paid
    any attention to its message queue. So now I can make it call plain
    WaitForMultipleObjects instead of MsgWaitForMultipleObjects.

 pscp.c             |  6 ------
 psftp.c            |  6 ------
 windows/window.c   | 28 +---------------------------
 windows/winpgnt.c  |  6 ------
 windows/winplink.c | 32 +-------------------------------
 windows/winstuff.h |  8 --------
 6 files changed, 2 insertions(+), 84 deletions(-)

commit 575ee4f8fc2bf681d558a6197fc9cc17478abb47
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=575ee4f8fc2bf681d558a6197fc9cc17478abb47;hp=9da36bd897533db6811fefb7954ff81ab2dfbb63
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 30 06:40:22 2020 +0000

    Make cmdline_tooltype a const int.
    
    Another ugly mutable global variable gone: now, instead of this
    variable being defined in cmdline.c and written to by everyone's
    main(), it's defined _alongside_ everyone's main() as a constant, and
    cmdline.c just refers to it.
    
    A bonus is that now nocmdline.c doesn't have to define it anyway for
    tools that don't use cmdline.c. But mostly, it didn't need to be
    mutable, so better for it not to be.
    
    While I'm at it, I've also fiddled with the bit flags that go in it,
    to define their values automatically using a list macro instead of
    manually specifying each one to be a different power of 2.

 cmdline.c          | 12 ------------
 nocmdline.c        |  5 -----
 pscp.c             |  3 ++-
 psftp.c            |  3 ++-
 putty.h            | 37 ++++++++++++++++++++++++++++---------
 unix/uxplink.c     | 12 ++++++------
 unix/uxpterm.c     |  3 ++-
 unix/uxputty.c     |  7 +++++--
 windows/window.c   |  7 +++++--
 windows/winplink.c | 12 ++++++------
 10 files changed, 56 insertions(+), 45 deletions(-)

commit 492e6b11877f66e95274597185a0f70ec35f2e68
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=492e6b11877f66e95274597185a0f70ec35f2e68;hp=575ee4f8fc2bf681d558a6197fc9cc17478abb47
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 30 06:40:22 2020 +0000

    Remove cmdline_session_name.
    
    This mutable global was never actually used at all, _even_ in history!
    Commit 1a03fa929 introduced it, as part of the jump list support, but
    even that commit never _read_ from the variable - it only assigned to
    it. I have to guess that it was part of an earlier draft of the jump
    lists patch and ended up orphaned in the final version.

 cmdline.c | 1 -
 putty.h   | 4 ----
 2 files changed, 5 deletions(-)

commit 22deebfc3e40570b9784b3576a0ce8c94a9ab2b9
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=22deebfc3e40570b9784b3576a0ce8c94a9ab2b9;hp=492e6b11877f66e95274597185a0f70ec35f2e68
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 30 06:40:22 2020 +0000

    Move 'loaded_session' into cmdline.c.
    
    I haven't managed to make this one _not_ be a mutable variable, but at
    least it's not global across all tools any more: it lives in cmdline.c
    along with the code that decides what to set it to, and cmdline.c
    exports a query method to ask for its value.

 cmdline.c          | 2 ++
 pscp.c             | 3 +--
 psftp.c            | 3 +--
 putty.h            | 6 +-----
 unix/uxplink.c     | 1 -
 windows/winplink.c | 1 -
 6 files changed, 5 insertions(+), 11 deletions(-)



More information about the tartarus-commits mailing list