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

RHEL7's vncserver script is not compatible with the free list

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • vncviewer-plugin
    • None
    • RHEL7, Jenkins 2.30 and 2.66, latest version of the plugin

      The behavior of the /bin/vncserver script has changed in RHEL7: When it checks for a display to start VNC on, the code has changed:

       

      • On RHEL6, when it finds that the first display in the free list is used, it dies
      • On RHEL7, when it finds that the first display in the free list is used, it starts looking at display :1, bypassing the free list.

      Here's the original code on RHEL7:

      Find display number.
      if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
       $displayNumber = $1;
       shift(@ARGV);
       if (!&CheckDisplayNumber($displayNumber)) {
       warn "A VNC server is already running as :$displayNumber\n";
       $displayNumber = &GetDisplayNumber();
       }
      } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
       &Usage();
      } else {
       $displayNumber = &GetDisplayNumber();
      }

       

      Here is what we did to get it to work correctly:

      Find display number.
      if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
       $displayNumber = $1;
       shift(@ARGV);
       if (!&CheckDisplayNumber($displayNumber)) {
       die "A VNC server is already running as :$displayNumber\n";
      # warn "A VNC server is already running as :$displayNumber\n";
      # $displayNumber = &GetDisplayNumber();
       }
      } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
       &Usage();
      } else {
       $displayNumber = &GetDisplayNumber();
      }

       

      Here's the equivalent code for RHEL6:

      if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
       $displayNumber = $1;
       shift(@ARGV);
       if (!&CheckDisplayNumber($displayNumber)) {
       die "A VNC server is already running as :$displayNumber\n";
       }
      } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
       &Usage();
      } else {
       $displayNumber = &GetDisplayNumber();
      }

       

          [JENKINS-50745] RHEL7's vncserver script is not compatible with the free list

          Ugo Bellavance created issue -
          Ugo Bellavance made changes -
          Description Original: The behavior of the /bin/vncserver script has changed in RHEL7: When it checks for a display to start VNC on, the code has changed:

           
           * On RHEL6, when it finds that the first display in the free list is used, it dies
           * On RHEL7, when it finds that the first display in the free list is used, it starts looking at display :1, bypassing the free list.

          Here's the original code on RHEL6:
          {noformat}
          Find display number.
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
          # warn "A VNC server is already running as :$displayNumber\n";
          # $displayNumber = &GetDisplayNumber();
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           

          Here is what we did to get it to work correctly:
          {noformat}
          Find display number.
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
          # warn "A VNC server is already running as :$displayNumber\n";
          # $displayNumber = &GetDisplayNumber();
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           

          Here's the equivalent code for RHEL6:
          {noformat}
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           
          New: The behavior of the /bin/vncserver script has changed in RHEL7: When it checks for a display to start VNC on, the code has changed:

           
           * On RHEL6, when it finds that the first display in the free list is used, it dies
           * On RHEL7, when it finds that the first display in the free list is used, it starts looking at display :1, bypassing the free list.

          Here's the original code on RHEL7:
          {noformat}
          Find display number.
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
          # warn "A VNC server is already running as :$displayNumber\n";
          # $displayNumber = &GetDisplayNumber();
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           

          Here is what we did to get it to work correctly:
          {noformat}
          Find display number.
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
          # warn "A VNC server is already running as :$displayNumber\n";
          # $displayNumber = &GetDisplayNumber();
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           

          Here's the equivalent code for RHEL6:
          {noformat}
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           
          Ugo Bellavance made changes -
          Description Original: The behavior of the /bin/vncserver script has changed in RHEL7: When it checks for a display to start VNC on, the code has changed:

           
           * On RHEL6, when it finds that the first display in the free list is used, it dies
           * On RHEL7, when it finds that the first display in the free list is used, it starts looking at display :1, bypassing the free list.

          Here's the original code on RHEL7:
          {noformat}
          Find display number.
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
          # warn "A VNC server is already running as :$displayNumber\n";
          # $displayNumber = &GetDisplayNumber();
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           

          Here is what we did to get it to work correctly:
          {noformat}
          Find display number.
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
          # warn "A VNC server is already running as :$displayNumber\n";
          # $displayNumber = &GetDisplayNumber();
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           

          Here's the equivalent code for RHEL6:
          {noformat}
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           
          New: The behavior of the /bin/vncserver script has changed in RHEL7: When it checks for a display to start VNC on, the code has changed:

           
           * On RHEL6, when it finds that the first display in the free list is used, it dies
           * On RHEL7, when it finds that the first display in the free list is used, it starts looking at display :1, bypassing the free list.

          Here's the original code on RHEL7:
          {noformat}
          Find display number.
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           warn "A VNC server is already running as :$displayNumber\n";
           $displayNumber = &GetDisplayNumber();
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           

          Here is what we did to get it to work correctly:
          {noformat}
          Find display number.
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
          # warn "A VNC server is already running as :$displayNumber\n";
          # $displayNumber = &GetDisplayNumber();
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           

          Here's the equivalent code for RHEL6:
          {noformat}
          if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
           $displayNumber = $1;
           shift(@ARGV);
           if (!&CheckDisplayNumber($displayNumber)) {
           die "A VNC server is already running as :$displayNumber\n";
           }
          } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
           &Usage();
          } else {
           $displayNumber = &GetDisplayNumber();
          }{noformat}
           

            tbaum Dimitri Tenenbaum
            ubellavance Ugo Bellavance
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: