User:KeshaSShah/GSoC13/Reports

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

August 1

  • While trying to compile, it showed error and I figured out that applying astyle , the CMakelsit.txt had been changed, which was in pushed on github. Worked upon restoring the styling in CMakeLists.txt
  • Included headers for src/base in include directory of install. Checked it.
  • Now, when I run sudo make install after building the source, an sc-install folder is created in the same place as that of the stepcode repo and sc-install/include/base contains all headers for src/base.
  • http://paste.kde.org/pfbf685b6/ :)
  • The headers of src/expp and src/express were already being installed.
  • Made a new branch for issue 235.
  • pushed first commit of this issue to ks/installHeaders
  • If this is alright, I will move forward with installing headers of from other directories.

August 2

Week 8

August 5

August 6

August 7

  • School + first day coaching
  • Delivered a talk in IEEE/IAS DA-IICT
  • Took a session for orientation of Juniors in programming club as I am in core committee.
  • Too tired. Just read the mails and figured out what next.

August 8

  • Making changes in the existing commit or deleting a branch would lose the comments, hence Mark told to use git cherrypick / squash or fixup them
  • I used the second option and continued editing and committing.
  • In the install headers, in the destination, changed the path from CMAKE_INSTALL_HEADERS/* to CMAKE_INTSALL_HEADERS/stepcode/*
  • Used "NOT DEFINED" to check if the variables exist or not. In my previous approach, it would work bad if the value was set to true/false
  • Installed headers for some more like src/cllazyfile , src/clutils and src/clstepcore
  • For src/exppp and src/express, the headers were already included while 'make install'
  • For src/fedex_plus and src/fedex_python, I am not able to figure out what exactly to do.
  • Another issue I am facing is, whenever I try to push from the local branch to repo on github, it always rejects first saying it a non-fast-forward update. Then I do it using -f option.

August 9

  • Net breakdown. Conveyed what I had done and what needs to be done,

but there was a little communication gap as per Sean.

Week 9

August 12

  • Clarified the prev mail.
  • the branch is ready to be merged in mainstream :)
  • For headers in fedex_plus and fedex_python, "Headers need to be installed for libraries, so that executables that make use of the library can be compiled. It isn't possible to link one executable with another, so headers for executables do not need to be installed."
  • In ks/headers issue, the headers of exppp and express which were installed already was not in the correct directory, they need to be in include/stepcode/*. Change that.
  • There are two generated headers that should be installed; when you run CMake, they are created in build/include. Install them to include/stepcode

August 13

  • Figured out a nicer way. Instead of adding the FILES directly, if we can create a variable who stores the info of all header files, then it would be more readable and expandable.
  • Adding that in all the commits.
  • Also, adding two generated headers in /include/stepcode/*
  • Changing the path for exppp and express.

August 14

  • changed path where headers of exppp and express were included .../stepcode/...
  • exppp and express were not using ${INCLUDE_INSTALL_DIR}. Done that
  • generated headers from build/include/* included
  • other headers from stepcode/include/*.h also included
  • https://github.com/stepcode/stepcode/commits/ks/headers - the link to commits on github

August 15

  • The build location was hardcoded and can be anywhere in user's system, so make use of CMakeVariable that uses the location of build directory
  • Found that variable, cmake_binary_dir / cmake_current_binary_dir --> build/

and cmake_source_dir / cmake_current_source_dir --> stepcode/

  • Tried hard but couldn't work it out.

August 16

  • Finally figured out the problem. Silly me, in include/CMakeLists.txt I didn't include {$variable} and was getting it false.
  • Corrected that and committed it.
  • Tested it. It seems to have installed correctly.
  • A small confusion- the extraheaders in include/ should be in sc-install/install/* or sc-install/install/stepcode/* . Right now, kept in first one.

Week 10

August 19-20

  • Continued with the work of Issue 235.
  • Worked in the direction as per comments.
  • Pushed it on github.
  • Generated Pull requested.

August 21-August 23

  • University midterm 1 exams
  • 3 papers down, two to go

Week 11

August 26-27

  • University midterm 1 exams
  • All done

August 28

August 29

August 30

  • Discussion with Sean on IRC to understand what needs to be done.
  • Updating trunk
  • Compiling and building. Successfully ran mged and archer from source.
  • Next goal: Understanding geometry conversions.
  • Manual 4- Geometry Conversion
  • http://brlcad.org/private/geometry/
  • Manual 2- MGED. Playing with geometry in mged.

August 31

  • "pick a few of the importers, say dxf-g, 3dm-g, and stl-g.find some geometry, import them, view them. its' not just to look at it -- it's to understand what you imported, how you specified that import, what hierarchy resulted after import. grabcad.com has a ton of stuff. google can give you lots of stuff (just search for "filetype:obj truck" or "filetype:dxf boat" for example)"
  • "once you're comfortable and AFTER you've used three other converters, give the step-g importer a try on something 1) using 7.22.0 then 2) using trunk"