create account

Bug in Lterm Project (Fixed) by sachincool

View this thread on: hive.blogpeakd.comecency.com
· @sachincool · (edited)
$24.20
Bug in Lterm Project (Fixed)
[`Lterm`](https://github.com/NJACKWinterOfCode/lterm) is a  NJACK Winter of Code project. NWoC is a program that helps students understand the paradigm of Open Source contribution and gives them real world software development experience.
**Now, something about the project** :- Its a Terminal like copy but for  Website, Pretty neat eh ?
![screenshot from 2018-01-01 06-15-08](https://user-images.githubusercontent.com/25671488/34464915-1a8e3a88-eebc-11e7-8961-73b2e7d07eba.png)
![screenshot from 2018-01-01 06-15-36](https://user-images.githubusercontent.com/25671488/34464916-1acd0cc2-eebc-11e7-90d1-c13c0e8f4bf7.png)
At first i checked the project it was pretty cool so i tried more commands, as you can see after you execute every command  and press  `help` it shows  completed and not completed , probably an array of all the items with a [0,1]  value for not completed and completed.
![3](https://user-images.githubusercontent.com/25671488/34464914-1a52c2be-eebc-11e7-9e3e-0e5843645ea4.png)
Everything worked great but, When i executed the `clear`  command which *didnt* show "completed" after i execute it. it was a **BUG** .  i forked the project and went into the codebase :-
* Reading the development section of documentation i knew i had to check the js/main.js
![4](https://user-images.githubusercontent.com/25671488/34464946-e57815ac-eebc-11e7-8fc9-7d8e7a9b8010.png)
* i knew they would be having an array `arr` for  checking if the command is executed or not, initially the value was 0.
![5](https://user-images.githubusercontent.com/25671488/34464954-516df484-eebd-11e7-9f34-80a51d7c6d0d.png)
* They  changed the value to 1 on every execution like this :- `arr[6]=1;` 
 ![6](https://user-images.githubusercontent.com/25671488/34464955-51ab414a-eebd-11e7-9534-f6fa364979fa.png)
* they had a correct implementation of "clear"  command which works with "Clear"  aswell. 
![7](https://user-images.githubusercontent.com/25671488/34464956-51e85508-eebd-11e7-97d5-1da80f7d978f.png)
Then, Why didn't it worked ?  i thought about it a bit, then saw that they didnt had implemented the functionality of "clear"  command but somehow it worked when i executed, that means there must be some other file which is doing all the ground work. Soon enough i checked  the index.html and checked all the linked js files 
![8](https://user-images.githubusercontent.com/25671488/34464971-492d8d06-eebe-11e7-8fee-be0a66e3189d.png)
There was this file `terminal.min.js` which was interesting, i looked into it and searched "clear:function(){" and got the root of the problem :D 
![noname](https://user-images.githubusercontent.com/25671488/34464996-e1b22a86-eebf-11e7-87a5-d7ae299fb1df.jpeg)
Then, i added the `arr[9]=1;` but it still didnt worked like i wanted.. hmm what could be the problem this time ? 
![10](https://user-images.githubusercontent.com/25671488/34464999-0892aedc-eec0-11e7-9ddf-67fb8f59e54d.png)
Maybe the file is not able to access arr ?  But it's declared `var arr`  It should be global, i searched on StackOverflow  and found an alternative,  `window.arr`  could also make a  variable globally  accessible. Hmm let's try it in the `main.js` file
![11](https://user-images.githubusercontent.com/25671488/34465013-66c37400-eec0-11e7-8f41-53d7182f5469.png)
And Violla  executing the `clear` or `Clear` command works just as it should be.
![12](https://user-images.githubusercontent.com/25671488/34465017-a4fe6720-eec0-11e7-9871-558818d93cdf.png)
![13](https://user-images.githubusercontent.com/25671488/34465018-a54590e6-eec0-11e7-8441-1d1f2375ba6b.png)
Here's My PR for the related *bug* :- [PR](https://github.com/NJACKWinterOfCode/lterm/pull/9) 
Thankyou for  reading, If you liked it  please press the thumbs up  :+1:
Always  Keep Sharing, Keep Exploring :) 
Have a Nice day and  a Happy New Year!!


<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@sachincool/bug-in-lterm-project-fixed">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorsachincool
permlinkbug-in-lterm-project-fixed
categoryutopian-io
json_metadata"{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"score":41.847084,"default_branch":"master","watchers":1,"open_issues":3,"forks":10,"license":null,"open_issues_count":3,"archived":false,"mirror_url":null,"forks_count":10,"has_pages":false,"has_wiki":true,"has_downloads":true,"has_projects":true,"has_issues":true,"language":"JavaScript","watchers_count":1,"stargazers_count":1,"size":181,"homepage":"https://sr6033.github.io/lterm/","svn_url":"https://github.com/NJACKWinterOfCode/lterm","clone_url":"https://github.com/NJACKWinterOfCode/lterm.git","ssh_url":"git@github.com:NJACKWinterOfCode/lterm.git","git_url":"git://github.com/NJACKWinterOfCode/lterm.git","pushed_at":"2017-12-31T13:39:11Z","updated_at":"2017-12-22T07:16:22Z","created_at":"2017-11-25T23:09:11Z","deployments_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/deployments","releases_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/releases{/id}","labels_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/labels{/name}","notifications_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/notifications{?since,all,participating}","milestones_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/milestones{/number}","pulls_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/pulls{/number}","issues_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/issues{/number}","downloads_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/downloads","archive_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/{archive_format}{/ref}","merges_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/merges","compare_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/compare/{base}...{head}","contents_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/contents/{+path}","issue_comment_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/issues/comments{/number}","comments_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/comments{/number}","git_commits_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/git/commits{/sha}","commits_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/commits{/sha}","subscription_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/subscription","subscribers_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/subscribers","contributors_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/contributors","stargazers_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/stargazers","languages_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/languages","statuses_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/statuses/{sha}","trees_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/git/trees{/sha}","git_refs_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/git/refs{/sha}","git_tags_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/git/tags{/sha}","blobs_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/git/blobs{/sha}","tags_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/tags","branches_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/branches{/branch}","assignees_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/assignees{/user}","events_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/events","issue_events_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/issues/events{/number}","hooks_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/hooks","teams_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/teams","collaborators_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/collaborators{/collaborator}","keys_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/keys{/key_id}","forks_url":"https://api.github.com/repos/NJACKWinterOfCode/lterm/forks","url":"https://api.github.com/repos/NJACKWinterOfCode/lterm","fork":true,"description":"Online bash terminal(emulator) tutorial. A step by step tutorial for the bash shell.","html_url":"https://github.com/NJACKWinterOfCode/lterm","private":false,"owner":{"site_admin":false,"type":"Organization","received_events_url":"https://api.github.com/users/NJACKWinterOfCode/received_events","events_url":"https://api.github.com/users/NJACKWinterOfCode/events{/privacy}","repos_url":"https://api.github.com/users/NJACKWinterOfCode/repos","organizations_url":"https://api.github.com/users/NJACKWinterOfCode/orgs","subscriptions_url":"https://api.github.com/users/NJACKWinterOfCode/subscriptions","starred_url":"https://api.github.com/users/NJACKWinterOfCode/starred{/owner}{/repo}","gists_url":"https://api.github.com/users/NJACKWinterOfCode/gists{/gist_id}","following_url":"https://api.github.com/users/NJACKWinterOfCode/following{/other_user}","followers_url":"https://api.github.com/users/NJACKWinterOfCode/followers","html_url":"https://github.com/NJACKWinterOfCode","url":"https://api.github.com/users/NJACKWinterOfCode","gravatar_id":"","avatar_url":"https://avatars0.githubusercontent.com/u/33991322?v=4","id":33991322,"login":"NJACKWinterOfCode"},"full_name":"NJACKWinterOfCode/lterm","name":"lterm","id":112040898},"pullRequests":[],"platform":"github","type":"bug-hunting","tags":["utopian-io","happy-new-year","web-based-terminal","open-source"],"users":["sachincool"],"links":["https://github.com/NJACKWinterOfCode/lterm","https://user-images.githubusercontent.com/25671488/34464915-1a8e3a88-eebc-11e7-8961-73b2e7d07eba.png","https://user-images.githubusercontent.com/25671488/34464916-1acd0cc2-eebc-11e7-90d1-c13c0e8f4bf7.png","https://user-images.githubusercontent.com/25671488/34464914-1a52c2be-eebc-11e7-9e3e-0e5843645ea4.png","https://user-images.githubusercontent.com/25671488/34464946-e57815ac-eebc-11e7-8fc9-7d8e7a9b8010.png","https://user-images.githubusercontent.com/25671488/34464954-516df484-eebd-11e7-9f34-80a51d7c6d0d.png","https://user-images.githubusercontent.com/25671488/34464955-51ab414a-eebd-11e7-9534-f6fa364979fa.png","https://user-images.githubusercontent.com/25671488/34464956-51e85508-eebd-11e7-97d5-1da80f7d978f.png","https://user-images.githubusercontent.com/25671488/34464971-492d8d06-eebe-11e7-8fee-be0a66e3189d.png","https://user-images.githubusercontent.com/25671488/34464996-e1b22a86-eebf-11e7-87a5-d7ae299fb1df.jpeg","https://user-images.githubusercontent.com/25671488/34464999-0892aedc-eec0-11e7-9ddf-67fb8f59e54d.png","https://user-images.githubusercontent.com/25671488/34465013-66c37400-eec0-11e7-8f41-53d7182f5469.png","https://user-images.githubusercontent.com/25671488/34465017-a4fe6720-eec0-11e7-9871-558818d93cdf.png","https://user-images.githubusercontent.com/25671488/34465018-a54590e6-eec0-11e7-8441-1d1f2375ba6b.png","https://github.com/NJACKWinterOfCode/lterm/pull/9"],"image":["https://user-images.githubusercontent.com/25671488/34464915-1a8e3a88-eebc-11e7-8961-73b2e7d07eba.png","https://user-images.githubusercontent.com/25671488/34464916-1acd0cc2-eebc-11e7-90d1-c13c0e8f4bf7.png","https://user-images.githubusercontent.com/25671488/34464914-1a52c2be-eebc-11e7-9e3e-0e5843645ea4.png","https://user-images.githubusercontent.com/25671488/34464946-e57815ac-eebc-11e7-8fc9-7d8e7a9b8010.png","https://user-images.githubusercontent.com/25671488/34464954-516df484-eebd-11e7-9f34-80a51d7c6d0d.png","https://user-images.githubusercontent.com/25671488/34464955-51ab414a-eebd-11e7-9534-f6fa364979fa.png","https://user-images.githubusercontent.com/25671488/34464956-51e85508-eebd-11e7-97d5-1da80f7d978f.png","https://user-images.githubusercontent.com/25671488/34464971-492d8d06-eebe-11e7-8fee-be0a66e3189d.png","https://user-images.githubusercontent.com/25671488/34464996-e1b22a86-eebf-11e7-87a5-d7ae299fb1df.jpeg","https://user-images.githubusercontent.com/25671488/34464999-0892aedc-eec0-11e7-9ddf-67fb8f59e54d.png","https://user-images.githubusercontent.com/25671488/34465013-66c37400-eec0-11e7-8f41-53d7182f5469.png","https://user-images.githubusercontent.com/25671488/34465017-a4fe6720-eec0-11e7-9871-558818d93cdf.png","https://user-images.githubusercontent.com/25671488/34465018-a54590e6-eec0-11e7-8441-1d1f2375ba6b.png"],"moderator":{"account":"dutch","reviewed":true,"pending":false,"flagged":false}}"
created2018-01-01 01:30:36
last_update2018-01-07 00:52:27
depth0
children5
last_payout2018-01-08 01:30:36
cashout_time1969-12-31 23:59:59
total_payout_value16.933 HBD
curator_payout_value7.271 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,982
author_reputation18,548,631,010,973
root_title"Bug in Lterm Project (Fixed)"
beneficiaries
0.
accountutopian.pay
weight2,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,297,621
net_rshares2,402,806,007,191
author_curate_reward""
vote details (45)
@dutch ·
Thank you for the contribution. It has been approved.

To answer your question, you could have posted in either category - this one is perfectly fine! Good find, and nice fix.

You can contact us on [Discord](https://discord.gg/UCvqCsx).
**[[utopian-moderator]](https://utopian.io/moderators)**
properties (22)
authordutch
permlinkre-sachincool-bug-in-lterm-project-fixed-20180101t115530016z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-01-01 11:55:30
last_update2018-01-01 11:55:30
depth1
children0
last_payout2018-01-08 11:55:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length294
author_reputation11,905,004,165,125
root_title"Bug in Lterm Project (Fixed)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,357,047
net_rshares0
@sachincool ·
P.s for Mods  I didn't  knew  whether to post it under "Bug " or "Development".  if i took the wrong choice feel free to  mention it in the reviews :) 
properties (22)
authorsachincool
permlinkre-sachincool-bug-in-lterm-project-fixed-20180101t013203824z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-01-01 01:32:06
last_update2018-01-01 01:32:06
depth1
children1
last_payout2018-01-08 01:32:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length151
author_reputation18,548,631,010,973
root_title"Bug in Lterm Project (Fixed)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,297,729
net_rshares0
@ms10398 ·
Thats a nice project!
properties (22)
authorms10398
permlinkre-sachincool-re-sachincool-bug-in-lterm-project-fixed-20180101t023801271z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-01-01 02:38:00
last_update2018-01-01 02:38:00
depth2
children0
last_payout2018-01-08 02:38:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length21
author_reputation27,572,487,973,390
root_title"Bug in Lterm Project (Fixed)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,303,137
net_rshares0
@steemengineteam ·
Hello sachincool,

@SteemEngineTeam would like to take the time to thank you for signing up and participating in our community.  Your contributions and support are important to us and we hope you will continue to use our platform.

 We plan to give back to our community members, so have an upvote on us

Thank you. 
👍  
properties (23)
authorsteemengineteam
permlinkre-bug-in-lterm-project-fixed-20180103t020639
categoryutopian-io
json_metadata""
created2018-01-03 02:06:39
last_update2018-01-03 02:06:39
depth1
children0
last_payout2018-01-10 02:06:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length316
author_reputation78,572,684,397,658
root_title"Bug in Lterm Project (Fixed)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,674,518
net_rshares484,913,527
author_curate_reward""
vote details (1)
@utopian-io ·
### Hey @sachincool I am @utopian-io. I have just upvoted you!
#### Achievements
- You have less than 500 followers. Just gave you a gift to help you succeed!
- Seems like you contribute quite often. AMAZING!
#### Suggestions
- Contribute more often to get higher and higher rewards. I wish to see you often!
- Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!
#### Get Noticed!
- Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!
#### Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER!
- <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a>
- <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a>
- Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a>

[![mooncryption-utopian-witness-gif](https://steemitimages.com/DQmYPUuQRptAqNBCQRwQjKWAqWU3zJkL3RXVUtEKVury8up/mooncryption-s-utopian-io-witness-gif.gif)](https://steemit.com/~witnesses)

**Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**
properties (22)
authorutopian-io
permlinkre-sachincool-bug-in-lterm-project-fixed-20180102t004409584z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-01-02 00:44:09
last_update2018-01-02 00:44:09
depth1
children0
last_payout2018-01-09 00:44:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,508
author_reputation152,955,367,999,756
root_title"Bug in Lterm Project (Fixed)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,459,713
net_rshares0