Perl script seg faults in Cmenu - perl

I am getting a core dump when I use the Cmenu module on Solaris 8. The script works fine on Solaris 10. Could somebody please suggest a possible workaround for this? Using dbx shows the following:
terminated by signal SEGV (no mapping at the fault address)
Current function is Perl_safesysmalloc
92 Ptr = (Malloc_t)PerlMem_malloc(size?size:1)
Perl_safesysmalloc(size = 4U), line 92 in "util.c"
I built version 5.10 of Perl using gcc on this machine. Please let me know if you have need any other information.

That's probably a bug on the module. Send a bug report to the author!
... though, the last release is from 2001, probably not being maintained anymore :-(

Cmenu is a pure perl module that uses Curses.pm which is based on a C library. So mosts probable place for core dump is Curses.pm. Try upgrading it to latest version. Also try upgrading curses library.
If this does not help, try minimizing your program to get a minimal program that would still result a core dump. Report it to Cmenu bug tracker.

Related

using an array as a reference is deprecated in perl

Getting below Error: using an array as a reference is deprecated in perl script at line
Please Suggest, What is wrong in below code.
$sqlsyntax="exec Stored_Procedure,\#ErroeCode='$ErrMsg`";
#ret = $dbh->nsql ($sqlsyntax,"ARRAY");
my($EntityId,
$MaturutyDate);
my($size,$index,$count);
$size=scalar #ret;
$index=0;
$EntityId=#ret->[$index][0];
$MaturutyDate=#ret->[$index][9];
This perl is working fine in Solaris but when same is migrated to Linux environment, it is giving this error.
Getting below Error: using an array as a reference is deprecated in perl script at line
During Compilation it is giving this error, Want to fix this in Linux environment.
I'm not sure where you're getting this code from, but it uses a very old version of Perl syntax that you shouldn't have been using for a very long time. [Update: As ikegami points out in a comment below, this isn't very old Perl syntax - it's syntax that only worked because of a bug in Perl and which shouldn't have ever been used.]
#ret->[$index][0]
This code uses the fact that an array can (in certain circumstances) be used as an array reference. You should not do this, as there are other (simpler) ways to do the same thing. This syntax is, as you see, deprecated.
Your code should be written as $ret[$index][0]. If you change it to be like this, then the warnings will go away.
Update:
This perl is working fine in Solaris but when same is migrated to Linux environment, it is giving this error.
I imagine that's because your Solaris system is running a far older version of Perl. What do you get from running perl -v on both of your systems?

Perl 5.22 CLI 2.03

I am facing problem for accessing my serial port device from Control::CLI( ver 2.03) on Perl 5.22. Issue is connection gets established but I can't write on the port.
The same code was working well with Control::CLI( ver 1.03) on Perl 5.14
Please help.
Thanks.
Unfortunately there isn't more of information to go on but the problem sounds like it might be one of two areas:
1) there might be issues with the newer version of Control::CLI that you are using. This would be something to ask the maintainer of Control::CLI about.
Chances are you might need to modify your existing code.
2) the OS that you are running 5.22 on. What's not clear is if you ran 5.14 on an older version of Windows (ie, Win 7, Win XP) and are trying to run your script with 5.22 on a newer version (ie, Win 10).
Sorry that I can't give an exact answer but these would be areas I would advise looking into to begin troubleshooting.

Where can I get Perl 4?

I have a need to test some Perl 4 code. It will run on an ancient (pre-386) machine that I don't currently have access to. I would like to compile it for OS X, but I can't find the source on CPAN (it seems to only go back to 5.004).
The original simtel archive is down, but this link will give you a version of Perl 4.19 that will run on an 8086:
http://ftp.gnome.org/mirror/archive/ftp.sunet.se/pub/simtelnet/msdos/perl/
The filename is perl419x.zip and has been tested on on DOS 4.3 with 640k of memory and works.
http://www.cpan.org/src/unsupported/4.036/
Which I got to from http://perl.org => DOWNLOAD => Perl source code => unsupported

32bit active perl generating corrupt excel file

My code generates an excel 2007 file (.xlsx) from a data structure.
I am using Excel::Writer::XLSX module to create the excel file and to populate the workbook.
Although the code is working fine with 32bit active perl, while opening the excel, Excel 2007 is throwing error "An attribute value must not contain '<'."
Although the same code when executed using 64bit active perl produces excel without any issue.
Any pointer to what might be the reason will help?
Although the same code when executed using 64bit active perl produces excel without any issue.
Based on the error I'd guess that you aren't using the same version of Excel::Writer::XLSX with the 32 and 64 bit ActivePerls.
At the level the warning occurs at the code is pure Perl so there is no binary or 32/64bit issue that would cause this.
I would suggest ensuring that you have updated to the latest version of Excel::Writer::XLSX and testing again.
Also, it looks like the ActiveState repos for Excel::Writer::XLSX are significantly behind CPAN so make sure you upgrade the module from source and not via PPM.
If the issue still occurs then reduce the program down to the smallest amount of working code that demonstrates it and submit a bug report.

*** glibc detected *** perl: double free or corruption (!prev): 0x0c2b7138 ***

While running a perl program I encountered the following error
*** glibc detected *** perl: double free or corruption (!prev): 0x0c2b7138 ***
/lib/tls/i686/cmov/libc.so.6[0xb7daea85]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7db24f0]
perl(Perl_pregfree+0x3e)[0x80a004e]
perl(perl_destruct+0xcf1)[0x806b711]
/usr/local/lib/perl/5.8.8/auto/threads/threads.so[0xb79d2dfb]
/usr/local/lib/perl/5.8.8/auto/threads/threads.so[0xb79d2f9b]
/usr/local/lib/perl/5.8.8/auto/threads/threads.so[0xb79d5fbb]
/lib/tls/i686/cmov/libpthread.so.0[0xb7e974fb]
/lib/tls/i686/cmov/libc.so.6(clone+0x5e)[0xb7e19e5e]
My OS is Ubuntu 8.04, Perl version is 5.8.8
My scripts contains threads ... I cannot share the code but wanted to know if anyone has had experience with this type of errors and how you had resolved/approached/analysed it. Are there any tools/logs that i could refer to inaddition to work on this sort of issues.
Thank you for your support.
P.S: I know that threads are not the ideal friends for anyone. However I do not control decision of using perl. I am just maintaining the code.
open your code and put in it somewhere before where the problem occurs:
$DB::single=1;
Then run
PERL5OPT='-dt' perl yourscript.pl
and hit
c[enter]
repeatedly until the problem recurs. ( Keeping note of whether it stops at your manual breakpoint or not before failing ).
Then iteratively move the manual breakpoint forward/back until you have it just before your termination point ( you could find the death point with a bunch of print commands also ), and then try work from there, possibly with pre-crash introspection.
This will (hopefully) help you generate a test-case which exhibits the problem.
This thread on the perl5 porters mailing list seems to indicate that it's a known problem with 5.8.8 and threads. I think your problem is probably due to a code problem that isn't caught by perl.
If you can, I would suggest stripping down the code to a minimal example. You should then be able to attempt to fix the code problem.
The most likely cause is an incompatible version of glibc. You need to run Perl with the version of glibc with which it was compiled
This looks like an error internal to Perl. The "double free or corruption" refers to memory being freed twice, or corrupted. Perl manages memory for you, so this should never happen if Perl is working correctly.
Is there a newer version of Perl you can upgrade to?
Try updating 'threads' and 'threads::shared' modules from CPAN.