Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on FreeBSD closing a pipe too early doesn't return the correct exit code #3633

Closed
p6rt opened this issue Jan 7, 2015 · 6 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Jan 7, 2015

Migrated from rt.perl.org#123563 (status was 'resolved')

Searchable as RT123563$

@p6rt
Copy link
Author

p6rt commented Jan 7, 2015

From @usev6

Looking at test reports from testers.perl6.org ugexe++ found a bug with pipe() on FreeBSD. It looks like closing the returned handle happens too early, as shown by the third of following commands​:

$ perl6 -e 'my $cmd = "/usr/bin/false"; say shell("$cmd")' ## expected result
Proc​::Status.new(exit => 1, pid => Any, signal => 0)

$ perl6 -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); sleep 2; say $handle.close' ## same
Proc​::Status.new(exit => 1, pid => Any, signal => 0)

$ perl6 -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close' ## wrong
Proc​::Status.new(exit => 0, pid => Any, signal => 0)

On a linux box it's 'exit => 1' in all three cases.

Panda currently uses a command like this for it's test and build reports. Panda issue 130 (https://github.com/tadzik/panda/issues/130) hase some more context.

I've tested the above with rakudo.moar only.

@p6rt
Copy link
Author

p6rt commented Jan 9, 2015

From @usev6

On Wed Jan 07 13​:45​:39 2015, bartolin@​gmx.de wrote​:

Looking at test reports from testers.perl6.org ugexe++ found a bug
with pipe() on FreeBSD. It looks like closing the returned handle
happens too early, as shown by the third of following commands​:

$ perl6 -e 'my $cmd = "/usr/bin/false"; say shell("$cmd")' ##
expected result
Proc​::Status.new(exit => 1, pid => Any, signal => 0)

$ perl6 -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r);
sleep 2; say $handle.close' ## same
Proc​::Status.new(exit => 1, pid => Any, signal => 0)

$ perl6 -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r);
say $handle.close' ## wrong
Proc​::Status.new(exit => 0, pid => Any, signal => 0)

On a linux box it's 'exit => 1' in all three cases.

Panda currently uses a command like this for it's test and build
reports. Panda issue 130 (https://github.com/tadzik/panda/issues/130)
hase some more context.

I've tested the above with rakudo.moar only.

This seems to be special for Moar​:

$ perl6-m -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close'
Proc​::Status.new(exit => 0, pid => Any, signal => 0)
$ perl6-m -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close.status'
0

$ perl6-p -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close'
Proc​::Status.new(exit => 0, pid => Any, signal => 1)
$ perl6-p -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close.status'
1

$ perl6-j -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close'
Proc​::Status.new(exit => 0, pid => Any, signal => 1)
$ perl6-j -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close.status'
1

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jan 9, 2015

From @usev6

On Wed Jan 07 13​:45​:39 2015, bartolin@​gmx.de wrote​:

Looking at test reports from testers.perl6.org ugexe++ found a bug
with pipe() on FreeBSD. It looks like closing the returned handle
happens too early, as shown by the third of following commands​:

$ perl6 -e 'my $cmd = "/usr/bin/false"; say shell("$cmd")' ##
expected result
Proc​::Status.new(exit => 1, pid => Any, signal => 0)

$ perl6 -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r);
sleep 2; say $handle.close' ## same
Proc​::Status.new(exit => 1, pid => Any, signal => 0)

$ perl6 -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r);
say $handle.close' ## wrong
Proc​::Status.new(exit => 0, pid => Any, signal => 0)

On a linux box it's 'exit => 1' in all three cases.

Panda currently uses a command like this for it's test and build
reports. Panda issue 130 (https://github.com/tadzik/panda/issues/130)
hase some more context.

I've tested the above with rakudo.moar only.

This seems to be special for Moar​:

$ perl6-m -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close'
Proc​::Status.new(exit => 0, pid => Any, signal => 0)
$ perl6-m -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close.status'
0

$ perl6-p -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close'
Proc​::Status.new(exit => 0, pid => Any, signal => 1)
$ perl6-p -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close.status'
1

$ perl6-j -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close'
Proc​::Status.new(exit => 0, pid => Any, signal => 1)
$ perl6-j -e 'my $cmd = "/usr/bin/false"; my $handle = pipe("$cmd", :r); say $handle.close.status'
1

@p6rt
Copy link
Author

p6rt commented Apr 20, 2015

From @usev6

This works now.

$ perl6-m -e 'my $handle = pipe("/usr/bin/false", :r); say $handle.close'
Proc​::Status.new(exit => 1, pid => Any, signal => 0)

There are passing tests in S32-io/pipe.t.

I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Apr 20, 2015

From @usev6

This works now.

$ perl6-m -e 'my $handle = pipe("/usr/bin/false", :r); say $handle.close'
Proc​::Status.new(exit => 1, pid => Any, signal => 0)

There are passing tests in S32-io/pipe.t.

I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Apr 20, 2015

@usev6 - Status changed from 'new' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant