Re: [PATCH] git-p4: Fix race between p4_edit and p4_change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 02 April 2008 00:28:56 Kevin Green wrote:
> Hi,
>
> Ran into a nasty race today with git-p4.  The changelist Files: section was
> showing up empty and it turned out to be a race between the p4_edit and
> p4_change -o, e.g.
>
> $ p4 edit $file && p4 change -o
>
> will show no files in the Files: section.
>
> I attach a patch after my .sig as a suggested fix.  It simply loops over
> the p4_changes -o as long as we're not finding any files (and we always
> should since we just did a p4_edit!); sleeping for 3 secs in between to
> allow Perforce to catch up with itself.

I don't mind the workaround in general as I agree this race is a bit nasy, but 
shouldn't the sleep only happen if we didn't find any files? Right now even 
if the server reacted immediately we still sleep for three seconds.

Another condition could be to verify that the list of files in the files 
section is identical to the list of files we called 'p4 edit' on.

Last but not least we could of course also generate the entire Files: section 
ourselves, using 'p4 change -o' just to get the rest of the template right.

I almost prefer the last approach, since we know the base depot path and the 
relative paths of all edited/added files.

What do you think?


Simon

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux