-
Notifications
You must be signed in to change notification settings - Fork 560
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
Handle intrin files on win32 with gcc #20033
Conversation
@kenneth-olwing, our test suite has certain metadata tests (
Thank you very much. |
@jkeenan Thanks for your help. ken1 |
@kenneth-olwing, please see the CI failure reported at https://github.com/Perl/perl5/runs/7672753925?check_suite_focus=true (Windows mingw64). |
I wonder if it would be more robust if get_files() returned the file names in the order seen, rather than randomly per hash randomization. The headers that depend on |
Hi, Being new in this repo I took the cowardly way of fixing things as local to the win32 build as possible...:-). Having said that I now see that my last push eff'd up a lot of whitespace for no good reason :-(. Sorry. I'll fix that, the 'real' changes are just muddied now. Having get_files() return things in order found won't really change the underlying problem as it would still be generally non-determinate whether you'd get the files in an order that satisfies the wish of the headers to have the two files be included first. There is no externally imposed order that can anticipate this or any future similar 'rule'. I only have access to gcc 8.3.0 (strawberry perl) so I have no idea if gcc 12 have changed/added to this in any way...? However, it's certainly a good idea to always do this in a specific order so as to ensure results are more easily repeatable - hence my change to use them in a sorted order (which incidentally will, in my circumstance actually 'fix' the problem, but that's just luck so...). I'm not truly familiar with the script overall and would be hesitant to start mucking around in areas of the script that clearly has existed a long time and as this particular problem apparently hasn't been noticed on other platforms, it feels wrong to try to fix what ain't broken...but I'm open to suggestions. ken1 |
FYI, minimized the whitespace diffs for now to make the functional change be visible, but the file should be sanitized on this score; there's a mix of tab/space indentation in it... |
For the cases where get_files() returns multiple files it gets the list of files by preprocessing a program like:
and scanning the result for |
Doh. Mea culpa. I was so focused on the fact that the previous fix did filename processing that I assumed get_files() was finding the names in a non-determinate manner to begin with; hence I just put my fixes in the same place with a similar idea. Ok, I'll redo on that premise. BRB Thanks, ken1 |
Thank you; do we need to repeat for new pushes or will it start up automatically? |
I suspect we will need to repeat, since for the purpose of this pull request you are a "First-time contributor." But I'm not an expert on our Continuous Integration setup, so don't take what I say as gospel truth. (@toddr, @atoomic) (If you do IRC, this is the sort of question that can often be answered more quickly by hopping on |
Ok, thanks again. |
ext/Errno/Errno_pm.PL
Outdated
if (/$pat/o) { | ||
my $f = $1; | ||
$f =~ s,\\\\,/,g; | ||
$file{$f} = 1; | ||
push(@file, $f); | ||
} | ||
} | ||
else { | ||
$file{$1} = 1 if /$pat/o; | ||
push(@file, $1) if /$pat/o; | ||
} | ||
} | ||
close(CPPO); | ||
} | ||
return keys %file; | ||
return @file; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds duplicate entries to get_files() which really isn't necessary.
Rather than using an array I was thinking of something more like:
my $seq = 1;
while(<CPPO>) {
if ($^O eq 'os2' or $IsMSWin32) {
if (/$pat/o) {
my $f = $1;
$f =~ s,\\\\,/,g;
$file{$f} = $seq++ if !$file{$f};
}
}
else {
$file{$1} = $seq++ if /$pat/o && !$file{$f};
}
}
close(CPPO);
}
return sort { $file{$a} <=> $file{$b} } keys %file;
This returns the filenames in the order seen and avoids returning duplicate entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was aware, and initially tried to use List::Util::uniq on the return; alas, this is not functioning at that point (because it being a miniperl IIUC). So I figured it didn't truly matter, including the same file many times shouldn't cause a problem.
But yes, I checked and there's a fair amount of unnecessary duplication, so I made a local uniq() function to be used for the return list. I think this a bit clearer than having the %seen hash in the main part, and since it's always a list, it will also work for any of the other OS/variant cases in case they have more than one entry in the array.
Pushed a rebased/squashed commit with all changes (also getting rid of some commits I made from work which uses a different mail address in the commit, causing the porting/author.t to complain).
?
@kenneth-olwing A force push of the same branch should re-start CI testing. |
Ok thanks; not sure if you're just responding to that particular point, but otherwise this is IMHO now ready to merge unless there is some other objection. |
The commit message on the only commit is: which doesn't describe what the PR is meant to fix. Other than that it's good. |
Ah. Obviously. |
@toddr |
I see a run 8 hours ago. https://github.com/Perl/perl5/runs/7992394167?check_suite_focus=true Looks like the workflow doesn't trust you. github security at work.
I have approved it. |
I also see a failure on porting/authors.t A failure on this run aborts the other jobs. https://github.com/Perl/perl5/runs/7992394173?check_suite_focus=true |
@kenneth-olwing, can you rebase the p.r. on blead and force push? There have been some commits in the past 24 hours which may have resolved this problem. Thanks. |
This fixes #20033. When building on Windows with Strawberry 5.32.1 (gcc 8.3.0) as the toolchain, the Errno.pm is created by a script Errno_pm.pl, which takes output from the compiler to find headers. A subset of these headers requires them to only be included by some specific headers. Previously the header order was effectively random and this occasionally caused build errors (that further were never detected). The get_files() is now returning the header names in the order the compiler saw them which insures they are in the right order.
Rebased and ran Porting/updateAuthors.pl. Hope that brings it in sync :-) |
This pull request is now passing CI on GitHub. Can we get it looked at by people knowledgeable on Windows? |
Thank you all for input and help! |
This fixes Perl#20033. When building on Windows with Strawberry 5.32.1 (gcc 8.3.0) as the toolchain, the Errno.pm is created by a script Errno_pm.pl, which takes output from the compiler to find headers. A subset of these headers requires them to only be included by some specific headers. Previously the header order was effectively random and this occasionally caused build errors (that further were never detected). The get_files() is now returning the header names in the order the compiler saw them which insures they are in the right order.
Hi all,
This is effectively a new fix for the issue #18025, merged in https://github.com/Perl/perl5/pull/18026.
As it happens, that fix can't ever have worked as I understand it as tests are made against a file basename only, but the variable contains full pathnames. Further, it only addresses two possibilities, but there are more headers that exhibit the behavior that it tries to fix.
It may not have been noticed since it depends on the order of the files, coming as keys from a hash in a non-determinate fashion, and since in many such cases the 'right' files happens to have been #include'd first, and then there simply is no error. Other reasons are that the error is only noticeable if you eyeball the build log, since the code doesn't report back the fact that the gcc run has failed - nor even if it does, the build system doesn't stop.
No need to actually build, just running the Errno_pm.PL script is enough to eventually hit it. In my experience at least once per 10 tries, but typically more; here are some sample runs (using a portable Strawberry 5.32.1 on a Win11 machine):
Unfortunately there is obviously no way to know if future headers in a mingw64 will change the assumption here, but after checking the headers it appears that it is the immintrin.h/x86intrin.h that are required to be 'first' so the code simply ensures that they come in that order (and also that both they and the rest are ordered by sorting the two categories - helps when troubleshooting so the results are always the same...).
Hope this helps,
ken1