Page MenuHomePhabricator

getMainExecutable: Fix hand-rolled AT_EXECPATH search for older branches
ClosedPublic

Authored by kevans on May 1 2020, 9:24 AM.

Details

Summary

Once we hit AT_NULL, we need to bail out of the loop; not just the enclosing
switch. This fixes basic usage (e.g. cc --version) when AT_EXECPATH isn't
present on older branches (e.g. under qemu-user-static, at the moment),
where we would previously run off the end of ::environ.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>

Diff Detail

Event Timeline

kevans created this revision.May 1 2020, 9:24 AM

Since there are only two cases I'd be tempted to use an if instead of a switch. That would avoid the need for a go-to.

kevans updated this revision to Diff 261650.May 2 2020, 7:56 AM

Sure; I have no strong preference.

arichardson accepted this revision.May 2 2020, 8:29 AM

LGTM if @emaste / @dim are also happy with it.

This revision is now accepted and ready to land.May 2 2020, 8:29 AM
emaste accepted this revision.May 2 2020, 1:08 PM
emaste added a comment.May 7 2020, 1:06 PM

I will commit this shortly (and then merge the change into FreeBSD's copy).

This revision was automatically updated to reflect the committed changes.
MaskRay added a subscriber: MaskRay.EditedMay 7 2020, 2:45 PM

We are using git now. Please use git commit --amend --author=

Thanks for stripping unneeded Phabricator tags.

I usually do this when committing: arcfilter; git fetch origin master && git rebase origin/master; last-minute-testing && git push origin HEAD:master where arcfilter is a shell function which drops unneeded Phabricator tags (Subscribers:, Summary:, Tags:, Reviewers:) but keeps Differential Revision: and Reviewed By:

arcfilter () {
        arc amend
        git log -1 --pretty=%B | awk '/Reviewers:|Subscribers:/{p=1} /Reviewed By:|Differential Revision:/{p=0} !p && !/^Summary:$/ {sub(/^Summary: /,"");print}' | git commit --amend -F -
}

Also, we don't use Signed-off-by: