ugexe / zef

Raku Module Management
Artistic License 2.0
206 stars 44 forks source link

zef install fails on a fresh (?) M1 macos brew install of rakudo star #552

Closed cognominal closed 6 days ago

cognominal commented 4 months ago

Context

This is a followup on https://github.com/rakudo/star/issues/199

Expected Behavior

Installation of App::Mi6

Actual Behavior

Installation fails

Steps to Reproduce

zef --debug install App::Mi6
===> Searching for: App::Mi6
===> Found: App::Mi6:ver<3.0.4>:auth<zef:skaji> [via Zef::Repository::Ecosystems<fez>]
===> Dependencies: Pod::To::Markdown, Shell::Command, fez, TAP
===> Searching for missing dependencies: Pod::To::Markdown:ver<0.2.1+>, fez:ver<38+>
===> Found dependencies: fez:ver<55>:auth<zef:tony-o>:api<0> [via Zef::Repository::Ecosystems<fez>]
===> Found dependencies: Pod::To::Markdown:ver<0.2.1>:auth<cpan:SOFTMOTH> [via Zef::Repository::Ecosystems<rea>]
===> Dependencies: Pod::To::HTML
===> Fetching: App::Mi6
===> Fetching: Pod::To::Markdown:ver<0.2.1+>
===> Fetching: fez:ver<38+>
[App::Mi6] Fetching https://360.zef.pm/A/PP/APP_MI6/0869ab01c0d73b78b04600d0b6c5d73359af8914.tar.gz with plugin: Zef::Service::Shell::curl
[Pod::To::Markdown] Fetching https://raw.githubusercontent.com/raku/REA/main/archive/P/Pod%3A%3ATo%3A%3AMarkdown/Pod%3A%3ATo%3A%3AMarkdown%3Aver%3C0.2.1%3E%3Aauth%3Ccpan%3ASOFTMOTH%3E.tar.gz with plugin: Zef::Service::Shell::curl
[fez] Fetching https://360.zef.pm/F/EZ/FEZ/545919bd9786e02834ecf24e3d93febfba196bf3.tar.gz with plugin: Zef::Service::Shell::curl
===> Fetching [OK]: Pod::To::Markdown:ver<0.2.1>:auth<cpan:SOFTMOTH> to /var/folders/n0/_8g462950vgdhwl4s_h_jysw0000gn/T//.zef/1710712745.5407/1710712765.5407.7502.760373204599/Pod%3A%3ATo%3A%3AMarkdown%3Aver%3C0.2.1%3E%3Aauth%3Ccpan%3ASOFTMOTH%3E.tar.gz
===> Fetching [OK]: App::Mi6:ver<3.0.4>:auth<zef:skaji> to /var/folders/n0/_8g462950vgdhwl4s_h_jysw0000gn/T//.zef/1710712745.5407/1710712765.5407.3645.7283472892477/0869ab01c0d73b78b04600d0b6c5d73359af8914.tar.gz
===> Fetching [OK]: fez:ver<55>:auth<zef:tony-o>:api<0> to /var/folders/n0/_8g462950vgdhwl4s_h_jysw0000gn/T//.zef/1710712745.5407/1710712765.5407.4150.6831960378295/545919bd9786e02834ecf24e3d93febfba196bf3.tar.gz
===> Extracting: App::Mi6
Enabled extracting backends [git unzip path] don't understand /var/folders/n0/_8g462950vgdhwl4s_h_jysw0000gn/T//.zef/1710712745.5407/1710712765.5407.3645.7283472892477/0869ab01c0d73b78b04600d0b6c5d73359af8914.tar.gz
You may need to configure one of the following backends, or install its underlying software - [tar]

Your Environment

➜  raku zef list --installed
===> Found via inst#/opt/homebrew/Cellar/rakudo-star/2024.02/share/perl6/core
rakudo:ver<2024.02>:auth<Yet Another Society>
===> Found via inst#/opt/homebrew/Cellar/rakudo-star/2024.02/share/perl6/site
App::Prove6:ver<0.0.17>:auth<cpan:LEONT>
App::Zef-Deps:ver<0.9.8>:auth<zef:coke>
Config::Parser::json:ver<1.0.0>:auth<github:arjancwidlak>
Config::Parser::yaml:ver<1.0.0>:auth<github:scriptkitties>
Config::TOML:ver<0.1.2>:auth<atweiden>
Config:ver<3.0.4>:auth<cpan:TYIL>:api<3>
Crane:ver<0.1.1>:auth<atweiden>
DBIish:ver<0.6.6>:auth<zef:raku-community-modules>:api<1>
DateTime::Format:ver<0.1.5>:auth<zef:raku-community-modules>:api<1.0>
DateTime::Parse:ver<0.9.3>:auth<github:sergot>
Digest:ver<1.1.0>:auth<zef:grondilu>
Distribution::Builder::MakeFromJSON:ver<0.6>:auth<github:niner>
Encode:ver<0.0.4>:auth<github:sergot>
File::Directory::Tree:ver<0.1>:auth<zef:labster>
File::Find:ver<0.2.1>:auth<zef:raku-community-modules>
File::Temp:ver<0.0.10>:auth<zef:rbt>
File::Which:ver<1.0.4>
Getopt::Long:ver<0.4.2>
Grammar::Debugger:ver<1.0.1>:auth<github:jnthn>
Grammar::Profiler::Simple:ver<0.05>:auth<zef:raku-community-modules>
HTTP::Easy:ver<1.2>:auth<zef:raku-community-modules>
HTTP::Status:ver<0.0.4>:auth<zef:lizmat>
HTTP::UserAgent:ver<1.1.52>:auth<github:sergot>
Hash::Merge:ver<2.0.0>:auth<github:scriptkitties>:api<2>
IO::Capture::Simple:ver<v.0.0.2>:auth<zef:jjmerelo>
IO::Glob:ver<0.9.0>:auth<github:zostay>
IO::Path::XDG:ver<0.2.0>:api<0>
IO::Socket::SSL:ver<0.0.3>:auth<github:sergot>
IO::String:ver<0.1.1>:auth<Rob Hoelz>
JSON::Class:ver<0.0.21>:auth<zef:jonathanstowe>:api<1.0>
JSON::Fast:ver<0.19>:auth<cpan:TIMOTIMO>
JSON::Marshal:ver<0.0.25>:auth<zef:jonathanstowe>:api<1.0>
JSON::Name:ver<0.0.7>:auth<zef:jonathanstowe>:api<1.0>
JSON::OptIn:ver<0.0.2>:auth<zef:jonathanstowe>
JSON::RPC:ver<1.0.6>:auth<zef:bbkr>
JSON::Tiny:ver<1.0>
JSON::Unmarshal:ver<0.15>:auth<zef:raku-community-modules>
L10N::DE:ver<0.0.1>:auth<zef:l10n>
L10N::EN:ver<0.0.1>:auth<zef:l10n>
L10N::FR:ver<0.0.1>:auth<zef:l10n>
L10N::HU:ver<0.0.1>:auth<zef:l10n>
L10N::IT:ver<0.0.1>:auth<zef:l10n>
L10N::NL:ver<0.0.1>:auth<zef:l10n>
L10N::PT:ver<0.0.1>:auth<zef:l10n>
L10N:ver<0.0.2>:auth<zef:l10n>
LWP::Simple:ver<0.109>:auth<zef:raku-community-modules>
LibraryCheck:ver<0.0.12>:auth<zef:jonathanstowe>:api<1.0>
LibraryMake:ver<1.0.5>:auth<zef:jjmerelo>
License::SPDX:ver<3.22.0>:auth<zef:jonathanstowe>:api<1.0>
License::SPDX:ver<3.23.0>:auth<zef:jonathanstowe>:api<1.0>
Log::Colored:ver<0.1.2>:api<0>
Log:ver<0.3.0>:auth<cpan:TYIL>:api<0>
Log:ver<0.3.1>:auth<cpan:TYIL>:api<0>
META6:ver<0.0.30>:auth<zef:jonathanstowe>:api<1.0>
MIME::Base64:ver<1.2.3>:auth<zef:raku-community-modules>
NativeCall::TypeDiag:auth<Sylvain Colinet>
NativeHelpers::Blob:ver<0.1.12>:auth<github:salortiz>
NativeLibs:ver<0.0.9>:auth<github:salortiz>
OO::Monitors:ver<1.1.1>
OpenSSL:ver<0.2.2>:auth<github:sergot>
PSGI:ver<1.2.1>:auth<zef:raku-community-modules>
Path::Finder:ver<0.4.7>:auth<zef:leont>
PathTools:ver<0.2.0>:auth<github:ugexe>
Pod::Load:ver<0.7.2>:auth<zef:jjmerelo>
Pod::To::BigPage:ver<0.5.2>:auth<Perl 6>
Pod::To::HTML:ver<0.7.1>:auth<github:Raku>
Pod::Usage:ver<0.0.1>:auth<zef:leont>
SVG::Plot
SVG:ver<1.0>
Shell::Command:ver<1.1>:auth<zef:raku-community-modules>
System::Query:ver<0.1.6>:auth<zef:tony-o>
TAP:ver<0.3.14>
Temp::Path:ver<1.001008>
Template6:ver<0.14.0>:auth<zef:raku-community-modules>
Template::Mojo:ver<0.2.2>:auth<zef:raku-community-modules>
Template::Mustache:ver<1.2.3>:auth<github:softmoth>
Term::termios:ver<0.2.7>:auth<zef:krunen>
Term::termios:ver<0.2>:auth<github:krunen>
Terminal::ANSIColor:ver<0.10>:auth<zef:lizmat>
Terminal::ANSIColor:ver<0.9.1>:auth<zef:lizmat>
Terminal::ANSIParser:ver<0.0.3>:auth<zef:japhb>
Terminal::Capabilities:ver<0.0.3>:auth<zef:japhb>
Terminal::LineEditor:ver<0.0.16>:auth<zef:japhb>
Test::META:ver<0.0.20>:auth<zef:jonathanstowe>:api<1.0>
Test::Mock:ver<1.6>:auth<zef:jnthn>
Test::Output:ver<1.001006>:auth<zef:raku-community-modules>
Test::Util::ServerPort:ver<0.0.5>:auth<zef:jonathanstowe>:api<1.0>
Test::When:ver<1.001009>:auth<zef:raku-community-modules>
Testo:ver<1.003009>:auth<zef:raku-community-modules>
Text::MiscUtils:ver<0.0.9>:auth<zef:japhb>
URI:ver<0.3.7>:auth<zef:raku-community-modules>
XML::Writer
XML:ver<0.3.3>:auth<zef:raku-community-modules>
YAMLish:ver<0.1.0>:auth<zef:leont>
sigpipe:ver<0.0.3>:auth<zef:leont>
zef:ver<0.21.4>:auth<github:ugexe>:api<0>
ugexe commented 4 months ago

Enabled extracting backends [git unzip path] don't understand /var/folders/n0/_8g462950vgdhwl4s_h_jysw0000gn/T//.zef/1710712745.5407/1710712765.5407.3645.7283472892477/0869ab01c0d73b78b04600d0b6c5d73359af8914.tar.gz

This implies you don't have the tar command available in your PATH. You can look at https://github.com/ugexe/zef/blob/main/lib/Zef/Service/Shell/tar.rakumod for an example of the code that gets run. Specifically the probe method, when it returns true, tells zef that it can find tar and use it.

FWIW I've installed fresh rakudos on various M1/M2/M3 macbooks and used zef successfully as-is, so it is strange that tar seems to not be findable on your system.

cognominal commented 4 months ago

Thx. Tar is accessible thru PATH env var. But something may be indeed wrong with my system. I have seen strange error messages when running docker failing to fork stuff thru bin/sh or whatever. That does not affect docker otherwise. This may be related.

cognominal commented 4 months ago

Problem solved, thx to your help. Zef found a tar executable in PDP11 (!!! see below) format and did not try to find further in the PATH env the path for a correct tar. So zef could be more robust against that kind of time travel so I don't close the bug report. But really that's on me.

This is really comical. I deserve tar and feathers. And it is indeed doubly a tar problem. A few days ago, I pulled the tar of v7 unix because I wanted to see the sources of the prehistoric shell. I untared it in my home directory, which was a mistake because the tar has no prefix so the /bin files ended up in ~/bin. I was searching for the sources and I did not notice the tar contained the binaries as well so I did not clean it up.

$ cd ~/bin
$ file tar
tar: PDP-11 separate I&D executable
$ ls -l tar
-rwxr-xr-x  1 cog  staff  17724 May 16  1979 tar
$ which tar
/usr/bin/tar

And speaking of shells. Modern shells are robust. zsh does not even whine and execs the good tar.

ugexe commented 4 months ago

I’m not sure what a reasonable action for zef to take is in that scenario. There would have to be a way to determine the type of tar (bsd, gnu, busybox, etc) as well as the version from invoking the command itself, and as far as I know there is no way to do this. I’m also not really a fan of trying every version of a program in PATH to find one that works - that’s not how any shell works when invoking commands so is just as likely to lead to some other confusing behavior for some other edge case. Maybe I’m missing something though… do any other popular tools behave like that?

cognominal commented 4 months ago

Like I said, neither modern shells fall in that trap, nor the which command. So there must be a way to do it. Having my problem (that was clearly my fault) solved, I understand these may be a low priority target for you to work around buggy user settings.

I thank you for your helpful support and for writing zef in the first place.

My real concern would be it is real slow compared to npm but that may be a rakudo problem.

ugexe commented 4 months ago

I mentioned PATH earlier, but really zef just does the equivalent of run 'tar', '--help - it doesn't actually crawl PATH looking for what to run. It sounds like one of your shell files might be setting up PATH for an interactive shell but not for other processes or something. I'm not sure that e.g. which tar does any magic to find the "right" tar or tries multiple tars.

cognominal commented 4 months ago

Once I have suppressed the spurious PDP11 executables in my `~/bin' folder all problems and warning messages have disappeared on my mac. As for calling the right executables when spurious ones appear earlier in the PATH , I don't know the correct idiom and how it would translate rakuwise.