Jeremy Stanley [Tue, 24 Dec 2019 22:23:32 +0000 (22:23 +0000)]
Eliminate exec() in Universe.new()
Replace questionable exec call in the new() method of the Universe
class with cleaner getattr/setattr equivalents.
Jeremy Stanley [Thu, 26 Dec 2019 01:57:24 +0000 (01:57 +0000)]
More thoroughly test account and avatar menus
Split up the teardown "test" into separate tests for avatar and
account deletion. Avatar deletion was previously not being exercised
correctly, instead avatar deletion aborting was what was actually
being tested. Add separate tests that the avatar and account
deletion default actions are to abort. Also add a test of the avatar
creation limit.
Jeremy Stanley [Wed, 25 Dec 2019 23:04:20 +0000 (23:04 +0000)]
Properly escape punctuation in test patterns
Make sure all literal question marks (?) and periods (.) in selftest
match patterns are backslash-escaped in raw strings.
Jeremy Stanley [Tue, 24 Dec 2019 21:33:37 +0000 (21:33 +0000)]
Tighten up eval() scope in show result subcommand
In order to slightly reduce risk but mostly to increase convenience
with the `show result` administrative subcommand, replace its eval()
invocation's globals with just the mudpy module namespace and the
actor's universe pointer as "universe" (this way exploratory
expressions don't need to do things relative to actor.universe all
the time). Extend the selftest to confirm these are present and that
any attempts to access other globals and locals within the
command.show() function's scope raise an exception.
Whitelist this intentional use of eval() for bandit analysis.
Jeremy Stanley [Sun, 22 Dec 2019 20:48:12 +0000 (20:48 +0000)]
Replace uses of exec() in module loader
Improve the module loader to avoid the more dangerous exec()
function in favor of smarter use of importlib. This allows us to
drop some flake8 whitelisting. Also switch out the hard-coded module
list (which missed addition of the daemon module) with a more
dynamic routine on Python 3.7 and later, which will use all *.py
files in the top level of the package so none are forgotten in the
future. Keep a hard-coded fallback list for support of earlier
Python versions, but compare the two so this list is guaranteed
complete for as long as it is maintained.
Jeremy Stanley [Tue, 12 Nov 2019 15:25:59 +0000 (15:25 +0000)]
Use generic authors for copyright shown in docs
Adjust the copyright holder listed in the Sphinx-built documentation
to match the more general "mudpy authors" used in copyright headers
for files.
Jeremy Stanley [Thu, 17 Oct 2019 07:21:36 +0000 (07:21 +0000)]
Update copyright for files edited in 2019
These files missed a copyright year bump when they were edited.
Jeremy Stanley [Wed, 16 Oct 2019 11:11:43 +0000 (11:11 +0000)]
Satisfy yamllint checking of .yamllint
The 1.18.0 release of yamllint has started linting its .yamllint
config file by default. Add a document marker at the top of the file
so that it will pass document-start rule.
Jeremy Stanley [Fri, 27 Sep 2019 16:26:54 +0000 (16:26 +0000)]
Log User object ID even when account is an admin
Adjust authentication logging to consistently record the User object
instance ID regardless of, and separately from, whether the account
which authenticated is an administrator.
Jeremy Stanley [Sun, 1 Sep 2019 21:35:00 +0000 (21:35 +0000)]
Log starting directory during initialization
Update the initialization logging to also include the starting
directory, since some of the startup routines form their file paths
relative to it.
Jeremy Stanley [Sat, 24 Aug 2019 19:32:33 +0000 (19:32 +0000)]
Separate listening port in startup logging
Using a port separator of ":" is vague in combination with IPv6
addresses, so separate the listening port number more clearly in the
startup log message.
Jeremy Stanley [Wed, 10 Jul 2019 17:18:53 +0000 (17:18 +0000)]
Disable usedevelop for some tox testenvs
Tox's usedevelop option implicitly installs the project and its
dependencies, and is enabled in the base testenv. Disable it in
testenvs which don't make use of the installed project, but add the
project dependencies to the docs testenv since it needs them to be
able to generate the API docs. This results in a fairly substantial
speedup of >10% for a full `tox` invocation.
Jeremy Stanley [Sun, 7 Jul 2019 11:36:22 +0000 (11:36 +0000)]
Correct reference to main config in walk-through
The main sample configuration is mudpy.yaml, not mudpy.conf.
Jeremy Stanley [Sun, 7 Jul 2019 03:06:15 +0000 (03:06 +0000)]
Add info on what's missing and included
To properly set expectations, update the README file with
information on the current state of development, what's done so far
and what's not yet.
Jeremy Stanley [Sun, 7 Jul 2019 01:49:28 +0000 (01:49 +0000)]
Add a demo walk-through to the coder guide
Include an example of a simple development environment setup,
explaining how to start the server using the provided sample
configuration and then interact with it using a console-based MUD
client.
Jeremy Stanley [Sun, 7 Jul 2019 01:45:47 +0000 (01:45 +0000)]
Recommend the tox-venv plug-in
In the coder guide, include a suggestion for tox-venv (a tox plug-in
which makes tox use the venv module from the Python 3 standard
library in place of the separate virtualenv package).
Jeremy Stanley [Sun, 7 Jul 2019 01:42:20 +0000 (01:42 +0000)]
Link API documentation in the coder guide
In the API section of the coder guide, add a cross-link to the API
documentation for the package and modules.
Jeremy Stanley [Sat, 6 Jul 2019 22:13:00 +0000 (22:13 +0000)]
Drop Python 3.4 and add 3.8
Python 3.4 reached end-of-life status nearly 4 months ago with the
release of 3.4.10 on 2019-03-18, so stop asserting we test new
commits against it (truth be told, it was already hard to build on
modern distros with newer libssl anyway).
Python 3.8 has been in beta for over a month already, and 3.8.0b2
was tagged earlier this week. New commits have been tested against
3.8 alpha and beta builds for a while, so add it to the list of
trove classifiers.
Update the README file to stop mentioning minimum Python 3 versions,
so that it won't need further updates as older interpreters age out.
Jeremy Stanley [Mon, 10 Jun 2019 22:49:15 +0000 (22:49 +0000)]
Update minimum PBR for setup_requires
Some of the recently-added Python package metadata (particularly
project_urls and description-content-type) need newer PBR where that
support was added. PBR 5.0.0 is the oldest version with the
particular features we're using, so update the lower bound for it
accordingly.
Jeremy Stanley [Mon, 13 May 2019 20:26:09 +0000 (20:26 +0000)]
Improve preferences display
When displaying preferences, color-code the base and admin
preferences similar to command help. Also show a placeholder when
there is no existing value set for a preference. Add a hyphen
separator between preference names and values. Update tests to
accommodate the new formatting, and while we're there add a test to
make sure non-admins can't set values for admin-only preferences.
Jeremy Stanley [Mon, 13 May 2019 19:28:30 +0000 (19:28 +0000)]
Support abbreviating portal names when moving
Allow users to abbreviate portal names provided to the move command
for convenience.
Jeremy Stanley [Mon, 13 May 2019 19:23:51 +0000 (19:23 +0000)]
Provide normal error if command raises exception
If a attempting to execute a user-supplied command results in a
Python exception, return the normal error message string to the user
(in addition to logging the exception and traceback). This way,
normal users won't see any difference between unknown/invalid
commands and broken ones.
Jeremy Stanley [Mon, 13 May 2019 19:22:24 +0000 (19:22 +0000)]
Safely log when a command error cannot be sent
If a command triggers an error back to the user and sending that
error raises an exception, log it and continue to avoid crashing the
engine.
Jeremy Stanley [Mon, 13 May 2019 03:30:53 +0000 (03:30 +0000)]
Correct data type for see_also command facets
Make the see_also facets of the chat and say commands list items as
they were originally intended to be, and test that they get
displayed.
Jeremy Stanley [Mon, 13 May 2019 03:06:42 +0000 (03:06 +0000)]
Show possible abbreviations in help list
When listing available commands via the help command, show which
parts of a given command word are optional to type. Also test it.
Jeremy Stanley [Mon, 13 May 2019 02:24:59 +0000 (02:24 +0000)]
Correct logged error for missing action function
When logging an error for a missing command action function,
correctly include the function name. Also go ahead and add the
action name sought for improved clarity.
Jeremy Stanley [Sun, 12 May 2019 13:22:42 +0000 (13:22 +0000)]
Make command actions implicit
If an action is not listed for a command, assume the action function
is named the same as the command itself.
Jeremy Stanley [Sat, 11 May 2019 13:24:02 +0000 (13:24 +0000)]
Dereference command action functions
Replace the use of Python expressions for command actions with
simple names of functions relative to the mudpy package namespace.
This removes an unsafe use of exec(). Also start catching all
exceptions raised by the execution of a command and simply logging
them rather than allowing them to crash the engine.
Jeremy Stanley [Sat, 11 May 2019 13:20:55 +0000 (13:20 +0000)]
Test the show result command
Add self test coverage for the show result administrative command,
both with a working expression and one which raises an exception.
Jeremy Stanley [Sat, 11 May 2019 13:18:04 +0000 (13:18 +0000)]
Correct a TypeError in the show time command
Add missing type conversion in the output of the show time
administrative command, and include a regression test so we assure
it continues to work.
Jeremy Stanley [Thu, 9 May 2019 21:06:35 +0000 (21:06 +0000)]
Always pass parameters in commands
When calling a command handler, pass a parameters object regardless
of whether the command actually needs one. This normalizes the
interface between command actions and their corresponding handler
functions so they can be called through a generic interface in the
future.
Jeremy Stanley [Thu, 9 May 2019 20:19:50 +0000 (20:19 +0000)]
Don't allow abbreviating administrative commands
If a command is flagged as administrative, don't match substring
abbreviations for it. For example, an admin entering "h" should get
the help summary, not halt the engine.
Jeremy Stanley [Thu, 9 May 2019 20:18:13 +0000 (20:18 +0000)]
Show full command name in help output
When help is requested on an abbreviated command, include the full
name (rather than the provided abbreviation) in the synopsis.
Jeremy Stanley [Mon, 6 May 2019 19:00:13 +0000 (19:00 +0000)]
Implicitly support abbreviating commands
Match entered commands against initial substrings of a sorted list
of command keywords, effectively supporting abbreviated commands.
Also test it works.
Jeremy Stanley [Sun, 5 May 2019 21:07:26 +0000 (21:07 +0000)]
Allow including time in the active state prompt
Occurrences of $(time) in the user's prompt string will be replaced
by the current World clock increment when displayed. Also test this
works as intended.
Jeremy Stanley [Sun, 5 May 2019 20:37:43 +0000 (20:37 +0000)]
Escape replacement macros in preferences
Don't let users inject replacement macros into their preferences,
just escape them so they're harmless. Also adjust the preferences
tests to include macros so this safety measure does not regress.
Jeremy Stanley [Sun, 5 May 2019 20:36:17 +0000 (20:36 +0000)]
Test that macros are escaped in communication
We explicitly escape replacement macros in user input for
communication commands (say, ask, et cetera). Test to make sure this
safety measure does not regress.
Jeremy Stanley [Sun, 5 May 2019 16:44:10 +0000 (16:44 +0000)]
Use the active state prompt as the default prompt
In order to stop hard-coding the default prompt string into the
prompt method, use the prompt string associated with the active
state to provide it. This is intuitive and allows it to be more
easily overridden if desired.
Jeremy Stanley [Sun, 5 May 2019 16:20:48 +0000 (16:20 +0000)]
Add a prompt generator method
Move the retrieval and assembly of the prompt string fragment for
active state users into its own method, paving the way for more
dynamic and extensible prompts.
Jeremy Stanley [Sun, 5 May 2019 15:26:10 +0000 (15:26 +0000)]
Fix selftest telopt callback for Python 3.4
Python 3.4 is unable to handle formatted bytestrings. Replace two
occurrences in the Telnet option callback handler in the selftest
script to use concatenation operators instead.
Jeremy Stanley [Sat, 27 Apr 2019 19:13:58 +0000 (19:13 +0000)]
Use ISO 8601 time in logs
For ease of readability, switch log timestamps from traditional
"asctime" format to ISO 8601 date and time.
Jeremy Stanley [Sat, 27 Apr 2019 16:14:45 +0000 (16:14 +0000)]
Test for high-severity vulnerabilities with bandit
Use the bandit analyzer to check non-test-related Python source code
for potential vulnerabilities. To start, only error on matches with
severity "high" (we can ratchet it down later as lower-severity
items are addressed).
Jeremy Stanley [Sat, 30 Mar 2019 19:09:01 +0000 (19:09 +0000)]
Test with the bugbear plugin for flake8
Add the bugbear plugin to the flake8 tox testenv, and mark as
private a couple of loop control variables it identified (B007).
Jeremy Stanley [Sun, 3 Feb 2019 00:28:23 +0000 (00:28 +0000)]
Fix comparisons for pyflakes 2.1
The latest release of flake8 updates to pyflakes 2.1, and with that
comes an expectation that typical variable equality comparisons
should avoid the use of "is" and "is not" for safety. Adjust a
couple places we previously ran afoul of the new F632 check.
Jeremy Stanley [Sun, 3 Feb 2019 00:07:36 +0000 (00:07 +0000)]
Safely log unknown Telnet options and commands
During Telnet negotiation, log unknown options by numeric value if
there is no listed name for them. Do the same for unknown Telnet
commands, though in reality this should never happen as they get
filtered by the existing implementation. Add regression testing to
make certain the crash bug which this fixes doesn't recur.
Jeremy Stanley [Sun, 27 Jan 2019 19:25:19 +0000 (19:25 +0000)]
Be explicit about test requirements in tox.ini
Only a couple of the testenvs listed in tox.ini actually made use of
the packages claimed as general test dependencies inherited by all
testenvs. Move these to their corresponding declarations and drop
the old test-requirements.txt file.
Jeremy Stanley [Sun, 27 Jan 2019 19:14:04 +0000 (19:14 +0000)]
Switch to passlib.PasswordHash.hash
Starting with passlib 1.7 the PasswordHash.encrypt() method has been
renamed to PasswordHash.hash() for clarity, and the old name
deprecated. Use the new name and update our minimum passlib
dependency version accordingly.
Jeremy Stanley [Tue, 22 Jan 2019 01:44:57 +0000 (01:44 +0000)]
Add support for user preferences
Make it possible for users to list, view and set values of any
account facets white-listed in configuration. Also add
administrator-only preferences as a convenience option. To have a
means of exercising this, make the active state prompt dynamic so
that each user can set it as a preferences. Include sample
configuration, regression tests and documentation.
Jeremy Stanley [Sat, 5 Jan 2019 18:24:35 +0000 (18:24 +0000)]
Add 2019 to copyright for docs and license
A new year is upon us, and changes committed in 2019 warrant
increasing the copyright range for documentation and the full
license text to indicate that.
Jeremy Stanley [Sat, 5 Jan 2019 17:53:57 +0000 (17:53 +0000)]
Rename command.set to command.c_set
In order to avoid shadowing any built-in set() method for Python
modules, rename the set() function defined in the command module to
c_set() and adjust the corresponding caller for the "set"
administrative command accordingly.
Jeremy Stanley [Sat, 5 Jan 2019 17:20:58 +0000 (17:20 +0000)]
Support using tox-venv for testing
The tox-venv plugin for tox leverages the venv module from the
Python 3 standard library instead of relying on the third-party
virtualenv project. Its environments differ in minor ways, however,
so to accommodate that we adjust a couple of our tox testenvs. The
dist testenv no longer assumes the wheel package will be installed,
and expressly includes it as a dep. The docs testenv preinstalls
mudpy into the environment so that we can be sure PBR generates the
AUTHORS and ChangeLog files before Sphinx attempts to include them
in any rendered documents.
Jeremy Stanley [Mon, 31 Dec 2018 18:41:49 +0000 (18:41 +0000)]
Rename debug testenv to demo and use sample config
Switch the tox testenv name for invoking the daemon to demo, and
also switch it to implicitly using the default sample configuration
in etc/mudpy.yaml rather than explicitly using the daemon config
from the test fixtures. This makes it a little more friendly for
developers and/or first-time users who want to try things out since
`tox -e demo` will get them the log streaming to stdout and the
process bound to the invoking terminal where they can terminate it
with a simple sigint. For those who want to use a different
configuration, it can be passed with a command-line argument, like
`tox -e demo mudpy/tests/fixtures/test_daemon.yaml` (as an example
to replicate the old "debug" behavior).
Jeremy Stanley [Mon, 31 Dec 2018 18:33:56 +0000 (18:33 +0000)]
Use yamllint --strict when called from tox
To treat YAML formatting inconsistency warnings from yamllint as
blocking errors for development, invoke it with --strict so that tox
will report a failure rather than success.
Jeremy Stanley [Fri, 9 Nov 2018 21:54:21 +0000 (21:54 +0000)]
Move commands into a separate command module
For ease of maintainability, move all the mudpy.misc.command_*()
functions into their own module accessible via mudpy.command.*()
instead. In order to accomplish this, User objects now carry a
universe attribute so that commands they call can identify the
correct universe object in which to act.
Alphabetize the command functions, update the corresponding function
calls in the command elements, add the new module to the API
documentation, and include it in the dynamic module reload list.
Jeremy Stanley [Sat, 3 Nov 2018 13:06:15 +0000 (13:06 +0000)]
Update admin command help for new data model
Refresh the example invocations in help entries for admin commands
which previously showed old-style element identifiers.
Jeremy Stanley [Sun, 28 Oct 2018 19:46:38 +0000 (19:46 +0000)]
Alphabetize the `help show` subcommand entries
When categories were renamed to groups, help details for the
corresponding show subcommands were updated in-place rather than
getting reordered to maintain the existing alphabetization. Fix it.
Jeremy Stanley [Sat, 27 Oct 2018 21:01:52 +0000 (21:01 +0000)]
Don't LBYL when creating missing data directories
It's better to ask forgiveness than permission. Just try to create
parent directories for any data file, and don't error if they
already exist.
Jeremy Stanley [Sat, 27 Oct 2018 20:52:04 +0000 (20:52 +0000)]
Try to make missing pidfile and logfile parent dir
Rather than assume the path to a specified pidfile or logfile
already exists, try to make it before opening the file for writing.
This solves an issue with `tox -e debug` raising FileNotFoundError
when trying to open the logfile. Remove the mkdir() call in the
selftest setup so that this gets exercised properly.
Jeremy Stanley [Tue, 16 Oct 2018 15:53:45 +0000 (15:53 +0000)]
Update copyright dates for files changed in 2018
Bump the copyright date to the present for files which received
significant modification since the beginning of 2018.
Jeremy Stanley [Mon, 15 Oct 2018 12:49:49 +0000 (12:49 +0000)]
Add navigation links to Sphinx config
Similar to the project URLs in the Python package configuration,
include some useful hyperlinks in the Sphinx Alabaster sidebar for
things like code browsing/cloning, bug reporting and release files.
Jeremy Stanley [Mon, 15 Oct 2018 12:43:22 +0000 (12:43 +0000)]
Reorganize Sphinx config
For improved manageability, sort the contents of the Sphinx conf.py
file alphabetically, and switch to the same indentation style as the
rest of the codebase.
Jeremy Stanley [Sun, 14 Oct 2018 20:48:14 +0000 (20:48 +0000)]
Clarify Python version support in README
Make it more apparent that testing is being performed as far back as
Python 3.4, which doesn't exclude the possibility that it may also
be made to work with Python 3.3 on platforms where that can still be
compiled/installed.
Jeremy Stanley [Tue, 2 Oct 2018 20:53:01 +0000 (20:53 +0000)]
Generalize copyright headers in files
Since we're distributing an AUTHORS file even in wheel packages now
replace the specific copyright strings with ones which generally
mention "mudpy authors" instead, refer to the AUTHORS file and Git
history from the LICENSE file, and embed the generated list of
authors in rendered versions of the license.
Jeremy Stanley [Sat, 29 Sep 2018 17:42:23 +0000 (17:42 +0000)]
Add AUTHORS file to wheel
Now that Wheel 0.32 supports a list of license_files we can
incorporate the AUTHORS file into .whl packages. With this, we
should also be able to make the copyright headers in various files
more generalized.
Jeremy Stanley [Sat, 29 Sep 2018 17:09:40 +0000 (17:09 +0000)]
Remove docutils dep in tox dist testenv
Now that we're using `twine check` to validate the package long
description, we no longer need to preinstall docutils in
testenv:dist.
Jeremy Stanley [Tue, 25 Sep 2018 15:25:51 +0000 (15:25 +0000)]
Switch to `twine check` in tox testenv:dist
As of twine 1.12.0 we can now replace `setup.py check ...` with
`twine check` as a more standard approach to validating the markup
of description text in packages (and potentially other aspects of
package metadata in the future).
Jeremy Stanley [Sun, 2 Sep 2018 00:54:59 +0000 (00:54 +0000)]
Add debug logging for Telnet protocol negotiation
For improved debugging of Telnet protocol negotiations, add a log
function wrapper to the telnet module and apply it any time Telnet
commands are received or sent.
Jeremy Stanley [Sun, 2 Sep 2018 00:36:22 +0000 (00:36 +0000)]
Expand logging for User class methods
Increase logging detail so that client connection/disconnection,
account login/logout, avatar activation/deactivation and
creation/deletion can be clearly associated and followed for ease of
troubleshooting.
Jeremy Stanley [Sun, 26 Aug 2018 17:42:15 +0000 (17:42 +0000)]
Support clients using CR+NUL to signal EOL
IETF RFC 854 requires that a Telnet server accept CR+NUL
interchangeably with CR+LF to indicate end of an input line from any
NVT (client). CR+NUL also happens to be the default behavior of
popular Telnet clients specifically when communicating on TCP port
23 (as opposed to non-default ports where more liberal protocol
fallbacks get employed). Previously these clients would need to `set
crlf` in their .telnetrc or at a telnet> command prompt as a
workaround.
Alter the selftest framework to send \r\0 from the NVT as an EOL to
make sure this does not regress, and add a test to explicitly end a
command with a \r\n just to make sure we can continue to support
CR+LF from clients.
Jeremy Stanley [Sun, 29 Jul 2018 17:56:52 +0000 (17:56 +0000)]
Add a "debug" testenv
Create a convenience tox testenv named "debug" which simply starts
the mudpy service with the daemon test configuration, for use in
manual client testing.
Jeremy Stanley [Sun, 29 Jul 2018 17:55:16 +0000 (17:55 +0000)]
Streamline selftest output
The standard output from a selftest run is much more brief, with the
prior verbose information redirected to a capture_tests.log file.
Jeremy Stanley [Sun, 29 Jul 2018 17:53:41 +0000 (17:53 +0000)]
Clean up leading space typo in test title
This is merely a cosmetic fix removing stray leading whitespace from
a test's title.
Jeremy Stanley [Tue, 17 Jul 2018 23:51:14 +0000 (23:51 +0000)]
Drop Python 3.3 support
Since wheel 0.30 and later no longer works with Python 3.3, it's
increasingly hard to test. Very few old platforms are likely to lack
Python 3.4 or later so this is a relatively safe move.
Also clean up some 3.3 workarounds as they're no longer needed if we
don't support running on it.
Jeremy Stanley [Tue, 17 Jul 2018 23:17:07 +0000 (23:17 +0000)]
Add signed artifact URL to Python package metadata
As PyPI doesn't support serving detached signatures for sdist and
wheel packages, but we provide some, link the URL to our copies in
the package metadata so that it appears in the links on the PyPI
project page.
Jeremy Stanley [Mon, 16 Jul 2018 03:40:03 +0000 (03:40 +0000)]
Clean up tox.ini
Remove an unused testenv:venv definition from tox.ini, and clean up
an unneeded ignore for .venv when running flake8.
Jeremy Stanley [Mon, 16 Jul 2018 03:35:52 +0000 (03:35 +0000)]
Apply correct Python version in tox base envs
Since we set basepython to python3 in tox's default testenv, this
has the unwanted side effect of causing all tox base envs (e.g.
py35) to use whatever interpreter is linked from the python3
executable name even if it isn't the requested version. Add a new
option from tox 3.1 to ignore this basepython override conflict.
Jeremy Stanley [Mon, 16 Jul 2018 03:32:07 +0000 (03:32 +0000)]
Test the default example config
To make sure the example config at etc/mudpy.yaml remains valid and
functional, add a separate tox test environment to exercise it
explicitly with the selftest suite.
Jeremy Stanley [Mon, 16 Jul 2018 03:29:15 +0000 (03:29 +0000)]
Add py3 to the default tox env list
Add a py3 environment to tox's list of default envs so that it will
be included in a basic `tox` run.
Jeremy Stanley [Mon, 16 Jul 2018 03:26:05 +0000 (03:26 +0000)]
Run the selftest in base tox testenvs
Configure tox so that the default (py35, py36, py37...) test
environments run the selftest with the daemon test configuration.
Jeremy Stanley [Mon, 16 Jul 2018 03:18:17 +0000 (03:18 +0000)]
Optionally manage a daemon during selftest runs
If a mudpy config file is supplied when invoking the selftest suite,
use it to start the service. This is intended for use with testing
automation such as tox. Handle both daemonized/disassociated and
direct child process possibilities, and attempt to clean the up
afterward. Also clean up the test environment when starting in case
stale processes or old logs were left behind by a previous run.
Jeremy Stanley [Mon, 16 Jul 2018 03:12:50 +0000 (03:12 +0000)]
Resolve included files only once
Remove an unnecessary additional round of included file resolution
and rely on the one which happens once the parent file has been
completely loaded. This was causing a startup race which would
sometimes result in the configured search path to not get applied
depending on initial config file load order, because it would
prematurely attempt to resolve included files before the configured
search path was loaded.
Jeremy Stanley [Sun, 15 Jul 2018 19:06:22 +0000 (19:06 +0000)]
Fix deprecated regex pattern syntax in selftests
A deprecated (non-raw with escape sequences) regular expression
string went unnoticed in a recent commit, so this change fixes it to
be ready for eventual Python 3.8.
Jeremy Stanley [Fri, 13 Jul 2018 17:04:24 +0000 (17:04 +0000)]
Clean up at the end of every selftest run
As the last sequence of calls made in the selftest suite, delete
remaining created accounts. This makes it possible to rerun the
selftest with data files preserved from a previous run to confirm we
don't introduce any dependencies on a fresh environment.
Jeremy Stanley [Fri, 13 Jul 2018 16:56:17 +0000 (16:56 +0000)]
Overhaul data reloading
The data model change left the reload feature in a miserable state
causing facets of mutable elements to be lost, changes introduced in
read-only origins to be ignored, and so on. Simplify the
implementation to just save, wipe and re-read all persistent data as
if the engine were starting initially. Also add a basic check to the
reload test to make sure a mutable element still has facets after
reloading, so that we reduce the risk of future regression. Include
a bit more verbose logging around when and what files are read at
load/reload time.
Jeremy Stanley [Sun, 8 Jul 2018 19:31:38 +0000 (19:31 +0000)]
Include "docs" in default tox envs list
Encourage regular testing that docs builds aren't broken by
generating them by default when tox is run without specific env
list. Also remove the doc tree from the flake8 exclusion list as it
should no longer contain anything to which that would object.
Jeremy Stanley [Sun, 8 Jul 2018 19:12:12 +0000 (19:12 +0000)]
Check readme suitability for PyPI
When generating sdists and wheels with the testenv:dist env in tox,
first run a check of the readme to make sure its contents will be
correctly parsed by PyPI/Warehouse. Also add dist to the set of
default envs and stop excluding the dist directory it creates from
testenv:flake8 runs since it shouldn't contain anything problematic
anyway. Clean up an unused VIRTUAL_ENV assignment in the tox.ini
too.
Update the Coder Guide with the simpler tox invocation while we're
at it.
Jeremy Stanley [Sun, 8 Jul 2018 18:55:53 +0000 (18:55 +0000)]
Rename "initial" state to "telopt_negotiation"
There was a rare race where if a client disconnected during the
initial Telnet option negotiation pause, an attempt to log an entry
about it would raise an exception because the "initial" state
placeholder in the default menu data was incorrectly-named. Fix
that, and rename the state to "telopt_negotiation" so it's less
confusing to debug if similar issues are discovered with this state
in the future.
Jeremy Stanley [Sat, 30 Jun 2018 20:52:23 +0000 (20:52 +0000)]
Test that ANSI input is filtered
Add a simple regression test to make sure ANSI escape sequences
aren't allowed in input lines. The escape (byte \x1b) character
should be filtered from non-binary-mode clients because we filter to
a "printable" set. For binary-mode clients an escape won't be valid
UTF-8 and so will cause the entire line of input on which it's found
to be skipped.
Jeremy Stanley [Sat, 30 Jun 2018 20:21:58 +0000 (20:21 +0000)]
Only wrap on actual spaces
Trying to match on Unicode character classes to determine where to
wrap lines turns out to be a fragile and blacklist-heavy exercise.
Instead, just wrap on actual (ASCII \x20) space characters. This
fixes a bug where the escape characters starting ANSI sequences were
sometimes matching as a wrap point garbling the output, but also
simplifies the code by no longer needing to exclude carriage returns
in a CR+LF line ending sequence. Further it solves a couple TODO
reminders to stop wrapping on non-breaking (Unicode \xa0) space
characters.
Jeremy Stanley [Sat, 30 Jun 2018 13:42:40 +0000 (13:42 +0000)]
Filter non-ASCII input when not in binary mode
If the client does not have binary send enabled per prior Telnet
option negotiation, filter for non-ASCII characters. This fixes a
bug where previously only binary mode senders were checked for
non-ASCII input and 7-bit senders were checked for non-UTF-8 input
rather than the other way around.
Jeremy Stanley [Fri, 25 May 2018 06:10:52 +0000 (06:10 +0000)]
Retool word wrapping
Better handle CR+LF injection when encountering words longer than
the terminal width. If a word is so wide it cannot be wrapped, leave
it on a line by itself and allow the terminal to apply its own
wrapping rules instead. Fixes a bug where excessive EOL markers
would get added in such situations. Also more accurately handles
skipping ANSI escape sequences in subsequently wrapped content.
Include a word-wrapping test in the selftests to avoid regressing
here.
Jeremy Stanley [Wed, 9 May 2018 13:23:50 +0000 (13:23 +0000)]
Include show version in help
Mention the new show version subcommand in help string for the
version command. Also tweak the explanations for a couple of other
subcommands for consistency.
Jeremy Stanley [Tue, 8 May 2018 19:23:52 +0000 (19:23 +0000)]
Clean dist directory in tox dist environment
To avoid accumulating deleted cruft in the dist directory, remove it
prior to running bdist_wheel/sdist.
Jeremy Stanley [Tue, 8 May 2018 18:46:54 +0000 (18:46 +0000)]
Add version command and diagnostic logging
Implement a new Versions class which is instantiated at startup and
reflects the versions of mudpy as well as the Python interpreter on
which it's running and versions of associated Python dependencies
plus any other importable Python packages which are found to be
present in the environment.
Include a show version command which provides a relevant summary of
this information and a selftest routine to make sure it's exercised.
Also log detailed version and diagnostic information at service
start, for ease of troubleshooting and defect reporting.
Jeremy Stanley [Wed, 2 May 2018 01:52:32 +0000 (01:52 +0000)]
Provide a dist environment for tox
A convenience env to create Python packages via tox.
Jeremy Stanley [Wed, 2 May 2018 01:50:34 +0000 (01:50 +0000)]
Indicate Python3.7 support
Update the Python package trove metadata to reflect that the project
is tested to work with the (still in beta) Python3.7 interpreter.
Jeremy Stanley [Wed, 2 May 2018 01:30:40 +0000 (01:30 +0000)]
Note platform in package metadata
In the Python package metadata, indicate that this project expects
and is targeted at POSIX/Unix platforms.
Jeremy Stanley [Wed, 2 May 2018 01:29:48 +0000 (01:29 +0000)]
Add keywords to Python package metadata
Include some relevant package search keywords for ease of location
on PyPI.
Jeremy Stanley [Wed, 2 May 2018 01:22:30 +0000 (01:22 +0000)]
Include license info in Python packages
Add the license metadata option for clear indication on PyPI, and
also link the license file for inclusion directly in Python wheel
packages. Add the URL for the generic license text redirect too.
Jeremy Stanley [Wed, 2 May 2018 01:18:49 +0000 (01:18 +0000)]
Update URLs in package metadata
Update the home-page URL in setup.cfg to reflect the switch to
HTTPS, and also add specific PEP 345 Project-URL entries for generic
documentation, VCS cloning/browsing and defect tracking redirects.