Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33857

Setup wizard password file should end with a newline

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: core
    • Labels:
    • Environment:
      Jenkins 2.0 beta
    • Similar Issues:

      Description

      Now that JENKINS-33599 changed the password to be written to a file, it would be more convenient for copy-pasting if the password was printed on its own line — i.e. the file should end with a (platform-specific) newline character.

      With the 2.0 beta, I saw this:

      chris@rebigulator:~$ cat /tmp/j2beta/secrets/initialAdminPassword
      c84b4a5991db49ef9d431159421107bdchris@rebigulator:~$
      

      The setup wizard unlock field has been changed to a password field, so that also didn't help me in seeing that I had made a mistake in copying the password.

      Here the password is just written straight to the file:
      https://github.com/jenkinsci/jenkins/blob/1735f3c/core/src/main/java/jenkins/install/SetupWizard.java#L64

        Attachments

          Activity

          Hide
          danielbeck Daniel Beck added a comment -

          I think this should do it?

          $ git diff
          diff --git a/core/src/main/java/jenkins/install/SetupWizard.java b/core/src/main/java/jenkins/install/SetupWizard.java
          index 6c9b53a..7b9a889 100644
          --- a/core/src/main/java/jenkins/install/SetupWizard.java
          +++ b/core/src/main/java/jenkins/install/SetupWizard.java
          @@ -82,7 +82,7 @@ public class SetupWizard {
                           // JENKINS-33599 - write to a file in the jenkins home directory
                           // most native packages of Jenkins creates a machine user account 'jenkins' to run Jenkins,
                           // and use group 'jenkins' for admins. So we allo groups to read this file
          -                iapf.write(randomUUID, "UTF-8");
          +                iapf.write(randomUUID + System.lineSeparator(), "UTF-8");
                           iapf.chmod(0640);
          

          TBH I'd hesitate to include this in 2.0. It's clearly an improvement, clearly not critical… as usual, let's just hold for 2.1 and make that one an overloaded, broken mess of a release.

          Show
          danielbeck Daniel Beck added a comment - I think this should do it? $ git diff diff --git a/core/src/main/java/jenkins/install/SetupWizard.java b/core/src/main/java/jenkins/install/SetupWizard.java index 6c9b53a..7b9a889 100644 --- a/core/src/main/java/jenkins/install/SetupWizard.java +++ b/core/src/main/java/jenkins/install/SetupWizard.java @@ -82,7 +82,7 @@ public class SetupWizard { // JENKINS-33599 - write to a file in the jenkins home directory // most native packages of Jenkins creates a machine user account 'jenkins' to run Jenkins, // and use group 'jenkins' for admins. So we allo groups to read this file - iapf.write(randomUUID, "UTF-8"); + iapf.write(randomUUID + System.lineSeparator(), "UTF-8"); iapf.chmod(0640); TBH I'd hesitate to include this in 2.0. It's clearly an improvement, clearly not critical… as usual, let's just hold for 2.1 and make that one an overloaded, broken mess of a release.
          Hide
          orrc Christopher Orr added a comment -

          Yeah, that looks good.

          I think it would be nice to include this for 2.0 — it's still a few weeks away, and this small stumbling block happened literally within 30 seconds of starting up the 2.0 beta

          But you're the release boss! If I get my ICLA accepted soon, I'll at least submit this as a PR, unless someone beats me to it.

          Show
          orrc Christopher Orr added a comment - Yeah, that looks good. I think it would be nice to include this for 2.0 — it's still a few weeks away, and this small stumbling block happened literally within 30 seconds of starting up the 2.0 beta But you're the release boss! If I get my ICLA accepted soon, I'll at least submit this as a PR, unless someone beats me to it.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Christopher Orr
          Path:
          core/src/main/java/jenkins/install/SetupWizard.java
          http://jenkins-ci.org/commit/jenkins/3659e9cfaa496c71c7d0152f24740bb33194706f
          Log:
          [FIXED JENKINS-33857] Make initial admin password file end with a newline.

          This makes it a tiny bit more convenient to `cat` the file and copy the password
          to your clipboard. Previously, the file did not have a line ending, so the
          password would run into your shell prompt, making copying the text harder.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christopher Orr Path: core/src/main/java/jenkins/install/SetupWizard.java http://jenkins-ci.org/commit/jenkins/3659e9cfaa496c71c7d0152f24740bb33194706f Log: [FIXED JENKINS-33857] Make initial admin password file end with a newline. This makes it a tiny bit more convenient to `cat` the file and copy the password to your clipboard. Previously, the file did not have a line ending, so the password would run into your shell prompt, making copying the text harder.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Daniel Beck
          Path:
          core/src/main/java/jenkins/install/SetupWizard.java
          http://jenkins-ci.org/commit/jenkins/b633f883477af58be17b83e10c4d7325c2ed9e13
          Log:
          Merge pull request #2201 from orrc/2.0

          [FIXED JENKINS-33857] Make initial admin password file end with a newline

          Compare: https://github.com/jenkinsci/jenkins/compare/6b6ae729a904...b633f883477a

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/jenkins/install/SetupWizard.java http://jenkins-ci.org/commit/jenkins/b633f883477af58be17b83e10c4d7325c2ed9e13 Log: Merge pull request #2201 from orrc/2.0 [FIXED JENKINS-33857] Make initial admin password file end with a newline Compare: https://github.com/jenkinsci/jenkins/compare/6b6ae729a904...b633f883477a

            People

            Assignee:
            danielbeck Daniel Beck
            Reporter:
            orrc Christopher Orr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: