Ticket #1314 (closed bug: invalid)

Opened 5 years ago

Last modified 5 years ago

open opcode returns true instead of returning an exception

Reported by: dukeleto Owned by:
Priority: major Milestone:
Component: core Version: 1.8.0
Severity: high Keywords:
Cc: Language:
Patch status: Platform:

Description

This test should not pass:

.include 'test_more.pir'
.local pmc pipe
pipe = open 'idontexist', 'rp'
ok(pipe,'pipe is true')

I ran into this testing Plumage from NQP. I have only verified that this occurs on darwin/x86. I will check other platforms.

Change History

Changed 5 years ago by dukeleto

I used the Parrot Shell to verify this. In the root of a parrot repo, type : perl tools/dev/parrot_shell.pl then paste the code snippet :

parrot_shell 4> .include 'test_more.pir'
.local pmc pipe
pipe = open 'idontexist', 'rp'
ok(pipe,'pipe is true')
.
Time: 0.0564442 wallclock secs 
Output:
ok 1 - pipe is true

Changed 5 years ago by dukeleto

  • summary changed from open opcode returns instead of returning an exception to open opcode returns true instead of returning an exception

Changed 5 years ago by NotFound

An exception in open is only expected for exceptional conditions, like being unable to create a handle, and in the pipe's case being unable to fork or to launch a process, for example.

The pipe ask the operating system to do some work. That work can fail at some later point. get_bool on FileHandle objects don't check error conditions, just check if the object already is in error state.

Current pipe implementation just launch a shell, the shell can start without problem even if the program you ask it to execute does not exist, it takes some time to search the PATH and such. Waiting for stablization or something in open or in get_bool will compromise the possible implementations, probalbly slowing them down.

So, I don't think this is a bug, just wrong expectations.

Changed 5 years ago by dukeleto

Does a test like this exist already? If not, where should this one live?

Changed 5 years ago by NotFound

A test like what? You want to test that trying to execute a non existent program fails? Well, fails at doing what? It can hardly fails to do nothing.

If you want to check the exit value of the launched process or something like that, that is highly platform dependent.

Changed 5 years ago by dukeleto

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

Thank you for the clarification. This can be chalked up to a bug in the way Plumage uses Parrot pipes, so this ticket can be closed.

Note: See TracTickets for help on using tickets.