Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7123402
D8675.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D8675.diff
View Options
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
Details
Attached
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
Attached To
D8675: cvsclient: Handle error in fetch_rlog when path does not exist
Event Timeline
Log In to Comment