delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/09/04/11:12:54

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:references
:mime-version:content-type:in-reply-to; q=dns; s=default; b=tp/K
I1ycRzKBMRuM7U4ruZTviyMJ7Bzwtl5PRDXbDDPYxESYeFmjCBDkOxjEcDehGt1E
O+9naKwjMZGQwmywMgsd1YGHf+jF2rBPwkbXM5oARTj4qk31IiAmTA/1dYHTOwE9
KoKUN7uMAiy0rBHKJe1PuLYlg2aBdrK65xFe6PA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:references
:mime-version:content-type:in-reply-to; s=default; bh=j3MVrawAqK
2hXPuvPod7tOcrPXc=; b=m5c5mzjWAxrzdZU9H5peVkvXTPu7ZLpIZEUnuC3P8J
Qz8h4kxqmqs/OYremephO5bM94k7UolbuIqj7iZxe2+hFx74VedquCypGSXJS9sZ
E7YbvMC8me0NnIdhtwPclkCTC9WlqJxFMntljDlSJWuDUHunji0S1rlIyeS2KDE4
s=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-wi0-f169.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=FbwCBsgQL6AB1itxWWR0kMVU9+HJkou2kmwAf+w3fME=; b=PTAgxDt/+0HkkHph2jCwWM9gAO0vAkYbiPmB35d7WVSh9pvA+kXSwGt5ipXyIi2tCH iTOVSrEbWp7Kmnu/FeegSiYu303EFOISNWC87WAPS/8j+Tdw0wHYJeQX/zhPeEkan0k3 5JPtnliZImSnnpfAHpeuwqp4UV/hEf1eK+iUDYzOTXwuYjbY3sbzqQ8a0Igvaoi73Q/W 2Xj7gDRjew9fVCnSNH1Azuj0pozVSUKpQjymTMholRq/5yYZYPo+FPaYfg8FL+nxkjzs 1GfAbQTWi7o6W7FJR38Y4u8ObAP4RKjUyp8n9FtsJ+gne/vSeCIVq5Z7OurhX00e5QJ7 e1ag==
X-Gm-Message-State: ALoCoQlIaq/3lnPPOICDO6O6zSjev6OqIn1UXGS2Y78L7VYSjIYQorxkWCVT11rSKrhHrOgmnxnb
X-Received: by 10.194.179.6 with SMTP id dc6mr8110711wjc.39.1441379551906; Fri, 04 Sep 2015 08:12:31 -0700 (PDT)
Date: Fri, 4 Sep 2015 16:12:29 +0100
From: Adam Dinwoodie <adam AT dinwoodie DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: Problem with git and file mode changes
Message-ID: <20150904151229.GB14466@dinwoodie.org>
References: <CAH8Pv0jXEEJ5P4jmojYne_SAt-DtK7twGLuujFCukoAhr1-f8g AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAH8Pv0jXEEJ5P4jmojYne_SAt-DtK7twGLuujFCukoAhr1-f8g@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-IsSubscribed: yes

On Fri, Sep 04, 2015 at 04:44:11PM +0200, Dani Moncayo wrote:
> After doing a 'git pull', I saw that git didn't make the merge,
> because apparently I had some local changes.  But I didn't make
> any local change.  For example, this file appears as modified:
> 
>   $ git status --short test/rmailmm.el
>    M test/rmailmm.el
> 
>   $ git diff test/rmailmm.el
>   diff --git a/test/rmailmm.el b/test/rmailmm.el
>   old mode 100644
>   new mode 100755
> 
> Mmm strange, I never changed the permissions of any file in my
> repo.  And moreover:
> 
>   $ ls -o test/rmailmm.el
>   -rwxrwxr--+ 1 Dani 3106 Sep 4 16:19 test/rmailmm.el
> 
> According to 'ls', the file mode is 774, but according to git is
> 755.  Which one is wrong?

Git internally only stores file permissions of 755 or 644*; anything
else is mapped down to one of those two, based (I believe) on whether
the user execute bit is set or not.

> Well, let's try to revert the misterious change:
> 
>   $ git checkout test/rmailmm.el
> 
>   $ git status --short test/rmailmm.el
>    M test/rmailmm.el
> 
>   $ git diff test/rmailmm.el
>   diff --git a/test/rmailmm.el b/test/rmailmm.el
>   old mode 100644
>   new mode 100755
> 
>   $ ls -o test/rmailmm.el
>   -rwxrwxr--+ 1 Dani 3106 Sep  4 16:28 test/rmailmm.el
> 
> Apparently nothing has changed after the 'git checkout'!!

It looks like the underlying file system is failing to record the file
permissions correctly**.  That could be a limitation of the file system
(FAT32 is much more limited than NTFS, for example, and I could believe
permissions go very wrong over network shares), of the options with
which the filesystem is mounted in Cygwin (take a look for "noacl" in
the Cygwin FAQs), or possibly just that you don't have permission to
change the file properties (although I'd expect an error in that
scenario).  Another option is that some non-Cygwin program is getting in
the way and interfering with the permissions.

The underlying problem here is that Cygwin is trying to write a file
without the executable bit set, but whenever it checks the filesystem,
it sees the executable bit is set, and so has to assume that's a change.
If you can't fix the filesystem, you can tell Git to ignore the
filesystem executable bit with

    git config --global --bool core.fileMode false

(Remove the `--global` to only change it for the current repository.)

If you do that, you'll need to use `git update-index` if you need to
change the executable bit as recorded in the Git repository; see `git
help update-index` under the `--chmod` option for details.

HTH

Adam

* There are some special values stored in the same way as permissions
to denote things like submodules or symlinks, but the above is correct
as far as simple files are concerned.

** Where by "correctly" I mean "in the POSIX-like style that Cygwin
understands and uses"; it probably is correct from a Windows
perspective.

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019