Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash under cygwin with configured git-up.rebase.log-hook #80

Closed
fj128 opened this issue Aug 22, 2018 · 1 comment
Closed

Crash under cygwin with configured git-up.rebase.log-hook #80

fj128 opened this issue Aug 22, 2018 · 1 comment
Labels

Comments

@fj128
Copy link

fj128 commented Aug 22, 2018

When running under cygwin, with git and python from cygwin, and configured git-up.rebase.log-hook (echo "changes on $1:"; git lg $1..$2; git diff --stat $1..$2 for the record) git up crashes after rebasing because it tries to run the log hook from a batch file with no execute permission bit set (of course then it wouldn't work anyway because it's a windows batch file probably):

Fetching origin
feature fast-forwarding...
Traceback (most recent call last):
  File "/usr/bin/git-up", line 11, in <module>
    load_entry_point('git-up==1.5.0', 'console_scripts', 'git-up')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/PyGitUp/gitup.py", line 658, in run
    gitup.run()
  File "/usr/lib/python2.7/site-packages/PyGitUp/gitup.py", line 201, in run
    self.rebase_all_branches()
  File "/usr/lib/python2.7/site-packages/PyGitUp/gitup.py", line 288, in rebase_all_branches
    self.log(branch, target)
  File "/usr/lib/python2.7/site-packages/PyGitUp/gitup.py", line 392, in log
    [bat_file.name, branch.name, remote.name]
  File "/usr/lib/python2.7/subprocess.py", line 168, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1025, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied

This is because it's using the ON_WINDOWS flag https://github.com/msiemens/PyGitUp/blame/master/PyGitUp/gitup.py#L48 for two distinct purposes: 1) to work around the colorama bug(?) when running in Windows console (see #24), and 2) to execute the hook from a batch file when running from under cmd.exe shell. And while cygwin might count as windows for (1), it definitely doesn't for (2).

But I'm not sure that (1) is still relevant. I checked and replacing that line with ON_WINDOWS = sys.platform == 'win32' (or in ['win32'], but not in ('win32'), I did that at first) not only fixed this bug but also colorized the output! And it worked perfectly both in mintty and when starting cygwin bash from cmd.exe (note: use bash --login -i or weird things happen). So I'd do that unless there are other concerns.

@msiemens msiemens added the bug label Sep 13, 2018
@msiemens
Copy link
Owner

Thanks for the comprehensive and helpful bug report! I've release v1.5.1 which applies the fix you described 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants