git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pete Wyckoff <pw@padd.com>
To: "Damien Gérard" <damien@iwi.me>
Cc: git@vger.kernel.org, Alexandru Juncu <alexj@rosedu.org>
Subject: Re: git-p4: exception when cloning a perforce repository
Date: Tue, 14 Jan 2014 18:24:32 -0500	[thread overview]
Message-ID: <20140114232432.GA31465@padd.com> (raw)
In-Reply-To: <20140114001820.GA12058@padd.com>

pw@padd.com wrote on Mon, 13 Jan 2014 19:18 -0500:
> damien@iwi.me wrote on Mon, 13 Jan 2014 14:37 +0100:
> > 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):
> [..]
> >   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.

I've tried to hack a test that produces a null symlink,
and having done so, find an error later on trying to
generate a symlink that points to "".  So the "easy"
fix of checking for an empty string is unlikely to work
for your repo.

Curious as to how you managed to generate such a thing.
If you find the file, and can get at the p4 depot, the
full ,v file would be interesting too.

		-- Pete

  reply	other threads:[~2014-01-14 23:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 13:37 git-p4: exception when cloning a perforce repository Damien Gérard
2014-01-14  0:18 ` Pete Wyckoff
2014-01-14 23:24   ` Pete Wyckoff [this message]
2014-01-15  8:56     ` Damien Gérard
2014-01-16 13:08       ` Pete Wyckoff
2014-01-16 13:46         ` Damien Gérard
2014-01-16 14:45           ` Pete Wyckoff
2014-01-16 16:02             ` Damien Gérard
2014-01-18 18:22               ` Pete Wyckoff
2014-01-20 12:14                 ` Damien Gérard
2014-01-20 14:01                 ` Damien Gérard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140114232432.GA31465@padd.com \
    --to=pw@padd.com \
    --cc=alexj@rosedu.org \
    --cc=damien@iwi.me \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).