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

$*PROGRAM-NAME is not assignable / does not change process's name #6562

Open
p6rt opened this issue Oct 1, 2017 · 4 comments
Open

$*PROGRAM-NAME is not assignable / does not change process's name #6562

p6rt opened this issue Oct 1, 2017 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Oct 1, 2017

Migrated from rt.perl.org#132194 (status was 'open')

Searchable as RT132194$

@p6rt
Copy link
Author

p6rt commented Oct 1, 2017

From @zoffixznet

Opening a ticket, per Raku/roast#339

-----------8<-------------------------

$*PROGRAM-NAME is supposed to be a replacement for Perl 5's $0, but it doesn't work that way.

What I'd expect to work​:

use v6;
$*PROGRAM-NAME = 'foo';
say `ps $$`;
=output
Cannot modify an immutable Str (test.pl)
  in block <unit> at test.pl line 2
What should happen​:

use v5.26;
$0 = "foo";
say `ps $$`;
__DATA__
# PID TTY STAT TIME COMMAND
# 5875 pts/1 S+ 0​:00 foo

@p6rt
Copy link
Author

p6rt commented Oct 1, 2017

From @geekosaur

On Sun, Oct 1, 2017 at 12​:35 PM, Zoffix Znet <perl6-bugs-followup@​perl.org>
wrote​:

$*PROGRAM-NAME is supposed to be a replacement for Perl 5's $0, but it
doesn't work that way.

What I'd expect to work​:

use v6;
$*PROGRAM-NAME = 'foo';

This is not portable and not reliable --- although it will probably work on
the limited set of systems moarvm/rakudo currently run on. But the linked
ticket is not quite right either​: even on Unix-likes that support it, the
result would be shown by 'ps' as something like 'foo [moarvm]' (exact
format will depend on OS and/or 'ps' implementation). This is forced for
security-related reasons, and you can't override the process's execname to
control the part in brackets.

--
brandon s allbery kf8nh sine nomine associates
allbery.b@​gmail.com ballbery@​sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

@p6rt
Copy link
Author

p6rt commented Oct 1, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 5, 2017

From @AlexDaniel

I wonder if this needs a separate sub or variable instead of adding secret functionality to $*PROGRAM-NAME.

On 2017-10-01 09​:52​:19, allbery.b@​gmail.com wrote​:

On Sun, Oct 1, 2017 at 12​:35 PM, Zoffix Znet <perl6-bugs-followup@​perl.org>
wrote​:

$*PROGRAM-NAME is supposed to be a replacement for Perl 5's $0, but it
doesn't work that way.

What I'd expect to work​:

use v6;
$*PROGRAM-NAME = 'foo';

This is not portable and not reliable --- although it will probably work on
the limited set of systems moarvm/rakudo currently run on. But the linked
ticket is not quite right either​: even on Unix-likes that support it, the
result would be shown by 'ps' as something like 'foo [moarvm]' (exact
format will depend on OS and/or 'ps' implementation). This is forced for
security-related reasons, and you can't override the process's execname to
control the part in brackets.

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

No branches or pull requests

1 participant