{"thread":{"id":"35647","subject":"git-p4: exception when cloning a perforce repository","startedAt":"2014-01-13T13:37:45Z","lastAt":"2014-01-20T14:01:47Z","messageCount":11,"participants":["Damien Gérard","Pete Wyckoff"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"233052","messageId":"01EF41A4-533B-4A24-8952-CAEB49970272@iwi.me","threadId":"35647","inReplyTo":null,"subject":"git-p4: exception when cloning a perforce repository","fromName":"Damien Gérard","fromEmail":"damien@iwi.me","sentAt":"2014-01-13T13:37:45Z","receivedAt":"2014-01-13T13:37:45Z","isPatch":false,"sender":{"key":"damien@iwi.me","avatar":null},"body":"\nHi !\n\nI am trying to clone a perforce repository via git and I am having the following backtrace :\n\n{14:20}~/projects/####:master ✗ ➭ git p4 clone //depot/@all .\nImporting revision …\n[...]\nImporting revision 59702 (45%)Traceback (most recent call last):\n  File \"/opt/git/libexec/git-core/git-p4\", line 3287, in <module>\n    main()\n  File \"/opt/git/libexec/git-core/git-p4\", line 3281, in main\n    if not cmd.run(args):\n  File \"/opt/git/libexec/git-core/git-p4\", line 3155, in run\n    if not P4Sync.run(self, depotPaths):\n  File \"/opt/git/libexec/git-core/git-p4\", line 3008, in run\n    self.importChanges(changes)\n  File \"/opt/git/libexec/git-core/git-p4\", line 2680, in importChanges\n    self.initialParent)\n  File \"/opt/git/libexec/git-core/git-p4\", line 2304, in commit\n    self.streamP4Files(new_files)\n  File \"/opt/git/libexec/git-core/git-p4\", line 2218, in streamP4Files\n    cb=streamP4FilesCbSelf)\n  File \"/opt/git/libexec/git-core/git-p4\", line 482, in p4CmdList\n    cb(entry)\n  File \"/opt/git/libexec/git-core/git-p4\", line 2212, in streamP4FilesCbSelf\n    self.streamP4FilesCb(entry)\n  File \"/opt/git/libexec/git-core/git-p4\", line 2167, in streamP4FilesCb\n    self.streamOneP4File(self.stream_file, self.stream_contents)\n  File \"/opt/git/libexec/git-core/git-p4\", line 2078, in streamOneP4File\n    if data[-1] == '\\n':\nIndexError: string index out of range\n\n\ngit —version: git version 1.8.5.2.309.ga25014b [last commit from master from github.com/git/git]\nos : ubuntu 13.10\n\n\nAny ideas ? :)\n\nBest regards,\nDamien"},{"id":"233072","messageId":"20140114001820.GA12058@padd.com","threadId":"35647","inReplyTo":"01EF41A4-533B-4A24-8952-CAEB49970272@iwi.me","subject":"Re: git-p4: exception when cloning a perforce repository","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-14T00:18:20Z","receivedAt":"2014-01-14T00:18:20Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"damien@iwi.me wrote on Mon, 13 Jan 2014 14:37 +0100:\n> I am trying to clone a perforce repository via git and I am having the following backtrace :\n> \n> {14:20}~/projects/####:master ✗ ➭ git p4 clone //depot/@all .\n> Importing revision …\n> [...]\n> Importing revision 59702 (45%)Traceback (most recent call last):\n[..]\n>   File \"/opt/git/libexec/git-core/git-p4\", line 2078, in streamOneP4File\n>     if data[-1] == '\\n':\n> IndexError: string index out of range\n> \n> git —version: git version 1.8.5.2.309.ga25014b [last commit from master from github.com/git/git]\n> os : ubuntu 13.10\n\nThis code:\n\n        if type_base == \"symlink\":\n            git_mode = \"120000\"\n            # p4 print on a symlink sometimes contains \"target\\n\";\n            # if it does, remove the newline\n            data = ''.join(contents)\n  ==>       if data[-1] == '\\n':\n                contents = [data[:-1]]\n            else:\n                contents = [data]\n\nmeans that data is an empty string.  Implies you've got a\nsymlink pointing to nothing.  Is that even possible?\n\nIt could be this is a regression introduced at 1292df1 (git-p4:\nFix occasional truncation of symlink contents., 2013-08-08).  The\nold way of doing data[:-1] unconditionally would have worked but\nwas broken for other reasons.\n\nCould you investigate the symlink a bit?  We're looking for\none in change 59702 that points to nowhere.  Maybe do:\n\n    $ p4 describe -s 59702\n\nand see if you can figure out which of those could be a symlink, then\ninspect it:\n\n    $ p4 fstat //depot/symlink@59702\n    (probably shows it is \"headRev 1\")\n\n    $ p4 print -q //depot/symlink#1\n\n    $ p4 print -q //depot/symlink#1 | od -c\n\nThanks for checking this depot info first.\n\n\t\t-- Pete\n"},{"id":"233113","messageId":"20140114232432.GA31465@padd.com","threadId":"35647","inReplyTo":"20140114001820.GA12058@padd.com","subject":"Re: git-p4: exception when cloning a perforce repository","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-14T23:24:32Z","receivedAt":"2014-01-14T23:24:32Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"pw@padd.com wrote on Mon, 13 Jan 2014 19:18 -0500:\n> damien@iwi.me wrote on Mon, 13 Jan 2014 14:37 +0100:\n> > I am trying to clone a perforce repository via git and I am having the following backtrace :\n> > \n> > {14:20}~/projects/####:master ✗ ➭ git p4 clone //depot/@all .\n> > Importing revision …\n> > [...]\n> > Importing revision 59702 (45%)Traceback (most recent call last):\n> [..]\n> >   File \"/opt/git/libexec/git-core/git-p4\", line 2078, in streamOneP4File\n> >     if data[-1] == '\\n':\n> > IndexError: string index out of range\n> > \n> > git —version: git version 1.8.5.2.309.ga25014b [last commit from master from github.com/git/git]\n> > os : ubuntu 13.10\n> \n> This code:\n> \n>         if type_base == \"symlink\":\n>             git_mode = \"120000\"\n>             # p4 print on a symlink sometimes contains \"target\\n\";\n>             # if it does, remove the newline\n>             data = ''.join(contents)\n>   ==>       if data[-1] == '\\n':\n>                 contents = [data[:-1]]\n>             else:\n>                 contents = [data]\n> \n> means that data is an empty string.  Implies you've got a\n> symlink pointing to nothing.  Is that even possible?\n> \n> It could be this is a regression introduced at 1292df1 (git-p4:\n> Fix occasional truncation of symlink contents., 2013-08-08).  The\n> old way of doing data[:-1] unconditionally would have worked but\n> was broken for other reasons.\n> \n> Could you investigate the symlink a bit?  We're looking for\n> one in change 59702 that points to nowhere.  Maybe do:\n> \n>     $ p4 describe -s 59702\n> \n> and see if you can figure out which of those could be a symlink, then\n> inspect it:\n> \n>     $ p4 fstat //depot/symlink@59702\n>     (probably shows it is \"headRev 1\")\n> \n>     $ p4 print -q //depot/symlink#1\n> \n>     $ p4 print -q //depot/symlink#1 | od -c\n> \n> Thanks for checking this depot info first.\n\nI've tried to hack a test that produces a null symlink,\nand having done so, find an error later on trying to\ngenerate a symlink that points to \"\".  So the \"easy\"\nfix of checking for an empty string is unlikely to work\nfor your repo.\n\nCurious as to how you managed to generate such a thing.\nIf you find the file, and can get at the p4 depot, the\nfull ,v file would be interesting too.\n\n\t\t-- Pete\n"},{"id":"233135","messageId":"843E4B24-5EDD-4451-8849-425160576A99@iwi.me","threadId":"35647","inReplyTo":"20140114232432.GA31465@padd.com","subject":"Re: git-p4: exception when cloning a perforce repository","fromName":"Damien Gérard","fromEmail":"damien@iwi.me","sentAt":"2014-01-15T08:56:13Z","receivedAt":"2014-01-15T08:56:13Z","isPatch":false,"sender":{"key":"damien@iwi.me","avatar":null},"body":"\nOn 15 Jan 2014, at 00:24, Pete Wyckoff <pw@padd.com> wrote:\n\n> pw@padd.com wrote on Mon, 13 Jan 2014 19:18 -0500:\n>> damien@iwi.me wrote on Mon, 13 Jan 2014 14:37 +0100:\n>>> I am trying to clone a perforce repository via git and I am having the following backtrace :\n>>> \n>>> {14:20}~/projects/####:master ✗ ➭ git p4 clone //depot/@all .\n>>> Importing revision …\n>>> [...]\n>>> Importing revision 59702 (45%)Traceback (most recent call last):\n>> [..]\n>>>  File \"/opt/git/libexec/git-core/git-p4\", line 2078, in streamOneP4File\n>>>    if data[-1] == '\\n':\n>>> IndexError: string index out of range\n>>> \n>>> git —version: git version 1.8.5.2.309.ga25014b [last commit from master from github.com/git/git]\n>>> os : ubuntu 13.10\n>> \n>> This code:\n>> \n>>        if type_base == \"symlink\":\n>>            git_mode = \"120000\"\n>>            # p4 print on a symlink sometimes contains \"target\\n\";\n>>            # if it does, remove the newline\n>>            data = ''.join(contents)\n>>  ==>       if data[-1] == '\\n':\n>>                contents = [data[:-1]]\n>>            else:\n>>                contents = [data]\n>> \n>> means that data is an empty string.  Implies you've got a\n>> symlink pointing to nothing.  Is that even possible?\n\nIt does not seem so but I am so sure.\n\n\n>> It could be this is a regression introduced at 1292df1 (git-p4:\n>> Fix occasional truncation of symlink contents., 2013-08-08).  The\n>> old way of doing data[:-1] unconditionally would have worked but\n>> was broken for other reasons.\n>> \n>> Could you investigate the symlink a bit?  We're looking for\n>> one in change 59702 that points to nowhere.  Maybe do:\n>> \n>>    $ p4 describe -s 59702\n>> \n>> and see if you can figure out which of those could be a symlink, then\n>> inspect it:\n>> \n>>    $ p4 fstat //depot/symlink@59702\n>>    (probably shows it is \"headRev 1\")\n>> \n>>    $ p4 print -q //depot/symlink#1\n>> \n>>    $ p4 print -q //depot/symlink#1 | od -c\n>> \n>> Thanks for checking this depot info first.\n> \n> I've tried to hack a test that produces a null symlink,\n> and having done so, find an error later on trying to\n> generate a symlink that points to \"\".  So the \"easy\"\n> fix of checking for an empty string is unlikely to work\n> for your repo.\n> \n> Curious as to how you managed to generate such a thing.\n> If you find the file, and can get at the p4 depot, the\n> full ,v file would be interesting too.\n> \n\n\n\nIndeed, those files are symlinks actually.  But it sems they are all valid.\n\n\nHere is what I can get :\n\nChange 59702 by ##############@VS9 on 2009/03/24 15:53:39\n\n\tOpenSSL 0.9.8j\n\nAffected files ...\n\n... //depot/openssl/0.9.8j/openssl/include/openssl/aes.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/asn1.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/asn1_mac.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/asn1t.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/bio.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/blowfish.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/buffer.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/cast.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/comp.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/conf.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/conf_api.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/crypto.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/des.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/des_old.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/dh.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/dsa.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/dso.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/dtls1.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/e_os2.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ebcdic.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ec.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ecdh.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ecdsa.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/engine.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/err.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/evp.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/fips.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/fips_rand.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/hmac.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/idea.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/krb5_asn.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/kssl.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/lhash.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/md2.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/md4.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/md5.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/obj_mac.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/objects.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ocsp.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/opensslconf.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/opensslv.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ossl_typ.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/pem.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/pem2.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/pkcs12.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/pkcs7.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/pq_compat.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/pqueue.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/rand.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/rc2.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/rc4.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ripemd.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/rsa.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/safestack.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/sha.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ssl.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ssl2.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ssl23.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ssl3.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/stack.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/store.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/symhacks.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/tls1.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/tmdiff.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/txt_db.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ui.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/ui_compat.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/x509.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/x509_vfy.h#2 edit\n... //depot/openssl/0.9.8j/openssl/include/openssl/x509v3.h#2 edit\n\n\nJust in case :\n\n$ p4 describe -s 59700\n59700 - no such changelist.\n\n\np4 fstat  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h@59702 \n... depotFile //depot/openssl/0.9.8j/openssl/include/openssl/bn.h\n... headAction edit\n... headType symlink\n... headTime 1237906419\n... headRev 2\n... headChange 59702\n... headModTime 1231329423\n\n\np4 print -q //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 | od -c\n0000000\n\np4 print  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#1        \n//depot/openssl/0.9.8j/openssl/include/openssl/bn.h#1 - add change 59574 (text)\n\n p4 print  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2\n//depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 - edit change 59702 (symlink)\n"},{"id":"233203","messageId":"20140116130833.GA15613@padd.com","threadId":"35647","inReplyTo":"843E4B24-5EDD-4451-8849-425160576A99@iwi.me","subject":"Re: git-p4: exception when cloning a perforce repository","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-16T13:08:33Z","receivedAt":"2014-01-16T13:08:33Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"damien@iwi.me wrote on Wed, 15 Jan 2014 09:56 +0100:\n> p4 fstat  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h@59702 \n> ... depotFile //depot/openssl/0.9.8j/openssl/include/openssl/bn.h\n> ... headAction edit\n> ... headType symlink\n> ... headTime 1237906419\n> ... headRev 2\n> ... headChange 59702\n> ... headModTime 1231329423\n> \n> p4 print -q //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 | od -c\n> 0000000\n> \n> p4 print  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#1        \n> //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#1 - add change 59574 (text)\n>  p4 print  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2\n> //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 - edit change 59702 (symlink)\n\nThat's interesting.  When I do the equivalent \"p4 print\" commands\nit shows something like this.\n\narf-git-test$ p4 fstat //depot/bn.h\n... depotFile //depot/bn.h\n... clientFile /dev/shm/trash directory.t9802-git-p4-filetype/cli/bn.h\n... isMapped \n... headAction edit\n... headType symlink\n... headTime 1389876870\n... headRev 2\n... headChange 8\n... headModTime 1389876870\n... haveRev 2\n\narf-git-test$ p4 print //depot/bn.h#1\n//depot/bn.h#1 - add change 7 (text)\nfile-text\n\narf-git-test$ p4 print //depot/bn.h#2\n//depot/bn.h#2 - edit change 8 (symlink)\n/elsewhere/bn.h\n\nI don't know how you manage to get a symlink with an empty\ndestination like that.\n\nI'll work on a way to hack around this failure.  In the mean time,\nif you're game, it might be fun to see what p4 does with such a\nrepository.  You could make a client for just that little subdir,\ncheck out at 59702 and see what is there:\n\nmkdir testmess\ncd testmess\ncat <<EOF | p4 client -i\nClient: testmess\nDescription: testmess\nRoot: $(pwd)\nView: //depot/openssl/0.9.8j/openssl/include/openssl/... //testmess/...\nEOF\n\nthen take a look at how p4 represents the \"empty\" symlink\nin the filesystem:\n\np4 sync @59702\nls -la bn.h\n\n\t\t-- Pete\n"},{"id":"233204","messageId":"4FE5D5E6-60F6-4111-B538-5CA01092A2F0@iwi.me","threadId":"35647","inReplyTo":"20140116130833.GA15613@padd.com","subject":"Re: git-p4: exception when cloning a perforce repository","fromName":"Damien Gérard","fromEmail":"damien@iwi.me","sentAt":"2014-01-16T13:46:58Z","receivedAt":"2014-01-16T13:46:58Z","isPatch":false,"sender":{"key":"damien@iwi.me","avatar":null},"body":"\nOn 16 Jan 2014, at 14:08, Pete Wyckoff <pw@padd.com> wrote:\n\n> damien@iwi.me wrote on Wed, 15 Jan 2014 09:56 +0100:\n>> p4 fstat  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h@59702 \n>> ... depotFile //depot/openssl/0.9.8j/openssl/include/openssl/bn.h\n>> ... headAction edit\n>> ... headType symlink\n>> ... headTime 1237906419\n>> ... headRev 2\n>> ... headChange 59702\n>> ... headModTime 1231329423\n>> \n>> p4 print -q //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 | od -c\n>> 0000000\n>> \n>> p4 print  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#1        \n>> //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#1 - add change 59574 (text)\n>> p4 print  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2\n>> //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 - edit change 59702 (symlink)\n> \n> That's interesting.  When I do the equivalent \"p4 print\" commands\n> it shows something like this.\n> \n> arf-git-test$ p4 fstat //depot/bn.h\n> ... depotFile //depot/bn.h\n> ... clientFile /dev/shm/trash directory.t9802-git-p4-filetype/cli/bn.h\n> ... isMapped \n> ... headAction edit\n> ... headType symlink\n> ... headTime 1389876870\n> ... headRev 2\n> ... headChange 8\n> ... headModTime 1389876870\n> ... haveRev 2\n> \n> arf-git-test$ p4 print //depot/bn.h#1\n> //depot/bn.h#1 - add change 7 (text)\n> file-text\n> \n> arf-git-test$ p4 print //depot/bn.h#2\n> //depot/bn.h#2 - edit change 8 (symlink)\n> /elsewhere/bn.h\n> \n> I don't know how you manage to get a symlink with an empty\n> destination like that.\n> \n> I'll work on a way to hack around this failure.  In the mean time,\n> if you're game, it might be fun to see what p4 does with such a\n> repository.  You could make a client for just that little subdir,\n> check out at 59702 and see what is there:\n> \n> mkdir testmess\n> cd testmess\n> cat <<EOF | p4 client -i\n> Client: testmess\n> Description: testmess\n> Root: $(pwd)\n> View: //depot/openssl/0.9.8j/openssl/include/openssl/... //testmess/...\n> EOF\n> \n> then take a look at how p4 represents the \"empty\" symlink\n> in the filesystem:\n> \n> p4 sync @59702\n> ls -la bn.h\n\nI’ve tried exactly your commands, and I’ve got an empty folder..\n\n{14:38}~/p4/testmess ➭ p4 sync @59702\n//depot/openssl/0.9.8j/openssl/include/openssl/aes.h#2 - refreshing /home/dgerard/p4/testmess/aes.h\n//depot/openssl/0.9.8j/openssl/include/openssl/asn1.h#2 - refreshing /home/dgerard/p4/testmess/asn1.h\n//depot/openssl/0.9.8j/openssl/include/openssl/asn1_mac.h#2 - refreshing /home/dgerard/p4/testmess/asn1_mac.h\n//depot/openssl/0.9.8j/openssl/include/openssl/asn1t.h#2 - refreshing /home/dgerard/p4/testmess/asn1t.h\n//depot/openssl/0.9.8j/openssl/include/openssl/bio.h#2 - refreshing /home/dgerard/p4/testmess/bio.h\n//depot/openssl/0.9.8j/openssl/include/openssl/blowfish.h#2 - refreshing /home/dgerard/p4/testmess/blowfish.h\n//depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 - refreshing /home/dgerard/p4/testmess/bn.h\n//depot/openssl/0.9.8j/openssl/include/openssl/buffer.h#2 - refreshing /home/dgerard/p4/testmess/buffer.h\n[…]\n\n\n{14:39}~/p4/testmess ➭ ls -la\ntotal 12\ndrwxr-xr-x 2 dgerard dgerard 4096 janv. 16 14:37 .\ndrwxr-xr-x 4 dgerard dgerard 4096 janv. 16 14:34 ..\n-rw-r--r-- 1 dgerard dgerard   93 janv. 16 14:37 .perforce\t\n\n\nThen I tried to sync the previous changeset, which is ok :\n\n{14:44}~/p4/testmess ➭ p4 sync -f @59701\n//depot/openssl/0.9.8j/openssl/include/openssl/aes.h#1 - updating /home/dgerard/p4/testmess/aes.h\n[…]\n\n{14:44}~/p4/testmess ➭ l\ntotal 0\n-r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 aes.h\n-r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 asn1.h\n-r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 asn1_mac.h\n-r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 asn1t.h\n-r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 bio.h\n-r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 blowfish.h\n-r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 bn.h\n-r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 buffer.h\n[…]\n\n\n\nHowever, when trying to sync to the appropriate changeset :\n\n{14:44}~/p4/testmess ➭ p4 sync -f @59702\n//depot/openssl/0.9.8j/openssl/include/openssl/aes.h#2 - updating /home/dgerard/p4/testmess/aes.h\nrename: /home/dgerard/p4/testmess/aes.h: No such file or directory\n//depot/openssl/0.9.8j/openssl/include/openssl/asn1.h#2 - updating /home/dgerard/p4/testmess/asn1.h\nrename: /home/dgerard/p4/testmess/asn1.h: No such file or directory\n//depot/openssl/0.9.8j/openssl/include/openssl/asn1_mac.h#2 - updating /home/dgerard/p4/testmess/asn1_mac.h\nrename: /home/dgerard/p4/testmess/asn1_mac.h: No such file or directory\n//depot/openssl/0.9.8j/openssl/include/openssl/asn1t.h#2 - updating /home/dgerard/p4/testmess/asn1t.h\nrename: /home/dgerard/p4/testmess/asn1t.h: No such file or directory\n//depot/openssl/0.9.8j/openssl/include/openssl/bio.h#2 - updating /home/dgerard/p4/testmess/bio.h\nrename: /home/dgerard/p4/testmess/bio.h: No such file or directory\n//depot/openssl/0.9.8j/openssl/include/openssl/blowfish.h#2 - updating /home/dgerard/p4/testmess/blowfish.h\nrename: /home/dgerard/p4/testmess/blowfish.h: No such file or directory\n//depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 - updating /home/dgerard/p4/testmess/bn.h\nrename: /home/dgerard/p4/testmess/bn.h: No such file or directory\n\nAnd the folder remains untouched.\nQuite strange for me...\n"},{"id":"233205","messageId":"20140116144519.GB15674@padd.com","threadId":"35647","inReplyTo":"4FE5D5E6-60F6-4111-B538-5CA01092A2F0@iwi.me","subject":"Re: git-p4: exception when cloning a perforce repository","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-16T14:45:19Z","receivedAt":"2014-01-16T14:45:19Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"damien@iwi.me wrote on Thu, 16 Jan 2014 14:46 +0100:\n> \n> On 16 Jan 2014, at 14:08, Pete Wyckoff <pw@padd.com> wrote:\n> \n> > damien@iwi.me wrote on Wed, 15 Jan 2014 09:56 +0100:\n> >> p4 fstat  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h@59702 \n> >> ... depotFile //depot/openssl/0.9.8j/openssl/include/openssl/bn.h\n> >> ... headAction edit\n> >> ... headType symlink\n> >> ... headTime 1237906419\n> >> ... headRev 2\n> >> ... headChange 59702\n> >> ... headModTime 1231329423\n> >> \n> >> p4 print -q //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 | od -c\n> >> 0000000\n> >> \n> >> p4 print  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#1        \n> >> //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#1 - add change 59574 (text)\n> >> p4 print  //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2\n> >> //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 - edit change 59702 (symlink)\n> > \n> > That's interesting.  When I do the equivalent \"p4 print\" commands\n> > it shows something like this.\n> > \n> > arf-git-test$ p4 fstat //depot/bn.h\n> > ... depotFile //depot/bn.h\n> > ... clientFile /dev/shm/trash directory.t9802-git-p4-filetype/cli/bn.h\n> > ... isMapped \n> > ... headAction edit\n> > ... headType symlink\n> > ... headTime 1389876870\n> > ... headRev 2\n> > ... headChange 8\n> > ... headModTime 1389876870\n> > ... haveRev 2\n> > \n> > arf-git-test$ p4 print //depot/bn.h#1\n> > //depot/bn.h#1 - add change 7 (text)\n> > file-text\n> > \n> > arf-git-test$ p4 print //depot/bn.h#2\n> > //depot/bn.h#2 - edit change 8 (symlink)\n> > /elsewhere/bn.h\n> > \n> > I don't know how you manage to get a symlink with an empty\n> > destination like that.\n> > \n> > I'll work on a way to hack around this failure.  In the mean time,\n> > if you're game, it might be fun to see what p4 does with such a\n> > repository.  You could make a client for just that little subdir,\n> > check out at 59702 and see what is there:\n> > \n> > mkdir testmess\n> > cd testmess\n> > cat <<EOF | p4 client -i\n> > Client: testmess\n> > Description: testmess\n> > Root: $(pwd)\n> > View: //depot/openssl/0.9.8j/openssl/include/openssl/... //testmess/...\n> > EOF\n> > \n> > then take a look at how p4 represents the \"empty\" symlink\n> > in the filesystem:\n> > \n> > p4 sync @59702\n> > ls -la bn.h\n> \n> I’ve tried exactly your commands, and I’ve got an empty folder..\n> \n> {14:38}~/p4/testmess ➭ p4 sync @59702\n> //depot/openssl/0.9.8j/openssl/include/openssl/aes.h#2 - refreshing /home/dgerard/p4/testmess/aes.h\n> //depot/openssl/0.9.8j/openssl/include/openssl/asn1.h#2 - refreshing /home/dgerard/p4/testmess/asn1.h\n> //depot/openssl/0.9.8j/openssl/include/openssl/asn1_mac.h#2 - refreshing /home/dgerard/p4/testmess/asn1_mac.h\n> //depot/openssl/0.9.8j/openssl/include/openssl/asn1t.h#2 - refreshing /home/dgerard/p4/testmess/asn1t.h\n> //depot/openssl/0.9.8j/openssl/include/openssl/bio.h#2 - refreshing /home/dgerard/p4/testmess/bio.h\n> //depot/openssl/0.9.8j/openssl/include/openssl/blowfish.h#2 - refreshing /home/dgerard/p4/testmess/blowfish.h\n> //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 - refreshing /home/dgerard/p4/testmess/bn.h\n> //depot/openssl/0.9.8j/openssl/include/openssl/buffer.h#2 - refreshing /home/dgerard/p4/testmess/buffer.h\n> […]\n> \n> \n> {14:39}~/p4/testmess ➭ ls -la\n> total 12\n> drwxr-xr-x 2 dgerard dgerard 4096 janv. 16 14:37 .\n> drwxr-xr-x 4 dgerard dgerard 4096 janv. 16 14:34 ..\n> -rw-r--r-- 1 dgerard dgerard   93 janv. 16 14:37 .perforce\t\n> \n> \n> Then I tried to sync the previous changeset, which is ok :\n> \n> {14:44}~/p4/testmess ➭ p4 sync -f @59701\n> //depot/openssl/0.9.8j/openssl/include/openssl/aes.h#1 - updating /home/dgerard/p4/testmess/aes.h\n> […]\n> \n> {14:44}~/p4/testmess ➭ l\n> total 0\n> -r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 aes.h\n> -r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 asn1.h\n> -r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 asn1_mac.h\n> -r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 asn1t.h\n> -r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 bio.h\n> -r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 blowfish.h\n> -r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 bn.h\n> -r--r--r-- 1 dgerard dgerard 0 janv. 16 14:44 buffer.h\n> […]\n> \n> \n> \n> However, when trying to sync to the appropriate changeset :\n> \n> {14:44}~/p4/testmess ➭ p4 sync -f @59702\n> //depot/openssl/0.9.8j/openssl/include/openssl/aes.h#2 - updating /home/dgerard/p4/testmess/aes.h\n> rename: /home/dgerard/p4/testmess/aes.h: No such file or directory\n> //depot/openssl/0.9.8j/openssl/include/openssl/asn1.h#2 - updating /home/dgerard/p4/testmess/asn1.h\n> rename: /home/dgerard/p4/testmess/asn1.h: No such file or directory\n> //depot/openssl/0.9.8j/openssl/include/openssl/asn1_mac.h#2 - updating /home/dgerard/p4/testmess/asn1_mac.h\n> rename: /home/dgerard/p4/testmess/asn1_mac.h: No such file or directory\n> //depot/openssl/0.9.8j/openssl/include/openssl/asn1t.h#2 - updating /home/dgerard/p4/testmess/asn1t.h\n> rename: /home/dgerard/p4/testmess/asn1t.h: No such file or directory\n> //depot/openssl/0.9.8j/openssl/include/openssl/bio.h#2 - updating /home/dgerard/p4/testmess/bio.h\n> rename: /home/dgerard/p4/testmess/bio.h: No such file or directory\n> //depot/openssl/0.9.8j/openssl/include/openssl/blowfish.h#2 - updating /home/dgerard/p4/testmess/blowfish.h\n> rename: /home/dgerard/p4/testmess/blowfish.h: No such file or directory\n> //depot/openssl/0.9.8j/openssl/include/openssl/bn.h#2 - updating /home/dgerard/p4/testmess/bn.h\n> rename: /home/dgerard/p4/testmess/bn.h: No such file or directory\n> \n> And the folder remains untouched.\n> Quite strange for me...\n\nOh cool, that helps a lot.  P4 is just broken here, so we can get\naway with being a bit sloppy in git.  I'll try just pretending\n\"empty symlinks\" are not in the repo.  Hopefully you'll have a\nfuture commit in your p4 repo that brings back bn.h properly.\n\nStill not sure about how I'll test this.\n\nThanks,\n\n\t\t-- Pete\n"},{"id":"233206","messageId":"B6C98918-4339-4D14-8C52-4B3AEC2526E7@iwi.me","threadId":"35647","inReplyTo":"20140116144519.GB15674@padd.com","subject":"Re: git-p4: exception when cloning a perforce repository","fromName":"Damien Gérard","fromEmail":"damien@iwi.me","sentAt":"2014-01-16T16:02:18Z","receivedAt":"2014-01-16T16:02:18Z","isPatch":false,"sender":{"key":"damien@iwi.me","avatar":null},"body":"\nOn 16 Jan 2014, at 15:45, Pete Wyckoff <pw@padd.com> wrote:\n\n> Oh cool, that helps a lot.  P4 is just broken here, so we can get\n> away with being a bit sloppy in git.  I'll try just pretending\n> \"empty symlinks\" are not in the repo.  Hopefully you'll have a\n> future commit in your p4 repo that brings back bn.h properly.\n\nThanks !\nI would love to use git instead of perforce if possible :)\n\n> Still not sure about how I'll test this.\n\nI can test for you, no probleme with that.\n\n\n> \n> Thanks,\n> \n> \t\t-- Pete\n> \n"},{"id":"233340","messageId":"20140118182225.GA6072@padd.com","threadId":"35647","inReplyTo":"B6C98918-4339-4D14-8C52-4B3AEC2526E7@iwi.me","subject":"Re: git-p4: exception when cloning a perforce repository","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-18T18:22:25Z","receivedAt":"2014-01-18T18:22:25Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"damien@iwi.me wrote on Thu, 16 Jan 2014 17:02 +0100:\n> \n> On 16 Jan 2014, at 15:45, Pete Wyckoff <pw@padd.com> wrote:\n> \n> > Oh cool, that helps a lot.  P4 is just broken here, so we can get\n> > away with being a bit sloppy in git.  I'll try just pretending\n> > \"empty symlinks\" are not in the repo.  Hopefully you'll have a\n> > future commit in your p4 repo that brings back bn.h properly.\n> \n> Thanks !\n> I would love to use git instead of perforce if possible :)\n> \n> > Still not sure about how I'll test this.\n> \n> I can test for you, no probleme with that.\n\nAny chance you can give this a go?  I've a bigger patch in\na longer series, but this should be the minimal fix.  If it\nworks, I'll ship it to Junio.\n\nThanks,\n\n\t\t-- Pete\n\n----8<--------\n\nFrom 8556ab04dd126184e26a380b7ed08998fd33debe Mon Sep 17 00:00:00 2001\nFrom: Pete Wyckoff <pw@padd.com>\nDate: Thu, 16 Jan 2014 18:34:09 -0500\nSubject: [PATCH] git p4: work around p4 bug that causes empty symlinks\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n\nDamien Gérard highlights an interesting problem.  Some p4\nrepositories end up with symlinks that have an empty target.  It\nis not possible to create this with current p4, but they do\nindeed exist.\n\nThe effect in git p4 is that \"p4 print\" on the symlink returns an\nempty string, confusing the curret symlink-handling code.\n\nIn p4, syncing to a change that includes such a bogus symlink\ncreates errors:\n\n    //depot/empty-symlink - updating /home/me/p4/empty-symlink\n    rename: /home/me/p4/empty-symlink: No such file or directory\n\nand leaves no symlink.\n\nReplicate the p4 behavior by ignoring these bogus symlinks.  If\nthey are fixed in later revisions, the symlink will be replaced\nproperly.\n\nReported-by: Damien Gérard <damien@iwi.me>\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n git-p4.py | 9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 5ea8bb8..e798ecf 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -2075,7 +2075,14 @@ class P4Sync(Command, P4UserMap):\n             # p4 print on a symlink sometimes contains \"target\\n\";\n             # if it does, remove the newline\n             data = ''.join(contents)\n-            if data[-1] == '\\n':\n+            if not data:\n+                # Some version of p4 allowed creating a symlink that pointed\n+                # to nothing.  This causes p4 errors when checking out such\n+                # a change, and errors here too.  Work around it by ignoring\n+                # the bad symlink; hopefully a future change fixes it.\n+                print \"\\nIgnoring empty symlink in %s\" % file['depotFile']\n+                return\n+            elif data[-1] == '\\n':\n                 contents = [data[:-1]]\n             else:\n                 contents = [data]\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233397","messageId":"864C1780-6231-4F47-BD86-380EED08C765@iwi.me","threadId":"35647","inReplyTo":"20140118182225.GA6072@padd.com","subject":"Re: git-p4: exception when cloning a perforce repository","fromName":"Damien Gérard","fromEmail":"damien@iwi.me","sentAt":"2014-01-20T12:14:15Z","receivedAt":"2014-01-20T12:14:15Z","isPatch":false,"sender":{"key":"damien@iwi.me","avatar":null},"body":"\nOn 18 Jan 2014, at 19:22, Pete Wyckoff <pw@padd.com> wrote:\n\n> damien@iwi.me wrote on Thu, 16 Jan 2014 17:02 +0100:\n>> \n>> On 16 Jan 2014, at 15:45, Pete Wyckoff <pw@padd.com> wrote:\n>> \n>>> Oh cool, that helps a lot.  P4 is just broken here, so we can get\n>>> away with being a bit sloppy in git.  I'll try just pretending\n>>> \"empty symlinks\" are not in the repo.  Hopefully you'll have a\n>>> future commit in your p4 repo that brings back bn.h properly.\n>> \n>> Thanks !\n>> I would love to use git instead of perforce if possible :)\n>> \n>>> Still not sure about how I'll test this.\n>> \n>> I can test for you, no probleme with that.\n> \n> Any chance you can give this a go?  I've a bigger patch in\n> a longer series, but this should be the minimal fix.  If it\n> works, I'll ship it to Junio.\n\nYeah it seems to work fine !\nI’ve finally imported all 152620 changesets :)\n\nThanks !\n\n(git pull from this morning + patch)\n\n\n> \n> Thanks,\n> \n> \t\t-- Pete\n> \n> ----8<--------\n> \n> From 8556ab04dd126184e26a380b7ed08998fd33debe Mon Sep 17 00:00:00 2001\n> From: Pete Wyckoff <pw@padd.com>\n> Date: Thu, 16 Jan 2014 18:34:09 -0500\n> Subject: [PATCH] git p4: work around p4 bug that causes empty symlinks\n> MIME-Version: 1.0\n> Content-Type: text/plain; charset=UTF-8\n> Content-Transfer-Encoding: 8bit\n> \n> Damien Gérard highlights an interesting problem.  Some p4\n> repositories end up with symlinks that have an empty target.  It\n> is not possible to create this with current p4, but they do\n> indeed exist.\n> \n> The effect in git p4 is that \"p4 print\" on the symlink returns an\n> empty string, confusing the curret symlink-handling code.\n> \n> In p4, syncing to a change that includes such a bogus symlink\n> creates errors:\n> \n>    //depot/empty-symlink - updating /home/me/p4/empty-symlink\n>    rename: /home/me/p4/empty-symlink: No such file or directory\n> \n> and leaves no symlink.\n> \n> Replicate the p4 behavior by ignoring these bogus symlinks.  If\n> they are fixed in later revisions, the symlink will be replaced\n> properly.\n> \n> Reported-by: Damien Gérard <damien@iwi.me>\n> Signed-off-by: Pete Wyckoff <pw@padd.com>\n> ---\n> git-p4.py | 9 ++++++++-\n> 1 file changed, 8 insertions(+), 1 deletion(-)\n> \n> diff --git a/git-p4.py b/git-p4.py\n> index 5ea8bb8..e798ecf 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -2075,7 +2075,14 @@ class P4Sync(Command, P4UserMap):\n>             # p4 print on a symlink sometimes contains \"target\\n\";\n>             # if it does, remove the newline\n>             data = ''.join(contents)\n> -            if data[-1] == '\\n':\n> +            if not data:\n> +                # Some version of p4 allowed creating a symlink that pointed\n> +                # to nothing.  This causes p4 errors when checking out such\n> +                # a change, and errors here too.  Work around it by ignoring\n> +                # the bad symlink; hopefully a future change fixes it.\n> +                print \"\\nIgnoring empty symlink in %s\" % file['depotFile']\n> +                return\n> +            elif data[-1] == '\\n':\n>                 contents = [data[:-1]]\n>             else:\n>                 contents = [data]\n> -- \n> 1.8.5.2.320.g99957e5\n> \n> \n"},{"id":"233398","messageId":"2BB6F289-A5B2-4213-8B8C-0AAECF5CFB4C@iwi.me","threadId":"35647","inReplyTo":"20140118182225.GA6072@padd.com","subject":"Re: git-p4: exception when cloning a perforce repository","fromName":"Damien Gérard","fromEmail":"damien@iwi.me","sentAt":"2014-01-20T14:01:47Z","receivedAt":"2014-01-20T14:01:47Z","isPatch":false,"sender":{"key":"damien@iwi.me","avatar":null},"body":"\nOn 18 Jan 2014, at 19:22, Pete Wyckoff <pw@padd.com> wrote:\n\n> damien@iwi.me wrote on Thu, 16 Jan 2014 17:02 +0100:\n>> \n>> On 16 Jan 2014, at 15:45, Pete Wyckoff <pw@padd.com> wrote:\n>> \n>>> Oh cool, that helps a lot.  P4 is just broken here, so we can get\n>>> away with being a bit sloppy in git.  I'll try just pretending\n>>> \"empty symlinks\" are not in the repo.  Hopefully you'll have a\n>>> future commit in your p4 repo that brings back bn.h properly.\n>> \n>> Thanks !\n>> I would love to use git instead of perforce if possible :)\n>> \n>>> Still not sure about how I'll test this.\n>> \n>> I can test for you, no probleme with that.\n> \n> Any chance you can give this a go?  I've a bigger patch in\n> a longer series, but this should be the minimal fix.  If it\n> works, I'll ship it to Junio.\n> \n\nJust for info, it works but it seems there are still some issues when a git repository is present within the perforce repo :\n\nerror: Invalid path 'Tools/Doc/bin/yuidoc/.git/FETCH_HEAD'\nerror: Invalid path 'Tools/Doc/bin/yuidoc/.git/HEAD'\nerror: Invalid path 'Tools/Doc/bin/yuidoc/.git/ORIG_HEAD’\n[...]\n\nThose files have been added then removed in another commit\n\nI’ve have to make git reset —hard ‘HEAD^’ && git p4 sync to a clean staging area right after the \"clone\".\n\n\n\n\n> Thanks,\n> \n> \t\t-- Pete\n> \n> ----8<--------\n> \n> From 8556ab04dd126184e26a380b7ed08998fd33debe Mon Sep 17 00:00:00 2001\n> From: Pete Wyckoff <pw@padd.com>\n> Date: Thu, 16 Jan 2014 18:34:09 -0500\n> Subject: [PATCH] git p4: work around p4 bug that causes empty symlinks\n> MIME-Version: 1.0\n> Content-Type: text/plain; charset=UTF-8\n> Content-Transfer-Encoding: 8bit\n> \n> Damien Gérard highlights an interesting problem.  Some p4\n> repositories end up with symlinks that have an empty target.  It\n> is not possible to create this with current p4, but they do\n> indeed exist.\n> \n> The effect in git p4 is that \"p4 print\" on the symlink returns an\n> empty string, confusing the curret symlink-handling code.\n> \n> In p4, syncing to a change that includes such a bogus symlink\n> creates errors:\n> \n>    //depot/empty-symlink - updating /home/me/p4/empty-symlink\n>    rename: /home/me/p4/empty-symlink: No such file or directory\n> \n> and leaves no symlink.\n> \n> Replicate the p4 behavior by ignoring these bogus symlinks.  If\n> they are fixed in later revisions, the symlink will be replaced\n> properly.\n> \n> Reported-by: Damien Gérard <damien@iwi.me>\n> Signed-off-by: Pete Wyckoff <pw@padd.com>\n> ---\n> git-p4.py | 9 ++++++++-\n> 1 file changed, 8 insertions(+), 1 deletion(-)\n> \n> diff --git a/git-p4.py b/git-p4.py\n> index 5ea8bb8..e798ecf 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -2075,7 +2075,14 @@ class P4Sync(Command, P4UserMap):\n>             # p4 print on a symlink sometimes contains \"target\\n\";\n>             # if it does, remove the newline\n>             data = ''.join(contents)\n> -            if data[-1] == '\\n':\n> +            if not data:\n> +                # Some version of p4 allowed creating a symlink that pointed\n> +                # to nothing.  This causes p4 errors when checking out such\n> +                # a change, and errors here too.  Work around it by ignoring\n> +                # the bad symlink; hopefully a future change fixes it.\n> +                print \"\\nIgnoring empty symlink in %s\" % file['depotFile']\n> +                return\n> +            elif data[-1] == '\\n':\n>                 contents = [data[:-1]]\n>             else:\n>                 contents = [data]\n> -- \n> 1.8.5.2.320.g99957e5\n> \n> \n"}]}