[JIRA] (JENKINS-61711) Git plugin global config incorrectly reports git not in PATH

45 views
Skip to first unread message

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 8, 2020, 8:02:02 PM4/8/20
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
 
Jenkins / Bug JENKINS-61711
Git plugin global config incorrectly reports git not in PATH
Change By: Mark Waite
Summary: Git plugin global config incorrectly fails to find reports git not in PATH
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 13, 2020, 5:29:04 PM4/13/20
to jenkinsc...@googlegroups.com
Rishabh Budhouliya commented on Bug JENKINS-61711
 
Re: Git plugin global config incorrectly reports git not in PATH

Hi Mark Waite. I was trying to reproduce this bug and I can't figure out a way to do it.
I'd like to know if this is a windows or a linux machine.

As it can be seen, the environment variable `PATH` is being used to find the git executable and depending upon the OS, it will try to append PATH + "git" and try to check if that exists. Since you have mentioned that the git executable does exist on the path, it doesn't make sense to me how could the `FormValidation validateExecutable` can't find it.

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 13, 2020, 5:30:03 PM4/13/20
to jenkinsc...@googlegroups.com
Rishabh Budhouliya edited a comment on Bug JENKINS-61711
Hi [~markewaite]. I was trying to reproduce this bug and I can't figure out a way to do it.
I'd like to know if this is a windows or a linux machine.

As it can be seen, the environment variable ` * PATH ` * is being used to find the git executable and depending upon the OS, it will try to append * PATH + "git" * and try to check if that exists. Since you have mentioned that the git executable _does_ exist on the path, it doesn't make sense to me how could the ` FormValidation validateExecutable` _validateExecutable_ can't find it.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 13, 2020, 7:33:02 PM4/13/20
to jenkinsc...@googlegroups.com

Rishabh Budhouliya thanks very much for investigating and for trying to duplicate the problem. I should have provided a precise set of steps that will duplicate the problem. The steps are:

  1. Install and enable the git LFS extension (if not already installed)
  2. Install Docker
  3. Clone my docker-lfs repository
    $ git clone https://github.com/MarkEWaite/docker-lfs.git
  4. Checkout the lts-with-plugins branch
    $ git checkout -b lts-with-plugins -t origin/lts-with-plugins
  5. Build the lts-with-plugins image
    $ ./docker_build.py
  6. Run the lts-with-plugins image
    $ ./docker_run.py --clean --quiet
  7. Open the newly started Jenkins in a web browser on port 8080
  8. Open "Manage Jenkins"
  9. Open "Global Tool Configuration"
  10. Scroll down to show the git tool configuration
  11. Wait briefly while Jenkins checks for existence of the git tool, not that there is a red warning below that field which reports the tool is not available

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 13, 2020, 7:35:03 PM4/13/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-61711
[~rishabhbudhouliya] thanks very much for investigating and for trying to duplicate the problem.  I should have provided a precise set of steps that will duplicate the problem.  The steps are:

# Install and enable the git LFS extension (if not already installed)
# Install Docker
# Clone my [docker-lfs repository|https://github.com/MarkEWaite/docker-lfs]
  {{$ git clone https://github.com/MarkEWaite/docker-lfs.git}}
# Checkout the lts
branch
  {{$ git checkout
- b lts -t origin/lts}}
# Remove the master branch
  {{$ git branch -D --delete master}}
# Checkout the lts-
with-plugins branch

  {{$ git checkout -b lts-with-plugins -t origin/lts-with-plugins}}
# Build the lts-with-plugins image
  {{$ ./docker_build.py}}
# Run the lts-with-plugins image
  {{$ ./docker_run.py --clean --quiet}}
# Open the newly started Jenkins in a web browser on port 8080
# Open "Manage Jenkins"
# Open "Global Tool Configuration"
# Scroll down to show the git tool configuration
# Wait briefly while Jenkins checks for existence of the git tool, not that there is a red warning below that field which reports the tool is not available

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 13, 2020, 7:37:03 PM4/13/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-61711
[~rishabhbudhouliya] thanks very much for investigating and for trying to duplicate the problem.  I should have provided a precise set of steps that will duplicate the problem.  The steps are:

# Install and enable the git LFS extension (if not already installed)
# Install Docker
# Clone my [docker-lfs repository|https://github.com/MarkEWaite/docker-lfs]
  {{$ git clone https://github.com/MarkEWaite/docker-lfs.git}}
# Change to the cloned directory
  {{$ cd docker-lfs}}
#
Checkout the lts branch
  {{$ git checkout -b lts -t origin/lts}}

# Remove the master branch
  {{$ git branch -D --delete master}}
# Checkout the lts-with-plugins branch

  {{$ git checkout -b lts-with-plugins -t origin/lts-with-plugins}}
# Build the lts-with-plugins image
  {{$ ./docker_build.py}}
# Run the lts-with-plugins image
  {{$ ./docker_run.py --clean --quiet}}
# Open the newly started Jenkins in a web browser on port 8080
# Open "Manage Jenkins"
# Open "Global Tool Configuration"
# Scroll down to show the git tool configuration
# Wait briefly while Jenkins checks for existence of the git tool, not that there is a red warning below that field which reports the tool is not available

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 13, 2020, 7:37:03 PM4/13/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-61711
[~rishabhbudhouliya] thanks very much for investigating and for trying to duplicate the problem.  I should have provided a precise set of steps that will duplicate the problem.  The steps are:

# Install and enable the git LFS extension (if not already installed)
# Install Docker
# Clone my [docker-lfs repository|https://github.com/MarkEWaite/docker-lfs]
  {{$ git clone https://github.com/MarkEWaite/docker-lfs.git}}
# Change to the cloned directory
  {{$ cd docker-lfs}}
# Checkout the lts branch
  {{$ git checkout -b lts -t origin/lts}}
# Remove the master branch
  {{$ git branch -D --delete master}}
# Checkout the lts-with-plugins branch
  {{$ git checkout -b lts-with-plugins -t origin/lts-with-plugins}}
# Build the lts-with-plugins image
  {{$ ./docker_build.py}}
# Run the lts-with-plugins image
  {{$ ./docker_run.py --clean --quiet}}
# Open the newly started Jenkins in a web browser on port 8080
# Open "Manage Jenkins"
# Open "Global Tool Configuration"
# Scroll down to show the git tool configuration
# Wait briefly while Jenkins checks for existence of the git tool, not note that there is a red warning below that field which reports the tool is not available

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 13, 2020, 7:52:02 PM4/13/20
to jenkinsc...@googlegroups.com

Rishabh Budhouliya I was concerned that the problem might be specific to my Docker image, so I tested a fresh download of Jenkins 2.222.1 run as a war file on my Ubuntu 18.04 computer. Steps in this test were:

  1. Download Jenkins 2.222.1 war file
    $ wget http://mirrors.jenkins.io/war-stable/2.222.1/jenkins.war
  2. Run war file
    $ java -jar jenkins.war
  3. Connect to the Jenkins instance on port 8080 with a web browser
  4. Enter the random admin password for Jenkins
  5. Create a user account in Jenkins
  6. Choose to install selected plugins from the install wizard, select "None", then select only the git plugin
  7. Complete the install wizard, watch the plugins as they install
  8. Open "Manage Jenkins" and the "Global Tool Configuration" page
  9. Review the "git" configured for the Default git tool, confirm that it reports that "git" cannot be found, even though there is a git installed in /usr/bin on my computer

Thanks again for investigating!

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 14, 2020, 8:21:02 AM4/14/20
to jenkinsc...@googlegroups.com
Rishabh Budhouliya updated an issue
 
Change By: Rishabh Budhouliya
Attachment: Screenshot 2020-04-14 at 5.43.50 PM.png

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 14, 2020, 8:21:05 AM4/14/20
to jenkinsc...@googlegroups.com
Rishabh Budhouliya commented on Bug JENKINS-61711
 
Re: Git plugin global config incorrectly reports git not in PATH

Many thanks for laying out the steps so clearly, I was able to reproduce the bug and I think I have found the problem.

https://github.com/jenkinsci/jenkins/blob/d66bd8595e531749e842274a806eabab5cc16a32/core/src/main/java/hudson/util/DOSToUnixPathHelper.java#L68

Here, the executable file is built as "_dir + File.pathSeperator + exe" where File.pathSeperator should be used for multiple directories (: for unix, ; for windows). 
I changed it to File.seperator (platform independent) and it is working correctly, here is a screenshot of my Jenkins UI:

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 14, 2020, 8:24:03 AM4/14/20
to jenkinsc...@googlegroups.com
Rishabh Budhouliya edited a comment on Bug JENKINS-61711
Many thanks for laying out the steps so clearly, I was able to reproduce the bug and I think I have found the problem.

[https://github.com/jenkinsci/jenkins/blob/d66bd8595e531749e842274a806eabab5cc16a32/core/src/main/java/hudson/util/DOSToUnixPathHelper.java#L68]

Here, the executable file is built as *"_dir + File.pathSeperator + exe"* where *File.pathSeperator* should be used for multiple directories (: for unix Unix , ; for windows). 

For example, it was trying to find git executable in "/usr/local/bin:git" instead of "/usr/local/bin/git"

I changed it to *File.seperator* (platform independent , "/" for Unix ) and it is working correctly, here is a screenshot of my Jenkins UI:
!Screenshot 2020-04-14 at 5.43.50 PM.png!

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 14, 2020, 8:31:03 AM4/14/20
to jenkinsc...@googlegroups.com
Rishabh Budhouliya edited a comment on Bug JENKINS-61711
Many thanks for laying out the steps so clearly, I was able to reproduce the bug and I think I have found the problem.

[https://github.com/jenkinsci/jenkins/blob/d66bd8595e531749e842274a806eabab5cc16a32/core/src/main/java/hudson/util/DOSToUnixPathHelper.java#L68]

Here, the executable file is built as *"_dir + File.pathSeperator + exe"* where *File.pathSeperator* should be used for multiple directories (: for Unix, ; for windows). 


For example, it was trying to find git executable in "/usr/local/bin:git" instead of "/usr/local/bin/git"

I changed it to *File.seperator* (platform independent, "/" for Unix) and it is working correctly, here is a screenshot of my Jenkins UI:
!Screenshot 2020-04-14 at 5.43.50 PM.png
|width=417,height=260 !

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 14, 2020, 9:10:02 AM4/14/20
to jenkinsc...@googlegroups.com

Thanks for that research and for finding the root of the problem. Will you submit a pull request with a fix and with tests to confirm that the fix is working as expected?

Since the issue seems to be in Jenkins core, I've reassigned the component as core.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 14, 2020, 9:11:02 AM4/14/20
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
 
Change By: Mark Waite
Component/s: core
Component/s: git-plugin

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 14, 2020, 9:14:03 AM4/14/20
to jenkinsc...@googlegroups.com
Rishabh Budhouliya commented on Bug JENKINS-61711
 
Re: Git plugin global config incorrectly reports git not in PATH

Sure, I'll raise a pull request with the fix and tests.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 14, 2020, 9:17:01 AM4/14/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-61711
Thanks for that research and for finding the root of the problem.  Will you submit a pull request with a fix and with tests to confirm that the fix is working as expected?

Since the issue seems to be in Jenkins core, I've reassigned the component as {{core}}.

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 14, 2020, 2:20:03 PM4/14/20
to jenkinsc...@googlegroups.com

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 14, 2020, 5:02:03 PM4/14/20
to jenkinsc...@googlegroups.com
Rishabh Budhouliya started work on Bug JENKINS-61711
 
Change By: Rishabh Budhouliya
Status: Open In Progress

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 14, 2020, 5:02:03 PM4/14/20
to jenkinsc...@googlegroups.com

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Apr 14, 2020, 5:02:03 PM4/14/20
to jenkinsc...@googlegroups.com

o.v.nenashev@gmail.com (JIRA)

unread,
Apr 17, 2020, 12:31:02 AM4/17/20
to jenkinsc...@googlegroups.com
Change By: Oleg Nenashev
Status: In Review Resolved
Resolution: Fixed
Released As: Jenkins 2.232

o.v.nenashev@gmail.com (JIRA)

unread,
Apr 17, 2020, 12:31:02 AM4/17/20
to jenkinsc...@googlegroups.com
Oleg Nenashev updated an issue
Change By: Oleg Nenashev
Environment: Jenkins 2. 22 222 .1
Git plugin 4.2.2
Git client plugin 3.2.1

o.v.nenashev@gmail.com (JIRA)

unread,
Apr 17, 2020, 12:31:03 AM4/17/20
to jenkinsc...@googlegroups.com
Oleg Nenashev updated an issue
Change By: Oleg Nenashev
Labels: configuration lts-candidate newbie-friendly

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 19, 2020, 8:11:03 AM4/19/20
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Fixed
Change By: Mark Waite
Status: Resolved Closed

ogondza@gmail.com (JIRA)

unread,
May 5, 2020, 2:26:02 AM5/5/20
to jenkinsc...@googlegroups.com
Oliver Gondža updated an issue
Change By: Oliver Gondža
Labels: configuration lts 2.222.4 - candidate fixed configuration newbie-friendly
Reply all
Reply to author
Forward
0 new messages