Using perlbrew on Cygwin - a problem with gnu tar unwrapping perl archive files
Discussed in https://github.com/gugod/App-perlbrew/discussions/832
Originally posted by somian December 16, 2024 I'm having some trouble setting up and using perlbrew on cygwin, and I don't think I am going to be the only one. Unfortunately I don't understand how to use Github and I don't have time to learn it right now. I'll describe the problem and I can offer a patch by uploading it to this message.
The problem occurs where perlbrew acts on a downloaded perl archive, using gnu tar to expand it. Gnu tar must not be used on a filename that is absolute, on cygwin or MSWindows, because it misunderstands the C: as referring to a remote tape drive or similar device. The flag --force-local must be used or tar dies with an error.
So, I have a fix that should not break any other platform. Thank you for your kind attention.
Here's my console error:
-bash-5.2$ perlbrew install perl-5.38.2
Fetching perl 5.38.2 as C:/Users/somia/perl5/perlbrew/dists/perl-5.38.2.tar.gz
Download https://cpan.metacpan.org/authors/id/P/PE/PEVANS/perl-5.38.2.tar.gz to C:/Users/somia/perl5/perlbrew/dists/perl-5.38.2.tar.gz
tar (child): Cannot connect to C: resolve failed
gzip: stdin: unexpected end of file
tar: Child returned status 128
tar: Error is not recoverable: exiting now
Failed to extract C:/Users/somia/perl5/perlbrew/dists/perl-5.38.2.tar.gz at C:/Users/somia/perl5/perlbrew/bin/perlbrew line 1726.
@somian Thanks for your contribution. Since I don't have a working cygwin environment, I have no way of confirming the result of your patch. I'm OK with just bring in all your changes as it looks like it's properly guarding the scope by checking $^O already.
If you are aware of any free CI service that would provide cygwin environment such that I could run tests in, I'd be glad to set it up so perlbrew can be more or less supported (at least tested) on cygwin.
Thank you for looking at this error report and patch, @gugod. It seems that you found a CI service to test builds of perlbrew on cygwin, I am glad because I did not know of any service to guide you to.
Thank you for looking at this error report and patch, @gugod. It seems that you found a CI service to test builds of perlbrew on cygwin, I am glad because I did not know of any service to guide you to.
Thanks @somian -- I happened to notice that Github Action can run on windows and there is already a way to setup cygwin on top of that. With a bit of luck and searching on the internet I managed to setup a simple a simple way to run the installation of App-perlbrew distribution (of develop branch, or of branches of pull requests) well as the unit tests.
I'm going to briefly modify your patch and make a new pull request based on it too.