[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#7075) back-perl initialization broken



Full_Name: Hallvard B Furuseth
Version: 2.4.17-2.4.26
OS: 
URL: http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/151f806c70cb85a
Submission from: (NULL) (193.71.61.60)
Submitted by: hallvard


back-perl initialization broken

PERL_SYS_INIT3() is called with wrong arguments. Introduced by ITS#5658.

Fixing it to do the same as the Perl main program, but I can not test it
on a system where these params are used so it is relevant - e.g. Windows.

- arg 3 (env) is NULL, but Perl:proto.h requires non-NULL.
  Fixing to use PERL_SYS_INIT() instead.

  That also affects Perl versions before 5.6.  5.6 introduced INIT3,
  INIT is older.  The alternative would be to pass &(char **environ) to
  PERL_SYS_INIT3(), but who knows what Perl does with the environment.
  Seems simpler to avoid it.

- PERL_SYS_INIT/INIT3() can change their arguments.  back-perl
  passed the changed argc but not the changed argv to perl_parse().
  Fixing to pass both the changed argc and the changed argv.

- arg 2 is passed char *(*argv)[3].  Fixing to pass as a char ***argv:
     char *embedding[] = { "", "-e", "0", NULL }, **argv = embedding;
     char ***old = (char ***) &embedding, ***corrected = &argv;
  'old' is how the address was passed, 'new' is how it should be passed.
  'old' holds the address of the embedding array, but it should hold
  the address of a variable which holds that address.

See comp.lang.perl.misc discussion "PERL_SYS_INIT()" from Oct 31 2011.