Bug 7364 - Compat resolver can't handle module.pmod
: Compat resolver can't handle module.pmod
Status: RESOLVED FIXED
: Pike
Compiler
: 8.0
: All All
: P3 (normal) normal
: ---
Assigned To:
:
:
:
  Show dependency treegraph
 
Reported: 2014-11-21 11:05 CET by
Modified: 2014-11-21 16:43 CET (History)
Scrum Prio:
In scrum?: ---
Story included in sprints:
Unplanned in sprints:


Attachments


Description From 2014-11-21 11:05:19 CET
A very simple example is in the 8.0 compat code for Locale in 8.1. The
Locale.pmod/module.pmod file essentially only contains

#pike 8.1
inherit Locale;
object Charset = global.Charset;

but when accessed creates the following error

Pike v8.1 release 0 running Hilfe v3.5 (Incremental Pike Frontend)
(running in Pike 8.0 compat mode)
> Locale;            
(1) Result: Locale
> indices(Locale);
Bad argument 1.
Unknown program: foreach(UNDEFINED)
master.pike:2233:
    master()->joinnode(0).create(UNDEFINED,UNDEFINED,UNDEFINED,UNDEFINED)     
-:1: PikeCompiler("", UNDEFINED, 8, -1, target, placeholder)->compile()
-:1:
    DefaultCompilerEnvironment->compile(PikeCompiler("", UNDEFINED, 8, -1, tar
    get, placeholder))                                                        
master.pike:675:
    compile_string("#pike 8.1\n\ninherit Locale;\n\n//! @module Charset\n//!\n
    //!   This is the old loca"+[162],"/home/nilsson/pike/lib/8.0/modules/Loca
    le.pmod/module.pmod",0,object_program(8.0::Locale),master()->joinnode(0),U
    NDEFINED)                                                                 
master.pike:1378:
    master()->low_findprog("/home/nilsson/pike/lib/8.0/modules/Locale.pmod/mod
    ule.pmod","",0,1)                                                         
master.pike:1501:
    master()->findprog("/home/nilsson/pike/lib/8.0/modules/Locale.pmod/module.
    pmod",".pmod",0,1)                                                        
master.pike:1535:
    master()->low_cast_to_program("/home/nilsson/pike/lib/8.0/modules/Locale.p
    mod/module",0,0,1)
------- Comment #1 From 2014-11-21 12:24:10 CET -------
Looks like an interpreter bug breaking the stack.

joinnode(({ /* 3 elements */
    predef::,
    predef::,
    ([ /* 5 elements */
      "Builtin": _static_modules.Builtin(),
      "Gmp": _static_modules.Gmp(),
      "_Stdio": _static_modules._Stdio(),
      "_math": _static_modules._math(),
      "_system": _static_modules._system()
    ])
}))->ind("Charset")
Bad argument 1.
Unknown program: foreach(UNDEFINED)
master.pike:2233:
    master()->joinnode(0).create(UNDEFINED,UNDEFINED,UNDEFINED,UNDEFINED)     
-:1: PikeCompiler("", UNDEFINED, -1, -1, target, placeholder)->compile()
-:1:
    DefaultCompilerEnvironment->compile(PikeCompiler("", UNDEFINED, -1, -1, ta
    rget, placeholder))                                                       
master.pike:675:
    compile_string("#pike 8.1\n\ninherit Locale;\n\n//! @module Charset\n//!\n
    //!   This is the o"+[169],"/home/grubba/src/Pike/8.1/lib/8.0/modules/Loca
    le.pmod/module.pmod",0,object_program(8.0::Locale),master()->joinnode(0),U
    NDEFINED)                                                                 
[...]
------- Comment #2 From 2014-11-21 16:43:17 CET -------
Some further debugging gives that the problem is the line

  inherit Locale;

which causes an inherit of the joinnode representing predef::Locale, which in
turn gets confused when its lfun::create() is called with zero arguments when
8.0::Locale is initialized.

One possible workaround is to use

  inherit Locale.module;

But as it in this case is the question of a compatibility module, there's no
need for the inherit to begin with, as the modules will be joined anyway.

Fixed:

Pike v8.1 release 0 running Hilfe v3.5 (Incremental Pike Frontend)
> indices(8.0::Locale);
(1) Result: ({ /* 16 elements */
                "get_objects",
                "clean_cache",
                "translate",
                "register_project",
                "Language",
                "cache_status",
                "Charset",
                "list_languages",
                "module",
                "set_default_project_path",
                "Gettext",
                "get_object",
                "flush_cache",
                "call",
                "DeferredLocale",
                "LocaleObject"
            })

Note

You need to log in before you can comment on or make changes to this bug.