Bug 976740 - Execute permission of ".openshift/action_hooks/build" lost after git push in Windows but not in Linux
Execute permission of ".openshift/action_hooks/build" lost after git push in ...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Image (Show other bugs)
2.x
Unspecified Windows
medium Severity low
: ---
: ---
Assigned To: Michal Fojtik
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-21 06:45 EDT by Lei Zhang
Modified: 2015-05-14 20:33 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-23 22:22:35 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lei Zhang 2013-06-21 06:45:54 EDT
Description of problem:
On Windows-8, the execute permission of build action_hooks will be lost during git push. But for linux, it won't happen in linux.

Version-Release number of selected component (if applicable):
INT(deven_3395)
rhc-1.10.5
ruby-2.0
window-8
Git Bash

How reproducible:
alway

Steps to Reproduce:
1. use "git bash" tool, rhc app create mypy26 python-2.6
2. cd mypy26 and echo "date" >.openshift/action_hooks/build
3. ls -l .openshift/action_hooks/build and find the permissoion of file is 755
4. git add -A && git commit -amp && git push
5. the permission of ".openshift/action_hooks/build" changed into 644 during git push

Actual results:
build action_hooks lose execute permission during git push and didn't execute during deploying. 

Expected results:
build action_hooks should have execute permission during git push and will execute during deploying. 

Additional info:

openshift@OPENSHIFT-WIN8 ~/mypy26 (master)
 $ ls -l  .openshift/action_hooks/build
-rwxr-xr-x    1 openshif Administ      154 Jun 21 10:30 .openshift/action_hooks/
build
openshift@OPENSHIFT-WIN8 ~/mypy26 (master)
$ git add -A && git commit -amp && git push
warning: LF will be replaced by CRLF in .openshift/action_hooks/build.
The file will have its original line endings in your working directory.
[master bc8fd86] p
warning: LF will be replaced by CRLF in .openshift/action_hooks/build.
The file will have its original line endings in your working directory.
 1 file changed, 10 insertions(+)
  create mode 100644 .openshift/action_hooks/build
Comment 1 Michal Fojtik 2013-09-04 08:44:33 EDT
There are two possible workarounds for this:

$ git config core.filemode false

<cite>
   core.fileMode
       If false, the executable bit differences between the index and the
       working copy are ignored; useful on broken filesystems like FAT.
       See git-update-index(1). True by default
</cite>

OR to fix file permissions on Windows:

$ git update-index --chmod=+x <file>

Is this reasonable workaround for you or do you think we should do more care on openshift side?
Comment 2 Lei Zhang 2013-09-05 02:42:16 EDT
Yeah, Thanks for your workaround. I use 'git update -index --chmod+x <file>', and git push .openshift/action_hooks/build, It can be executed. I also don't think we should do more care, since action_hooks build can work on windows
Comment 3 Michal Fojtik 2013-11-05 06:58:11 EST
No changes needed on the Cartridge side for this. I added documentation note for Windows users:

https://github.com/openshift/origin-server/pull/4088
Comment 4 openshift-github-bot 2013-11-05 08:08:56 EST
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/17e3f3577c68b67b30719ed22bf8b2da8b251d75
Bug 976740 - Document the wrong permissions of action hooks on Windows
Comment 5 Lei Zhang 2013-11-05 21:12:59 EST
Verified on devenv_3992, related doc has been changed.

origin-server/documentation/oo_user_guide.adoc

Note: On Windows, the execute permissions of an action hook files will be lost during
the git push. To fix this problem, you can run this command:

----
# git update-index --chmod=+x .openshift/action_hooks/*
# git push
----

Note You need to log in before you can comment on or make changes to this bug.