- 
    
Bug
 - 
    Resolution: Unresolved
 - 
    
Major
 - 
    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();
}