anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: mitre/caldera
Issue: unexpected keyword argument 'loop

While deploying Caldera version 4 as a docker container, I get this error message

2022-06-22 13:44:29 - ERROR (base_events.py:1744 default_exception_handler) Task exception was never retrieved
future: <Task finished name='Task-20' coro=<start_server() done, defined at /usr/lib/python3.10/asyncio/streams.py:53> exception=TypeError("BaseEventLoop.create_server() got an unexpected keyword argument 'loop'")>
TypeError: BaseEventLoop.create_server() got an unexpected keyword argument 'loop'

Changed files:
app/contacts/contact_tcp.py

diff --git a/app/contacts/contact_tcp.py b/app/contacts/contact_tcp.py
index 4ad5044f..35f942c8 100644
--- a/app/contacts/contact_tcp.py
+++ b/app/contacts/contact_tcp.py
@@ -21,7 +21,7 @@ class Contact(BaseWorld):
     async def start(self):
         loop = asyncio.get_event_loop()
         tcp = self.get_config('app.contact.tcp')
-        loop.create_task(asyncio.start_server(self.tcp_handler.accept, *tcp.split(':'), loop=loop))
+        loop.create_task(asyncio.start_server(self.tcp_handler.accept, *tcp.split(':')))
         loop.create_task(self.operation_loop())
 
     async def operation_loop(self):
Repository: androguard/androguard
Issue: Bug: AttributeError in show method of MethodAnalysis class

The line `i.show()` in the show method of the MethodAnalysis class causes an AntributeError as the DVMBasicBlock object does not have an attribute show.


Changed files:
androguard/core/analysis/analysis.py

diff --git a/androguard/core/analysis/analysis.py b/androguard/core/analysis/analysis.py
index b3d0af99..f98466bf 100644
--- a/androguard/core/analysis/analysis.py
+++ b/androguard/core/analysis/analysis.py
@@ -173,6 +173,9 @@ class DVMBasicBlock(object):
     def set_exception_analysis(self, exception_analysis):
         self.exception_analysis = exception_analysis
 
+    def show(self):
+        print(self.get_name(), self.get_start(), self.get_end())
+
 
 class Enum(object):
Repository: androguard/androguard
Issue: travis python2.7 is failing because of ipython dependency

Looks like ipython 6 dropped python2 support and travis does not like to install something else:
```
Collecting ipython>=5.0.0 (from androguard==2.0)

  Downloading ipython-6.0.0.tar.gz (5.1MB)

    100% |################################| 5.1MB 108kB/s 

    IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.

    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.

    Beginning with IPython 6.0, Python 3.3 and above is required.

    See IPython `README.rst` file for more information:

        https://github.com/ipython/ipython/blob/master/README.rst

    Python sys.version_info(major=2, minor=7, micro=9, releaselevel='final', serial=0) detected.

    Your pip version is out of date, please install pip >= 9.0.1. pip 6.0.7 detected.

    Complete output from command python setup.py egg_info:

    

    

    IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.

    

    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.

    

    Beginning with IPython 6.0, Python 3.3 and above is required.

    

    

    

    See IPython `README.rst` file for more information:

    

    

    

        https://github.com/ipython/ipython/blob/master/README.rst

    

    

    

    Python sys.version_info(major=2, minor=7, micro=9, releaselevel='final', serial=0) detected.

    

    Your pip version is out of date, please install pip >= 9.0.1. pip 6.0.7 detected.

    

    

    

    ----------------------------------------

    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-WRMWjs/ipython

The command "pip install ." failed and exited with 1 during .

```

Who has travis$foo and can fix this?

Changed files:
setup.py

diff --git a/setup.py b/setup.py
index 3a12591b..56b7ca67 100644
--- a/setup.py
+++ b/setup.py
@@ -4,6 +4,11 @@ import os
 
 from setuptools import setup, find_packages
 
+if sys.version_info >= (3,):
+    install_requires = ['pyasn1', 'cryptography>=1.0', 'future', 'ipython>=5.0.0', 'networkx', 'pygments']
+else:
+    install_requires = ['pyasn1', 'cryptography>=1.0', 'future', 'ipython>=5.0.0,<6', 'networkx', 'pygments'],
+
 # TODO this is actually a hack... How to copy the files to the right folder?
 #guidir = os.path.join(sys.prefix, 'Scripts', 'androguard', 'gui')
 #if not os.path.isdir(guidir):
@@ -19,7 +24,7 @@ setup(
              'androlyze.py',
              'androdd.py',
              'androgui.py',],
-    install_requires=['pyasn1', 'cryptography>=1.0', 'future', 'ipython>=5.0.0', 'networkx', 'pygments'],
+    install_requires=install_requires,
     extras_require={
         'GUI': ["pyperclip", "PyQt5"],
         'docs': ['sphinx', 'sphinxcontrib-programoutput'],
@@ -28,5 +33,5 @@ setup(
         'graphing': ['pydot'],
     },
     setup_requires=['setuptools'],
-    
+
 )
Repository: androguard/androguard
Issue: AttributeError: 'DalvikVMFormat' object has no attribute 'dotbuff'

when i run this command ->
"./apkviewer.py TheTruthSpy_7.7.apk -o ../cikti2" i got this error message:


AttributeError: 'DalvikVMFormat' object has no attribute 'dotbuff'

What can i do? this is important for me .please help

Changed files:
androguard/core/data/data.py

diff --git a/androguard/core/data/data.py b/androguard/core/data/data.py
index 43083a92..60d5cfd8 100644
--- a/androguard/core/data/data.py
+++ b/androguard/core/data/data.py
@@ -70,7 +70,7 @@ class DexViewer(object):
         idx = i.start
         label = ""
         for ins in i.get_instructions():
-            c_label = "%x %s\\n" % (idx, self.vm.dotbuff(ins, idx))
+            c_label = "%x %s %s\\n" % (idx, ins.get_name(), ins.get_output(idx))
             idx += ins.get_length()
             label += c_label
             width = max(width, len(c_label))
Repository: androguard/androguard
Issue: incomplete get_operands

Hi, is it normal that `instruction.get_operands()` doesn't give me the same registers as `instruction.get_output()`?

 Example to better explain:

If i execute `print instruction.get_output()` I get:

```
v0 ... v7, Landroid/database/sqlite/SQLiteDatabase;->query(Ljava/lang/String; [Ljava/lang/String; Ljava/lang/String; [Ljava/lang/String; Ljava/lang/String; Ljava/lang/String; Ljava/lang/String;)Landroid/database/Cursor; 
```

If I execute `print instruction.get_operands()` I get:

```
[(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (256, 420, 'Landroid/database/sqlite/SQLiteDatabase;->query(Ljava/lang/String; [Ljava/lang/String; Ljava/lang/String; [Ljava/lang/String; Ljava/lang/String; Ljava/lang/String; Ljava/lang/String;)Landroid/database/Cursor;')]
```

The result of `get_output()` ranges from v0 to v7, while the result of `get_operands()` ranges from (0, 0) to (0, 6). Maybe I'm wrong, but I expected `get_operands()` to range from (0, 0) to (0, 7).

The instruction type in this example is `<class 'androguard.core.bytecodes.dvm.Instruction3rc'>`

Thanks


Changed files:
androguard/core/bytecodes/dvm.py

diff --git a/androguard/core/bytecodes/dvm.py b/androguard/core/bytecodes/dvm.py
index f914506e..1570c9d9 100644
--- a/androguard/core/bytecodes/dvm.py
+++ b/androguard/core/bytecodes/dvm.py
@@ -5495,7 +5495,7 @@ class Instruction3rc(Instruction):
                     (self.get_kind() + OPERAND_KIND, self.BBBB, kind)]
         else:
             l = []
-            for i in range(self.CCCC, self.NNNN):
+            for i in range(self.CCCC, self.NNNN + 1):
                 l.append((OPERAND_REGISTER, i))
 
             l.append((self.get_kind() + OPERAND_KIND, self.BBBB, kind))
Repository: androguard/androguard
Issue: AttributeError: 'DalvikVMFormat' object has no attribute 'dotbuff'

when i run this command ->
"./apkviewer.py TheTruthSpy_7.7.apk -o ../cikti2" i got this error message:


AttributeError: 'DalvikVMFormat' object has no attribute 'dotbuff'

What can i do? this is important for me .please help

Changed files:
androguard/core/data/data.py

diff --git a/androguard/core/data/data.py b/androguard/core/data/data.py
index d997e79d..00f0d744 100644
--- a/androguard/core/data/data.py
+++ b/androguard/core/data/data.py
@@ -153,7 +153,7 @@ class DexViewer(object):
         idx = i.start
         label = ""
         for ins in i.get_instructions():
-            c_label = "%x %s\\n" % (idx, self.vm.dotbuff(ins, idx))
+            c_label = "%x %s\\n" % (idx, ins)
             idx += ins.get_length()
             label += c_label
             width = max(width, len(c_label))
Repository: androguard/androguard
Issue: UnicodeEncodeError: Unencoded UTF-8 unicode in ARSC._analyze

The bug is here : https://github.com/androguard/androguard/blob/a18256203d7af751c8862b04b15b15c23225b54f/androguard/core/bytecodes/axml.py#L1017

`language` and `region` are `<unicode>` type but are being used as string. This raised the following error:

```shell

UnicodeEncodeError: 'ascii' codec can't encode character u'\\xa4' in position 0: ordinal not in range(128)

```
`u'\\xa4'` being some unicode region name.

- Androguard Version: master
- Python Version: 2.7.10
- Operating System: Mac OS


Changed files:
androguard/core/bytecodes/axml.py

diff --git a/androguard/core/bytecodes/axml.py b/androguard/core/bytecodes/axml.py
index 455c3962..a3713220 100644
--- a/androguard/core/bytecodes/axml.py
+++ b/androguard/core/bytecodes/axml.py
@@ -1009,12 +1009,7 @@ class ARSCParser(object):
                     if header.type == RES_TABLE_TYPE_TYPE:
                         a_res_type = self.packages[package_name][nb + 1]
 
-                        language = a_res_type.config.get_language()
-                        region = a_res_type.config.get_country()
-                        if region == "\\x00\\x00":
-                            locale = language
-                        else:
-                            locale = "{}-r{}".format(language, region)
+                        locale = a_res_type.config.get_language_and_region()
 
                         c_value = self.values[package_name].setdefault(locale, {"public":[]})
Repository: mbed-tls/mbedtls
Issue: Incorrect capitalisation of Mbed TLS in generated changelogs.

### Summary

Capitalisation of 'Mbed TLS' in the changelog created by assemble_changelog.py is not correct, its using 'mbed TLS' instead.


Changed files:
scripts/assemble_changelog.py

diff --git a/scripts/assemble_changelog.py b/scripts/assemble_changelog.py
index b742cc8ca..d27cc4713 100755
--- a/scripts/assemble_changelog.py
+++ b/scripts/assemble_changelog.py
@@ -122,7 +122,7 @@ class ChangelogFormat:
 class TextChangelogFormat(ChangelogFormat):
     """The traditional Mbed TLS changelog format."""
 
-    _unreleased_version_text = '= mbed TLS x.x.x branch released xxxx-xx-xx'
+    _unreleased_version_text = '= Mbed TLS x.x.x branch released xxxx-xx-xx'
     @classmethod
     def is_released_version(cls, title):
         # Look for an incomplete release date
Repository: mbed-tls/mbedtls
Issue: Incorrect capitalisation of Mbed TLS in generated changelogs.

### Summary

Capitalisation of 'Mbed TLS' in the changelog created by assemble_changelog.py is not correct, its using 'mbed TLS' instead.


Changed files:
scripts/assemble_changelog.py

diff --git a/scripts/assemble_changelog.py b/scripts/assemble_changelog.py
index 7b036aa51..f3aca7070 100755
--- a/scripts/assemble_changelog.py
+++ b/scripts/assemble_changelog.py
@@ -122,7 +122,7 @@ class ChangelogFormat:
 class TextChangelogFormat(ChangelogFormat):
     """The traditional Mbed TLS changelog format."""
 
-    _unreleased_version_text = '= mbed TLS x.x.x branch released xxxx-xx-xx'
+    _unreleased_version_text = '= Mbed TLS x.x.x branch released xxxx-xx-xx'
     @classmethod
     def is_released_version(cls, title):
         # Look for an incomplete release date
Repository: mbed-tls/mbedtls
Issue: generate_psa_tests.py does not work on non-English versions of Visual Studio

Reported in https://github.com/ARMmbed/mbedtls/issues/2188#issuecomment-865502961:

> `scripts\\make_generated_files.bat` doesn't work out of the box because I'm using visual studio with Chinese language. The cl.exe output is not match `Microsoft (R) C/C++ Optimizing Compiler` but `Microsoft (R) C/C++ 优化编译器`

Since we don't ship the generated files on the development branch, `generate_psa_tests.py` is somewhat user-facing (only for users who use the development version, not for users of released versions where the files are pre-generated). It's invoked by `scripts\\make_generated_files.bat` which is mentioned in `README.md`.


Changed files:
scripts/mbedtls_dev/c_build_helper.py

diff --git a/scripts/mbedtls_dev/c_build_helper.py b/scripts/mbedtls_dev/c_build_helper.py
index 18c1e7606..459afba42 100644
--- a/scripts/mbedtls_dev/c_build_helper.py
+++ b/scripts/mbedtls_dev/c_build_helper.py
@@ -135,8 +135,7 @@ def get_c_expression_values(
                                 stdout=subprocess.DEVNULL,
                                 stderr=subprocess.PIPE,
                                 universal_newlines=True)
-        cc_is_msvc = 'Microsoft (R) C/C++ Optimizing Compiler' in \\
-                      proc.communicate()[1]
+        cc_is_msvc = 'Microsoft (R) C/C++' in proc.communicate()[1]
 
         cmd += ['-I' + dir for dir in include_path]
         if cc_is_msvc:
Repository: mbed-tls/mbedtls
Issue: Some generated files are generated with tabs in them

### Summary

In 'ssl_debug_helpers_generated.c', 'mbedtls_ssl_named_group_to_str()' and 'mbedtls_ssl_sig_alg_to_str()' are generated using tabs instead of spaces, which causes check_files.py to fail on a release build. This only shows up on a release build, as its the only time this file is commited, otherwise its ignored by .gitignore.

### System information

Mbed TLS version (number or commit id): between 3.1.0 and 3.2.0

### Expected behavior

Generated files should only contain spaces, not tabs.

### Actual behavior

'ssl_debug_helpers_generated.c' has tabs in it, as above.


Changed files:
scripts/generate_ssl_debug_helpers.py

diff --git a/scripts/generate_ssl_debug_helpers.py b/scripts/generate_ssl_debug_helpers.py
index 959cbbca7..4c64fe1e3 100755
--- a/scripts/generate_ssl_debug_helpers.py
+++ b/scripts/generate_ssl_debug_helpers.py
@@ -277,7 +277,7 @@ class SignatureAlgorithmDefinition:
         for m in self._definitions:
             name = m.groupdict()['name']
             translation_table.append(
-                '\\tcase {}:\\n\\t    return "{}";'.format(name,
+                '    case {}:\\n        return "{}";'.format(name,
                                                         name[len('MBEDTLS_TLS1_3_SIG_'):].lower())
             )
 
@@ -337,7 +337,7 @@ class NamedGroupDefinition:
         for m in self._definitions:
             name = m.groupdict()['name']
             iana_name = name[len('MBEDTLS_SSL_IANA_TLS_GROUP_'):].lower()
-            translation_table.append('\\tcase {}:\\n\\t    return "{}";'.format(name, iana_name))
+            translation_table.append('    case {}:\\n        return "{}";'.format(name, iana_name))
 
         body = textwrap.dedent('''\\
             const char *mbedtls_ssl_named_group_to_str( uint16_t in )