All of lore.kernel.org
 help / color / mirror / Atom feed
* git-cvsserver strips exec bit
@ 2013-09-10 15:23 Michael Cronenworth
  2013-09-10 17:02 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Cronenworth @ 2013-09-10 15:23 UTC (permalink / raw)
  To: git

Hello,

On git 1.8.1.x (Fedora 18) I was able to use the git-cvsserver to checkout code
to package into a tarball. Script files that were in git with 755 masks were
checked-out with the same mask. After upgrading the git repository machine to
Fedora 19 (1.8.3.1) the behaviour has changed. When I checkout the same script
files their mask is now 644. The mask has not changed in git.

I understand I can use git-archive to perform the same functionality, but I'd
like to report this issue here.

Thanks,
Michael

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git-cvsserver strips exec bit
  2013-09-10 15:23 git-cvsserver strips exec bit Michael Cronenworth
@ 2013-09-10 17:02 ` Junio C Hamano
  2013-09-10 20:11   ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2013-09-10 17:02 UTC (permalink / raw)
  To: Matthew Ogilvie; +Cc: git, Michael Cronenworth

Michael Cronenworth <mike@cchtml.com> writes:

> On git 1.8.1.x (Fedora 18) I was able to use the git-cvsserver to checkout code
> to package into a tarball. Script files that were in git with 755 masks were
> checked-out with the same mask. After upgrading the git repository machine to
> Fedora 19 (1.8.3.1) the behaviour has changed. When I checkout the same script
> files their mask is now 644. The mask has not changed in git.

Matthew, I do not know if you are still using the git-cvsserver, but
it seems that the only substantial change to that subsystem between
the 1.8.1.x and 1.8.3.x is your update.

Especially 2c3af7e7 (cvsserver: factor out git-log parsing logic,
2012-10-13) looks interesting.  It has a hunk like this:

-                my $git_perms = "";
-                $git_perms .= "r" if ( $mode & 4 );
-                $git_perms .= "w" if ( $mode & 2 );
-                $git_perms .= "x" if ( $mode & 1 );
-                $git_perms = "rw" if ( $git_perms eq "" );
+                my $dbMode = convertToDbMode($mode);

with the definition of convertToDbMode being:

+sub convertToDbMode
+{
+    my $mode = shift;
+    ...
+    $mode=~/^\d\d(\d)\d{3}$/;
+    my $userBits=$1;
+
+    my $dbMode = "";
+    $dbMode .= "r" if ( $userBits & 4 );
+    $dbMode .= "w" if ( $userBits & 2 );
+    $dbMode .= "x" if ( $userBits & 1 );
+    $dbMode = "rw" if ( $dbMode eq "" );
+
+    return $dbMode;

The $mode in the caller comes from diff-tree output (the post-change
side of the mode string, like "100755").

Picking the third digit from the left (i.e. "10'0'755"), instead of
the tail digit (i.e. "10075'5'"), looks strange.

Side note: now I look at it, the original does not make much sense
for that matter.  "100755" & 4 is different from oct("100755") & 4.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git-cvsserver strips exec bit
  2013-09-10 17:02 ` Junio C Hamano
@ 2013-09-10 20:11   ` Junio C Hamano
  2013-09-10 22:20     ` Michael Cronenworth
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2013-09-10 20:11 UTC (permalink / raw)
  To: Michael Cronenworth; +Cc: git, Matthew Ogilvie

Junio C Hamano <gitster@pobox.com> writes:

> Michael Cronenworth <mike@cchtml.com> writes:
>
>> On git 1.8.1.x (Fedora 18) I was able to use the git-cvsserver to checkout code
>> to package into a tarball. Script files that were in git with 755 masks were
>> checked-out with the same mask. After upgrading the git repository machine to
>> Fedora 19 (1.8.3.1) the behaviour has changed. When I checkout the same script
>> files their mask is now 644. The mask has not changed in git.
>
> Matthew, I do not know if you are still using the git-cvsserver, but
> it seems that the only substantial change to that subsystem between
> the 1.8.1.x and 1.8.3.x is your update.
>
> Especially 2c3af7e7 (cvsserver: factor out git-log parsing logic,
> 2012-10-13) looks interesting.  It has a hunk like this:
>
> -                my $git_perms = "";
> -                $git_perms .= "r" if ( $mode & 4 );
> -                $git_perms .= "w" if ( $mode & 2 );
> -                $git_perms .= "x" if ( $mode & 1 );
> -                $git_perms = "rw" if ( $git_perms eq "" );
> +                my $dbMode = convertToDbMode($mode);
>
> with the definition of convertToDbMode being:
>
> +sub convertToDbMode
> +{
> +    my $mode = shift;
> +    ...
> +    $mode=~/^\d\d(\d)\d{3}$/;
> +    my $userBits=$1;
> +
> +    my $dbMode = "";
> +    $dbMode .= "r" if ( $userBits & 4 );
> +    $dbMode .= "w" if ( $userBits & 2 );
> +    $dbMode .= "x" if ( $userBits & 1 );
> +    $dbMode = "rw" if ( $dbMode eq "" );
> +
> +    return $dbMode;
>
> The $mode in the caller comes from diff-tree output (the post-change
> side of the mode string, like "100755").
>
> Picking the third digit from the left (i.e. "10'0'755"), instead of
> the tail digit (i.e. "10075'5'"), looks strange.
>
> Side note: now I look at it, the original does not make much sense
> for that matter.  "100755" & 4 is different from oct("100755") & 4.

I stopped interacting with CVS quite a long time ago, so I do not
have any way of verifying, but the fix may be just the matter of
something like this.

I am not sure if we want to use the owner bit (i.e. 4th place)
instead of the other bit (i.e. the last place) like this patch does,
though.  The old code in 1.8.1.x would have produced either "r" (for
100644) or "wx" (for 100755); I think that the result of applying
this patch would give us "r" (for 100644) or "rx" (for 100755).

-- >8 --
Subject: cvsserver: pick up the right mode bits

When determining the file mode from either ls-tree or diff-tree
output, we used to grab these octal mode string (typically 100644 or
100755) and then did

	$git_perms .= "r" if ( $mode & 4 );
	$git_perms .= "w" if ( $mode & 2 );
	$git_perms .= "x" if ( $mode & 1 );

which was already wrong, as (100644 & 4) is very different from
oct("100644") & 4.  An earlier refactoring 2c3af7e7 (cvsserver:
factor out git-log parsing logic, 2012-10-13) further changed it to
pick the third octal digit (10*0*644 or 10*0*755) from the left and
then do the above conversion, which does not make sense, either.

Let's use the last digit of the octal mode string to make sure we
get the executable and read bits right.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 git-cvsserver.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index a0d796e..b1d7a4c 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -4167,7 +4167,7 @@ sub convertToDbMode
     #  this half-converted form, but it isn't currently worth the
     #  backwards compatibility headaches.
 
-    $mode=~/^\d\d(\d)\d{3}$/;
+    $mode=~/^\d{5}(\d)$/;
     my $userBits=$1;
 
     my $dbMode = "";

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: git-cvsserver strips exec bit
  2013-09-10 20:11   ` Junio C Hamano
@ 2013-09-10 22:20     ` Michael Cronenworth
  2013-09-10 22:22       ` Michael Cronenworth
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Cronenworth @ 2013-09-10 22:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Matthew Ogilvie

Junio C Hamano wrote:
> I stopped interacting with CVS quite a long time ago, so I do not
> have any way of verifying, but the fix may be just the matter of
> something like this.

This fix is close. Now all files are checked out with a mask of 555.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git-cvsserver strips exec bit
  2013-09-10 22:20     ` Michael Cronenworth
@ 2013-09-10 22:22       ` Michael Cronenworth
  2013-09-10 22:33         ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Cronenworth @ 2013-09-10 22:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Matthew Ogilvie

Michael Cronenworth wrote:
> This fix is close. Now all files are checked out with a mask of 555.

Let me clarify.

Git mask 755 => CVS mask 555
Git mask 644 => CVS mask 444

Thanks,
Michael

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git-cvsserver strips exec bit
  2013-09-10 22:22       ` Michael Cronenworth
@ 2013-09-10 22:33         ` Junio C Hamano
  2013-09-11 13:12           ` Michael Cronenworth
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2013-09-10 22:33 UTC (permalink / raw)
  To: Michael Cronenworth; +Cc: git, Matthew Ogilvie

Michael Cronenworth <mike@cchtml.com> writes:

> Michael Cronenworth wrote:
>> This fix is close. Now all files are checked out with a mask of 555.
>
> Let me clarify.
>
> Git mask 755 => CVS mask 555
> Git mask 644 => CVS mask 444
>
> Thanks,
> Michael

Then what I wrote was actually relevant ;-)

    I am not sure if we want to use the owner bit (i.e. 4th place)
    instead of the other bit (i.e. the last place) like this patch does,
    though.  The old code in 1.8.1.x would have produced either "r" (for
    100644) or "wx" (for 100755); I think that the result of applying
    this patch would give us "r" (for 100644) or "rx" (for 100755).

This should then work, I would think.

-- >8 --
Subject: [PATCH v2] cvsserver: pick up the right mode bits

When determining the file mode from either ls-tree or diff-tree
output, we used to grab these octal mode string (typically 100644 or
100755) and then did

	$git_perms .= "r" if ( $mode & 4 );
	$git_perms .= "w" if ( $mode & 2 );
	$git_perms .= "x" if ( $mode & 1 );

which was already wrong, as (100644 & 4) is very different from
oct("100644") & 4.  An earlier refactoring 2c3af7e7 (cvsserver:
factor out git-log parsing logic, 2012-10-13) further changed it to
pick the third octal digit (10*0*644 or 10*0*755) from the left and
then do the above conversion, which does not make sense, either.

Let's use the third digit from the last of the octal mode string to
make sure we get the executable and read bits right.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 git-cvsserver.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index a0d796e..67b1e7b 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -4167,7 +4167,7 @@ sub convertToDbMode
     #  this half-converted form, but it isn't currently worth the
     #  backwards compatibility headaches.
 
-    $mode=~/^\d\d(\d)\d{3}$/;
+    $mode=~/^\d{3}(\d)\d\d$/;
     my $userBits=$1;
 
     my $dbMode = "";

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: git-cvsserver strips exec bit
  2013-09-10 22:33         ` Junio C Hamano
@ 2013-09-11 13:12           ` Michael Cronenworth
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Cronenworth @ 2013-09-11 13:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Matthew Ogilvie

Junio C Hamano wrote:
> Then what I wrote was actually relevant;-)
>
>      I am not sure if we want to use the owner bit (i.e. 4th place)
>      instead of the other bit (i.e. the last place) like this patch does,
>      though.  The old code in 1.8.1.x would have produced either "r" (for
>      100644) or "wx" (for 100755); I think that the result of applying
>      this patch would give us "r" (for 100644) or "rx" (for 100755).
>
> This should then work, I would think.

Yes, this new patch fixes the issue.

Thanks!
Michael

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-11 13:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-10 15:23 git-cvsserver strips exec bit Michael Cronenworth
2013-09-10 17:02 ` Junio C Hamano
2013-09-10 20:11   ` Junio C Hamano
2013-09-10 22:20     ` Michael Cronenworth
2013-09-10 22:22       ` Michael Cronenworth
2013-09-10 22:33         ` Junio C Hamano
2013-09-11 13:12           ` Michael Cronenworth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.