git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-p4: exception when cloning a perforce repository

From
PWPete Wyckoff <pw@padd.com>
Date
Jan 14, 2014, 00:18 UTC
Message-ID
<20140114001820.GA12058@padd.com>
In-Reply-To
<01EF41A4-533B-4A24-8952-CAEB49970272@iwi.me>
damien@iwi.me wrote on Mon, 13 Jan 2014 14:37 +0100:
Show 6 quoted lines
> I am trying to clone a perforce repository via git and I am having the following backtrace :
> 
> {14:20}~/projects/####:master ✗ ➭ git p4 clone //depot/@all .
> Importing revision …
> [...]
> Importing revision 59702 (45%)Traceback (most recent call last):
[..]
Show 6 quoted lines
>   File "/opt/git/libexec/git-core/git-p4", line 2078, in streamOneP4File
>     if data[-1] == '\n':
> IndexError: string index out of range
> 
> git —version: git version 1.8.5.2.309.ga25014b [last commit from master from github.com/git/git]
> os : ubuntu 13.10
This code:
        if type_base == "symlink":
            git_mode = "120000"
            # p4 print on a symlink sometimes contains "target\n";
            # if it does, remove the newline
            data = ''.join(contents)
  ==>       if data[-1] == '\n':
                contents = [data[:-1]]
            else:
                contents = [data]

means that data is an empty string. Implies you've got a symlink pointing to nothing. Is that even possible?

It could be this is a regression introduced at 1292df1 (git-p4: Fix occasional truncation of symlink contents., 2013-08-08). The old way of doing data[:-1] unconditionally would have worked but was broken for other reasons.

Could you investigate the symlink a bit? We're looking for one in change 59702 that points to nowhere. Maybe do:

    $ p4 describe -s 59702

and see if you can figure out which of those could be a symlink, then inspect it:

    $ p4 fstat //depot/symlink@59702
    (probably shows it is "headRev 1")
    $ p4 print -q //depot/symlink#1
    $ p4 print -q //depot/symlink#1 | od -c
Thanks for checking this depot info first.
		-- Pete
Previous: Damien GérardNext: Pete Wyckoff
Message 2 of 11 in “git-p4: exception when cloning a perforce repository”
  1. Damien GérardJan 13, 2014
  2. Pete WyckoffJan 14, 2014
  3. Pete WyckoffJan 14, 2014
  4. Damien GérardJan 15, 2014
  5. Pete WyckoffJan 16, 2014
  6. Damien GérardJan 16, 2014
  7. Pete WyckoffJan 16, 2014
  8. Damien GérardJan 16, 2014
  9. Pete WyckoffJan 18, 2014
  10. Damien GérardJan 20, 2014
  11. Damien GérardJan 20, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.