Difference between revisions of "User:KeshaSShah/GSoC13/Reports"

From BRL-CAD
(July 30)
(Week 7)
Line 294: Line 294:
 
*Reading now cmake documentation to figure out how installation works - http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:install
 
*Reading now cmake documentation to figure out how installation works - http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:install
  
http://www.cmake.org/Wiki/CMake_Useful_Variables
+
==July 31==
 +
* http://www.cmake.org/Wiki/CMake_Useful_Variables
 +
* Worked upon the changes suggested by Mark on github commits
 +
* Looking for the best place to install headers for the issue - https://github.com/stepcode/stepcode/issues/235
 +
* Now, I have kept a dummy DESTINATION, and tried to install those headers. Got the way to do it.
 +
* http://paste.kde.org/p95cd4501/
 +
* Last line has to be changed.

Revision as of 08:41, 31 July 2013

Week (-1) : Familiarizing Phase

April 19-22

  • Joined #brlcad channel on IRC
  • Subscribed to mailing list
  • Introduced myself to the community through mailing list
  • Downloaded Source Code
  • Compiled it successfully from the source using cmake
  • Made an account on SVN.
  • Had a glance at source folder and caught my eyes on an instance of duplication.
  • Made first patch and submitted it.
  • Looked through project ideas and found Code Refacoring most interesting and suitable for me.

April 23-30

  • University Final Exams

May 1

  • Checked out some TODO task in the domain of Code Reducing and Refactoring.
  • Picked up moving LIBWBD comments.
  • Used the grep command to find out the comments that needed to be moved.
  • Within just 10 minutes, I was able to successfully move all comments and submitted another patch
  • Discussed with Sean about my interest when he encouraged me to explore converting and processing geometry.

May 2

  • Read tutorial I and then tutorial IV on Converting Geometry and recieved some basic idea on STEP and other convertors available for importing and exporting between different CAD softwares.
  • Gone through project ideas again and liked two more ideas-namely Improving STEP Library and STEP AP242 Parser.

May 3

  • Proposal Submission Deadline on melange.
  • Made my User-Wiki-pages
  • Uploaded proposal on Melange and embedded wiki links in it.

May 4-5

May 6-8

  • Picked up Issue #47 to work upon.
  • Made a list of differences between pair of 13 similar files.
  • Untangles some calls from src/fedex_plus to src/clstepcore.
  • Discussed on IRC about the errors I encounter.
  • Read about how calls are made, maintainence of call-stack heap, the process of linking and Compiler warnings
  • Overall, have got some better understanding.

May 9

  • Installed doxygen and looked up some example codes.(for documentation part)
  • Made a test-bot for IRC #stepcode (it functionalities still remaining to be discussed with mentors.)

May 10-11

  • Read from some references and manuals and gone through cheat-sheet for learning GIT and GITHUB. (add, branch, commit, push, pull, reset, log etc.)
  • Installed gitk and used it.
  • Assigned #47 issue to myself.
  • Made a branch and committed and push the removal of 5 similar functions.
  • Revised some concept like virtual, pure functions, friend functions, use of const and static, extern etc.
  • Discussed with Mark for logs and bot of #stepcode on IRC
  • Reading doxygen manual.

May 12

  • Almost done with issue #47. Pushed the commits on branch ks-duplicate-files.
  • Known about the Debugger gdb- used back-trace feature.
  • Quick Guide to gdb Debugger.
  • Installed KDevelop IDE and planning to use it as it has nicer gdb GUI wrapper.

May 13-14

  • Getting "Abort (core dumped)" error. Pushed it to a new branch for Mark to review it.
  • Picked new issue #200.

May 15

  • Got Doxygen working correctly and tried few samples. Read manual to see how to comment.

May 17

  • Surfed for lazy-loading. Reading the process of loading (ch 7) of Bryant book.

May 18-May 26

(

Week 0

May 27

  • Accepted Students announced on Melange. Yupiie, selected ! :)

May 28-June1

  • I fully confirm and accept the stated participation requirements including giving full rights to my contributions, remaining visibly active, being engaged in discussion, providing regular updates on progress, complying with the development rules, and writing excellent code.
  • Reading Hacking Guide.
  • Will be returning on 5th June from di's marriage
  • Next Target: Obtain commit access till 17th June (before gsoc program begins)

June 2-June 16

  • Community Bonding Period.
  • Preparation of Release 7.24.0 - Release Note

Week 1

June 17

  • Worked upon Issue 21: Removed 100 warnings, errors and styles shown by cppcheck from about total 455.
  • I ran "rm -r *" from stepcode/ instead of build/, and cloned the repo again in stepcode/ through which I lost all my progress. Thanks to git cherry-pick command, through which i recovered it back ! #sighofrelief

