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

Issue:
Conveyor : Fix bug affecting http+srm protocol
Motivation
----------
Fix bug affecting http+srm protocol in the conveyor







Discussion:

Resolving patch:
diff --git a/lib/rucio/core/transfer.py b/lib/rucio/core/transfer.py
--- a/lib/rucio/core/transfer.py
+++ b/lib/rucio/core/transfer.py
@@ -664,15 +664,15 @@ def __rewrite_source_url(source_url, source_sign_url, dest_sign_url, source_sche
         if source_scheme in ['davs', 'https']:
             source_url += '?copy_mode=%s' % WEBDAV_TRANSFER_MODE
 
-    if source_sign_url == 'gcs':
-        source_url = re.sub('davs', 'gclouds', source_url)
-        source_url = re.sub('https', 'gclouds', source_url)
-    elif source_sign_url == 's3':
-        source_url = re.sub('davs', 's3s', source_url)
-        source_url = re.sub('https', 's3s', source_url)
-
-    if source_scheme == 'https+srm':
-        source_url = re.sub('srm', 'https+srm', source_url)
+    source_sign_url_map = {'gcs': 'gclouds', 's3': 's3s'}
+    if source_sign_url in source_sign_url_map:
+        if source_url[:7] == 'davs://':
+            source_url = source_sign_url_map[source_sign_url] + source_url[4:]
+        if source_url[:8] == 'https://':
+            source_url = source_sign_url_map[source_sign_url] + source_url[5:]
+
+    if source_url[:12] == 'srm+https://':
+        source_url = 'srm' + source_url[10:]
     return source_url
 
 
@@ -686,8 +686,9 @@ def __rewrite_dest_url(dest_url, dest_sign_url, dest_scheme):
     elif dest_sign_url == 's3':
         dest_url = re.sub('davs', 's3s', dest_url)
         dest_url = re.sub('https', 's3s', dest_url)
-    if dest_scheme == 'https+srm':
-        dest_url = re.sub('srm', 'https+srm', dest_url)
+
+    if dest_url[:12] == 'srm+https://':
+        dest_url = 'srm' + dest_url[10:]
     return dest_url
 
 


Test patch:
Repository: rucio/rucio

Issue:
Fix FTSCompleteState capitalisation
Motivation
----------

It's actually `Ok` and `Error`.


Discussion:

Resolving patch:
diff --git a/lib/rucio/common/constants.py b/lib/rucio/common/constants.py
--- a/lib/rucio/common/constants.py
+++ b/lib/rucio/common/constants.py
@@ -1,15 +1,25 @@
-# Copyright European Organization for Nuclear Research (CERN)
+# -*- coding: utf-8 -*-
+# Copyright 2013-2021 CERN
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
-# You may not use this file except in compliance with the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
 #
-# Authors:
-# - Vincent Garonne, <vincent.garonne@cern.ch>, 2013
-# - Cedric Serfon, <cedric.serfon@cern.ch>, 2015-2021
-# - Mario Lassnig, <mario.lassnig@cern.ch>, 2018
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
-# PY3K COMPATIBLE
+# Authors:
+# - Vincent Garonne <vincent.garonne@cern.ch>, 2013-2015
+# - Cedric Serfon <cedric.serfon@cern.ch>, 2015-2021
+# - Martin Barisits <martin.barisits@cern.ch>, 2017
+# - Mario Lassnig <mario.lassnig@cern.ch>, 2018-2021
+# - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2018
+# - Sahan Dilshan <32576163+sahandilshan@users.noreply.github.com>, 2021
 
 from collections import namedtuple
 
@@ -41,4 +51,4 @@
                                      'CANCELED'])('SUBMITTED', 'READY', 'ACTIVE', 'FAILED', 'FINISHED', 'FINISHEDDIRTY',
                                                   'CANCELED')
 
-FTS_COMPLETE_STATE = namedtuple('FTS_COMPLETE_STATE', ['OK', 'ERROR'])('OK', 'ERROR')
+FTS_COMPLETE_STATE = namedtuple('FTS_COMPLETE_STATE', ['OK', 'ERROR'])('Ok', 'Error')
diff --git a/lib/rucio/daemons/conveyor/receiver.py b/lib/rucio/daemons/conveyor/receiver.py
--- a/lib/rucio/daemons/conveyor/receiver.py
+++ b/lib/rucio/daemons/conveyor/receiver.py
@@ -144,9 +144,9 @@ def on_message(self, headers, message):
                                 'details': {'files': msg['file_metadata']}}
 
                 record_counter('daemons.conveyor.receiver.message_rucio')
