public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Rainer Blome" <rainer.blome@gmx.de>
To: cygwin@cygwin.com
Subject: chmod failed: Invalid argument [was: git clone fails with: error: chmod on config.lock failed: Invalid argument]
Date: Thu, 28 Jan 2016 14:44:00 -0000	[thread overview]
Message-ID: <trinity-cbf47259-7226-4e63-a653-2bbe8e064933-1453988667017@3capp-gmx-bs39> (raw)

Christopher Cobb wrote on Thu, 28 Jan 2016 01:27:16 +0100:
> Or maybe chmod is broken, like it is on my machine

You nailed it, thanks! Indeed, `chmod` appears to always fail,
on any file. Git tries to use it, and that fails.

----
cd
touch foo
ls -l foo
-rwx------ 1 myusername 213 0 Jan 28 14:22 foo

chmod u-w foo
chmod: changing permissions of ‘foo’: Invalid argument
----

Corinna and Ken, thanks for your suggestions too, replies below.

Rainer


===== Details recorded before I understood the chmod problem:

First I created the directory manually and tried `git init`.

----
$ mkdir bar
$ cd bar

$ git init
error: chmod on /cygdrive/c/base/bar/.git/config.lock failed: Invalid argument
error: chmod on /cygdrive/c/base/bar/.git/config.lock failed: Invalid argument
error: chmod on /cygdrive/c/base/bar/.git/config.lock failed: Invalid argument
error: chmod on /cygdrive/c/base/bar/.git/config.lock failed: Invalid argument
Initialized empty Git repository in /cygdrive/c/base/bar/.git/
----

Looks as if the repository was created as expected:

----
$ ls -la .git
total 11
drwx------+ 1 myusername 213  0 Jan 28 13:15 .
drwx------+ 1 myusername 213  0 Jan 28 13:15 ..
-rwx------  1 myusername 213 36 Jan 28 13:15 config
-rwx------  1 myusername 213 73 Jan 28 13:15 description
-rwx------  1 myusername 213 23 Jan 28 13:15 HEAD
drwx------+ 1 myusername 213  0 Jan 28 13:15 hooks
drwx------+ 1 myusername 213  0 Jan 28 13:15 info
drwx------+ 1 myusername 213  0 Jan 28 13:15 objects
drwx------+ 1 myusername 213  0 Jan 28 13:15 refs

$ git fsck
notice: HEAD points to an unborn branch (master)
Checking object directories: 100% (256/256), done.
notice: No default references
----

The experiment with `git init` showns that Git can
create ordinary files and directories just fine.


The problem appears when Git tries to `chmod config.lock`. Sounds
like a mechanism to protect `.git/config`, so let's see what
happens if I try to use `git config` to modify that file:

----
git config user.email myusername@xyz.org
error: chmod on /cygdrive/c/base/bar/.git/config.lock failed: Invalid argument
----

That narrows it down a bit. When modifying `.git/config`, Git
creates a temporary file `config.lock` and immediately tries to
do `chmod 0777 config.lock` (or any other permission set), which fails.


===== On Jan 27 08:30, Ken Brown wrote:
> There might be a problem with the default ACL on the directory
> /cygdrive/c/base.

The directory is one of my usual base directories for git repos.
I have not knowingly changed any permissions or ACLs there.
The experiments with `git init` above show that the base dir is not
to blame, IMO.

I am logged in as my usual Windows user, unchanged in years.

 whoami
 myusername

> What does 'getfacl /cygdrive/c/base' show?

----
cd base

getfacl .
# file: .
# owner: myusername
# group: 213 <unknown>
user::rwx
user:myusername:rwx
group::r-x
mask:rwx
other:r-x
default:user::rwx
default:user:myusername:rwx
default:group::r-x
default:mask:rwx
default:other:r-x
----

===== Corinna Vinschen wrote on Wed, 27 Jan 2016 15:53:14 +0100:

> The setup of the ACL may give us a hint why git apparently
> fails to create the bar subdir.

I assume that Git did not fail to create the directory, it just
removed it again when the clone failed.

> what does the native windows icacls command print for that
> directory?

----
$ icacls .
. myhostname\myusername:(F)
  myhostname\None:(RX)
  Everyone:(RX)
  myhostname\myusername:(I)(OI)(CI)(F)

Successfully processed 1 files; Failed processing 0 files
----

I assume that means that myusername has (F)ull control.

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

             reply	other threads:[~2016-01-28 13:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-28 14:44 Rainer Blome [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-01-28 14:31 git clone fails with: error: chmod on config.lock failed: Invalid argument Corinna Vinschen
2016-01-28 15:52 ` chmod failed: Invalid argument [was: git clone fails with: error: chmod on config.lock failed: Invalid argument] Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-cbf47259-7226-4e63-a653-2bbe8e064933-1453988667017@3capp-gmx-bs39 \
    --to=rainer.blome@gmx.de \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).