Raku / App-Rakubrew

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

Use of temporary directory value $dir in Build.pm under Darwin #8

Closed SqrtNegInf closed 4 years ago

SqrtNegInf commented 4 years ago

This 'my' should be removed, as it localizes the value of $dir to just inside this conditional block, making unavailable to 'return':

https://github.com/Raku/App-Rakubrew/blob/5d4feb61bcbc63a89bca6a18c1d74e82012d1df9/lib/App/Rakubrew/Build.pm#L29

If the code follows the 'darwin' branch, then $versions_dir is never set?

https://github.com/Raku/App-Rakubrew/blob/5d4feb61bcbc63a89bca6a18c1d74e82012d1df9/lib/App/Rakubrew/Build.pm#L125

Both of the above (in 'build_impl') apply to the corresponding code in the 'build_triple' routine.

patrickbkr commented 4 years ago

Good spotting!

I fixed the first error in this commit.

$versions_dir is set in a separate file App::Rakubrew::Variables. I think that's probably non-obvious and the code layout should be changed somehow. Not sure how yet, though.

I am not entirely sure if there is yet another error in your report that I missed. Can you confirm?

patrickbkr commented 4 years ago

@SqrtNegInf I just uploaded v4. Can you give it a try?

SqrtNegInf commented 4 years ago

Downloaded v4, and it looks good (as in: works on older Darwin releases). In general, you can pre-flight this in future releases by verifying that this commands returns nothing:

strings rakubrew | grep chkstk

Will continue testing, and let you know if anything else turns up.

SqrtNegInf commented 4 years ago

That was quick...

Building NQP ...
perl Configure.pl --prefix=/private/tmp/rakubrew_build_XYlz1KscJu/moar-2020.02/install --make-install --git-protocol=https --relocatable --no-ignore-errors --silent-build --no-force-rebuild --git-cache-dir=/Users/dhoekman/Library/Application Support/.rakubrew/git_reference --backends=moar --gen-moar
Updating submodules .................................... Too many arguments.

Presumably if the argument to '--git-cache-dir' were quoted, it would go better? That was without $RAKUBREW_HOME set, so it was using the default directory. I will do a separate attempt with a path containing no spaces.

Incidentally, I tried a Windows install too, a couple of days ago, and it also failed because of a space in home folder of the account I was using, "David Hoekman" (am I not talented at breaking things?). I changed my account name to "dhoekman", but haven't had a chance to re-try it.

patrickbkr commented 4 years ago

The Windows situation is worse than the one on MacOS. The only way out is to fix rakudo being able to build in a folder with spaces. That's on my todo list (see #4).

With respect to the Too many arguments. error: I think that's a bug in the rakudo build process. I'm not entirely sure, but think so. If that proves to be true, then we'll have to wait for 2020.03 for the fix. I'll have a look. Apart from that pre-compiled packages should be ready soon. When they are, the rakubrew download command can be used, which circumvents problems with building.

SqrtNegInf commented 4 years ago

OTOH, my primary use of the system will be 'rakubrew build moar-blead', as I do daily updates for my Raku smoke-test (https://github.com/SqrtNegInf/Rosettacode-Perl6-Smoke), so am motivated to keep up 'rakubrew' build testing...

patrickbkr commented 4 years ago

@SqrtNegInf I hope this is fixed with https://github.com/rakudo/rakudo/commit/3ec58489e7b512df9e48c782046ceb95e1abdfa4 and https://github.com/perl6/nqp/commit/b9a1878c4ffe82209be15e0e27b128964365aff6.

SqrtNegInf commented 4 years ago

Unfortunately, when using the default path there is still a place where 'Application Support' causes problems:

HEAD is now at 75ed826... [release] Bump VERSION to 2020.02
Building NQP ...
perl Configure.pl --prefix=/private/tmp/rakubrew_build_jNktVr3jo5/moar-2020.02/install --make-install --git-protocol=https --relocatable --no-ignore-errors --silent-build --no-force-rebuild --git-cache-dir=/Users/dhoekman/Library/Application Support/.rakubrew/git_reference --backends=moar --gen-moar
Updating submodules .................................... Too many arguments.

If I set $RAKUBREW_HOME (to path with no spaces) then the build completes, and the only problem with moving the build to the destination (doesn't know the source or destination, haven't tested which):

Rakudo has been built and installed.
Moving installation to target directory
Can't move installation: Not a directory at App/Rakubrew/Build.pm line 128.

If I move 'moar-2020.02' from the /tmp build location to the 'versions' folder everything works right.

SqrtNegInf commented 4 years ago

To get the installation to the proper location after building, I made the following two changes in Build.pm:

chdir($tmp_dir= _get_temp_dir()); # line 96

File::Copy::Recursive::dirmove("$tmp_dir/$name", $destdir) or die "Can't move installation: $!"; # line 128

patrickbkr commented 4 years ago

@SqrtNegInf Your changes have been in corporated in this commit. Thanks for that! The fixes to MoarVM, NQP and Rakudo to repair a git cache directory with a space in its path will be done soonish. So starting with 2020.03 building should work on MacOS in its default path (which has spaces).

patrickbkr commented 4 years ago

I have given up on trying to be clever with the spaces in path problem. There are some very difficult hurdles to overcome to get this done cleanly. So rakubrew (in the recently released version 5) now defaults to installing to ~/.rakubrew and C:\rakubrew and warns during install when the install dir contains a space. I hope this solves this problem as good as is possible given the circumstances we have.