June 18

  • Looked upon 100 more cppchecks to solve Issue 21.
  • Strangely, many cppchecks claimed wrong warnings. Like, a warning says, the varaible was not used, but in later part of the code, it was actually used.
  • Learnt not to believe any warnings blindly unless looking upon the code.
  • (Now onwards, my phone's low battery warning is the only warning I will take seriously :P #alighthumour)
  • Github issue - The branch I am working doesn't have master changes, so after this issue completes, I will clone repo again and use the freshly cloned directory's .git/ folder.
  • IRC log.

June 19

June 20

  • Done with issue 21. All genuine warnings have been successfully removed.
  • The ones which remain are due to bugs in cppcheck. Cppcheck says some variables unused though it has been used, says many functions have not been used, shows some warnings in generated files(generated files can't be changed obviously)
  • To ensure all test are running fine as before and nothing has been broken, compiled with testing enable and ran 'make test'. All test are working correctly as before. :)

June 21

  • Will push the change to github repo for Mark to review it once, and then it will be merged with master branch. Issue 21 can be closed now.
  • Next thing to work on is - STEPcode 0.7 doesn't install all required headers. All .h files need to be in /usr/lib or whatever the install prefix is.So you don't need to reinstall in order to add schemas.Then you could just sudo make install and start using the API:s like any other library.
  • CMake Tutorial

June 22

  • Updated this page for all the participants, for the release purpose.
  • Reviewed the comments by Sean on patch and made a new patch for that.
  • Got mail from Mark to add myself into AUTHORS file :)

June 23

  • Solved the error regarding #214 testcase showing failed while 'make test'.
  • Known git add -p command. Its awesome !

Week 2

June 24

  • Cloned stepcode @ 4kbps speed ! #crazymoments
  • Looked for cmake installations

June 25

  • Problem with transferring .git/ folder - The changes after the repo was cloned are also being shown in diff, which were not made by me.
  • Still to figure out how to apply just a small subset among them
  • Known about Cool IRC apps for mobile. #feelingblessed

June 26

  • Solved the git problem after smashing head for 2 hrs. Reason was I ran 'git init ' after cloning the repo.
  • Sorting out commits with the same kind of patches in them.
  • Like, all unused variable in one commit, all scope reducing in one commit, all strncpy() in one commit, all memory leaks in one commit, all C-style pointers removing in one commit etc.
  • Pushing that to a new branch ks-cppcheck

June 27

  • Mark suggested not to change src/base/judy

a) it will make it harder to merge upstream changes, and b) that code is particularly complex; some of the changes the author has made to fix bugs have been very subtle.

  • There is a way to rewrite commits,yet left to figure it out.

June 28

  • Unused Variable-Don't just comment out unused variables. If there is no possibility of side effects (i.e. they aren't initialized via a function call), remove them. In case of doubts, delete them and then make a note on github by clicking the message bubble by the line.Oops, no point in modifying clSchemas/* either. I should probably just delete that, since it's old generated code.Other than this and the commented out variables, it looks good.
  • Reducing Scope-Looks good, except there are some lines that were commented out instead of being deleted.
  • Closing file-Closing the files doesn't hurt, but at that point the program is definitely about to exit. I'm not sure if I would put the effort in to fix the warning.
  • Increment/Decrement-I assume you changed these because of a message like "(performance) Prefer prefix ++/-- operators for non-primitive types."That means change 'x++' (++ is the suffix) to '++x' (++ is the prefix). I had to look this one up; the latter is more efficient due to the language spec, which affects how compilers usually implement prefix operator++.\
  • Strncpy NULL terminated- Looks good.
  • C-style pointer casting- %50c is almost certainly incorrect, and %50s may be too limiting.Adding arbitrary magic numbers like this is really bad in the long term. They're just bugs waiting to present themselves later in very hard-to-discover ways. The usual fix for insecure coding detection from static analyzers is to do manual parsing. We have a replacement in BRL-CAD (src/libbu/sscanf.c) that could be translated to stepCode string data structures, and which prevent the buffer overrun issue of sscanf().

Week 3

July 1

  • Found out solution for modifying prev commits, and editing them using 'git rebase -i' and change pick to edit. Then use commands git commit --amend and git rebase --continue
  • But there was some problem with the branches.
  • Also, I searched for alternative ways on internet and found something like it could be done using filter, but was not working out on my system.
  • Asked Mark to comeup on IRC at night, if possible, to resolve it.
  • Yeah, finally I have fresh 5GB refilled in my account and can use net with a pretty awesome speed again :)

July 2

  • Unfortunately, Mark and I were not online on same time and that prev thing remains.
  • So, Looked up for installation in cmake and Build Processes.

July 3

  • Pulled branch ks/CppCheck
  • Made all necessary changes listed in June 28
  • Finally, the thing worked :)

July 4-5

  • No work for upcoming two days due to placement season at college.
  • Sorry for that. I will cover up in upcoming week giving some extra time.

Week 4

July 8-9

  • Brother going to Germany tomorrow for six months, so spending time with him.
  • A small get-together at home with friends and relatives.
  • Busy with his last moment packing and all.

July 10

  • Went to airport to drop him alongwith some cousins.
  • As promised, will get back working hard from tomorrow and cover up the missed things.

July 11

  • Looking at the previous comments on the changes on github and modifying code accordingly.
  • Linking again the code in head.

July 12

  • New branch ks/cpp on github.
  • Undone all changes from src/base/judy/* , src/clprobe-ui and src/clSchemas.
  • Accidentally capitalized Schema has been changed to schema.
  • Magic Number 50 in %50s eliminated. Now, it will accept characters only till upto max BUFSIZ-1 and prevents overflow.
  • The previous conflict message taken care of.

Week 5

July 15

  • Rebasing kept on giving error, that ks/CPP is a non-fastforward branch. Cloned a fresh copy, pulled my branch from github and then it worked.
  • Tried with many sscanf examples to make sure how it actually works. And then suggested what should be done on github.
  • It checks for all failing cases of sscanf also.
  • If Mark approves, I will change it according, orelse, we will go with the present version of it.

July 16

  • Ponder through a quite tricky program - http://paste.kde.org/p5bf0a67b/raw/
  • Eventhough scanBuf has size 1, it stores a 4 size long string.
  • Puzzled why ?
  • Suprisingly on windows gcc compiler, it shows "t:)" as output of scanBuf ! :O

July 17

  • We need to change %s to %ns to avoid the overflow (where n is an integer)
    1. define BUFSIZ 99 //in real code, BUFSIZ would be set in a system header
  • const unsigned int size = BUFSIZ;
  • char fmtString[10] = {0};
  • snprintf( fmtString, 99, "%%%ds", size ); /* the first pair of % signs prints a '%', then %d prints an int, followed by 's'*/
  • fmtString now contains "%99s"

July 18

  • Tried examples from sprintf, sscanf and snprinf
  • Found answer to question in log of July 16.
  • Because pointer is passed and not the actual value.

July 19

  • Found out the value of BUFSIZ in header.
    1. define BUFSIZ _IO_BUFSIZ /* in stdio.h */
    2. define _IO_BUFSIZ _G_BUFSIZ /* in libio.h */
    3. define _G_BUFSIZ 8192 /* in _G_config.h */
  • so pushed "%8192s" in place of "%s" in sscanf, where 8192, though is hardcoded but is not actually a magic number !

Week 6

July 22

July 23

  • Reviews and suggestions :
  • Writing to the same buffer you are reading from qualifies as "undefined behavior", which means that the compiler/libc writers get to do whatever they please. It may or not behave as expected on various platforms and with different compiler/libc versions.
  • No need to worry about memory here.
  • Expand the size of character array assome platform might use a much larger number instead of 8k - such as 16k or 128k.
  • Sean suggested- std::stringstream fmtStr1; fmtStr1 << "#%%d %" << BUFSIZ-1 << "s"; ... sscanf(... fmtStr1.str().c_str(), ...);
  • Implementing with std::stringstream now.

July 24

  • Cppcheck manual and checking cppcheck for style,warning,performance, error,unused functions and variables etc in brlcad source.
  • Run the following :

cd brlcad cppcheck -isrc/other/ include/ src/ --enable=all 2>cppcheck_brlcad.txt

  • It checks for issues in 1690 files under all src/ except src/other and all include/ .
  • The manual claims that it supports multithread ( by option -j like -j 4 ), but when I tried, it said, "cppcheck: unusedFunction check can't be used with '-j' option, so it's disabled." So, if not checking for unusedFunction, it can also have mutithreaded checking.

July 25

July 26

  • A long discussion on IRC with Sean who inspired me alot on IRC as well as positive feedback on my mistakes of which I should take care of.
  • Issues discussed included - my visibility. All the technical discussions are now done through stepcode Mailing list
  • Second was my availability. I will increase the time spent on my project.
  • Thirdly, the issues and problems which I face, I should go deep and analyze the root of it.
  • Last, but not least, NULL, '\0' , 0 and nul are all different !

(The commit message made previously "strncpy() NULL terminated" was erroneous.Changed it)

Week 7

July 29

  • While adding comments to the remanants of cppcheck on my branch, I realized there were few checks which could be merged in previous commits. I did so, but later while building it, I ran into make error.
  • Asked Mark about it, but Sean motivated me that I should do it myself and that would be a great learning experience and that might be difficult at first instance, but not impossible. :)
  • Rebased the commits related to reducing scope and figured out that it was dues to src/fedex_plus/classes.c
  • Remaining cppcheck with comments here - https://github.com/stepcode/stepcode/issues/21
  • Running astyle
  • Build without error. Ran test. They were alright.
  • pushed the final version to github.
  • http://brlcad.org/wiki/Code_Cleanup#CPPCHECK-CLEANUP -> Cleaned all prefer prefix performance based issues with a patch of 2134 lines with all prefix ++/-- issues cleaned. - https://sourceforge.net/p/brlcad/patches/219/

July 30

July 31