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

OS X: postinstall script interprets that all uid's are taken if uid 499 is taken

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • packaging
    • jenkins 1.610, OSX 10.10.3.

      The postinstall scipt has a line that checks for an available uid for the jenkins user and fails if no uid below 500 is found to be free. The problem is that the script only checks whether uid 499 is taken and if it is, then assumes that all other uid's below are also taken. This is not always the case.
      To recreate, create a user with uid 499 and afterwards attempt to install jenkins from the native osx installer. The error output can be found in /var/log/install.log. The offending lines of code can be found in https://github.com/kisielk/jenkins/blob/master/osx/scripts/postinstall-launchd-jenkins, and consists of:
      uid=$(dscl . -list /Users uid | sort -nrk 2 | awk '$2 < 500

      {print $2 + 1; exit 0}

      ')
      if [ $uid -eq 500 ]; then
      echo 'ERROR: All system uids are in use!'
      exit 1
      fi

      The issue would be fixed if these lines were changed to something more flexible.

      Workaround:
      Unpack the installer, find the postinstall script and manually set uid, then repack installer. See http://stackoverflow.com/a/29747480/584405

          [JENKINS-28015] OS X: postinstall script interprets that all uid's are taken if uid 499 is taken

          David Marmoy created issue -
          David Marmoy made changes -
          Description Original: The postinstall scipt has a line that checks for an available uid for the jenkins user and fails if no uid below 500 is found to be free. The problem is that the script that checks this only checks if uid 499 is taken and if it is, then assumes that all other uid's below are also taken. This is not always the case.
          To recreate, create a user with uid 499 and afterwards attempt to install jenkins from the native osx installer. The error output can be found in /var/log/install.log. The offending lines of code can be found in https://github.com/kisielk/jenkins/blob/master/osx/scripts/postinstall-launchd-jenkins, and consists of:
              uid=$(dscl . -list /Users uid | sort -nrk 2 | awk '$2 < 500 {print $2 + 1; exit 0}')
          if [ $uid -eq 500 ]; then
                  echo 'ERROR: All system uids are in use!'
                  exit 1
              fi

          The issue would be fixed if these lines were changed to something more flexible.
           
          New: The postinstall scipt has a line that checks for an available uid for the jenkins user and fails if no uid below 500 is found to be free. The problem is that the script only checks whether uid 499 is taken and if it is, then assumes that all other uid's below are also taken. This is not always the case.
          To recreate, create a user with uid 499 and afterwards attempt to install jenkins from the native osx installer. The error output can be found in /var/log/install.log. The offending lines of code can be found in https://github.com/kisielk/jenkins/blob/master/osx/scripts/postinstall-launchd-jenkins, and consists of:
              uid=$(dscl . -list /Users uid | sort -nrk 2 | awk '$2 < 500 {print $2 + 1; exit 0}')
          if [ $uid -eq 500 ]; then
                  echo 'ERROR: All system uids are in use!'
                  exit 1
              fi

          The issue would be fixed if these lines were changed to something more flexible.
           
          David Marmoy made changes -
          Description Original: The postinstall scipt has a line that checks for an available uid for the jenkins user and fails if no uid below 500 is found to be free. The problem is that the script only checks whether uid 499 is taken and if it is, then assumes that all other uid's below are also taken. This is not always the case.
          To recreate, create a user with uid 499 and afterwards attempt to install jenkins from the native osx installer. The error output can be found in /var/log/install.log. The offending lines of code can be found in https://github.com/kisielk/jenkins/blob/master/osx/scripts/postinstall-launchd-jenkins, and consists of:
              uid=$(dscl . -list /Users uid | sort -nrk 2 | awk '$2 < 500 {print $2 + 1; exit 0}')
          if [ $uid -eq 500 ]; then
                  echo 'ERROR: All system uids are in use!'
                  exit 1
              fi

          The issue would be fixed if these lines were changed to something more flexible.
           
          New: The postinstall scipt has a line that checks for an available uid for the jenkins user and fails if no uid below 500 is found to be free. The problem is that the script only checks whether uid 499 is taken and if it is, then assumes that all other uid's below are also taken. This is not always the case.
          To recreate, create a user with uid 499 and afterwards attempt to install jenkins from the native osx installer. The error output can be found in /var/log/install.log. The offending lines of code can be found in https://github.com/kisielk/jenkins/blob/master/osx/scripts/postinstall-launchd-jenkins, and consists of:
              uid=$(dscl . -list /Users uid | sort -nrk 2 | awk '$2 < 500 {print $2 + 1; exit 0}')
          if [ $uid -eq 500 ]; then
               echo 'ERROR: All system uids are in use!'
               exit 1
          fi

          The issue would be fixed if these lines were changed to something more flexible.
           
          David Marmoy made changes -
          Description Original: The postinstall scipt has a line that checks for an available uid for the jenkins user and fails if no uid below 500 is found to be free. The problem is that the script only checks whether uid 499 is taken and if it is, then assumes that all other uid's below are also taken. This is not always the case.
          To recreate, create a user with uid 499 and afterwards attempt to install jenkins from the native osx installer. The error output can be found in /var/log/install.log. The offending lines of code can be found in https://github.com/kisielk/jenkins/blob/master/osx/scripts/postinstall-launchd-jenkins, and consists of:
              uid=$(dscl . -list /Users uid | sort -nrk 2 | awk '$2 < 500 {print $2 + 1; exit 0}')
          if [ $uid -eq 500 ]; then
               echo 'ERROR: All system uids are in use!'
               exit 1
          fi

          The issue would be fixed if these lines were changed to something more flexible.
           
          New: The postinstall scipt has a line that checks for an available uid for the jenkins user and fails if no uid below 500 is found to be free. The problem is that the script only checks whether uid 499 is taken and if it is, then assumes that all other uid's below are also taken. This is not always the case.
          To recreate, create a user with uid 499 and afterwards attempt to install jenkins from the native osx installer. The error output can be found in /var/log/install.log. The offending lines of code can be found in https://github.com/kisielk/jenkins/blob/master/osx/scripts/postinstall-launchd-jenkins, and consists of:
              uid=$(dscl . -list /Users uid | sort -nrk 2 | awk '$2 < 500 {print $2 + 1; exit 0}')
          if [ $uid -eq 500 ]; then
               echo 'ERROR: All system uids are in use!'
               exit 1
          fi

          The issue would be fixed if these lines were changed to something more flexible.

          Workaround:
          Unpack the installer, find the postinstall script and manually set uid, then repack installer. See http://stackoverflow.com/a/29747480/584405
           
          Daniel Beck made changes -
          Component/s New: packaging [ 20120 ]
          Component/s Original: core [ 15593 ]
          Summary Original: postinstall script interprets that all uid's are taken if uid 499 is taken New: OS X: postinstall script interprets that all uid's are taken if uid 499 is taken
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 162617 ] New: JNJira + In-Review [ 180993 ]

          Basil Crow added a comment -

          The Jenkins project no longer distributes a macOS installer.

          Basil Crow added a comment - The Jenkins project no longer distributes a macOS installer.
          Basil Crow made changes -
          Resolution New: Won't Fix [ 2 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            Unassigned Unassigned
            videre David Marmoy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: