tiny-care-terminal icon indicating copy to clipboard operation
tiny-care-terminal copied to clipboard

Crash when counting commits in multiple repos

Open AndiDog opened this issue 7 years ago • 16 comments

Node Version: v7.2.1 tiny-core-terminal version: 1.0.8 Shell: bash Terminal Program: iTerm2 Operating System: macOS

I have quite a few repos in ~/dev. The dashboard starts up, starts counting commits for a second and then crashes. Using TTC_REPOS=/single/repo works fine for the ones I tried. Didn't try very hard to debug into the blessed library since I don't know what the code is doing. What I can tell you that at that given code location in blessed (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/program.js:2543), we have part == "cpp" and val == "cpp".

Unsetting env vars other than TTC_REPOS doesn't make a difference.

$ set | grep TTC
TTC_APIKEYS=false
TTC_BOTS=tinycarebot,selfcare_bot
TTC_REPOS='~/dev'
TTC_WEATHER=Munich
$ tiny-care-terminal
TypeError: Cannot read property 'slice' of null
    at /usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/program.js:2543:35
    at Array.forEach (native)
    at Program._attr (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/program.js:2542:11)
    at Box.Element._parseTags (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/widgets/element.js:498:26)
    at Box.Element.parseContent (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/widgets/element.js:393:22)
    at Box.Element.render (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/widgets/element.js:1839:8)
    at /usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/widgets/screen.js:738:8
    at Array.forEach (native)
    at Screen.render (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/widgets/screen.js:735:17)
    at Socket.week.stdout.on.data (/usr/local/lib/node_modules/tiny-care-terminal/care.js:120:12)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20)

AndiDog avatar Apr 22 '17 09:04 AndiDog

It looks like you only have 2 bots in TTC_BOTS -- i think that's where the slice is failing, maybe. Might adding a third?

notwaldorf avatar Apr 22 '17 19:04 notwaldorf

I also tried with the default TTC_BOTS and an empty value. As mentioned, only the TTC_REPOS variable affects this issue.

AndiDog avatar Apr 23 '17 11:04 AndiDog

I really can't repro this, nor have heard of anyone else having problems in this way :(

notwaldorf avatar Apr 26 '17 19:04 notwaldorf

Then I'm happy for everyone else 👍 I'll leave this open and try to debug myself.

AndiDog avatar Apr 27 '17 07:04 AndiDog

As of version 1.2.0 there's a new way to use the terminal that doesn't involve the bash script/ Would you mind updating to that and setting the TTC_GITBOT environment variable to gitlog, to see if that fixes your problems?

notwaldorf avatar May 14 '17 00:05 notwaldorf

The problem resolved on its own recently. Hard to find out afterwards what the real reason was (such as the state of my 200+ Git repos)... 1.2.0 is also working fine for me. We can close this and hope it doesn't happen anymore ;) Thanks!

AndiDog avatar May 16 '17 10:05 AndiDog

I'm also getting this error, and it's caused by a specific one of my git repos, it seems. :cry:

jarednorman avatar Jun 21 '17 22:06 jarednorman

@jarednorman I've noticed I couldn't use a git repo with a dot in the name. Maybe it's that? :(

notwaldorf avatar Jun 21 '17 22:06 notwaldorf

No dot or any other weird characters. It's just of the format "fooBar".

jarednorman avatar Jun 21 '17 23:06 jarednorman

I've noticed I couldn't use a git repo with a dot in the name. Maybe it's that? :(

@notwaldorf Is this a git-log or an git-standup issue? I think this should be fixed!

mojoaxel avatar Jun 22 '17 07:06 mojoaxel

Changing between git-log/git-standup has no effect on the error for me. The only thing that changes whether I get this error is whether I include this one repo I have in TTC_REPOS.

jarednorman avatar Jun 22 '17 16:06 jarednorman

Mysteriously just started working today. :confounded:

jarednorman avatar Jun 28 '17 17:06 jarednorman

I had the same problem, and traced it to curly braces in the commit messages wreaking havoc with the "tag parser" implemented in the blessed library. The simplest fix is to set tags: false in makeBox(), but I'm not sure if there is an unrelated reason it needs to be set to true. The alternative is to do something like content = content.replace(/[{}]/g, m => m === '{' ? '{open}' : '{close}'); inside getCommits(). Happy to submit a tiny-PR if you let me know which solution you think would be more appropriate :)

cfinucane avatar Sep 05 '17 23:09 cfinucane

I also had this problem with just one repo, which had curly braces in commit messages. I applied @cfinucane's patch and it works. 😀

timbeadle avatar Feb 22 '18 17:02 timbeadle

Having the same issue:

TypeError: Cannot read property 'slice' of null
    at /usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/program.js:2543:35
    at Array.forEach (<anonymous>)
    at Program._attr (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/program.js:2542:11)
    at Box.Element._parseTags (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/widgets/element.js:498:26)
    at Box.Element.parseContent (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/widgets/element.js:393:22)
    at Box.Element.render (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/widgets/element.js:1839:8)
    at /usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/widgets/screen.js:738:8
    at Array.forEach (<anonymous>)
    at Screen.render (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/blessed/lib/widgets/screen.js:735:17)
    at gitbot.getCommitsFromRepos (/usr/local/lib/node_modules/tiny-care-terminal/care.js:207:16)
    at async.each.err (/usr/local/lib/node_modules/tiny-care-terminal/gitbot.js:88:5)
    at /usr/local/lib/node_modules/tiny-care-terminal/node_modules/async/lib/async.js:52:16
    at done (/usr/local/lib/node_modules/tiny-care-terminal/node_modules/async/lib/async.js:246:17)
    at /usr/local/lib/node_modules/tiny-care-terminal/node_modules/async/lib/async.js:44:16
    at gitlog (/usr/local/lib/node_modules/tiny-care-terminal/gitbot.js:82:9)
    at /usr/local/lib/node_modules/tiny-care-terminal/node_modules/gitlog/index.js:132:5
> node -v
v8.11.2
> npm -v
5.6.0

Probably also due to commits titled like

Rename ./build{,-dev}.sh to ./webpack-build{,-dev}.sh

For me it was also "fixed" by changing the tags: option in function makeBox(label) to false. (In /usr/local/bin/tiny-care-terminal)

@AndiDog Would you reopen and apply @cfinucane 's patch? :)

LeoniePhiline avatar Jun 13 '18 20:06 LeoniePhiline

I won't find the time in the near future to work on this issue. Maybe somebody can create a pull-request? It shouldn't be that hard. :crossed_fingers:

mojoaxel avatar Jun 14 '18 07:06 mojoaxel