internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: certbot/certbot

Issue:
Usability improvements for dns-rfc2136 plugin
[This community thread points out](https://community.letsencrypt.org/t/supported-bind9-dns-challenge-client/96542) two issues with the current plugin:

 - The name is confusing. Most people don't know what RFC2136 is. We should probably add an alias like `dns-bind` or `dns-nsupdate` (after the widely used CLI update tool).

 - [The instructions to use dnssec-keygen](https://certbot-dns-rfc2136.readthedocs.io/en/stable/#sample-bind-configuration) should be replaced with tsig-keygen for Bind 9.13+. Though @joohoi pointed out on chat that most distros are still on Bind 9.11 so far.


Discussion:
bind is not the only server providing this service based on RFC2136.
PowerDNS should also support this.
dns-dyndns might be confusing as well as dyndns is also used for other servicees where someone can update only it's own record. mostly through specific other tools.
We've made a lot of changes to Certbot since this issue was opened. If you still have this issue with an up-to-date version of Certbot, can you please add a comment letting us know? This helps us to better see what issues are still affecting our users. If there is no activity in the next 30 days, this issue will be automatically closed.

\*pokes bot\*

Resolving patch:
diff --git a/certbot-dns-rfc2136/certbot_dns_rfc2136/__init__.py b/certbot-dns-rfc2136/certbot_dns_rfc2136/__init__.py
--- a/certbot-dns-rfc2136/certbot_dns_rfc2136/__init__.py
+++ b/certbot-dns-rfc2136/certbot_dns_rfc2136/__init__.py
@@ -107,12 +107,11 @@
 .. code-block:: bash
    :caption: Generate a new SHA512 TSIG key
 
-   dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST keyname.
+   tsig-keygen -a HMAC-SHA512 keyname.
 
 .. note::
-   There are a few tools shipped with BIND that can all generate TSIG keys;
-   ``dnssec-keygen``, ``rndc-confgen``, and ``ddns-confgen``. Try and use the
-   most secure algorithm supported by your DNS server.
+   Prior to BIND version 9.10.0, you will need to use ``dnssec-keygen`` to generate
+   TSIG keys. Try and use the most secure algorithm supported by your DNS server.
 
 .. code-block:: none
    :caption: Sample BIND configuration


Test patch:
Repository: certbot/certbot

Issue:
dns_common.py error message "Error parsing credentials configuration" could be more helpful
I recently ran into this error message. The solution was just me being dumb, but I think this error message could be improved to help the user better troubleshoot the situation. The easiest thing that could already help a lot is to add the file path of the invalid configuration file to the error message. As I understand it, certbot manages multiple configuration files (`/etc/letsencrypt/renewal/*.conf`, or in my case `linode-credentials.ini`). Ideally, the error message would say exactly how the syntax is wrong and how to fix it, but that would be more involved I think.

I wanted to open a PR, but reading your contributing guide, I saw that I should open an issue first.

## My operating system is (include version):
openSUSE Leap 15.3

## I installed Certbot with (snap, OS package manager, pip, certbot-auto, etc):
zypper

## I ran this command and it produced this output:

`sudo certbot certonly --dns-linode --dns-linode-credentials /home/marcel/linode-credentials.ini --dns-linode-propagation-seconds 120 -d example.com -v`
```
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator dns-linode, Installer None
Requesting a certificate for example.com
Performing the following challenges:
dns-01 challenge for example.com
Cleaning up challenges
Error parsing credentials configuration: Parsing failed with several errors.
First error at line 1.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
```

## Certbot's behavior differed from what I expected because:
I would have preferred more troubleshooting information in the error message.



Discussion:
Good idea! I'd accept a PR adding the file path here.

I agree even further info about the parsing problem would be useful, but I think that arguably should be done in our dependency we use for parsing.

Resolving patch:
diff --git a/certbot/certbot/plugins/dns_common.py b/certbot/certbot/plugins/dns_common.py
--- a/certbot/certbot/plugins/dns_common.py
+++ b/certbot/certbot/plugins/dns_common.py
@@ -272,8 +272,18 @@ def __init__(self, filename: str, mapper: Callable[[str], str] = lambda x: x) ->
         try:
             self.confobj = configobj.ConfigObj(filename)
         except configobj.ConfigObjError as e:
-            logger.debug("Error parsing credentials configuration: %s", e, exc_info=True)
-            raise errors.PluginError("Error parsing credentials configuration: {0}".format(e))
+            logger.debug(
+                "Error parsing credentials configuration '%s': %s",
+                filename,
+                e,
+                exc_info=True
+            )
+            raise errors.PluginError(
+                "Error parsing credentials configuration '{}': {}".format(
+                    filename,
+                    e
+                )
+            )
 
         self.mapper = mapper
 


Test patch:
Repository: certbot/certbot

Issue:
docs: generated man pages sticks everything under NAME
## My operating system is (include version):

FreeBSD

## I installed Certbot with (snap, OS package manager, pip, certbot-auto, etc):

i didn't, really, i was just looking for a man page on https://man.freebsd.org when I noticed this

## I ran this command and it produced this output:

apropos certbot

https://man.freebsd.org/cgi/man.cgi?query=certbot&apropos=1&sektion=0&manpath=FreeBSD+13.1-RELEASE+and+Ports&arch=default&format=html

## Certbot's behavior differed from what I expected because:

this should only show the first line, but it has the entire man page. That means that the source must be formated wrong


Discussion:
Yeah, we should fix this. Everything is going under `.SH NAME` because we are just piping the output of `certbot --help all` into `rst2man`. We're probably not going to go to the effort of writing a structured man page, but possibly we can just shift everything into the "Options" section, instead of "Name".

Resolving patch:
diff --git a/certbot/docs/conf.py b/certbot/docs/conf.py
--- a/certbot/docs/conf.py
+++ b/certbot/docs/conf.py
@@ -286,7 +286,7 @@
 man_pages = [
     ('index', 'certbot', u'Certbot Documentation',
      [project], 7),
-    ('man/certbot', 'certbot', u'certbot script documentation',
+    ('man/certbot', 'certbot', u"Automatically configure HTTPS using Let's Encrypt",
      [project], 1),
 ]
 


Test patch:
Repository: certbot/certbot

Issue:
dns_route53_propagation_seconds is always written to renewal conf since #9619  
Since #9619 was merged, these two lines *always* get appended to renewal conf files:

    certbot_route53:auth_propagation_seconds = None
    dns_route53_propagation_seconds = None

We should avoid releasing Certbot v2.5.0 while this is still the case.


Discussion:

Resolving patch:
diff --git a/certbot/certbot/_internal/cli/cli_constants.py b/certbot/certbot/_internal/cli/cli_constants.py
--- a/certbot/certbot/_internal/cli/cli_constants.py
+++ b/certbot/certbot/_internal/cli/cli_constants.py
@@ -93,4 +93,6 @@
     "no_self_upgrade",
     "no_bootstrap",
     "no_permissions_check",
+    "dns_route53_propagation_seconds",
+    "certbot_route53:auth_propagation_seconds"
 }


Test patch:
Repository: evennia/evennia

Issue:
ANSIString: textwrap.wrap fails
@Kelketek

from textwrap import wrap
g = ANSIString("Text")
wrap(g)

leads to the following traceback:
http://pastebin.com/LPKnL9fK

ANSIString: non-text conversion fails
@Kelketek
The equivalent of str(1) fails: 

ANSIString(1) leads to a traceback; it expects a string only.



Discussion:

Resolving patch:
diff --git a/src/utils/ansi.py b/src/utils/ansi.py
--- a/src/utils/ansi.py
+++ b/src/utils/ansi.py
@@ -356,6 +356,8 @@ def __new__(cls, *args, **kwargs):
         decode strings, as escapes can only be respected once.
         """
         string = args[0]
+        if not isinstance(string, basestring):
+            string = str(string)
         args = args[1:]
         parser = kwargs.get('parser', ANSI_PARSER)
         decoded = kwargs.get('decoded', False) or hasattr(string, 'raw_string')
@@ -370,8 +372,8 @@ def __init__(self, *args, **kwargs):
         self.parser = kwargs.pop('parser', ANSI_PARSER)
         super(ANSIString, self).__init__(*args, **kwargs)
         self.raw_string = unicode(self)
-        self.clean_string = self.parser.parse_ansi(
-            self.raw_string, strip_ansi=True)
+        self.clean_string = unicode(self.parser.parse_ansi(
+            self.raw_string, strip_ansi=True))
         self._code_indexes, self._char_indexes = self._get_indexes()
 
     def __len__(self):
@@ -554,14 +556,14 @@ def _transform(func_name):
     with the resulting string.
     """
     def wrapped(self, *args, **kwargs):
-        replacement_string = _query_super(func_name)(*args, **kwargs)
+        replacement_string = _query_super(func_name)(self, *args, **kwargs)
         to_string = []
         for index in range(0, len(self.raw_string)):
             if index in self._code_indexes:
                 to_string.append(self.raw_string[index])
             elif index in self._char_indexes:
                 to_string.append(replacement_string[index])
-            return ANSIString(''.join(to_string), decoded=True)
+        return ANSIString(''.join(to_string), decoded=True)
     return wrapped
 
 


Test patch:
Repository: evennia/evennia

Issue:
ANSIString non-ascii codec failure
To reproduce (with latest rev)

``` python
# this is just to conveniently retrieve the failing string
from src.utils import utils
filename = "<path/to/evennia/>/src/utils/mudform_test.py"
formdict = utils.all_from_module(filename)
formstring = formdict["FORM"]

# This is the actual test
from src.utils.ansi import ANSIString
print ANSIString(formstring)
```

``` python_traceback
/home/griatch/Devel/MUD/evennia/evennia-trunk/src/utils/ansi.py in __new__(cls, *args, **kwargs)
    362         parser = kwargs.get('parser', ANSI_PARSER)
    363         decoded = kwargs.get('decoded', False) or hasattr(string, 'raw_string')
--> 364         if not decoded:
    365             string = parser.parse_ansi(string)
    366         return super(ANSIString, cls).__new__(ANSIString, string, *args)

```

The string contains `´` and ` characters for the bottom edges of the table, and those are what is causing the issue. I tried to look into ANSIString to fix it, but it was not clear how to work around it. I ran into an infinite loop trying to apply `src.utils.utils.to_str` and `to_unicode` (or vanilla `unicode` with the encoding specified to `UTF-8`). 



Discussion:

Resolving patch:
diff --git a/src/utils/ansi.py b/src/utils/ansi.py
--- a/src/utils/ansi.py
+++ b/src/utils/ansi.py
@@ -358,12 +358,11 @@ def __new__(cls, *args, **kwargs):
         string = args[0]
         if not isinstance(string, basestring):
             string = str(string)
-        args = args[1:]
         parser = kwargs.get('parser', ANSI_PARSER)
         decoded = kwargs.get('decoded', False) or hasattr(string, 'raw_string')
         if not decoded:
             string = parser.parse_ansi(string)
-        return super(ANSIString, cls).__new__(ANSIString, string, *args)
+        return super(ANSIString, cls).__new__(ANSIString, string, 'utf-8')
 
     def __repr__(self):
         return "ANSIString(%s, decoded=True)" % repr(self.raw_string)
@@ -373,7 +372,7 @@ def __init__(self, *args, **kwargs):
         super(ANSIString, self).__init__(*args, **kwargs)
         self.raw_string = unicode(self)
         self.clean_string = unicode(self.parser.parse_ansi(
-            self.raw_string, strip_ansi=True))
+            self.raw_string, strip_ansi=True), 'utf-8')
         self._code_indexes, self._char_indexes = self._get_indexes()
 
     def __len__(self):


Test patch:
Repository: evennia/evennia

Issue:
'<' character is an "escape" character when messaging characters?
Hi! I'm not sure if anyone else has stumbled across this issue. I first discovered this using a custom character typeclass that didn't have its msg method overloaded, and then tested it again with the default character typeclass. I haven't messed/overrode any functions found in /src. It seems as though the character '<' works like an escape character, as of the latest Evennia patch when messaging characters.

Examples of testing in-game with @py (using the default character typeclass):
![capture](https://cloud.githubusercontent.com/assets/3461344/4623802/33146316-5356-11e4-854d-8b6ee0ea87e5.GIF)

It's pretty weird, and it likely doesn't affect anyone sorely, but I was using the '<' and '>' character for my prompt, so I was surprised and baffled when half of my prompt disappeared! It used to work as of last night, before I pulled in the latest Evennia changes. I was browsing through Evennia's latest commits, but I haven't found anything that I thought would affect this.



Discussion:
I cannot reproduce your exact error. You don't specify which client you are using but using the telnet protocol,  using <> according to your examples work normally. In the web client I can see the following:

```
@py self.msg("<blahthisisatest>")
>>> self.msg("")
<blahthisisatest>
<<< None
```

That is, I see the text getting cropped in the echo, but the output is okay. There is no further escaping. The reason for the escaping, by the way, should have to do with the webclient, since `<tag>` marks a html tag, you generally don't want to allow this to pass through unchecked. 

I'll look into if one can change the way the tag markers are handled in the webclient, but it's a little hard to test against your particular problems since I cannot reproduce them in the same way. 

I can simulate this under mushclient, were you using that client?

It's an issue with MXP and the <, > and & character that needs to be converted.


Resolving patch:
diff --git a/src/server/portal/mxp.py b/src/server/portal/mxp.py
--- a/src/server/portal/mxp.py
+++ b/src/server/portal/mxp.py
@@ -28,6 +28,10 @@ def mxp_parse(text):
     """
     Replaces links to the correct format for MXP.
     """
+    text = text.replace("&", "&amp;") \
+               .replace("<", "&lt;") \
+               .replace(">", "&gt;")
+
     text = LINKS_SUB.sub(MXP_SEND, text)
     return text
 


Test patch:
Repository: evennia/evennia

Issue:
IRC Bot Sends Raw |h Symbol
#### Brief summary of issue / Description of requested feature:
The IRC bot sends |h as-is.

#### Steps to reproduce the issue / Reasons for adding feature:

1. Connect an IRC channel to Evennia
2. Send a message including |h

#### Error output / Expected result of feature
Evennia doesn't convert |h, since it's missing in the Regex options in irc.py

#### Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve / implement:
Add a regex that either just strips |h, or uses IRC bold instead.


Discussion:

Resolving patch:
diff --git a/evennia/server/portal/irc.py b/evennia/server/portal/irc.py
--- a/evennia/server/portal/irc.py
+++ b/evennia/server/portal/irc.py
@@ -93,6 +93,7 @@
     (r'|_', " "),         # space
     (r'|*', ""),          # invert
     (r'|^', ""),          # blinking text
+    (r'|h', IRC_BOLD),    # highlight, use bold instead
 
     (r'|r', IRC_COLOR + IRC_RED),
     (r'|g', IRC_COLOR + IRC_GREEN),


Test patch:
Repository: evennia/evennia

Issue:
@delaccount does not delete account - gives error
#### Brief summary of issue:

@delaccount does not delete account - gives error

#### Steps to reproduce the issue:

1. Logged onto mygame as #1 account (superuser) 
2. attempted to delete a test account using @delaccount Testperson 
3. Testperson account not deleted and error displayed.

#### Error output 

Traceback (most recent call last):
  File "/home/mark/muddev/evennia/evennia/commands/cmdhandler.py", line 591, in _run_command
    ret = cmd.func()
  File "/home/mark/muddev/evennia/evennia/commands/default/admin.py", line 304, in func
    account = accounts.pop()
AttributeError: 'QuerySet' object has no attribute 'pop'

An untrapped error occurred.
(Traceback was logged 2017-11-11 14:49:35-0000).

#### Extra information: 

Evennia 0.7.0 (rev 4a282b8)
OS Linux Mint 17.2 Rafaela 
Python 2.7.6
Twisted 16.0.0
Django 1.11.6

I had this occur on my previous Evennia mygame (same game same Evennia revision) so I restarted/reloaded and reinitialized as a new game starting from scratch. 

Same results:



Discussion:
Huh, that's a really interesting one. It seems we used to provide a list instead of a QuerySet. Anyway, this is a one-line fix, I'll put PR in a minute!

Resolving patch:
diff --git a/evennia/commands/default/admin.py b/evennia/commands/default/admin.py
--- a/evennia/commands/default/admin.py
+++ b/evennia/commands/default/admin.py
@@ -301,7 +301,7 @@ def func(self):
 
         # one single match
 
-        account = accounts.pop()
+        account = accounts.first()
 
         if not account.access(caller, 'delete'):
             string = "You don't have the permissions to delete that account."


Test patch:
Repository: evennia/evennia

Issue:
SaverList __add__ changes SaverList in place
#### Brief summary of issue / Description of requested feature:
So the expected behavior for adding two lists together with the `+` operator is to add the two lists together and to return the new list. But if one of the lists is a list in an Attribute, the original list gets the result of the operation - it becomes an in-place add.

#### Steps to reproduce the issue / Reasons for adding feature:

1. `@py self.db.my_list_test = []`
2. `@py 5 in self.db.my_list_test + [5]`
3. `@py self.db.my_list_test`

#### Error output / Expected result of feature
`seldf.db.my_list_test` now contains the result of adding the lists together. I discovered this through something similar - adding a number of lists together in order to do an `in` check, and the first attribute acquired the result of adding them together.

#### Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve / implement:
Master branch


Discussion:

Resolving patch:
diff --git a/evennia/utils/dbserialize.py b/evennia/utils/dbserialize.py
--- a/evennia/utils/dbserialize.py
+++ b/evennia/utils/dbserialize.py
@@ -237,10 +237,13 @@ def __init__(self, *args, **kwargs):
         self._data = list()
 
     @_save
-    def __add__(self, otherlist):
+    def __iadd__(self, otherlist):
         self._data = self._data.__add__(otherlist)
         return self._data
 
+    def __add__(self, otherlist):
+        return list(self._data) + otherlist
+
     @_save
     def insert(self, index, value):
         self._data.insert(index, self._convert_mutables(value))


Test patch:
Repository: evennia/evennia

Issue:
Typeclass web_get_*_url methods improperly handle CamelCased model names
#### Brief summary of issue / Description of requested feature:
If you try to retrieve a URL using the web_get_*_url() methods for a model with a CamelCased name, the result includes an unwanted space.

#### Error output / Expected result of feature
`2018-10-27T06:39:52+0000 [stdout#info] Reverse for 'help entry-detail' not found. 'help entry-detail' is not a valid view function or pattern name.`

#### Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve / implement:
I either need to slugify all terms before sticking them in the URL (probably ideal), regex/replace any spaces in the string or find a better Django meta-method that returns the model name without spaces.


Discussion:

Resolving patch:
diff --git a/evennia/typeclasses/models.py b/evennia/typeclasses/models.py
--- a/evennia/typeclasses/models.py
+++ b/evennia/typeclasses/models.py
@@ -782,7 +782,7 @@ def web_get_create_url(cls):
 
         """
         try:
-            return reverse('%s-create' % cls._meta.verbose_name.lower())
+            return reverse('%s-create' % slugify(cls._meta.verbose_name))
         except:
             return '#'
 
@@ -813,7 +813,7 @@ def web_get_detail_url(self):
 
         """
         try:
-            return reverse('%s-detail' % self._meta.verbose_name.lower(),
+            return reverse('%s-detail' % slugify(self._meta.verbose_name),
                            kwargs={'pk': self.pk, 'slug': slugify(self.name)})
         except:
             return '#'
@@ -845,7 +845,7 @@ def web_get_puppet_url(self):
 
         """
         try:
-            return reverse('%s-puppet' % self._meta.verbose_name.lower(),
+            return reverse('%s-puppet' % slugify(self._meta.verbose_name),
                            kwargs={'pk': self.pk, 'slug': slugify(self.name)})
         except:
             return '#'
@@ -877,7 +877,7 @@ def web_get_update_url(self):
 
         """
         try:
-            return reverse('%s-update' % self._meta.verbose_name.lower(),
+            return reverse('%s-update' % slugify(self._meta.verbose_name),
                            kwargs={'pk': self.pk, 'slug': slugify(self.name)})
         except:
             return '#'
@@ -908,7 +908,7 @@ def web_get_delete_url(self):
 
         """
         try:
-            return reverse('%s-delete' % self._meta.verbose_name.lower(),
+            return reverse('%s-delete' % slugify(self._meta.verbose_name),
                            kwargs={'pk': self.pk, 'slug': slugify(self.name)})
         except:
             return '#'


Test patch:
Repository: evennia/evennia

Issue:
Disabling webclient does not actually disable it
#### Steps to reproduce the issue / Reasons for adding feature:

1. Set WEBCLIENT_ENABLED to False
2. Link disappears from index page
3. Go to http://example.com/webclient
4. Webclient loads.

#### Error output / Expected result of feature
Setting WEBCLIENT_ENABLED to False should disable it, not hide it.

#### Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve / implement:
The status check needs to happen in urls.py, not just on the navbar template. If disabled, the url for the webclient should not be added to the list of urlpatterns.


Discussion:

Resolving patch:
diff --git a/evennia/web/webclient/views.py b/evennia/web/webclient/views.py
--- a/evennia/web/webclient/views.py
+++ b/evennia/web/webclient/views.py
@@ -5,6 +5,8 @@
 
 """
 from __future__ import print_function
+from django.conf import settings
+from django.http import Http404
 from django.shortcuts import render
 from django.contrib.auth import login, authenticate
 
@@ -19,6 +21,10 @@ def webclient(request):
     """
     # auto-login is now handled by evennia.web.utils.middleware
     
+    # check if webclient should be enabled
+    if not settings.WEBCLIENT_ENABLED:
+        raise Http404
+    
     # make sure to store the browser session's hash so the webclient can get to it!
     pagevars = {'browser_sessid': request.session.session_key}
 


Test patch:
diff --git a/evennia/web/website/tests.py b/evennia/web/website/tests.py
--- a/evennia/web/website/tests.py
+++ b/evennia/web/website/tests.py
@@ -94,6 +94,18 @@ class PasswordResetTest(EvenniaWebTest):
 class WebclientTest(EvenniaWebTest):
     url_name = 'webclient:index'
     
+    @override_settings(WEBCLIENT_ENABLED=True)
+    def test_get(self):
+        self.authenticated_response = 200
+        self.unauthenticated_response = 200
+        super(WebclientTest, self).test_get()
+    
+    @override_settings(WEBCLIENT_ENABLED=False)
+    def test_get_disabled(self):
+        self.authenticated_response = 404
+        self.unauthenticated_response = 404
+        super(WebclientTest, self).test_get()
+    
 class ChannelListTest(EvenniaWebTest):
     url_name = 'channels'