Raku / App-Rakubrew

Raku environment manager
https://rakubrew.org/
Other
26 stars 13 forks source link

Any support needed for csh/tcsh users? #13

Closed davehayes closed 3 years ago

davehayes commented 4 years ago

rakubrew v9 Build type: cpan OS: freebsd

I have to run in shim mode, see below

~/.rakubrew (edited to keep specifics out of a public issue)

So I installed this via cpanm App::Rakubrew into /usr/local/lib/perl5 (where all software goes). I believe I am forced to run in shim mode this way. It also appears that rakubrew build worked fine (apparently) to get raku on my system, but I am unable to run all the tests to verify.

When I dig a bit deeper I see this (paths somewhat edited like above):

> rakubrew init Csh
setenv PATH "~/.rakubrew/shims:/usr/local/bin:/usr/local/bin"

> rakubrew init Sh
export PATH="~/.rakubrew/shims:~/bin:/usr/local/bin:/bin:/usr/bin"
rakubrew() {
    command /usr/local/bin/rakubrew internal_hooked Sh "$@" &&
    eval "`command /usr/local/bin/rakubrew internal_shell_hook Sh post_call_eval "$@"`"
}

In App::Rakubrew::Shell::Csh I see this:

sub supports_hooking {
    my $self = shift;
    0;
}

So I didn't try to mock up your idea using aliases or anything, because apparently Csh doesn't support hooking. However even when I setenv my PATH above like rakubrew init asks, I still get this on a rakubrew test:

rakubrew test 
Spectesting moar-2020.05.1
Undefined subroutine &App::Rakubrew::Build::make called at /usr/local/lib/perl5/site_perl/App/Rakubrew.pm line 514.

It's always confusing to see things not work out of the box, but I am woefully unfamiliar with what you are trying to do there and the raku ecosystem in general. Raku appears to work, although it's squirreled away in some corner under ~/.rakubrew. Raku seems to work:

> `rakubrew which raku` -v
This is Rakudo version 2020.05.1 built on MoarVM version 2020.05
implementing Raku 6.d.

but I can't get it to run the entire test suite. So this is really two questions/issues:

1) Do I have to do anything special to get rakubrew installed and working properly (your standard of proper) for tcsh?

2) How can I run the entire raku test suite?

Thanks in advance.

patrickbkr commented 4 years ago

Thanks for your report!

Installing via CPAN does not limit rakubrew to using shim mode. Switching to env mode via rakubrew mode env should work given the hook is installed. See rakubrew init for more information on setting up the hook.

Csh/Tcsh is currently not supported well as I didn't get around to implementing a shell hook yet (I'm not entirely sure it's possible to pull off). The missing shell hook is also the reason why env mode does not work; it requires a working hook.

The

sub supports_hooking {
    my $self = shift;
    0;
}

bit simply signals to rakubrew that no hook is implemented on Csh. Given someone manages to successfully implement a hook, that can be changed to 1;.

As you already stated, the failure to run the test suite seems to be unrelated. I'll probably find time over the weekend to have a look at this.

patrickbkr commented 4 years ago

I have just released a new version of rakubrew to CPAN (version 10). Give the CPAN gears a bit time to turn and it should show up. It's not yet uploaded to the website, but that should hopefully also happen soon.

That version has full support for tcsh including auto-completion. As I don't use tcsh personally I'm very grateful for field testing. So if you find any problems with the tcsh support, please do make yourself heard.

I have also fixed the problem with the rakubrew test command. Please test and tell me if it works now.

patrickbkr commented 4 years ago

ping @davehayes Have you noticed the above comment?

davehayes commented 4 years ago

I have. Given all the people I support, I'm just a bit glacial. Please bear with me. Thanks. :)

I did just install your new version. This test fails:

> /usr/local/bin/rakubrew init Tcsh | tcsh

Unmatched '''.

Due to security reasons I won't post exact output here. However, it looks somewhat like this:

setenv PATH "~/.rakubrew/shims:~/bin:.:~/.rakubrew/shims:~/.rakubrew/shims"
&& alias rakubrew '/usr/local/bin/rakubrew internal_hooked Tcsh \!*
&& eval "`/usr/local/bin/rakubrew internal_shell_hook Tcsh post_call_eval \!*`"'
&& complete rakubrew 'p,*,`/usr/local/bin/rakubrew internal_shell_hook Tcsh completions "$COMMAND_LINE"`,'

There's a lot of magic there. :) I tried removing the quote at the end of the eval line but that didn't help.

I'll leave this window up so I can respond just a bit faster.

patrickbkr commented 4 years ago

@davehayes I might find some more time this week to look at this.

Can you send me the version of Perl and tcsh you are using? Then I can try to reproduce this. (My local setup currently doesn't show this error.)

Just as a wild guess: Can you try turning these four lines into a single long line and see what happens?

davehayes commented 4 years ago
> perl -v

This is perl 5, version 26, subversion 3 (v5.26.3) built for amd64-freebsd-thread-multi

> set | grep version
...
version tcsh 6.20.00 (Astron) 2016-11-24 (x86_64-amd-FreeBSD) options wide,nls,dl,al,kan,sm,rh,color,filec
patrickbkr commented 4 years ago

I have set up a virtual machine with FreeBSD 12.1 amd64 and installed perl 5.26. tcsh was already installed. The versions match those you listed. It seems that /bin/csh is also tcsh and the one used by default on FreeBSD. This breaks the shell autodetection. But apart from that rakubrew works as I expected.

I did try running the exact command you showed /usr/local/bin/rakubrew init Tcsh | tcsh and that actually does print the same warning. I have a fix for that. I'll try to get a rakudobrew v11 released tomorrow.

patrickbkr commented 3 years ago

We finally managed to push the releases (including this fix) to the website. Closing.