Received: (at submit) by bugs.debian.org; 17 Feb 2000 17:36:50 +0000 Received: (qmail 19462 invoked from network); 17 Feb 2000 17:36:49 -0000 Received: from flex.london.excite.com (194.216.238.16) by master.debian.org with SMTP; 17 Feb 2000 17:36:49 -0000 Received: from shaslam by flex.london.excite.com with local (Exim 3.12 #1 (Debian)) id 12LUr4-0006vZ-00; Thu, 17 Feb 2000 17:36:42 +0000 From: Steve Haslam To: Debian Bug Tracking System Subject: Perl_my_setenv() problem X-Reportbug-Version: 0.48 X-Mailer: reportbug 0.48 Date: Thu, 17 Feb 2000 17:36:42 +0000 Message-Id: Package: perl-5.005 Version: 5.005.03-5 Severity: normal I'm getting SIGBUS when doing "$ENV{TZ} = 'foo'" statements. Unfortunately, I can't reproduce the problem with a simple script :-( However, I've been using gdb a bit, and I've discovered something disturbing. Perl_my_setenv(), which is the back end to the above perl fragment, will duplicate the environment when it is modified for the first time- however, it seems that for some reason this is not happening with this particular script. I don't know why. In gdb, regrettably, you can't say "p environ" and get a sensible result. Nevertheless, I managed to catch this: Program received signal SIGBUS, Bus error. 0x7016ef94 in free () from /lib/libc.so.6 (gdb) p PL_origenviron $3 = (char **) 0xeffffc18 (gdb) bt #0 0x7016ef94 in free () from /lib/libc.so.6 #1 0x7a924 in Perl_safefree (where=0xeffffd9d) at util.c:173 #2 0x7ec44 in Perl_my_setenv (nam=0x142788 "TZ", val=0x142728 "Europe/London") at util.c:1443 #3 0x82bcc in Perl_magic_setenv (sv=0x14192c, mg=0x142768) at mg.c:660 #4 0x810f8 in Perl_mg_set (sv=0x14192c) at mg.c:149 #5 0x927c4 in Perl_pp_sassign () at pp_hot.c:133 #6 0x91adc in Perl_runops_debug () at run.c:66 #7 0x23910 in perl_run (sv_interp=0x13b248) at perl.c:1100 #8 0x1f470 in main (argc=4, argv=0xeffffc04, env=0xeffffc18) at perlmain.c:51 (gdb) up #1 0x7a924 in Perl_safefree (where=0xeffffd9d) at util.c:173 173 PerlMem_free(where); (gdb) up #2 0x7ec44 in Perl_my_setenv (nam=0x142788 "TZ", val=0x142728 "Europe/London") at util.c:1443 1443 Safefree(environ[i]); (gdb) p environ[i] cannot subscript something of type `' (gdb) p i $6 = 2 (gdb) p PL_origenviron[i] $7 = 0xeffffd9d "TZ=Europe/London" so it appears to be calling Perl_safefree() on the original environment variable in environ[], which not surprisingly chokes. I don't see why the "if (environ == PL_origenviron)" test in Perl_my_setenv() is not trapping this. I'll look into it some more when I have time. With no visibility on the "environ" variable (presumably because crt?.o doesn't have debug sections) it's rather frustrating.... SRH -- System Information Debian Release: potato Architecture: sparc Kernel: Linux flex 2.2.14 #4-ULTRA5 Tue Feb 8 11:32:04 GMT 2000 sparc64 Versions of packages perl-5.005 depends on: ii perl-5.005-base 5.005.03-5 The Pathologically Eclectic Rubbis ii perl-5.005-base [perl5-base 5.005.03-5 The Pathologically Eclectic Rubbis ii perl-base 5.004.05-1.1 Fake package assuring that one of