Menu
Logged-In As
ACCOUNTNot Logged In
Make tables.c not call system(cat ...)BRL-CAD
Status: ClosedTime to complete:
48 hrs
Mentors: Sean
BRL-CAD's geometry editor (MGED) provides hundreds of functions that users can call on the command line. One of our oldest commands writes data out to text files and calls the unix "cat" command to append output to a file ... That's really bad.
This task involves replacing the three calls to system() with a call to appropriate file I/O calls or any other similar mechanism.
Code:
- src/libged/tables.c
Uploaded Work
| File name/URL | File size | Date submitted | |
|---|---|---|---|
| tables.c | 12.9 KB | December 06 2012 04:04 UTC | |
| tables.patch | 955 bytes | December 07 2012 05:22 UTC | |
| tables.patch | 973 bytes | December 07 2012 13:29 UTC | |
| tables2.patch | 973 bytes | December 07 2012 13:30 UTC | |
| tables.patch | 1.2 KB | December 09 2012 01:41 UTC | |
| tables3.patch | 1.2 KB | December 09 2012 01:42 UTC | |
| tables4.patch | 1.3 KB | December 10 2012 03:57 UTC | |
| tables5patch | 1.3 KB | December 11 2012 00:36 UTC |

I would like to work on this task.
This task has been assigned to javamonn. You have 48 hours to complete this task, good luck!
First of all, where is the third system() call? I can find the two in the ged tables method but I cant seem to locate the third. Secondly, only one of these calls to system are a "cat" command, the other is a sort command. I'm assuming that I only replace the call with the cat command, but please correct me if I'm wrong. The submitted file will be the full tables.c with the appropriate changes made, right?
Thanks for the help,
Daniel
So I was looking at the code posted online which is apparently out of date. I fired up the vm and found the third call to system. My question still stands as far as if I'm replacing all three, or just the system("cat ...") command. I'm not sure how I would implement the sort command so I will work on just the cat for now. Let me know if I should do otherwise.
The work on this task is ready to be reviewed.
Yes, this task is for just that last system() call. There was another GCI task, already completed, that fixed the two sort ones.
If you're using the vm, make sure you run "svn update" to get the latest sources.
Submitting the whole file is nfg. You need to submit a proper patch file. See http://brlcad.org/wiki/Patches or the Deuces page or a slew or help around the web for instruction on creating a patch file. Patches are the proper way to exchange changes to code, professionally and especially throughout Open Source.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
Could I possibly get an extension on this task? I'm at school now but I'll be able to fix whats wrong and submit a patch as soon as I get home.
Thanks,
Daniel
The deadline of the task has been extended with 1 days and 0 hours.
The work on this task is ready to be reviewed.
I noticed a few problems that need to be fixed with the patch:
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The work on this task is ready to be reviewed.
Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
I'm guessing that you haven't actually tried to compile your patch. Please re-review and test whether this actually works. Upon further inspection, I don't think your code is equivalent to what the system() call was doing. You're appending the name of the file, which the original code was not doing.
The deadline of the task has been extended with 2 days and 0 hours.
The work on this task is ready to be reviewed.
The deadline of the task has been extended with 2 days and 0 hours.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
Javamonn, the implementation looks like it should be equivalent, but there are a few problems. Instead of scanning the file twice using a function we wrap and using a c99 array allocation that we don't allow, try using our bu_mapped_file interface. bu_mapped_file_open() then you can read from the mappedfile-buf, write the data out, and then close the mapped file. See bu.h for API help and src/libged/red.c for an example of the interface being used.
The work on this task is ready to be reviewed.
Hopefully tables4 is alright. That bu_mapped_file struct is pretty handy. To my understanding, I still had to open the file to write to in the normal fasion, correct? Unless you have another struct I would rather use, since bu_mapped_file is read only. Let me know if there are any other issues.
Thanks,
Daniel
Congratulations, this task has been completed successfully.
Very nicely done. I hope you take on some of our other coding tasks! This clears up a bad coding call that's been in there for a very long time.. :)
Thanks for making it better!