This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: git on mounted CIFS is it Git or Cygwin


On 2020/01/26 13:56, Jason Pyeron wrote:
I have an issue with git in Cygwin on windows shares - this is recent (worked months ago).
   Just to be clear, you are running 'git' on Cygwin and not on linux
or some other OS? There is a 'git' that runs on window natively. Have you thought about why you'd want to use the cygwin version of git vs. the windows version since you are running 'git' on the windows machine? I tend to like the cygwin version of things because often it will use the same sources and act the same way as a version on linux, so that's just a comfort and familiarity thing. Depending
on your use case, you might want to run git natively using a Win version.

Now another question, you say you are running git in Cygwin. Now you say you are running this on a "windows share". What that implies is that the files are being stored on another machine on the network (not locally) that might be a windows machine exporting part of its file system as a 'share', or it could be
another OS (like linux) running something like "Samba" to export the disks
with a Windows-type network interface (like CIFS).  Is there a 3rd machine
that is exporting its disks as windows-shares so they can be mounted by windows
machines (or other OS's using the CIFS protocol) -- since that is what a
'share' is -- a view of part of a filesystem on that 3rd system.  ==OR== is
it a local (to the windows machine) disk or partition that most likely has
the disk formatted with NTFS. CIFS is a network filesystem interface and has little or nothing to do with cygwin. It can be used between other OS's (linux<->linux for example) to share
files or windows<->windows or between different OS's.

A guess on my part -- CIFS isn't party of this -- and you are running git storing files on a local hard disk running NTFS and cygwin is emulating posix
permissions (ex. 0644) on NTFS.

My first guess was something in git had changed, but in writing this out, I think it more likely that it has something to do with 1) your umask settings being set overly restrictively. Created a testdir w/no acls on it. By default
it had acls on my system:

 cd /tmp;
 mkdir testdir
 lsacl testdir
[u::rwx,g::rwx,g:Untrusted:r-x,m::rwx,o::rwx/u::rwx,g::rwx,g:Untrusted:r-x,m::rwx,o::rwx] testdir
# of note: my system created those acls by defaults setup on my system.
# Simply creating a directory anywhere on my system will likely have some
# ACL's applied by default
# so for this test, I removed them:
 chacl -B testdir
 lsacl testdir
[u::rwx,g::rwx,o::rwx] testdir

# above acl corresponds to:
 ll -da testdir
drwxrwxrwx 2 36 Jan 27 03:34 testdir/
(user, group and other all have full access)  That was with a umask of 0.
Then I created 3 files with my umask set to different settings:
 umask 0; touch u0
 umask 02; touch u02
 umask 0377; touch u377
#looking at permission settings:
 ll testdir
total 0
-rw-rw-rw- 1 0 Jan 27 03:33 u0
-rw-rw-r-- 1 0 Jan 27 03:33 u02
-r-------- 1 0 Jan 27 03:34 u377
# Note the last case, gave the user read-only access and nothing
to group and other.  So something that changed the umask could
duplicate your symptoms.

So a setting in 'git' might have changed to change the bits
in the permissions or in the umask (aside from something changing your
default umask value).

Depending on where you create a directory it can affect
the permissions -- like /tmp is usually set to allow users
to create, modify and delete their own files, but not those
of other users.  Those permissions can change how the file
permissions are enforced -- like under tmp, you'd retain write
access despite what permissions were on the file, but under a
git dir owned by another user, permissions denying write
access would be more likely to be strictly enforced.

I have narrowed it down to a component of git creating a file as 04xx instead of 06xx permissions. When I do the same with mktemp, I am able to write the file, but git gets a permission denied. I can chmod +w the temp file and then writing works, albeit too late.
---
   So what umask is there when the file is created, and what
permissions does git try to create the file with?

   Possibly using 'strace' would allow you to see how or why
the file is created with the wrong permissions.

   Also, if you really are working on a network disk -- how you mount
and how the disk is exported can also set default permissions and
umask effects.  There can be ALOT of things that could be causing
your problem, BUT, the simplest, and easiest to break w/o knowing
it, would be something changing somethign like the umask or default
permissions on the directory (i.e. the same symptom could be created
by ACLs).

Hope this gives you some ideas on what to check -- if lucky
it's an easy find, if not, well, could take alot more investigation.

good luck!
Linda

Renaming the file works in either case.

What I need help in is determining if this is a bug or a special case of mounting a windows share? Is this a Cygwin issue or a git issue? Performing the fetch on the local file system has no issues.

I have updated Cygwin as of a few hours ago, no changes in behavior. What else can I provide to debug this better? Should this move over to the git mailing list?

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ GIT_TRACE=true git fetch REDACTED_REMOTENAME
13:31:59.678749 git.c:344               trace: built-in: git fetch REDACTED_REMOTENAME
13:32:03.393302 run-command.c:640       trace: run_command: unset GIT_DIR GIT_PREFIX; ssh REDACTED_USER2NAME@REDACTED_HOST2NAME 'git-upload-pack '\''REDACTED_REPO2PATH'\'''
13:32:18.448798 run-command.c:640       trace: run_command: git rev-list --objects --stdin --not --all --quiet
remote: Counting objects: 315, done.
13:32:26.217550 run-command.c:640       trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 2039 on REDACTED_HOSTNAME' --pack_header=2,315
13:32:31.645732 git.c:344               trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 2039 on REDACTED_HOSTNAME' --pack_header=2,315
fatal: write error: Permission denied
fatal: index-pack failed

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ mktemp -p REDACTED_CWD/objects/pack/ tmp_test_XXXXX
REDACTED_CWD/objects/pack/tmp_test_sdTdk

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ dir REDACTED_CWD/objects/pack/
...
-r--r--r-- 1 REDACTED_USERNAME REDACTED_GROUPNAME         12 Jan 26 13:27 tmp_pack_dxknyW
-r--r--r-- 1 REDACTED_USERNAME REDACTED_GROUPNAME         12 Jan 26 12:52 tmp_pack_FPEnsr
-r--r--r-- 1 REDACTED_USERNAME REDACTED_GROUPNAME         12 Jan 26 13:32 tmp_pack_tpiIGW
-rw-r--r-- 1 REDACTED_USERNAME REDACTED_GROUPNAME          0 Jan 26 13:29 tmp_test_sdTdk

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ mv REDACTED_CWD/objects/pack/tmp_pack_tpiIGW REDACTED_CWD/objects/pack/tmp_pack_tpiIGW.mv

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ mv REDACTED_CWD/objects/pack/tmp_pack_tpiIGW.mv REDACTED_CWD/objects/pack/tmp_pack_tpiIGW

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ hexdump.exe -C REDACTED_CWD/objects/pack/tmp_pack_tpiIGW
00000000  50 41 43 4b 00 00 00 02  00 00 01 3b              |PACK.......;|
0000000c

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ echo test >> REDACTED_CWD/objects/pack/tmp_pack_tpiIGW
-bash: REDACTED_CWD/objects/pack/tmp_pack_tpiIGW: Permission denied

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ chmod +w REDACTED_CWD/objects/pack/tmp_pack_tpiIGW

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ echo test >> REDACTED_CWD/objects/pack/tmp_pack_tpiIGW

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ GIT_TRACE_PACK_ACCESS=true GIT_TRACE_PACKET=true GIT_TRACE_PERFORMANCE=true GIT_TRACE_SETUP=true GIT_TRACE=true git fetch REDACTED_REMOTENAME
...
15:00:00.303534 pkt-line.c:80           packet:        fetch> have 1997703e1a01d311e54c32ece1776795209e61e1
15:00:00.306043 pkt-line.c:80           packet:        fetch> 0000
15:00:00.312236 pkt-line.c:80           packet:        fetch< NAK
15:00:00.317800 pkt-line.c:80           packet:        fetch> done
15:00:00.550242 pkt-line.c:80           packet:        fetch< NAK
15:00:00.555607 pkt-line.c:80           packet:        fetch< ACK 3466429b2926acc6e9e2d3c4c1c9ef86d2c82860
15:00:04.088156 pkt-line.c:80           packet:     sideband< \2Counting objects: 321, done.
remote: Counting objects: 321, done.
15:00:04.791067 pkt-line.c:80           packet:     sideband< PACK ...
15:00:04.829401 run-command.c:643       trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 1706 on REDACTED_HOSTNAME' --pack_header=2,321
15:00:17.109869 trace.c:377             setup: git_dir: .
15:00:17.112705 trace.c:378             setup: git_common_dir: .
15:00:17.114454 trace.c:379             setup: worktree: (null)
15:00:17.116820 trace.c:380             setup: cwd: REDACTED_CWD
15:00:17.118969 trace.c:381             setup: prefix: (null)
15:00:17.123794 git.c:419               trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 1706 on REDACTED_HOSTNAME' --pack_header=2,321
15:00:19.063715 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 22055
15:00:19.147310 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 22214
15:00:19.160865 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 22375
15:00:19.264012 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 22578
15:00:19.268455 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 23505
15:00:19.318936 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 23706
15:00:19.326812 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 24045
15:00:19.335579 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 149489
15:00:19.447526 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 182724
15:00:19.452150 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 182883
15:00:19.456088 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 183044
15:00:19.571515 packfile.c:1592         ./objects/pack/pack-1ed0c0228d9db2201f0445b87af08494b0b29465.pack 183202
fatal: write error: Permission denied
15:00:19.595784 trace.c:477             performance: 2.565797600 s: git command: /usr/libexec/git-core/git index-pack --stdin -v --fix-thin '--keep=fetch-pack 1706 on REDACTED_HOSTNAME' --pack_header=2,321
fatal: index-pack failed
15:00:19.617599 trace.c:477             performance: 78.536082300 s: git command: git fetch REDACTED_REMOTENAME

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ mount
REDACTED_SHARENAME/REDACTED_REPOPATH on /tmp/foo3 type hgfs (binary,notexec,noacl,user)
REDACTED_SHARENAME/REDACTED_REPOPATH on /tmp/foo2 type hgfs (binary,notexec,user)
REDACTED_SHARENAME/REDACTED_REPOPATH on /tmp/foo1 type hgfs (binary,notexec,user)
REDACTED_SHARENAME on /mnt/REDACTED_SHAREMNT type hgfs (binary,notexec,noacl,user)
C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64 on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)

REDACTED_USERNAME@REDACTED_HOSTNAME REDACTED_CWD
$ cygcheck.exe -s (paired down results)

Cygwin Configuration Diagnostics
Current System Time: Sun Jan 26 20:14:43 2020

Windows 10 Professional Ver 10.0 Build 17763

...
 3508k 2019/12/21 C:\cygwin64\bin\cygwin1.dll
    Cygwin DLL version info:
        DLL version: 3.1.2
        DLL epoch: 19
        DLL old termios: 5
        DLL malloc env: 28
        Cygwin conv: 181
        API major: 0
        API minor: 340
        Shared data: 5
        DLL identifier: cygwin1
        Mount registry: 3
        Cygwin registry name: Cygwin
        Installations name: Installations
        Cygdrive default prefix:
        Build date:
        Shared id: cygwin1S5

...
No Cygwin services found.


Cygwin Package Information
Package                 Version            Status
_autorebase             001007-1           OK
base-cygwin             3.8-1              OK
base-files              4.3-2              OK
bash                    4.4.12-3           OK
cygrunsrv               1.62-1             OK
cygutils                1.4.16-2           OK
cygwin                  3.1.2-1            OK
git                     2.21.0-1           OK


REDACTED_USERNAME@REDACTED_HOSTNAME /tmp/foo4
$ git clone REDACTED_CWD --bare ./
Cloning into bare repository '.'...
done.

REDACTED_USERNAME@REDACTED_HOSTNAME /tmp/foo4
$ git remote add REDACTED_REMOTENAME REDACTED_USER2NAME@REDACTED_HOST2NAME:REDACTED_REPO2PATH

REDACTED_USERNAME@REDACTED_HOSTNAME /tmp/foo4
$ git fetch REDACTED_REMOTENAME autocommit-20191028-1148-from-master
remote: Counting objects: 33, done.
remote: Total 33 (delta 0), reused 2 (delta 0)
Unpacking objects: 100% (33/33), done.
From REDACTED_HOST2NAME:REDACTED_REPO2PATH
 * branch                  autocommit-20191028-1148-from-master -> FETCH_HEAD
 * [new branch]            autocommit-20191028-1148-from-master -> REDACTED_REMOTENAME/autocommit-20191028-1148-from-master



--
Jason Pyeron  | Architect
PD Inc        |
10 w 24th St  |
Baltimore, MD |
.mil: jason.j.pyeron.ctr@mail.mil
.com: jpyeron@pdinc.us
tel : 202-741-9397




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]