Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P4 polling with ticket has incorrect parsing #4574

Closed
aisoard opened this issue Jan 30, 2019 · 1 comment
Closed

P4 polling with ticket has incorrect parsing #4574

aisoard opened this issue Jan 30, 2019 · 1 comment

Comments

@aisoard
Copy link
Contributor

aisoard commented Jan 30, 2019

Issue

P4 polling with tickets uses the p4 login -p command and expect 3 lines or more on stdout, the third line being the ticket number.

However, with my version of the CLI tools from Perforce:

$ p4 -V
Rev. P4/LINUX26X86_64/2018.2/1740258 (2018/12/11).

the ticket number appears on the 2nd line! (and there are therefore only 2 lines of stdout):

$ p4 login -p
Enter password: 
D25B979...3741E

Patch

Here is my proposed patch:

--- buildbot/changes/p4poller.py	2019-01-29 18:30:41.596740370 -0800
+++ buildbot/changes/p4poller.py	2019-01-28 17:23:42.110348463 -0800
@@ -200,7 +200,9 @@
 
     def _parseTicketPassword(self, text):
-        lines = text.split("\n")
+        lines = text.splitlines()
-        if len(lines) < 3:
-            return None
-        return lines[2].strip()
+        return lines[-1].strip()
 
     def _getPasswd(self):
         if self.use_tickets:

To make it short: I just pick the last line of stdout no matter the number of lines.
I'm not sure if that works on all p4 versions, and I fell that is not the best way of doing this.

Version found

Buildbot 1.8.0
Python 2.7.15rc1 & Python 3.6.5

@aisoard
Copy link
Contributor Author

aisoard commented Feb 20, 2019

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant