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]

chmod failed: Invalid argument [was: git clone fails with: error: chmod on config.lock failed: Invalid argument]


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


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