Skip to content

P4 polling with ticket has incorrect parsing #4574

Closed
@aisoard

Description

@aisoard

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @aisoard

        Issue actions

          P4 polling with ticket has incorrect parsing · Issue #4574 · buildbot/buildbot