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

git-bash perl should not be first in path #123

Closed
2 of 5 tasks
greghudson opened this issue Dec 3, 2019 · 11 comments
Closed
2 of 5 tasks

git-bash perl should not be first in path #123

greghudson opened this issue Dec 3, 2019 · 11 comments
Assignees
Labels
Area: Scripting and command line awaiting-deployment Code complete; awaiting deployment and/or deployment in progress bug Something isn't working OS: Windows

Comments

@greghudson
Copy link
Contributor

greghudson commented Dec 3, 2019

Describe the bug
The Windows runners have two versions of Perl installed. Strawberry Perl should be first in the default path ahead of git-bash Perl because it handles Windows newlines better.

Virtual environments affected

  • macOS 10.15
  • Ubuntu 16.04 LTS
  • Ubuntu 18.04 LTS
  • Windows Server 2016 R2
  • Windows Server 2019

Expected behavior
The default Perl should be able to read native text files line by line, using "chop" or "chomp" to remove the line separator, and not have extraneous CR characters behind.

Actual behavior
Run a Perl script like:

my $filename = shift @ARGV;
open(my $f, "<", $filename);
while (<$f>) {
    chomp;
    print length, "\n";
}

over a text file with Windows newlines using the default Perl, and observe that the line lengths are wrong. Try again with Strawberry Perl and note that the lengths are correct.

(For comparison, Appveyor has a working Perl first in the default path on its Windows runners. I'm not sure which port it is since it's just installed under C:\Perl. Might be ActiveState Perl.)

@github-actions
Copy link
Contributor

This issue has not had any activity for 45 days and will be closed in 45 days if there continues to be no activity.

@maxim-lobanov
Copy link
Contributor

@greghudson, please let us know if the issue is still actual

@greghudson
Copy link
Contributor Author

Yes, the issue is still there.

@hu13
Copy link

hu13 commented Mar 3, 2020

any updates or work around this?

@miketimofeev
Copy link
Contributor

miketimofeev commented Mar 3, 2020

@greghudson @hu13 strawberry Perl is installed under C:\Strawberry\bin directory. As a workaround, you can simply add that directory to the Path($env:Path = "C:\Strawberry\bin;$env:Path") as the first step of your run or use a full path to Perl.
We will investigate a way to make this Perl default one.

@miketimofeev
Copy link
Contributor

@greghudson @hu13 Pr has been merged. The new VM image rollout with the changes will be next week.

@miketimofeev miketimofeev added the awaiting-deployment Code complete; awaiting deployment and/or deployment in progress label Mar 5, 2020
@miketimofeev
Copy link
Contributor

@greghudson @hu13 the image has been deployed. Could you check that the correct version of Perl is in the PATH?

@hu13
Copy link

hu13 commented Mar 12, 2020

If using powershell on windows runner, it is correct.
However, if using bash, it is still using the git's Perl. Is this expected?

2020-03-12T14:06:42.9143540Z �[36;1mperl -e "print qq(@INC)"�[0m
2020-03-12T14:06:42.9143750Z �[36;1m# cpan App::cpanminus�[0m
2020-03-12T14:06:42.9143896Z �[36;1m# cpanm pod::Usage�[0m
2020-03-12T14:06:42.9144043Z �[36;1m# yum -y install perl-CPAN�[0m
2020-03-12T14:06:42.9144147Z �[36;1m# cpanm Text::Template�[0m
2020-03-12T14:06:42.9144296Z �[36;1m# cpanm Test::More�[0m
2020-03-12T14:06:42.9144439Z �[36;1m# cpanm CPAN::Author�[0m
2020-03-12T14:06:42.9144584Z �[36;1m# make win_64�[0m
2020-03-12T14:06:43.0501208Z shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
2020-03-12T14:06:43.0501459Z ##[endgroup]
2020-03-12T14:06:52.8158533Z C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib
2020-03-12T14:06:52.8658733Z ##[group]Run perl -e "print qq(@INC)"
2020-03-12T14:06:52.8659227Z �[36;1mperl -e "print qq(@INC)"�[0m
2020-03-12T14:06:52.8659350Z �[36;1m# cpan App::cpanminus�[0m
2020-03-12T14:06:52.8659929Z �[36;1m# cpanm pod::Usage�[0m
2020-03-12T14:06:52.8660050Z �[36;1m# yum -y install perl-CPAN�[0m
2020-03-12T14:06:52.8660168Z �[36;1m# cpanm Text::Template�[0m
2020-03-12T14:06:52.8660285Z �[36;1m# cpanm Test::More�[0m
2020-03-12T14:06:52.8660400Z �[36;1m# cpanm CPAN::Author�[0m
2020-03-12T14:06:52.8660517Z �[36;1m# make win_64�[0m
2020-03-12T14:06:52.8671776Z shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
2020-03-12T14:06:52.8671911Z ##[endgroup]
2020-03-12T14:06:53.9928513Z /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl

@greghudson
Copy link
Contributor Author

I can confirm that Strawberry Perl is first in the path for a cmd shell, and I no longer need to manually put it first.

However, if using bash, it is still using the git's Perl. Is this expected?

That might be unavoidable from the perspective of runner setup. The bad Perl comes from the git-bash package, and the git-bash bash might be putting the git-bash bindir first in the path at startup.

This problem would of course go away if the git-bash Perl handled newlines correctly. I will about filing an issue in the appropriate place, if there isn't one already.

@oktal3700
Copy link

strawberry Perl is installed under C:\Strawberry\bin directory.

For anyone else wondering, it's actually under C:\Strawberry\perl\bin

@usptact
Copy link

usptact commented Feb 18, 2021

For posterity, I fixed this problem in Git Bash by making sure Strawberry Perl is first in PATH.
export PATH=/c/Strawberry/perl/bin:$PATH
then running the cmake build commads.
If you got an error, delete the current build directory and also the ~/.hunter directory. Then restart the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Scripting and command line awaiting-deployment Code complete; awaiting deployment and/or deployment in progress bug Something isn't working OS: Windows
Projects
None yet
Development

No branches or pull requests

7 participants