Page MenuHomeSoftware Heritage

D8675.diff
No OneTemporary

D8675.diff

diff --git a/swh/loader/cvs/cvsclient.py b/swh/loader/cvs/cvsclient.py
--- a/swh/loader/cvs/cvsclient.py
+++ b/swh/loader/cvs/cvsclient.py
@@ -339,9 +339,12 @@
if response is None:
raise CVSProtocolError("No response from CVS server")
if response[0:2] == b"E ":
- if len(path) > 0 and response[-11:] == b" - ignored\n":
+ if len(path) > 0 and (
+ response.endswith(b" - ignored\n")
+ or b"could not read RCS file" in response
+ ):
response = self.conn_read_line()
- if response != b"error \n":
+ if response not in (b"error \n", b"ok\n"):
raise CVSProtocolError(
"Invalid response from CVS server: %s" % response
)
diff --git a/swh/loader/cvs/tests/test_cvsclient.py b/swh/loader/cvs/tests/test_cvsclient.py
new file mode 100644
--- /dev/null
+++ b/swh/loader/cvs/tests/test_cvsclient.py
@@ -0,0 +1,30 @@
+# Copyright (C) 2022 The Software Heritage developers
+# See the AUTHORS file at the top-level directory of this distribution
+# License: GNU Affero General Public License version 3, or any later version
+# See top-level LICENSE file for more information
+
+from urllib.parse import urlparse
+
+from swh.loader.cvs.cvsclient import CVSClient
+
+
+def test_cvs_client_rlog_could_not_read_rcs_file(mocker):
+
+ url = "ssh://anoncvs@anoncvs.example.org/cvsroot/src"
+ file = "src/README.txt"
+
+ mocker.patch("swh.loader.cvs.cvsclient.socket")
+ conn_read_line = mocker.patch.object(CVSClient, "conn_read_line")
+ conn_read_line.side_effect = [
+ # server response lines when client is initialized
+ b"Valid-requests ",
+ b"ok\n",
+ # server response lines when attempting to fetch rlog of a file
+ # but RCS file is missing
+ f"E cvs rlog: could not read RCS file for {file}\n".encode(),
+ b"ok\n",
+ ]
+
+ client = CVSClient(urlparse(url))
+
+ assert client.fetch_rlog(file.encode()) is None

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 7:51 AM (10 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3227043

Event Timeline