OnDemand Users Group

Support Forums => CMOD for Multiplatforms => Topic started by: Justin Derrick on April 08, 2015, 02:54:15 PM

Title: Segfault in arslog...
Post by: Justin Derrick on April 08, 2015, 02:54:15 PM
This is one of the weirdest things I've ever seen.

One of my current customers is using arslog to write some of their log files to a text file so it can be parsed.  Occasionally, this script will end with a 'segmentation fault' during a load, leading to warnings and alerts -- but there was nothing wrong with the load (and, in fact, it appears as having been successfully loaded in the System Log).

What makes this weird is that the shell script is so very, very basic...


#/bin/ksh
set -a
set -u
set -m
print $1,$2,$3,$4,$5,$6,$7,$8 >> /var/log/sys.log
exit 0


Now, I've checked the -a, -m, and -u options in ksh, and none of them seem terribly useful in this situation, but I'd like to have a better idea of what's going on before I start changing things...

Can anyone share some insight into what's going on here? 

Thanks!

-JD.
Title: Re: Segfault in arslog...
Post by: Alessandro Perucchi on April 10, 2015, 08:59:06 AM
Hello Justin,

Well by looking at this script, I don't see the need to use "set -a" "set -m" "set -u"... they are in that case totally useless. At least for that kind of script! And they take a little bit of working time...

That said, I'm always very careful to protect the script of side effects, and by looking at this script, I see a lot of possible side effects...

What I would advise is to change the script to quote all the variables.

Something like:


#/bin/ksh
print "$1,$2,$3,$4,$5,$6,$7,$8" >> /var/log/sys.log
exit 0


That way you avoid the possibility that one of the $variable contains some things that could "crash" or run some unwanted things on your box!
Title: Re: Segfault in arslog...
Post by: Justin Derrick on April 10, 2015, 10:27:06 AM
Thanks Alessandro.  I'll give that a try!

-JD.