threads / patch / 9944

patch[git-p4] Detect exec bit in more cases.

Subject: [PATCH] [git-p4] Detect exec bit in more cases.

## tl;dr

13 messages between Sep 19, 2007 and Sep 24, 2007. Diffs are folded; open one to read it.

replies: 12people: 4as markdown or json

David Brown· Sep 19, 2007, 18:15 UTC · lore
git-p4 was missing the execute bit setting if the file had other attribute
bits set.
---
 contrib/fast-import/git-p4 |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
Show changes to contrib/fast-import/git-p4 +4 −1
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index adaaae6..50850b8 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -932,7 +932,10 @@ class P4Sync(Command):
                 data = file['data']
 
                 mode = "644"
-                if file["type"].startswith("x"):
+                if (file["type"].startswith("x") or
+                        file["type"].startswith("cx") or
+                        file["type"].startswith("kx") or
+                        file["type"].startswith("ux")):
                     mode = "755"
                 elif file["type"] == "symlink":
                     mode = "120000"
-- 
1.5.3.1
Simon Hausmann· Sep 19, 2007, 19:03 UTC · re: David Brown · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

On Wednesday 19 September 2007 20:15:03 David Brown wrote:
Show 22 quoted lines
> git-p4 was missing the execute bit setting if the file had other attribute
> bits set.
> ---
>  contrib/fast-import/git-p4 |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
> index adaaae6..50850b8 100755
> --- a/contrib/fast-import/git-p4
> +++ b/contrib/fast-import/git-p4
> @@ -932,7 +932,10 @@ class P4Sync(Command):
>                  data = file['data']
>
>                  mode = "644"
> -                if file["type"].startswith("x"):
> +                if (file["type"].startswith("x") or
> +                        file["type"].startswith("cx") or
> +                        file["type"].startswith("kx") or
> +                        file["type"].startswith("ux")):
>                      mode = "755"
>                  elif file["type"] == "symlink":
>                      mode = "120000"
I'm fine with this, so unless you find a better way:
Acked-By: Simon Hausmann <simon@lst.de>
Simon
David Brown· Sep 19, 2007, 19:14 UTC · re: Simon Hausmann · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
Show 25 quoted lines
>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>> git-p4 was missing the execute bit setting if the file had other attribute
>> bits set.
>> ---
>>  contrib/fast-import/git-p4 |    5 ++++-
>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
>> index adaaae6..50850b8 100755
>> --- a/contrib/fast-import/git-p4
>> +++ b/contrib/fast-import/git-p4
>> @@ -932,7 +932,10 @@ class P4Sync(Command):
>>                  data = file['data']
>>
>>                  mode = "644"
>> -                if file["type"].startswith("x"):
>> +                if (file["type"].startswith("x") or
>> +                        file["type"].startswith("cx") or
>> +                        file["type"].startswith("kx") or
>> +                        file["type"].startswith("ux")):
>>                      mode = "755"
>>                  elif file["type"] == "symlink":
>>                      mode = "120000"
>
>I'm fine with this, so unless you find a better way:

Well, I just tested it, and it still doesn't work, so I need to take some time and try to figure out what is happening.

I'm sometimes getting back 'xtext', and sometimes things like 'text+mx' back from perforce, so I need to read up, and really figure out what to look for.

David
Dana How· Sep 19, 2007, 19:31 UTC · re: David Brown · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

On 9/19/07, David Brown <git@davidb.org> wrote:
Show 13 quoted lines
> On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
> >On Wednesday 19 September 2007 20:15:03 David Brown wrote:
> >> git-p4 was missing the execute bit setting if the file had other attribute
> >> bits set.
> >
> >I'm fine with this, so unless you find a better way:
>
> Well, I just tested it, and it still doesn't work, so I need to take some
> time and try to figure out what is happening.
>
> I'm sometimes getting back 'xtext', and sometimes things like 'text+mx'
> back from perforce, so I need to read up, and really figure out what to
> look for.

The output of "git p4 filetypes" was enough for me when I wrote my p4 front-end to fast-import; I never did read the p4 manual.

Have fun,
-- 
Dana L. How  danahow@gmail.com  +1 650 804 5991 cell
David Brown· Sep 19, 2007, 19:49 UTC · re: Dana How · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

On Wed, Sep 19, 2007 at 12:31:52PM -0700, Dana How wrote:
Show 18 quoted lines
>On 9/19/07, David Brown <git@davidb.org> wrote:
>> On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>> >On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>> >> git-p4 was missing the execute bit setting if the file had other attribute
>> >> bits set.
>> >
>> >I'm fine with this, so unless you find a better way:
>>
>> Well, I just tested it, and it still doesn't work, so I need to take some
>> time and try to figure out what is happening.
>>
>> I'm sometimes getting back 'xtext', and sometimes things like 'text+mx'
>> back from perforce, so I need to read up, and really figure out what to
>> look for.
>
>The output of "git p4 filetypes" was enough for me
>when I wrote my p4 front-end to fast-import;
>I never did read the p4 manual.

I have a patch based on what 'p4 help filetypes'. I'm running it now on a large test repository, and I'll compare the results when it is done. Provided it works, I'll send a new patch in a little bit.

David
David Brown· Sep 20, 2007, 15:16 UTC · re: Simon Hausmann · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>> git-p4 was missing the execute bit setting if the file had other attribute
>> bits set.
>> ---
>I'm fine with this, so unless you find a better way:
>
>Acked-By: Simon Hausmann <simon@lst.de>

I sent out an improved version of this patch yesterday <1190232768445-git-send-email-git@davidb.org> that I'd like to get approved. I guess I'm not quite sure what happens at this point with a patch.

Thanks, David

Junio C Hamano· Sep 20, 2007, 22:53 UTC · re: David Brown · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

David Brown <git@davidb.org> writes:
Show 15 quoted lines
> On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>
>>> git-p4 was missing the execute bit setting if the file had other attribute
>>> bits set.
>>> ---
>
>>I'm fine with this, so unless you find a better way:
>>
>>Acked-By: Simon Hausmann <simon@lst.de>
>
> I sent out an improved version of this patch yesterday
> <1190232768445-git-send-email-git@davidb.org> that I'd like to get
> approved.  I guess I'm not quite sure what happens at this point with a
> patch.

I still have that *768445* message as "the last one proposed as better than previous ones" in my mbox.

Simon?
Simon Hausmann· Sep 21, 2007, 10:20 UTC · re: Junio C Hamano · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

On Friday 21 September 2007 00:53:52 Junio C Hamano wrote:
Show 20 quoted lines
> David Brown <git@davidb.org> writes:
> > On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
> >>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
> >>> git-p4 was missing the execute bit setting if the file had other
> >>> attribute bits set.
> >>> ---
> >>
> >>I'm fine with this, so unless you find a better way:
> >>
> >>Acked-By: Simon Hausmann <simon@lst.de>
> >
> > I sent out an improved version of this patch yesterday
> > <1190232768445-git-send-email-git@davidb.org> that I'd like to get
> > approved.  I guess I'm not quite sure what happens at this point with a
> > patch.
>
> I still have that *768445* message as "the last one proposed as
> better than previous ones" in my mbox.
>
> Simon?
Indeed, the new improved version is much better :)
Acked-By: Simon Hausmann <simon@lst.de>
Simon
Junio C Hamano· Sep 21, 2007, 21:15 UTC · re: Simon Hausmann · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

Simon Hausmann <simon@lst.de> writes:
Show 25 quoted lines
> On Friday 21 September 2007 00:53:52 Junio C Hamano wrote:
>> David Brown <git@davidb.org> writes:
>> > On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>> >>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>> >>> git-p4 was missing the execute bit setting if the file had other
>> >>> attribute bits set.
>> >>> ---
>> >>
>> >>I'm fine with this, so unless you find a better way:
>> >>
>> >>Acked-By: Simon Hausmann <simon@lst.de>
>> >
>> > I sent out an improved version of this patch yesterday
>> > <1190232768445-git-send-email-git@davidb.org> that I'd like to get
>> > approved.  I guess I'm not quite sure what happens at this point with a
>> > patch.
>>
>> I still have that *768445* message as "the last one proposed as
>> better than previous ones" in my mbox.
>>
>> Simon?
>
> Indeed, the new improved version is much better :)
>
> Acked-By: Simon Hausmann <simon@lst.de>
Thanks.  This should go to 'maint' (part of v1.5.3.3) right?
David Brown· Sep 21, 2007, 21:24 UTC · re: Junio C Hamano · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

On Fri, Sep 21, 2007 at 02:15:10PM -0700, Junio C Hamano wrote:
Show 29 quoted lines
>Simon Hausmann <simon@lst.de> writes:
>
>> On Friday 21 September 2007 00:53:52 Junio C Hamano wrote:
>>> David Brown <git@davidb.org> writes:
>>> > On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>>> >>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>>> >>> git-p4 was missing the execute bit setting if the file had other
>>> >>> attribute bits set.
>>> >>> ---
>>> >>
>>> >>I'm fine with this, so unless you find a better way:
>>> >>
>>> >>Acked-By: Simon Hausmann <simon@lst.de>
>>> >
>>> > I sent out an improved version of this patch yesterday
>>> > <1190232768445-git-send-email-git@davidb.org> that I'd like to get
>>> > approved.  I guess I'm not quite sure what happens at this point with a
>>> > patch.
>>>
>>> I still have that *768445* message as "the last one proposed as
>>> better than previous ones" in my mbox.
>>>
>>> Simon?
>>
>> Indeed, the new improved version is much better :)
>>
>> Acked-By: Simon Hausmann <simon@lst.de>
>
>Thanks.  This should go to 'maint' (part of v1.5.3.3) right?

Sounds good by me. I've been using it on a few other repos, and haven't had any problems.

David
Simon Hausmann· Sep 24, 2007, 06:20 UTC · re: David Brown · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

On Friday 21 September 2007 23:24:43 David Brown wrote:
Show 32 quoted lines
> On Fri, Sep 21, 2007 at 02:15:10PM -0700, Junio C Hamano wrote:
> >Simon Hausmann <simon@lst.de> writes:
> >> On Friday 21 September 2007 00:53:52 Junio C Hamano wrote:
> >>> David Brown <git@davidb.org> writes:
> >>> > On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
> >>> >>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
> >>> >>> git-p4 was missing the execute bit setting if the file had other
> >>> >>> attribute bits set.
> >>> >>> ---
> >>> >>
> >>> >>I'm fine with this, so unless you find a better way:
> >>> >>
> >>> >>Acked-By: Simon Hausmann <simon@lst.de>
> >>> >
> >>> > I sent out an improved version of this patch yesterday
> >>> > <1190232768445-git-send-email-git@davidb.org> that I'd like to get
> >>> > approved.  I guess I'm not quite sure what happens at this point with
> >>> > a patch.
> >>>
> >>> I still have that *768445* message as "the last one proposed as
> >>> better than previous ones" in my mbox.
> >>>
> >>> Simon?
> >>
> >> Indeed, the new improved version is much better :)
> >>
> >> Acked-By: Simon Hausmann <simon@lst.de>
> >
> >Thanks.  This should go to 'maint' (part of v1.5.3.3) right?
>
> Sounds good by me.  I've been using it on a few other repos, and haven't
> had any problems.
Agreed.
Simon
David Brown· Sep 19, 2007, 20:12 UTC · re: David Brown · lore
git-p4 was missing the execute bit setting if the file had other attribute
bits set.
---
 contrib/fast-import/git-p4 |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
Show changes to contrib/fast-import/git-p4 +9 −1
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index adaaae6..557649a 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -63,6 +63,14 @@ def system(cmd):
     if os.system(cmd) != 0:
         die("command failed: %s" % cmd)
 
+def isP4Exec(kind):
+    """Determine if a Perforce 'kind' should have execute permission
+
+    'p4 help filetypes' gives a list of the types.  If it starts with 'x',
+    or x follows one of a few letters.  Otherwise, if there is an 'x' after
+    a plus sign, it is also executable"""
+    return (re.search(r"(^[cku]?x)|\+.*x", kind) != None)
+
 def p4CmdList(cmd, stdin=None, stdin_mode='w+b'):
     cmd = "p4 -G %s" % cmd
     if verbose:
@@ -932,7 +940,7 @@ class P4Sync(Command):
                 data = file['data']
 
                 mode = "644"
-                if file["type"].startswith("x"):
+                if isP4Exec(file["type"]):
                     mode = "755"
                 elif file["type"] == "symlink":
                     mode = "120000"
-- 
1.5.3
David Brown· Sep 19, 2007, 21:03 UTC · re: David Brown · lore

Re: [PATCH] [git-p4] Detect exec bit in more cases.

On Wed, Sep 19, 2007 at 01:12:48PM -0700, David Brown wrote:
Show 5 quoted lines
>git-p4 was missing the execute bit setting if the file had other attribute
>bits set.
>---
> contrib/fast-import/git-p4 |   10 +++++++++-
> 1 files changed, 9 insertions(+), 1 deletions(-)

I've tested this patch on our fairly large P4 repo, and at least the tip exactly matches the files that P4 finds. So, it at least should be better. git-p4 still has some problems with case-insensitive servers.

Dave

← back to recent threads