Closed pb-cdunn closed 8 years ago
My root now contains a version that now incorporates your fix and suggested add ons:
DBdust div-by-zero with empty tracks:
I fixed this and incidentally also now guard against div-by-0 if
the DB happens to be empty. I retained the code to compute the average and standard deviation of the length of a masks' intervals, and completed the intention by printing these stats out for each mask :-)
Realloc does behave wierdly with size=0. Rather than ignore the call (and leave potentially a very big block still allocated, I patched it by setting size=1 if it comes in <= 0.
I show the bad arg as per you edits, and I added stdio.h to QV.h
I did not add a .gitignore to the repository: I have one locally, and I
think everyone should, but
generally I find everybody does it there own way in their
development area, so I don't want
pulls to potentially wipe out someone's customized .gitignore.
(My .gitignore ignores .gitignore :-) )
Cheers,
Gene
On 3/3/16, 6:16 AM, Christopher Dunn wrote:
- When I use DBdust with a high enough |-t| that there is no "dust" found, |DBstats -mdust| crashes on calculating the average dust length. |ave| and |dev| are not even used there, so I've removed them.
- After that change, there is an /Out of memory/ reported for |realloc()| on a zero-size array, via |Trim_DB()|. (I don't know why that happens only for the case of empty dust tracks.)
|#0 Realloc (p=0x612090, size=0, mesg=0x0) at DB.c:57
1 0x00000000004049ab in Trim_DB (db=0x7fffffffe300) at DB.c:621
2 0x0000000000401834 in main (argc=2, argv=0x7fffffffe668) at DBstats.c:112
|
- I've also added |
| in a file that technically needs it. (That is useful for a Nim http://nim-lang.org/ wrapper I am writing for _DAZZDB.) - Finally, I've added a proper |.gitignore|, to make |git add .| work better.
You can view, comment on, or merge this pull request online at:
https://github.com/thegenemyers/DAZZ_DB/pull/13
Commit Summary
- Fix crash when dust track is empty
- Show bad arg
Add header
File Changes
- A .gitignore https://github.com/thegenemyers/DAZZ_DB/pull/13/files#diff-0 (17)
- M DB.c https://github.com/thegenemyers/DAZZ_DB/pull/13/files#diff-1 (2)
- M DB.h https://github.com/thegenemyers/DAZZ_DB/pull/13/files#diff-2 (8)
- M DBstats.c https://github.com/thegenemyers/DAZZ_DB/pull/13/files#diff-3 (10)
M QV.h https://github.com/thegenemyers/DAZZ_DB/pull/13/files#diff-4 (1)
Patch Links:
- https://github.com/thegenemyers/DAZZ_DB/pull/13.patch
- https://github.com/thegenemyers/DAZZ_DB/pull/13.diff
— Reply to this email directly or view it on GitHub https://github.com/thegenemyers/DAZZ_DB/pull/13.
Thanks, Dr. Myers! That helps.
Some warnings:
DBdump.c:581:12: warning: 'input' may be used uninitialized in this function [-Wmaybe-uninitialized]
iter = init_file_iterator(input);
^
DBdump.c:702:5: warning: 'pts' may be used uninitialized in this function [-Wmaybe-uninitialized]
free(pts);
^
DBdump.c:593:16: warning: 'reps' may be used uninitialized in this function [-Wmaybe-uninitialized]
{ if (c >= reps)
^
DBdump.c:681:40: warning: 'qv_val' may be used uninitialized in this function [-Wmaybe-uninitialized]
putchar(qv_map[qv_val[k++]]);
^
DBdump.c:678:19: warning: 'qv_idx' may be used uninitialized in this function [-Wmaybe-uninitialized]
e = qv_idx[i+1];
As for .gitignore
, I have this in my ${HOME}/.config/git/ignore
:
*.d
*.o
*.a
But I cannot ignore the executables in a generic way. So a minimal .gitignore
for this repo would be:
Catrack
DAM2fasta
DB2fasta
DB2quiva
DBdump
DBdust
DBrm
DBshow
DBsplit
DBstats
fasta2DAM
fasta2DB
quiva2DB
simulator
You do not need to have a .gitignore
locally that is not committed. For local ignore-overrides, you may use .git/info/exclude
. For more details on gitignore files:
git help gitignore
I have modified DBdump.c to avoid the warnings.
I'll check into the .gitignore options, thanks for the pointer.
-- Gene
On 3/5/16, 5:52 PM, Christopher Dunn wrote:
Thanks! That helps.
Some warnings:
DBdump.c:581:12: warning: 'input' may be used uninitialized in this function [-Wmaybe-uninitialized] iter = init_file_iterator(input); ^ DBdump.c:702:5: warning: 'pts' may be used uninitialized in this function [-Wmaybe-uninitialized] free(pts); ^ DBdump.c:593:16: warning: 'reps' may be used uninitialized in this function [-Wmaybe-uninitialized] { if (c >= reps) ^ DBdump.c:681:40: warning: 'qv_val' may be used uninitialized in this function [-Wmaybe-uninitialized] putchar(qv_map[qv_val[k++]]); ^ DBdump.c:678:19: warning: 'qv_idx' may be used uninitialized in this function [-Wmaybe-uninitialized] e = qv_idx[i+1]; As for |.gitignore|, I have this in my |${HOME}/.config/git/ignore|:
.d .o *.a But I cannot ignore the executables in a generic way. So a minimal |.gitignore| for this repo would be:
Catrack DAM2fasta DB2fasta DB2quiva DBdump DBdust DBrm DBshow DBsplit DBstats fasta2DAM fasta2DB quiva2DB simulator You do not need to have a |.gitignore| locally that is not committed. For local ignore-overrides, you may use |.git/info/exclude|. For more details on gitignore files https://git-scm.com/docs/gitignore:
git help gitignore — Reply to this email directly or view it on GitHub https://github.com/thegenemyers/DAZZ_DB/pull/13#issuecomment-192685511.
Danke schön!
-t
that there is no "dust" found,DBstats -mdust
crashes on calculating the average dust length.ave
anddev
are not even used there, so I've removed them.realloc()
on a zero-size array, viaTrim_DB()
. (I don't know why that happens only for the case of empty dust tracks.)<stdio.h>
in a file that technically needs it. (That is useful for a Nim wrapper I am writing for DAZZ_DB.).gitignore
, to makegit add .
work better.