git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-cvsserver strips exec bit

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 10, 2013, 22:33 UTC
Message-ID
<xmqqtxhsux25.fsf@gitster.dls.corp.google.com>
In-Reply-To
<522F9BBE.404@cchtml.com>
Michael Cronenworth <mike@cchtml.com> writes:
Show 10 quoted lines
> 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 = "";
Previous: Michael CronenworthNext: Michael Cronenworth
Message 6 of 7 in “git-cvsserver strips exec bit”
  1. Michael CronenworthSep 10, 2013
  2. Junio C HamanoSep 10, 2013
  3. Junio C HamanoSep 10, 2013
  4. Michael CronenworthSep 10, 2013
  5. Michael CronenworthSep 10, 2013
  6. Junio C HamanoSep 10, 2013
  7. Michael CronenworthSep 11, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.