jnovembre / ENCprime

ENCprime : Command-line utility for measuring codon bias
9 stars 4 forks source link

fscanf throwing segfault in ENCprime.c get_codon_count_data() #1

Closed ghost closed 10 years ago

ghost commented 10 years ago

hi,

I was having no luck running ENCprime on OS X (10.7.4) so I dug into the source a bit. it appears that there is an issue in the ENCprime.c function get_codon_count_data(). the for loop that reads the codon sequences only executes once; on the second pass, it fails with a segfault. this happens at the fscanf call (line 552). I moved the declaration of 'char cod_seq[3]' to the top of the for loop and now it works. I guess there might be an issue when you define cod_seq[3]='\0' (now the char arr is a different length?) but I'm not a C guru.

I also found a problem in SeqCount.c main(), where inputfile[40] and input[40] are apparently too short to hold my input file name. I changed them to inputfile[100] and input[100] and it fixed the problem.

cheers,

tim driscoll

jnovembre commented 10 years ago

Hi Tim,

Thanks!

On my installation of OS 10.7.4 fixing the length of cod_seq takes care of your first problem without the need to move the variable definition.

I've also adjusted the inputfile default length on SeqCount, as other users may find that useful too.

I'll push these updates shortly.

Cheers, John

ghost commented 10 years ago

very nice! thanks John,

tim