Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

$0 changes break PAR

0 views
Skip to first unread message

Nicholas Clark

unread,
Dec 14, 2003, 4:06:47 PM12/14/03
to perl5-...@perl.org
There are changes in blead relating to setting argv that aren't in maint:
[ 21538]
Fix off-by-one in $0 set magic. (From Autrijus.)
The whole PL_origalen thing in perl.c looks very hokey.

[ 21546]
Will the real off by one please stand up?

[ 21664]
Orphaned submission from #21546.

[ 21833]
Subject: [PATCH] setting $0 still broken
From: Jan Dubois <ja...@ActiveState.com>
Date: Thu, 27 Nov 2003 21:09:51 -0800
Message-ID: <f3mdsv8dcv4asle0k...@4ax.com>

(combined patch appended)

When I try applying these to maint, and using that maint to build PAR,
it all goes horribly wrong:

./par -I"/home/nick/PAR-0.76_98/inc" -I"/home/nick/maintsnap21908/lib/perl5/5.8.2/i686-linux-ld" -I"/home/nick/maintsnap21908/lib/perl5/5.8.2" -I"/home/nick/maintsnap21908/lib/perl5/site_perl/5.8.2/i686-linux-ld" -I"/home/nick/maintsnap21908/lib/perl5/site_perl/5.8.2" -I"/home/nick/maintsnap21908/lib/perl5/site_perl" -I"/home/nick/PAR-0.76_98" -I"." -I../myldr/.. -I../blib/lib -B -O../script/parl
Usage: ./par [ -Alib.par ] [ -Idir ] [ -Mmodule ] [ src.par ] [ program.pl ]
./par [ -B|-b ] [-Ooutfile] src.par

(I'm testing this with maint patchlevel 21908 plus the appended patch, and
PAR 0.76_98 from CPAN)

Without the patch below (ie vanilla 21908) par works. So it has to be
these changes that break it somehow. (With blead it breaks, and blead has
this changes already)

Any idea what's up? I'm not going to integrate these changes to maint until
we understand why they break things.

Nicholas Clark

==== //depot/maint-5.8/perl/mg.c#33 - /export/home/nwc10/p4perl/maint-5.8/perl/mg.c ====
@@ -2452,10 +2452,10 @@
#endif
/* PL_origalen is set in perl_parse(). */
s = SvPV_force(sv,len);
- if (len >= (STRLEN)PL_origalen) {
- /* Longer than original, will be truncated. */
- Copy(s, PL_origargv[0], PL_origalen, char);
- PL_origargv[0][PL_origalen - 1] = 0;
+ if (len >= (STRLEN)PL_origalen-1) {
+ /* Longer than original, will be truncated. We assume that
+ * PL_origalen bytes are available. */
+ Copy(s, PL_origargv[0], PL_origalen-1, char);
}
else {
/* Shorter than original, will be padded. */
@@ -2468,9 +2468,10 @@
* --jhi */
(int)' ',
PL_origalen - len - 1);
- for (i = 1; i < PL_origargc; i++)
- PL_origargv[i] = 0;
}
+ PL_origargv[0][PL_origalen-1] = 0;
+ for (i = 1; i < PL_origargc; i++)
+ PL_origargv[i] = 0;
UNLOCK_DOLLARZERO_MUTEX;
break;
#endif
==== //depot/maint-5.8/perl/perl.c#63 - /export/home/nwc10/p4perl/maint-5.8/perl/perl.c ====
@@ -1176,7 +1176,7 @@
}
}
}
- PL_origalen = s - PL_origargv[0];
+ PL_origalen = s - PL_origargv[0] + 1;
}

if (PL_do_undump) {

0 new messages