Bug 976740 - Execute permission of ".openshift/action_hooks/build" lost after git push in Windows but not in Linux
Summary: Execute permission of ".openshift/action_hooks/build" lost after git push in ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Image
Version: 2.x
Hardware: Unspecified
OS: Windows
medium
low
Target Milestone: ---
: ---
Assignee: Michal Fojtik
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-21 10:45 UTC by Lei Zhang
Modified: 2015-05-15 00:33 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-24 03:22:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Lei Zhang 2013-06-21 10:45:54 UTC
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 12:44:33 UTC
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 06:42:16 UTC
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 11:58:11 UTC
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 13:08:56 UTC
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-06 02:12:59 UTC
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.