-                if str(msg['t_final_transfer_state']) == FTS_COMPLETE_STATE.OK:
+                if str(msg['t_final_transfer_state']) == FTS_COMPLETE_STATE.OK:  # pylint:disable=no-member
                     response['new_state'] = RequestState.DONE
-                elif str(msg['t_final_transfer_state']) == FTS_COMPLETE_STATE.ERROR:
+                elif str(msg['t_final_transfer_state']) == FTS_COMPLETE_STATE.ERROR:  # pylint:disable=no-member
                     response['new_state'] = RequestState.FAILED
 
                 try:


Test patch:
Repository: rucio/rucio

Issue:
`rucio --help` fails on misconfigured sites
Motivation
----------
Even on a bad installation or typos in the configuration system, `rucio --help` ought to work.

The current version of `rucio` imports the `DownloadClient` at the module level.  If there is an error in the `rucio.cfg` that causes the `DownloadClient` constructor to throw an exception, you can't get to `--help`.

Example:
```
$ rucio --help 
Traceback (most recent call last):
  File "/home/cse496/bbockelm/software/rucio-doma/bin/rucio", line 63, in <module>
    from rucio.client.downloadclient import DownloadClient
  File "/home/cse496/bbockelm/projects/rucio/lib/rucio/client/downloadclient.py", line 34, in <module>
    client = Client()
... stack trace goes on for miles ...
  File "/home/cse496/bbockelm/software/rucio-doma/lib/python2.7/site-packages/requests/adapters.py", line 412, in send
    self.cert_verify(conn, request.url, verify, cert)
  File "/home/cse496/bbockelm/software/rucio-doma/lib/python2.7/site-packages/requests/adapters.py", line 227, in cert_verify
    "invalid path: {0}".format(cert_loc))
IOError: Could not find a suitable TLS CA certificate bundle, invalid path: /etc/ca.crt
```

In my case, the problem was caused by an invalid path in `rucio.cfg` for the CA bundle.

Modification
------------
Failures to create the clients should be swallowed until they are actually used.  Potentially we shouldn't even import the clients until needed.


Discussion:
Note that importing the client at the top of the `rucio` CLI causes an authentication to be attempted even when you're just doing `rucio --help`.
That doesn't seem to be problem only with importing downloadclient but Clients in genereal. The config is imported in baseclient. 
Just importing the module should not read the config? Only when constructing the client object; Then indeed it does read the config and even trys to authenticate against the rucio server.
@TomasJavurek can you please check the code path why this is the case even when doing `rucio --help`? In my opinion no client object needs to be constructed in that case.

Resolving patch:
diff --git a/lib/rucio/common/config.py b/lib/rucio/common/config.py
--- a/lib/rucio/common/config.py
+++ b/lib/rucio/common/config.py
@@ -54,7 +54,7 @@ def config_get(section, option, raise_exception=True, default=None, clean_cached
     global __CONFIG
     try:
         return get_config().get(section, option)
-    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError) as err:
+    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError, RuntimeError) as err:
         if raise_exception and default is None:
             raise err
         if clean_cached:


Test patch:
Repository: rucio/rucio

Issue:
Upload/Download CLI does not properly log INFO
Motivation
----------
Default log level was set to WARNING, increase to INFO.


Discussion:

Resolving patch:
diff --git a/lib/rucio/common/utils.py b/lib/rucio/common/utils.py
--- a/lib/rucio/common/utils.py
+++ b/lib/rucio/common/utils.py
@@ -16,7 +16,7 @@
 # Authors:
 # - Vincent Garonne <vincent.garonne@cern.ch>, 2012-2018
 # - Thomas Beermann <thomas.beermann@cern.ch>, 2012-2021
-# - Mario Lassnig <mario.lassnig@cern.ch>, 2012-2020
+# - Mario Lassnig <mario.lassnig@cern.ch>, 2012-2021
 # - Cedric Serfon <cedric.serfon@cern.ch>, 2013-2021
 # - Ralph Vigne <ralph.vigne@cern.ch>, 2013
 # - Joaquín Bogado <jbogado@linti.unlp.edu.ar>, 2015-2018
@@ -1366,7 +1366,7 @@ def _force_cfg_log_level(cfg_option):
 
     # extracting the log level
     if not logger_level:
-        logger_level = logging.WARNING
+        logger_level = logging.INFO
         if verbose:
             logger_level = logging.DEBUG
 


Test patch:
diff --git a/lib/rucio/tests/test_bin_rucio.py b/lib/rucio/tests/test_bin_rucio.py
--- a/lib/rucio/tests/test_bin_rucio.py
+++ b/lib/rucio/tests/test_bin_rucio.py
@@ -15,7 +15,7 @@
 #
 # Authors:
 # - Vincent Garonne <vincent.garonne@cern.ch>, 2012-2018
-# - Mario Lassnig <mario.lassnig@cern.ch>, 2012-2019
+# - Mario Lassnig <mario.lassnig@cern.ch>, 2012-2021
 # - Angelos Molfetas <Angelos.Molfetas@cern.ch>, 2012
 # - Thomas Beermann <thomas.beermann@cern.ch>, 2012-2021
 # - Joaquín Bogado <jbogado@linti.unlp.edu.ar>, 2014-2018
@@ -746,7 +746,7 @@ def test_download_timeout_options_accepted(self):
         print(self.marker + cmd)
         exitcode, out, err = execute(cmd)
         print(out, err)
-        assert not err
+        assert 'successfully downloaded' in err
         # search for the files with ls
         cmd = 'ls /tmp/'    # search in /tmp/
         print(self.marker + cmd)
Repository: rucio/rucio

