{"thread":{"id":"53892","subject":"[PATCH] [RFC] travis-ci: remove bogus 'pyenv' in the Linux jobs","startedAt":"2020-07-21T16:12:44Z","lastAt":"2020-07-24T13:58:51Z","messageCount":7,"participants":["SZEDER Gábor","Eric Sunshine","Junio C Hamano","brian m. carlson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"401808","messageId":"20200721161225.6769-1-szeder.dev@gmail.com","threadId":"53892","inReplyTo":null,"subject":"[PATCH] [RFC] travis-ci: remove bogus 'pyenv' in the Linux jobs","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2020-07-21T16:12:25Z","receivedAt":"2020-07-21T16:12:44Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"In our test suite, when 'git p4' invokes a Git command as a\nsubprocesses, then it should run the 'git' binary we are testing.\nUnfortunately, this is not the case in the 'linux-clang' and\n'linux-gcc' jobs on Travis CI, where 'git p4' runs the system\n'/usr/bin/git' instead.\n\nTravis CI's default Linux image includes 'pyenv', and all Python\ninvocations that involve PATH lookup go through 'pyenv', e.g. our\n'PYTHON_PATH=$(which python3)' sets '/opt/pyenv/shims/python3' as\nPYTHON_PATH, which in turn will invoke '/usr/bin/python3'.  Alas, the\n'pyenv' version included in this image is buggy, and prepends the\ndirectory containing the Python binary to PATH even if that is a\nsystem directory already in PATH near the end.  Consequently, 'git p4'\nin those jobs ends up with its PATH starting with '/usr/bin', and then\nruns '/usr/bin/git'.\n\nSo remove 'pyenv' in Travis CI's Linux jobs to prevet it from\ninterfering with our 'git p4' tests.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n\nNotes:\n    This issue triggered test failures in all 'git p4' test scripts in the\n    recent GIT_TEST_DEFAULT_HASH=sha256 test runs, because the system Git\n    doesn't understand the 'objectformat' extension, e.g.:\n    \n      https://travis-ci.org/github/git/git/jobs/710159470#L3267\n    \n    This is not an issue in Travis CI's macOS jobs or on Azure Pipelines,\n    because they don't use 'pyenv'.\n    \n    However, perhaps removing 'pyenv' is not the best solution here.\n    \n    We set PYTHON_PATH in 'ci/lib.sh', which is sourced at the beginning\n    of (almost) all of our CI scripts.  Consequently, in these jobs we\n    first run 'ci/install-dependencies.sh', which sources 'ci/lib.sh',\n    assigns PYTHON_PATH=/opt/pyenv/shims/python3 (which is never used),\n    and removes 'pyenv', and then run 'ci/run-build-and-test.sh', which\n    sources 'ci/lib.sh' and assigns PYTHON_PATH=/usr/bin/python3 (which is\n    then used in the build process to set 'pit p4's shebang line).  Not\n    really nice, is it.\n    \n    Alternatively, we could avoid the PATH lookup and thus the bogus\n    'pyenv' by explicitly using '/usr/bin/python{2,3}'.  The Linux images\n    in both Travis CI and Azure Pipelines are standard Ubuntu images, so I\n    think we can safely rely on these Python paths.\n\n ci/install-dependencies.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 0229a77f7d..b4bdcbcba2 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -36,6 +36,14 @@ linux-clang|linux-gcc)\n \t\ttar --extract --gunzip --file \"git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\tcp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .\n \tpopd\n+\n+\tif test true = \"$TRAVIS\" &&\n+\t   pyenv_root=$(pyenv root)\n+\tthen\n+\t\t# pyenv in Travis CI's current default (xenial) Linux\n+\t\t# image messes up PATH for 'git p4'.\n+\t\tsudo rm -rf \"$pyenv_root\"\n+\tfi\n \t;;\n osx-clang|osx-gcc)\n \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n-- \n2.28.0.rc1.319.g12ef029c8a\n\n"},{"id":"401810","messageId":"CAPig+cQmjgmWx3Y_8WwOORsjW0Q7M-xXKonFW1qfHYLW3mD4Fw@mail.gmail.com","threadId":"53892","inReplyTo":"20200721161225.6769-1-szeder.dev@gmail.com","subject":"Re: [PATCH] [RFC] travis-ci: remove bogus 'pyenv' in the Linux jobs","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-21T16:23:25Z","receivedAt":"2020-07-21T16:23:39Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jul 21, 2020 at 12:12 PM SZEDER Gábor <szeder.dev@gmail.com> wrote:\n> In our test suite, when 'git p4' invokes a Git command as a\n> subprocesses, then it should run the 'git' binary we are testing.\n> Unfortunately, this is not the case in the 'linux-clang' and\n> 'linux-gcc' jobs on Travis CI, where 'git p4' runs the system\n> '/usr/bin/git' instead.\n>\n> Travis CI's default Linux image includes 'pyenv', and all Python\n> invocations that involve PATH lookup go through 'pyenv', e.g. our\n> 'PYTHON_PATH=$(which python3)' sets '/opt/pyenv/shims/python3' as\n> PYTHON_PATH, which in turn will invoke '/usr/bin/python3'.  Alas, the\n> 'pyenv' version included in this image is buggy, and prepends the\n> directory containing the Python binary to PATH even if that is a\n> system directory already in PATH near the end.  Consequently, 'git p4'\n> in those jobs ends up with its PATH starting with '/usr/bin', and then\n> runs '/usr/bin/git'.\n>\n> So remove 'pyenv' in Travis CI's Linux jobs to prevet it from\n\ns/prevet/prevent/\n\n> interfering with our 'git p4' tests.\n>\n> diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\n> @@ -36,6 +36,14 @@ linux-clang|linux-gcc)\n> +\n> +       if test true = \"$TRAVIS\" &&\n> +          pyenv_root=$(pyenv root)\n> +       then\n> +               # pyenv in Travis CI's current default (xenial) Linux\n> +               # image messes up PATH for 'git p4'.\n\nI wonder if this comment should give more precise detail about exactly\nhow it \"messes up\" PATH.\n\n> +               sudo rm -rf \"$pyenv_root\"\n> +       fi\n"},{"id":"401823","messageId":"xmqqsgdk7gkq.fsf@gitster.c.googlers.com","threadId":"53892","inReplyTo":"20200721161225.6769-1-szeder.dev@gmail.com","subject":"Re: [PATCH] [RFC] travis-ci: remove bogus 'pyenv' in the Linux jobs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-21T20:34:29Z","receivedAt":"2020-07-21T20:34:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder.dev@gmail.com> writes:\n\n>     Alternatively, we could avoid the PATH lookup and thus the bogus\n>     'pyenv' by explicitly using '/usr/bin/python{2,3}'.  The Linux images\n>     in both Travis CI and Azure Pipelines are standard Ubuntu images, so I\n>     think we can safely rely on these Python paths.\n\nThat sounds quite sensible, actually.  The CI environment being\n\"special\" in the sense that we have certain control over it makes\nthis rather straight-forward.\n\n\n\n"},{"id":"401829","messageId":"20200721222004.GA1667453@crustytoothpaste.net","threadId":"53892","inReplyTo":"20200721161225.6769-1-szeder.dev@gmail.com","subject":"Re: [PATCH] [RFC] travis-ci: remove bogus 'pyenv' in the Linux jobs","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-21T22:20:05Z","receivedAt":"2020-07-21T22:20:42Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-07-21 at 16:12:25, SZEDER Gábor wrote:\n> In our test suite, when 'git p4' invokes a Git command as a\n> subprocesses, then it should run the 'git' binary we are testing.\n> Unfortunately, this is not the case in the 'linux-clang' and\n> 'linux-gcc' jobs on Travis CI, where 'git p4' runs the system\n> '/usr/bin/git' instead.\n> \n> Travis CI's default Linux image includes 'pyenv', and all Python\n> invocations that involve PATH lookup go through 'pyenv', e.g. our\n> 'PYTHON_PATH=$(which python3)' sets '/opt/pyenv/shims/python3' as\n> PYTHON_PATH, which in turn will invoke '/usr/bin/python3'.  Alas, the\n> 'pyenv' version included in this image is buggy, and prepends the\n> directory containing the Python binary to PATH even if that is a\n> system directory already in PATH near the end.  Consequently, 'git p4'\n> in those jobs ends up with its PATH starting with '/usr/bin', and then\n> runs '/usr/bin/git'.\n\nOuch.  So we're testing git-p4, but not the git binary underlying it.\nFixing this definitely seems like a good idea.\n-- \nbrian m. carlson: Houston, Texas, US\n"},{"id":"401967","messageId":"20200723213848.30032-1-szeder.dev@gmail.com","threadId":"53892","inReplyTo":"xmqqsgdk7gkq.fsf@gitster.c.googlers.com","subject":"[PATCH v2] ci: use absolute PYTHON_PATH in the Linux jobs","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2020-07-23T21:38:48Z","receivedAt":"2020-07-23T21:38:57Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"In our test suite, when 'git p4' invokes a Git command as a\nsubprocesses, then it should run the 'git' binary we are testing.\nUnfortunately, this is not the case in the 'linux-clang' and\n'linux-gcc' jobs on Travis CI, where 'git p4' runs the system\n'/usr/bin/git' instead.\n\nTravis CI's default Linux image includes 'pyenv', and all Python\ninvocations that involve PATH lookup go through 'pyenv', e.g. our\n'PYTHON_PATH=$(which python3)' sets '/opt/pyenv/shims/python3' as\nPYTHON_PATH, which in turn will invoke '/usr/bin/python3'.  Alas, the\n'pyenv' version included in this image is buggy, and prepends the\ndirectory containing the Python binary to PATH even if that is a\nsystem directory already in PATH near the end.  Consequently, 'git p4'\nin those jobs ends up with its PATH starting with '/usr/bin', and then\nruns '/usr/bin/git'.\n\nSo use the absolute paths '/usr/bin/python{2,3}' explicitly when\nsetting PYTHON_PATH in those Linux jobs to avoid the PATH lookup and\nthus the bogus 'pyenv' from interfering with our 'git p4' tests.\nDon't bother with special-casing Travis CI: while this issue doesn't\naffect the corresponding Linux jobs on GitHub Actions, both CI systems\nuse Ubuntu LTS-based images, so we can safely rely on these Python\npaths.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n\nJunio, I see that you picked up the first/RFC version and applied it\non top of v2.26.2.  This patch won't work on v2.26.2, because its 'git\np4' is not compatible with python3 yet.\n\n ci/lib.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex ff24c547c8..3eefec500d 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -184,9 +184,9 @@ linux-clang|linux-gcc)\n \tif [ \"$jobname\" = linux-gcc ]\n \tthen\n \t\texport CC=gcc-8\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n+\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python3\"\n \telse\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n+\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python2\"\n \tfi\n \n \texport GIT_TEST_HTTPD=true\n-- \n2.28.0.rc2.319.g2e16345e2b\n\n"},{"id":"401972","messageId":"xmqqwo2toobn.fsf@gitster.c.googlers.com","threadId":"53892","inReplyTo":"20200723213848.30032-1-szeder.dev@gmail.com","subject":"Re: [PATCH v2] ci: use absolute PYTHON_PATH in the Linux jobs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-23T22:31:56Z","receivedAt":"2020-07-23T22:32:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder.dev@gmail.com> writes:\n\n> In our test suite, when 'git p4' invokes a Git command as a\n> subprocesses, then it should run the 'git' binary we are testing.\n> Unfortunately, this is not the case in the 'linux-clang' and\n> 'linux-gcc' jobs on Travis CI, where 'git p4' runs the system\n> '/usr/bin/git' instead.\n>\n> Travis CI's default Linux image includes 'pyenv', and all Python\n> invocations that involve PATH lookup go through 'pyenv', e.g. our\n> 'PYTHON_PATH=$(which python3)' sets '/opt/pyenv/shims/python3' as\n> PYTHON_PATH, which in turn will invoke '/usr/bin/python3'.  Alas, the\n> 'pyenv' version included in this image is buggy, and prepends the\n> directory containing the Python binary to PATH even if that is a\n> system directory already in PATH near the end.  Consequently, 'git p4'\n> in those jobs ends up with its PATH starting with '/usr/bin', and then\n> runs '/usr/bin/git'.\n>\n> So use the absolute paths '/usr/bin/python{2,3}' explicitly when\n> setting PYTHON_PATH in those Linux jobs to avoid the PATH lookup and\n> thus the bogus 'pyenv' from interfering with our 'git p4' tests.\n> Don't bother with special-casing Travis CI: while this issue doesn't\n> affect the corresponding Linux jobs on GitHub Actions, both CI systems\n> use Ubuntu LTS-based images, so we can safely rely on these Python\n> paths.\n\nGood.  This does not need to touch pyenv but take advantage of the\nfact that we know where Python 2 and 3 are.  Nice.\n\n>\n> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n> ---\n>\n> Junio, I see that you picked up the first/RFC version and applied it\n> on top of v2.26.2.  This patch won't work on v2.26.2, because its 'git\n> p4' is not compatible with python3 yet.\n\nThanks.  Which means that we do not need to touch maint track (not\nthat we'd be merging the SHA-256 topic down to the maint track\nanyway).\n\nWill queue.\n"},{"id":"401998","messageId":"20200724135845.GN11341@szeder.dev","threadId":"53892","inReplyTo":"xmqqwo2toobn.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v2] ci: use absolute PYTHON_PATH in the Linux jobs","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2020-07-24T13:58:45Z","receivedAt":"2020-07-24T13:58:51Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Thu, Jul 23, 2020 at 03:31:56PM -0700, Junio C Hamano wrote:\n> SZEDER Gábor <szeder.dev@gmail.com> writes:\n> > Junio, I see that you picked up the first/RFC version and applied it\n> > on top of v2.26.2.  This patch won't work on v2.26.2, because its 'git\n> > p4' is not compatible with python3 yet.\n> \n> Thanks.  Which means that we do not need to touch maint track \n\nYeah, that system Git is v2.21.x, as far as I remember, but apparently\n'git p4' doesn't use any shiny new features since then, because all\nits test succeeded even with that old version.\n\n> (not\n> that we'd be merging the SHA-256 topic down to the maint track\n> anyway).\n\nIt might be worth applying the final SHA-256 topic on top of this,\nthough, so Travis CI builds of that branch on its own can succeed.\n\n"}]}