anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: globus/globus-cli
Issue: Task pause-info has inconsistent exit codes

Take an unpaused task, e.g. a completed task.

`globus task pause-info TID -Ftext` will exit 1.
`globus task pause-info TID -Fjson` will exit 0.

Either both should exit 0 or both exit 1.

Changed files:
globus_cli/commands/task/pause_info.py

diff --git a/globus_cli/commands/task/pause_info.py b/globus_cli/commands/task/pause_info.py
index 79471f0..abae551 100644
--- a/globus_cli/commands/task/pause_info.py
+++ b/globus_cli/commands/task/pause_info.py
@@ -1,7 +1,7 @@
 import click
 
 from globus_cli.parsing import common_options, task_id_arg
-from globus_cli.safeio import formatted_print, FORMAT_TEXT_RECORD
+from globus_cli.safeio import safeprint, formatted_print, FORMAT_TEXT_RECORD
 
 from globus_cli.services.transfer import get_client
 
@@ -55,8 +55,8 @@ def task_pause_info(task_id):
         effective_pause_rules = res['pause_rules']
 
         if not explicit_pauses and not effective_pause_rules:
-            raise click.ClickException(
-                'Task {} is not paused.'.format(task_id))
+            safeprint('Task {} is not paused.'.format(task_id))
+            click.get_current_context().exit(0)
 
         if explicit_pauses:
             formatted_print(
Repository: globus/globus-cli
Issue: 'globus endpoint search' help message

I typed 'globus endpoint search', expecting to get a helpful usage message, but instead got an error:

$ globus endpoint search
Globus CLI Error: A Transfer API Error Occurred.
HTTP status:      400
request_id:       B1eYyBvVj
code:             BadRequest
message:          scope 'all' requires an additional filter parameter



Changed files:
globus_cli/commands/endpoint/search.py

diff --git a/globus_cli/commands/endpoint/search.py b/globus_cli/commands/endpoint/search.py
index 9e72526..3350669 100644
--- a/globus_cli/commands/endpoint/search.py
+++ b/globus_cli/commands/endpoint/search.py
@@ -26,6 +26,13 @@ def endpoint_search(filter_fulltext, filter_owner_id, filter_scope):
     """
     Executor for `globus endpoint search`
     """
+    if filter_scope == 'all' and not filter_fulltext:
+        raise click.UsageError(
+            'When searching all endpoints (--filter-scope=all, the default), '
+            'a full-text search filter is required. Other scopes (e.g. '
+            '--filter-scope=recently-used) may be used without specifying '
+            'an additional filter.')
+
     client = get_client()
 
     owner_id = filter_owner_id
Repository: globus/globus-cli
Issue: When listing ACLs on an endpoint, the "Shared With" column doesn't output anything for principal_types all_authenticated_users and anonymous

The final line of the interpretation function returns `principal` for non-group/identity principals, but `principal` isn't going to be set for special `principal_type`s.


Changed files:
globus_cli/commands/endpoint/permission/list.py

diff --git a/globus_cli/commands/endpoint/permission/list.py b/globus_cli/commands/endpoint/permission/list.py
index 7c53d68..9e4253b 100644
--- a/globus_cli/commands/endpoint/permission/list.py
+++ b/globus_cli/commands/endpoint/permission/list.py
@@ -28,6 +28,8 @@ def list_command(endpoint_id):
             elif rule['principal_type'] == 'group':
                 return ('https://www.globus.org/app/groups/{}'
                         ).format(principal)
+            else:
+                principal = rule['principal_type']
             return principal
 
         print_table(rules, [('Rule ID', 'id'), ('Permissions', 'permissions'),
Repository: globus/globus-cli
Issue: `globus login` incorrectly captures KeyboardInterrupt in fancy browser mode

Easy to reproduce:

1. `globus login` to start the login flow with the browser interactivity.
2. Go back to the shell where `globus login` is running
3. Ctrl+C

Nothing happens.
The login command should die upon receipt of an interrupt.

I can workaround this by `Ctrl+Z; jobs; kill %n`, but that's silly.

Changed files:
globus_cli/helpers/local_server.py

diff --git a/globus_cli/helpers/local_server.py b/globus_cli/helpers/local_server.py
index 2898394..27dedcb 100644
--- a/globus_cli/helpers/local_server.py
+++ b/globus_cli/helpers/local_server.py
@@ -27,6 +27,8 @@ try:
 except ImportError:
     from urllib.parse import urlparse, parse_qsl
 
+from globus_cli.safeio import safeprint
+
 
 class LocalServerError(Exception):
     pass
@@ -139,7 +141,15 @@ class RedirectHTTPServer(HTTPServer, object):
         self._auth_code_queue.put_nowait(code)
 
     def wait_for_code(self):
-        return self._auth_code_queue.get(block=True)
+        # workaround for handling control-c interrupt.
+        # relevant Python issue discussing this behavior:
+        # https://bugs.python.org/issue1360
+        try:
+            return self._auth_code_queue.get(block=True, timeout=3600)
+        except Queue.Empty:
+            safeprint(
+                'Login timed out. Please try again.', write_to_stderr=True)
+            sys.exit(1)
 
 
 @contextmanager
Repository: globus/globus-cli
Issue: `globus logout` doesn't appear to link to the auth.globus.org logout page

Unless I'm missing something, `globus logout` fails to provide a link to `auth.globus.org/v2/web/logout`.

Am I forgetting some subtlety or reason that we did this, or is it just a bug?

Changed files:
globus_cli/commands/logout.py

diff --git a/globus_cli/commands/logout.py b/globus_cli/commands/logout.py
index 6b3b10b..e9414d5 100644
--- a/globus_cli/commands/logout.py
+++ b/globus_cli/commands/logout.py
@@ -26,6 +26,10 @@ Manage Consents Page:
 
 _LOGOUT_EPILOG = """\\
 You are now successfully logged out of the Globus CLI.
+You may also want to logout of any browser session you have with Globus:
+
+  https://auth.globus.org/v2/web/logout
+
 Before attempting any further CLI commands, you will have to login again using
 
   globus login
Repository: globus/globus-cli
Issue: `endpoint permission list` is way slower than expected

```
$ time globus endpoint permission list ...
...
globus endpoint permission list ...  24.63s user 1.49s system 16% cpu 2:38.88 total
```

The webapp can fetch ACLs on this same endpoint in ~1 second, so we know that the API is not responding slowly.
We suspect that either the CLI or SDK is doing something very foolish -- e.g. fetching the result multiple times.

We need to do some basic profiling and find the bug.

Changed files:
globus_cli/commands/endpoint/permission/list.py

diff --git a/globus_cli/commands/endpoint/permission/list.py b/globus_cli/commands/endpoint/permission/list.py
index b3f513f..d435f69 100644
--- a/globus_cli/commands/endpoint/permission/list.py
+++ b/globus_cli/commands/endpoint/permission/list.py
@@ -2,9 +2,36 @@ import click
 
 from globus_cli.parsing import common_options, endpoint_id_arg
 from globus_cli.safeio import formatted_print
-from globus_cli.services.auth import lookup_identity_name
+from globus_cli.helpers import outformat_is_text
+from globus_cli.services.auth import get_auth_client
 from globus_cli.services.transfer import get_client
 
+_id_batch_size = 100
+
+
+def _resolve_identities(rules):
+    """
+    Batch resolve identities to usernames.
+    Used only for text-output to get a nice listing.
+
+    Returns a dict mapping IDs to usernames.
+    """
+    to_resolve = set()
+    for rule in rules:
+        if rule['principal_type'] == 'identity':
+            to_resolve.add(rule['principal'])
+    to_resolve = list(to_resolve)
+
+    ac = get_auth_client()
+    resolved_map = {}
+    for i in range(0, len(to_resolve), _id_batch_size):
+        chunk = to_resolve[i:i+_id_batch_size]
+        resolved_result = ac.get_identities(ids=chunk)
+        for x in resolved_result['identities']:
+            resolved_map[x['id']] = x['username']
+
+    return resolved_map
+
 
 @click.command('list', help='List of permissions on an endpoint')
 @common_options
@@ -17,10 +44,14 @@ def list_command(endpoint_id):
 
     rules = client.endpoint_acl_list(endpoint_id)
 
+    resolved_map = {}
+    if outformat_is_text():
+        resolved_map = _resolve_identities(rules)
+
     def principal_str(rule):
         principal = rule['principal']
         if rule['principal_type'] == 'identity':
-            username = lookup_identity_name(principal)
+            username = resolved_map.get(rule['principal'])
 
             return username or principal
         elif rule['principal_type'] == 'group':