Issue:
srm+https not correctly stripped (related #4513)
It is necessary to changes `srm+https://...` scheme to `srm://...` before passing this URL to gfal, but current code remove too many characters and as a result we get `srm//...` without `:`

https://github.com/rucio/rucio/blob/f1159fbf1e6002715a77b613d35d037c55082803/lib/rucio/core/transfer.py#L685
https://github.com/rucio/rucio/blob/f1159fbf1e6002715a77b613d35d037c55082803/lib/rucio/core/transfer.py#L701



Discussion:

Resolving patch:
diff --git a/lib/rucio/core/transfer.py b/lib/rucio/core/transfer.py
--- a/lib/rucio/core/transfer.py
+++ b/lib/rucio/core/transfer.py
@@ -682,7 +682,7 @@ def __rewrite_source_url(source_url, source_sign_url, dest_sign_url, source_sche
             source_url = source_sign_url_map[source_sign_url] + source_url[5:]
 
     if source_url[:12] == 'srm+https://':
-        source_url = 'srm' + source_url[10:]
+        source_url = 'srm' + source_url[9:]
     return source_url
 
 
@@ -698,7 +698,7 @@ def __rewrite_dest_url(dest_url, dest_sign_url, dest_scheme):
         dest_url = re.sub('https', 's3s', dest_url)
 
     if dest_url[:12] == 'srm+https://':
-        dest_url = 'srm' + dest_url[10:]
+        dest_url = 'srm' + dest_url[9:]
     return dest_url
 
 


Test patch:
Repository: rucio/rucio

Issue:
Exporter: Broken distance option in Flask API
Motivation
----------
The distance option for the in Flask API exporter is broken (but worked fine with webpy)







Discussion:

Resolving patch:
diff --git a/lib/rucio/web/rest/flaskapi/v1/export.py b/lib/rucio/web/rest/flaskapi/v1/export.py
--- a/lib/rucio/web/rest/flaskapi/v1/export.py
+++ b/lib/rucio/web/rest/flaskapi/v1/export.py
@@ -56,7 +56,7 @@ def get(self):
         :status 406: Not Acceptable
         :returns: dictionary with rucio data
         """
-        distance = request.args.get('distance', default=True)
+        distance = request.args.get('distance', default='True') == 'True'
         return Response(render_json(**export_data(issuer=request.environ.get('issuer'), distance=distance, vo=request.environ.get('vo'))), content_type='application/json')
 
 


Test patch:
diff --git a/lib/rucio/tests/test_import_export.py b/lib/rucio/tests/test_import_export.py
--- a/lib/rucio/tests/test_import_export.py
+++ b/lib/rucio/tests/test_import_export.py
@@ -1252,6 +1252,8 @@ def test_export_client(vo, distances_data):
         }
     }
     assert parse_response(render_json(**distances_cmp)) == data['distances']
+    data = export_client.export_data(distance=False)
+    assert 'distances' not in data
 
 
 @pytest.mark.noparallel(reason='modifies distance on pre-defined RSE')
Repository: rucio/rucio

Issue:
Belle II: Add new Calibration Transfers activity
Motivation
----------
Add new Calibration Transfers activity






Discussion:

Resolving patch:
diff --git a/lib/rucio/common/schema/belleii.py b/lib/rucio/common/schema/belleii.py
--- a/lib/rucio/common/schema/belleii.py
+++ b/lib/rucio/common/schema/belleii.py
@@ -16,7 +16,7 @@
 # - Martin Barisits <martin.barisits@cern.ch>, 2019
 # - Mario Lassnig <mario.lassnig@cern.ch>, 2019
 # - Andrew Lister <andrew.lister@stfc.ac.uk>, 2019
-# - Cedric Serfon <cedric.serfon@cern.ch>, 2020
+# - Cedric Serfon <cedric.serfon@cern.ch>, 2020-2021
 # - Eli Chadwick <eli.chadwick@stfc.ac.uk>, 2020
 # - Radu Carpa <radu.carpa@cern.ch>, 2021
 #
@@ -50,7 +50,7 @@
                      "Production Input", "Production Output", "Production Merge",
                      "Analysis Input", "Analysis Output", "Staging",
                      "Raw Export", "Upload/Download (Job)", "Upload/Download (User)",
-                     "User Merge", "User Transfers"]}
+                     "User Merge", "User Transfers", "Calibration Transfers"]}
 
 SCOPE_LENGTH = 25
 


Test patch:
Repository: rucio/rucio

Issue:
Add an option to force the deletion of files when they are detached from a dataset
Motivation
----------
When a file is detached from a dataset, different things can happen to its replicas :
1 - If the replica was not covered by a rule nothing happen
2 - If the replica is covered by a rule and this rule doesn't have the `purge` option, the replica gets a "standard tombstone" i.e. `accessed_at` if not null or `created_at`
3 - If the replica is covered by a rule and this rule has the `purge` option, the replica gets an Epoch tombstone
It would be good to be able to always force the deletion of the replicas in case 2 and 3

Modification
------------
Introduce a `force_epoch` in the configuration to be able to always set Epoch



Discussion:

Resolving patch:
diff --git a/lib/rucio/core/rule.py b/lib/rucio/core/rule.py
--- a/lib/rucio/core/rule.py
+++ b/lib/rucio/core/rule.py
@@ -17,7 +17,7 @@
 # - Vincent Garonne <vincent.garonne@cern.ch>, 2012-2018
 # - Mario Lassnig <mario.lassnig@cern.ch>, 2013-2020
 # - Martin Barisits <martin.barisits@cern.ch>, 2013-2021
-# - Cedric Serfon <cedric.serfon@cern.ch>, 2014-2020
+# - Cedric Serfon <cedric.serfon@cern.ch>, 2014-2021
 # - David Cameron <david.cameron@cern.ch>, 2014
 # - Joaquín Bogado <jbogado@linti.unlp.edu.ar>, 2014-2018
 # - Thomas Beermann <thomas.beermann@cern.ch>, 2014-2021
@@ -2481,6 +2481,7 @@ def __evaluate_did_detach(eval_did, session=None, logger=logging.log):
     """
 
     logger(logging.INFO, "Re-Evaluating did %s:%s for DETACH", eval_did.scope, eval_did.name)
+    force_epoch = core_config_get('rules', 'force_epoch_when_detach', default=False, session=session)
 
     with record_timer_block('rule.evaluate_did_detach'):
         # Get all parent DID's
@@ -2504,7 +2505,7 @@ def __evaluate_did_detach(eval_did, session=None, logger=logging.log):
             query = session.query(models.ReplicaLock).filter_by(rule_id=rule.id)
             for lock in query:
                 if (lock.scope, lock.name) not in files:
-                    if __delete_lock_and_update_replica(lock=lock, purge_replicas=rule.purge_replicas, nowait=True, session=session):
+                    if __delete_lock_and_update_replica(lock=lock, purge_replicas=force_epoch or rule.purge_replicas, nowait=True, session=session):
                         transfers_to_delete.append({'scope': lock.scope, 'name': lock.name, 'rse_id': lock.rse_id})
                     if lock.rse_id not in account_counter_decreases:
                         account_counter_decreases[lock.rse_id] = []


Test patch:
Repository: rucio/rucio

Issue:
Core : Insert did in deleted_did table when deleted_did is called
Motivation
----------
The insertion of did in the `deleted_dids` table is performed by a trigger in ATLAS. It should be possible to do it without trigger when `delete_dids` is called by the undertaker.


Discussion:

Resolving patch:
diff --git a/lib/rucio/core/did.py b/lib/rucio/core/did.py
--- a/lib/rucio/core/did.py
+++ b/lib/rucio/core/did.py
@@ -606,6 +606,8 @@ def delete_dids(dids, account, expire_rules=False, session=None, logger=logging.
     did_followed_clause = []
     metadata_to_delete = []
 
+    archive_dids = config_core.get('undertaker', 'archive_dids', default=False, session=session)
+
     for did in dids:
         logger(logging.INFO, 'Removing did %(scope)s:%(name)s (%(did_type)s)' % did)
         if did['did_type'] == DIDType.FILE:
@@ -727,6 +729,8 @@ def delete_dids(dids, account, expire_rules=False, session=None, logger=logging.
             rowcount = session.query(models.DataIdentifier).filter(or_(*did_clause)).\
                 filter(or_(models.DataIdentifier.did_type == DIDType.CONTAINER, models.DataIdentifier.did_type == DIDType.DATASET)).\
                 delete(synchronize_session=False)
+            if archive_dids:
+                insert_deleted_dids(did_clause, session=session)
 
     if did_followed_clause:
         with record_timer_block('undertaker.dids'):


Test patch:
Repository: rucio/rucio

Issue:
Incorrect documentation on passing the dynamic parameter to /dids/(scope)/(name)
Motivation
----------

Following the documentation, adding `?dynamic` to the URL has no effect. Instead, one has to use something like `?dynamic=anything`. Possibly also applies to `/dids/(scope)/(name)/dids`.

Modification
------------

Either address the documentation or investigate why the parameter isn’t properly propagated.
Incorrect documentation on passing the dynamic parameter to /dids/(scope)/(name)
Motivation
----------

Following the documentation, adding `?dynamic` to the URL has no effect. Instead, one has to use something like `?dynamic=anything`. Possibly also applies to `/dids/(scope)/(name)/dids`.

Modification
------------

Either address the documentation or investigate why the parameter isn’t properly propagated.


Discussion:
For Flask that is not the case anymore, I just debugged through https://github.com/rucio/rucio/blob/02e86830f10c1bd7e5ea2a05d306706a09127bfe/lib/rucio/web/rest/flaskapi/v1/dids.py#L368 and dynamic is True as soon as it is in the args. This might have been different with web.py. I will fix the documentation hickup on `/dids/(scope)/(name)/dids`.
For Flask that is not the case anymore, I just debugged through https://github.com/rucio/rucio/blob/02e86830f10c1bd7e5ea2a05d306706a09127bfe/lib/rucio/web/rest/flaskapi/v1/dids.py#L368 and dynamic is True as soon as it is in the args. This might have been different with web.py. I will fix the documentation hickup on `/dids/(scope)/(name)/dids`.

Resolving patch:
diff --git a/lib/rucio/web/rest/flaskapi/v1/dids.py b/lib/rucio/web/rest/flaskapi/v1/dids.py
--- a/lib/rucio/web/rest/flaskapi/v1/dids.py
+++ b/lib/rucio/web/rest/flaskapi/v1/dids.py
@@ -498,7 +498,7 @@ def get(self, scope_name):
 
         .. sourcecode:: http
 
-            GET /dids/scope1/dataset1?dynamic HTTP/1.1
+            GET /dids/scope1/dataset1 HTTP/1.1
             Host: rucio.cern.ch
 
         **Example response**:
@@ -513,7 +513,6 @@ def get(self, scope_name):
              "bytes": 234, "length": 3, "account": "jdoe", "open": True,
              "monotonic": False, "expired_at": null}
 
-        :query dynamic: Flag to dynamically calculate size for open DIDs
         :resheader Content-Type: application/x-json-stream
         :status 200: DID found
         :status 401: Invalid Auth Token


Test patch:
Repository: rucio/rucio

Issue:
Tracer : Add the possibillity to point to a different host than rucio host
Motivation
----------
The client reporting traces to Rucio uses the same rucio host than the one used for every other client calls. It would be good to have the possibility to specify a different hosts.






Discussion:

Resolving patch:
diff --git a/lib/rucio/client/baseclient.py b/lib/rucio/client/baseclient.py
--- a/lib/rucio/client/baseclient.py
+++ b/lib/rucio/client/baseclient.py
@@ -36,6 +36,7 @@
 # - Patrick Austin <patrick.austin@stfc.ac.uk>, 2020
 # - Benedikt Ziemons <benedikt.ziemons@cern.ch>, 2020-2021
 # - Radu Carpa <radu.carpa@cern.ch>, 2021
+# - David Población Criado <david.poblacion.criado@cern.ch>, 2021
 
 '''
  Client class for callers of the Rucio system
@@ -149,6 +150,12 @@ def __init__(self, rucio_host=None, auth_host=None, account=None, ca_cert=None,
         except (NoOptionError, NoSectionError) as error:
             raise MissingClientParameter('Section client and Option \'%s\' cannot be found in config file' % error.args[0])
 
+        try:
+            self.trace_host = config_get('trace', 'trace_host')
+        except (NoOptionError, NoSectionError):
+            self.trace_host = self.host
+            LOG.debug('No trace_host passed. Using rucio_host instead')
+
         self.account = account
         self.vo = vo
         self.ca_cert = ca_cert
diff --git a/lib/rucio/client/downloadclient.py b/lib/rucio/client/downloadclient.py
--- a/lib/rucio/client/downloadclient.py
+++ b/lib/rucio/client/downloadclient.py
@@ -23,6 +23,7 @@
 # - Andrew Lister <andrew.lister@stfc.ac.uk>, 2019
 # - Thomas Beermann <thomas.beermann@cern.ch>, 2021
 # - Radu Carpa <radu.carpa@cern.ch>, 2021
+# - David Población Criado <david.poblacion.criado@cern.ch>, 2021
 #
 # PY3K COMPATIBLE
 
@@ -1508,7 +1509,7 @@ def _send_trace(self, trace):
         :param trace: the trace
         """
         if self.tracing:
-            send_trace(trace, self.client.host, self.client.user_agent)
+            send_trace(trace, self.client.trace_host, self.client.user_agent)
 
 
 def _verify_checksum(item, path):
diff --git a/lib/rucio/client/uploadclient.py b/lib/rucio/client/uploadclient.py
--- a/lib/rucio/client/uploadclient.py
+++ b/lib/rucio/client/uploadclient.py
@@ -38,6 +38,7 @@
 # - Eric Vaandering <ewv@fnal.gov>, 2020
 # - Rakshita Varadarajan <rakshitajps@gmail.com>, 2021
 # - Radu Carpa <radu.carpa@cern.ch>, 2021
+# - David Población Criado <david.poblacion.criado@cern.ch>, 2021
 
 import copy
 import json
@@ -719,4 +720,4 @@ def _send_trace(self, trace):
         :param trace: the trace
         """
         if self.tracing:
-            send_trace(trace, self.client.host, self.client.user_agent)
+            send_trace(trace, self.client.trace_host, self.client.user_agent)


Test patch:
Repository: rucio/rucio

Issue:
Fix default rse attribute reg-exp
Motivation
----------
The `default_rse_attribute` regular expression was made hard-coded (instead of pulled in from the schema) based on concerns that the expression parser could be impacted by faulty attributes. However, the hard-coded regexp was defined to strict, causing issues for Belle II.

Modification
------------
Change regexp to `([A-Za-z0-9]+([_-][A-Za-z0-9]+)*)`



Discussion:

Resolving patch:
diff --git a/lib/rucio/core/rse_expression_parser.py b/lib/rucio/core/rse_expression_parser.py
--- a/lib/rucio/core/rse_expression_parser.py
+++ b/lib/rucio/core/rse_expression_parser.py
@@ -39,7 +39,7 @@
 from rucio.db.sqla.session import transactional_session
 
 
-DEFAULT_RSE_ATTRIBUTE = r'([A-Z0-9]+([_-][A-Za-z0-9]+)*)'
+DEFAULT_RSE_ATTRIBUTE = r'([A-Za-z0-9]+([_-][A-Za-z0-9]+)*)'
 RSE_ATTRIBUTE = r'([A-Za-z0-9\._-]+[=<>][A-Za-z0-9_-]+)'
 PRIMITIVE = r'(\(*(%s|%s|%s)\)*)' % (RSE_ATTRIBUTE, DEFAULT_RSE_ATTRIBUTE, r'\*')
 UNION = r'(\|%s)' % (PRIMITIVE)


Test patch: