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

promptd-vcs crashes with Range exception on Mac OS X 10.10 #6

Closed
dgollub opened this issue Mar 12, 2015 · 5 comments
Closed

promptd-vcs crashes with Range exception on Mac OS X 10.10 #6

dgollub opened this issue Mar 12, 2015 · 5 comments

Comments

@dgollub
Copy link
Contributor

dgollub commented Mar 12, 2015

Hi,

I just cloned the repo, ran make and promptd-vcs fails with an exception. This is on Mac OS X 10.10.

make clean && make
rm -f promptd-path promptd-vcs *.o
dmd -wi -g -debug -ofpromptd-path promptd-path.d help.d
dmd -wi -g -debug -ofpromptd-vcs promptd-vcs.d help.d git.d color.d

$ export PS1="\$(promptd-path) \$(promptd-vcs) % "
[email protected](144): Range violation
----------------
5   promptd-vcs                         0x0000000107448034 D3git7__arrayZ + 44
6   promptd-vcs                         0x000000010746551f void git.asyncGetFlags(core.time.Duration).processPorcelainLine(immutable(char)[]) + 47
7   promptd-vcs                         0x0000000107465365 git.StatusFlags git.asyncGetFlags(core.time.Duration) + 533
8   promptd-vcs                         0x000000010746513e git.RepoStatus* git.getRepoStatus(core.time.Duration) + 270
9   promptd-vcs                         0x0000000107464d3c immutable(char)[] git.stringRepOfStatus(core.time.Duration, std.typecons.Flag!("UseColor").Flag, color.Escapes) + 28
10  promptd-vcs                         0x0000000107447f2c _Dmain + 396
11  promptd-vcs                         0x000000010747bf78 D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40
12  promptd-vcs                         0x000000010747bebd void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 45
13  promptd-vcs                         0x000000010747bf1d void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() + 45
14  promptd-vcs                         0x000000010747bebd void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 45
15  promptd-vcs                         0x000000010747be39 _d_run_main + 433
16  promptd-vcs                         0x0000000107447f72 main + 34
17  libdyld.dylib                       0x00007fff923135c9 start + 1
18  ???                                 0x0000000000000001 0x0 + 1

export PS1="$ "

$ git log --pretty=format:'%h' -n 1
1a75041

This also happens for the tag v0.3.

@mrkline mrkline added the bug label Mar 12, 2015
@mrkline
Copy link
Owner

mrkline commented Mar 12, 2015

Thanks for reporting this!

By the looks of it, promptd is assuming the output from git status --porcelain is at least two characters long, which it should be according to the docs. Perhaps git status --porcelain doesn't print anything and OSX is handling signals differently than Linux, causing us to try to read a nonexistent line.

Could you give the output of git status --porcelain in whatever directory was causing the crash?

@dgollub
Copy link
Contributor Author

dgollub commented Mar 13, 2015

Hi,

git status --porcelain does not output anything for me.

Here is some more info/output:

$ git status
HEAD detached at v0.3
nothing to commit, working directory clean
$ git status --porcelain
$ git --version
git version 2.3.2
$ which git
/usr/local/bin/git

I installed git through homebrew. Hope this helps.

dgollub added a commit to dgollub/promptd that referenced this issue Mar 16, 2015
empty git status --procelain output doesn't crash prompt-vcs any
longer
mrkline added a commit that referenced this issue Mar 16, 2015
Simple fix for issue #6 that fixes the crash when git-status --porcelain outputs nothing
@mrkline
Copy link
Owner

mrkline commented Mar 16, 2015

Thanks for resolving this! Out of curiosity, could you try out the branch alternate-osx-fix and see if that also fixes the problem? I have a suspicion that Linux and OSX have different behavior for poll when git status closes the other end of the pipe, and since I don't own a Mac, I can't experiment myself.

@dgollub
Copy link
Contributor Author

dgollub commented Mar 17, 2015

Hi Matt,

Tried the alternate-osx-fix branch and that works for me. Thanks.

Sorry about the spaces vs tabs mixup in my pull-request. I totally forgot that my vim settings are set to use spaces instead of tabs for indentation. I'll be more careful in the future.

@mrkline
Copy link
Owner

mrkline commented Mar 17, 2015

Don't worry about the little stuff. I'm just humbled that other people are using my software and submitting patches for it. Thanks to you, it runs on another OS!

@mrkline mrkline closed this as completed Mar 17, 2015
mrkline added a commit that referenced this issue Mar 17, 2015
Tested and working according to a Mac user:
#6 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants