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

Bisect runner tweaks #20016

Merged
merged 26 commits into from Feb 11, 2023
Merged

Bisect runner tweaks #20016

merged 26 commits into from Feb 11, 2023

Conversation

nwc10
Copy link
Contributor

@nwc10 nwc10 commented Jul 29, 2022

Patches to enable bisect.pl to build older perls on current Debian

@jkeenan
Copy link
Contributor

jkeenan commented Jul 29, 2022

There are places in this patch where we're "pseudo-patching" ext/Errno/Errno_pm.PL and, in the process are adding trailing whitespace. Do we want to clean that up?

Also, in that same file, could we regularize the leading whitespace (i.e., convert tabs to wordspaces) in the parts that define sub process_file and sub get_file?

@demerphq
Copy link
Collaborator

demerphq commented Jul 30, 2022 via email

@nwc10
Copy link
Contributor Author

nwc10 commented Aug 5, 2022

Sorry for the delay in replying - I wanted to "just" add a bit more, and it took ever longer...

There are places in this patch where we're "pseudo-patching" ext/Errno/Errno_pm.PL and, in the process are adding trailing whitespace. Do we want to clean that up?

Yes, that's a good observation - for these cases, it doesn't matter to the patch application what that whitespace is, and as it's a "fake" patch (I moved it around in the file from the original) rather than a hunk of an original patch, we don't cause problems later if we want to patch it further.

I've fixed this in the rebase.

Also, in that same file, could we regularize the leading whitespace (i.e., convert tabs to wordspaces) in the parts that define sub process_file and sub get_file?

You mean in ext/Errno/Errno_pm.PL itself - yes, we've done this sort of cleanup in the C code - I think it would be fine to have one commit that makes all whitespace "sane" (for some value of sane), which under git diff -w is "no reported changes". I think that github lets us annotate such commits as "whitespace only" (which helps with blame attribution) but I don't think that it's a standard core git feature yet.

But that would be a different PR from this one.

Copy link
Contributor

@jkeenan jkeenan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of your proposed revisions deal with the parts of bisect-runner.pl which patch fundamental files in the core distribution and which are beyond my current expertise. So I'm not the best person to comment on those parts of your p.r. Also, though I am a heavy user of Porting/bisect.pl, I rarely have to go as far back in our history as these revisions are concerned with. But apart from the spelling of one variable this LGTM. Thanks for your research.

Porting/bisect-runner.pl Outdated Show resolved Hide resolved
@demerphq
Copy link
Collaborator

demerphq commented Aug 5, 2022 via email

@jkeenan jkeenan added the Infrastructure Things needed to maintain Perl development label Jan 21, 2023
@demerphq
Copy link
Collaborator

demerphq commented Feb 5, 2023

@jkeenan I think @nwc10 is taking some time off the project. Maybe forever.

So I think you should fix the spelling yourself and commit it use git commit -a --amend and then force push the branch.

We as core committers are allowed to do this. Before we had github a committer would have made such a change as a routine part of committing the change and github shouldn't change that. You can add a note to the committ message stating you made a tweak as part of the ammendment process. Git distinguishes between author and committer, so when you --amend the committ it will keep @nwc10's authorship.

@demerphq
Copy link
Collaborator

demerphq commented Feb 8, 2023

Rebased and fixed the $agressive_apple_security variable.

@demerphq
Copy link
Collaborator

demerphq commented Feb 8, 2023

@jkeenan can you play around with this branch again and just double check it doesnt break any of your bisect work please?

@jkeenan
Copy link
Contributor

jkeenan commented Feb 10, 2023 via email

@demerphq
Copy link
Collaborator

Now I know you are on it I'm good, sorry you felt rushed, I just wanted an ack so i could scratch it off my list. Good luck and thanks!

@jkeenan jkeenan self-requested a review February 11, 2023 00:53
@jkeenan
Copy link
Contributor

jkeenan commented Feb 11, 2023

Since we've never had any regression tests for Porting/bisect.pl and bisect-runner.pl (or for other utility programs under Porting/), we have to take a different approach for this pull request.

What I did was to take most of the use-cases in the EXAMPLES section which I and others have been adding to the documentation in bisect-runner.pl in recent years and run them against the version of Porting/bisect.pl in the bisect-runner-tweaks branch, and then ask, "Did the bisection point to the same "first bad commit" as we did using the blead version in the past?"

I successfully ran the following bisections:

perl Porting/bisect.pl --target=miniperl \
--start=b9d9f9ab79a4bbe3c10743b2b22828dbb8bd2a46 \
--end=09b83c411bd5dcd2722d0acdd5730c75f926811a \
-e 'q|ace| =~ /c(?=.$)/; print ((($#{^CAPTURE} == -1) ? q|AAA| : q|BBB|), "\n") && exit 0'

perl Porting/bisect.pl-Duseithreads \
--start=6256cf2c --end=f6f85064 --module=XML::Parser

perl Porting/bisect.pl \
--start=0c9b04389335c3a662232102a5a5a570e4e7c403 \
--end=269a7913af37c73e7822a085898f90d15d896882 \
--crash -- ./miniperl -Ilib -e '@N = 1..5;map { pop @N } @N;'

perl Porting/bisect.pl \
--start=f1602e0aeea446456c6f795f1844004479db4de3 \
--end=da9ca395ced485afc455e876f420809dc0e64544 \
-DDEBUGGING --target miniperl --crash -- ./miniperl -Ilib -DXvt -Mstrict -e 1

perl Porting/bisect.pl \
--start=fbb9d44aca632b09ec1e12d53fdd2aedb72e78b2 \
--end=198c4f174582886fed1dd36610fff68fbe836c8e \
-DDEBUGGING --target miniperl --crash \
-- ./miniperl -Ilib -DXv -e '{ my $n=1; *foo= sub () { $n }; }'

export ERR="/tmp/err"
perl Porting/bisect.pl \
--start=507614678018ae1abd55a22e9941778c65741ba3 \
--end=d34b46d077dcfc479c36f65b196086abd7941c76 \
--target=test_prep -e 'chdir("t"); system( "./perl harness ../dist/Tie-File/t/43_synopsis.t 2>$ENV{ERR}"); -s $ENV{ERR} and die "See $ENV{ERR} for warnings thrown";'

perl Porting/bisect.pl --start=v5.27.0 --end=v5.27.1 \
--target=miniperl -e '@a = sort{eval"("}1,2'

perl Porting/bisect.pl --start=v5.37.1 --end=v5.37.2 \
--target=miniperl --expect-fail -e '@a = sort{eval"("}1,2'

perl Porting/bisect.pl --start=5624cfff8f --end=b80b9f7fc6 \
--expect-fail -we 'use Scalar::Util; use bigrat; my @w; local $SIG{__WARN__} = sub { die }; print "mercy\n" if Scalar::Util::looks_like_number(1/9)'

So, at least in these nine cases, this pull request does no harm.

In addition, while most of these bisections were running, I observed that ./Configure was being patched in ways consistently with some of @nwc10's commits in this p.r.

Ideally, we would have gotten somebody working on Darwin to review the Darwin-specific commits in this p.r. (All my testing was done on FreeBSD or Linux.) Ideally, we would have had a case to test on the really old Perl versions much of the p.r. is intended to address. But I suspect we'll only get data about that once this is in blead.

So I recommend merging at this point. However, this is a case where I would not like to squash all the commits because that would make understanding what Nick was doing more difficult. On the other hand, there are 26 commits in this p.r. and, other things being equal, that's 26 commits that future uses of Porting/bisect.pl would have to wade through. Is it possible to merge this in a way that for future bisection instances, they only count as one commit? (I've seen talk on IRC recently that we're considering that approach for feature class and if it's feasible we should use that here as well.)

Thank you very much.
Jim Keenan

@demerphq
Copy link
Collaborator

Is it possible to merge this in a way that for future bisection instances, they only count as one commit

Absolutely. I will do that.

What I did was to take most of the use-cases in the EXAMPLES section

That is really a lot of work @jkeenan. Thank you. I very much appreciate it. Also, I really do apologize for giving you the sense that I was rushing you. I really just wanted an "ack, on it, I'll get back to you", not to rush you. I regret it came across that way, especially given how much manual work you put into this.

Thanks again. I'll see to it this is merged as you requested here.

Without this fix, the generated Errno.pm will contain no entries, which
whilst syntactically valid causes much confusion later on when the bisect
run gives bogus results due to non-buggy module code unrelated to the test
case failing because %! is wrong.
Without this fix, Errno.pm fails to build.
Else they are implicitly assumed to return int, which can truncate addresses
on systems where pointers are larger than ints (such as 64 bit systems).
Strictly we only need this for glibc systems, but it doesn't seem terrible
to do it everywhere.
Previously it would skip, which meant you couldn't bisect the cause of
some ./Configure failures, which rather defeats the intent of --test-build.
The version number moved beyond 10, and older hints files were not ready for
this.
Configure can get stuck and ask questions for which it needs a valid answer
before it can continue. As-is, if you redirect stdin from /dev/null (or close
the file descriptor) it will (effectively) loop infinitely repeating the same
question, because it doesn't like empty string as an answer. Worse - it keeps
repeating the question to stdout - eg 'Where is your C library?'

Rather than attempting to patch the shell script to detect errors on read
(because they only matter the *second* time round the loop, *and* wouldn't
handle the /dev/null case), it's easier to patch the relevant loop so that
it will abort after too many loop iterations.
This only affects a small range of commits in development releases, but
without this change they can loop infinitely, rather than correctly skipping
(or failing a build test). An infinite loop (with terminal output) is
extremely unhelpful.
…Util

This problem was rapidly diagnosed and fixed at the time, but we need to fix
the few commits where the problem exists, else we can't bisect other build
failures.
This failure gets in the way of bisecting other problems.
Earlier versions of the hints defaulted to using nm, because on older versions
of OS X (as was) it worked.

It also needs to patch the hints file to force d_stdstdio to "undef".
Without this, a build with "d_faststdio" defined (or implicit) will fail badly
on current macOS, such as the perl-5.8.0 tag.
The older version assumed an explicit prototype for printf(), which doesn't
fly on arm64 macOS. It might not be robust on some other platforms too,
whereas the "current" (ie 2003 onward) approach still works everywhere.

Change edit_file() to only localise $/ to undef during the read, so that it's
restored to its default ("\n") when the callback is invoked. Without this,
`chomp` "doesn't work" (as expected) in the callback.
Without these various probes rely on implicit function declarations, typically
for exit() or printf(). macOS now forbids implicit function declarations,
which causes these probes to become compile time errors and hence "fail".
This results in Configure assuming that many symbols are missing, and the
build fails where it should pass.
The hints for macOS set -flat_namespace conditionally based on darwin
version, so that newer OSes would default to the native two level namespace.
However, the build of miniperl was relying on a flat namespace prior to a
refactoring during the 5.9.x series. Hence we need to force this linker flag
when building versions before this on current macOS versions.
El Capitan (OS X 10.11) (and later) strip DYLD_LIBRARY_PATH from the
environment of /bin/sh, hence setting the existing code that sets this in
%ENV assuming that it is visible to the invoked process no longer works. We
have to be explicit in every invocation, as part of the command that the
shell itself is processing.

This hurts us because in 5.8.0 and earlier the hints default macOS to build
a shared perl library.
Without this some early versions of DB_File won't build on current macOS,
and any other platform where the C compiler is agressive about prototypes.

This commit refactors code for an existing DB_File patch to split a compound
if statement into two ifs.
Else some development versions of 5.003 mysteriously won't build.
These versions aren't important in themselves, but their failure makes it
hard to bisect real problems.
These fallback functions are defined in util.c, but initially did not have
any prototypes in a header.
The regex wasn't handling context diffs, and two of the unified diffs were
generated with differing filenames and trailing timestamp text that it wasn't
robust against.
*Really* early xsubpp doesn't understand this, and it turns out to be trivial
to eliminate it.
@demerphq demerphq merged commit 7e382c3 into Perl:blead Feb 11, 2023
@demerphq
Copy link
Collaborator

Done and dusted @jkeenan. Thank you once again for your testing.

@nwc10 thanks for the patches, applied!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Things needed to maintain Perl development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants