Ticket #437 (closed bug: fixed)

Opened 13 years ago

Last modified 12 years ago

.loadlib fails silently

Reported by: moritz Owned by:
Priority: normal Milestone:
Component: core Version:
Severity: medium Keywords:
Cc: jkeenan Language:
Patch status: obsolete Platform:

Description

It appears that the .loadlib fails silently on wrong paths. For example Rakudo's perl6.pir contains the lines

 .loadlib 'perl6_group'
 .loadlib 'perl6_ops'

If I introduce a typo in the name perl6_ops in the second line, I get no error message from the failed load, just from subsequent failures.

This makes diagnosis very hard, and IMHO a failed .loadlib should throw an exception.

Attachments

parrot_libloading.patch Download (3.4 KB) - added by wayland 13 years ago.

Change History

  Changed 13 years ago by wayland

I'm subscribing to this ticket so that I'll (hopefully) get cc'ed on any changes. Is there an easier way to do this?

  Changed 13 years ago by wayland

It would also be nice if the error message said where it tried looking for the files, so that I know that my -L options are working correctly :)

  Changed 13 years ago by wayland

The patch I've attached seems to solve the problem. It throws an exception instead of printing a warning. The exception contains the path used to search for the library.

The patch also adds a -S option to Parrot that allows more paths to be added to the search path. I found this option useful in building Rakudo.

Changed 13 years ago by wayland

  Changed 13 years ago by wayland

allison requested via IRC that the -S option be done as a separate patch/ticket. That's now in https://trac.parrot.org/parrot/ticket/442

in reply to: ↑ description ; follow-up: ↓ 6   Changed 12 years ago by jkeenan

Replying to moritz:

It appears that the .loadlib fails silently on wrong paths. For example Rakudo's perl6.pir contains the lines {{{ .loadlib 'perl6_group' .loadlib 'perl6_ops' }}} If I introduce a typo in the name perl6_ops in the second line, I get no error message from the failed load, just from subsequent failures.

Moritz,

Does this problem still present itself?

Would the non-S part of wayland's patch be of benefit?

Thank you very much.
kid51

in reply to: ↑ 5 ; follow-up: ↓ 7   Changed 12 years ago by moritz

Replying to jkeenan:

Replying to moritz:

It appears that the .loadlib fails silently on wrong paths. For example Rakudo's perl6.pir contains the lines {{{ .loadlib 'perl6_group' .loadlib 'perl6_ops' }}} If I introduce a typo in the name perl6_ops in the second line, I get no error message from the failed load, just from subsequent failures.

Moritz, Does this problem still present itself?

Yes.

Would the non-S part of wayland's patch be of benefit?

If it makes .loadlib complain loudly and fatally (unless caught), yes.

in reply to: ↑ 6   Changed 12 years ago by jkeenan

  • cc jkeenan added
  • component changed from none to core
  • patch set to obsolete

Replying to moritz:

If it makes .loadlib complain loudly and fatally (unless caught), yes.

Unfortunately, in the 15 months since Wayland first posted his patch, the files being patched have changed so much that 2 of the 3 do not apply cleanly.

[li11-226:parrot] 524 $ patch -p1 < ~/learn/parrot/patches/parrot_libloading.patch 
patching file src/library.c
Hunk #1 FAILED at 710.
1 out of 1 hunk FAILED -- saving rejects to file src/library.c.rej
patching file src/dynext.c
Hunk #1 FAILED at 615.
1 out of 1 hunk FAILED -- saving rejects to file src/dynext.c.rej
patching file include/parrot/library.h
Hunk #1 succeeded at 85 (offset 11 lines).

Wayland, if you are still around: Could you (or anyone else) take another whack at it?

Thank you very much.
kid51

  Changed 12 years ago by plobsing

  • status changed from new to closed
  • resolution set to fixed

I've fixed the problem in r47282.

However, I made it such that only failing '.loadlib' directives throw exceptions. The 'loadlib' opcode interface is unchanged.

Note: See TracTickets for help on using tickets.