Skip to content
This repository has been archived by the owner. It is now read-only.

Suse + libX11 + x_ignore_nofocus == fail #2852

Closed
lukeis opened this issue Mar 3, 2016 · 16 comments

Comments

@lukeis
Copy link
Member

commented Mar 3, 2016

Originally reported on Google Code with ID 2852

=============================================== ENVIRONMENT

# cat /proc/version 
Linux version 2.6.32.12-0.7-default (geeko@buildhost) (gcc version 4.3.4 [gcc-4_3-branch
revision 152973] (SUSE Linux) ) #1 SMP 2010-05-20 11:14:20 +0200

# cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 1

Java: 1.6 
Selenium: 2.10.0, 2.12.0
Firefox: 3.5.9 64bit (default for this suse distribution); 8.0 64bit; 3.6.20 32bit;
Using x_ignore_nofocus.so library is need - aka firefoxProfile.setAlwaysLoadNoFocusLib(true)


=============================================== PROBLEM

There is no possibility to change production environment, for example create a symbolic
link. 
For that reason there is a problem in these two pieces of code:

http://selenium.googlecode.com/svn/tags/selenium-2.10.0/cpp/linux-specific/x_ignore_nofocus.c

  if (is_emulated_32bit() == FALSE) {
    const char default_x11_location[] = "/usr/lib/libX11.so.6";
    // Usually, libX11 will reside in /usr/lib. On some 64-bit Linux
    // distributions, it will reside in /usr/lib64.
    if (access(default_x11_location, F_OK) == 0) {
      snprintf(library, MAX_LIBRARY_PATH, default_x11_location);
    } else {
      snprintf(library, MAX_LIBRARY_PATH, "/usr/lib64/libX11.so.6");
    }
  } else {
    // Use a path that usually contains the 32 bit libs in a 64 bit system.
    snprintf(library, MAX_LIBRARY_PATH, "/usr/lib32/libX11.so.6");
  }

http://selenium.googlecode.com/svn/tags/selenium-2.12.0/cpp/linux-specific/x_ignore_nofocus.c

  if (is_emulated_32bit() == FALSE) {
    // Usually, libX11 will reside in /usr/lib. On some 64-bit Linux
    // distributions, it will reside in /usr/lib64.
    const char default_x11_location[] = "/usr/lib/libX11.so.6";
    const char debian_x11_location[] = "/usr/lib/x86_64-linux-gnu/libX11.so.6";
    const char ubuntu_32bit_x11_location[] = "/usr/lib/i386-linux-gnu/libX11.so.6";
    const char opensuse_x11_location[] = "/usr/lib64/libX11.so.6";
    const char *possible_locations[] = {
      default_x11_location, debian_x11_location, ubuntu_32bit_x11_location,
      opensuse_x11_location};
    int locations_len = sizeof(possible_locations) / sizeof(char*);
    int i = 0;
    while (i < (locations_len - 1) && access(possible_locations[i], F_OK) != 0) {
      i++;
    }
    snprintf(library, MAX_LIBRARY_PATH, possible_locations[i]);
  } else {
    // Use a path that usually contains the 32 bit libs in a 64 bit system.
    snprintf(library, MAX_LIBRARY_PATH, "/usr/lib32/libX11.so.6");
  }


1.) Firefox 64bit + x_ignore_nofocus fails because:
In 64 bit mode, as we have see, the library x_ignore_nofocus is looking for libX11.so.6
on the way "/usr/lib/libX11.so.6"
But this symlink /usr/lib/libX11.so.6 is reference to /usr/lib/libX11.so.6.2.0, which
is 32bit library.

# file /usr/lib/libX11.so.6 /usr/lib/libX11.so.6.2.0
/usr/lib/libX11.so.6:     symbolic link to `/usr/lib/libX11.so.6.2.0'
/usr/lib/libX11.so.6.2.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV),
dynamically linked, stripped

If I change this link to: ln -s /usr/lib64/libX11.so.6.2.0 /usr/lib/libX11.so.6 - firefox64bit
works well

2.) Firefox 32bit + x_ignore_nofocus fails because:
There is no link /usr/lib32/libX11.so.6 which must reference to 32bit library /usr/lib/libX11.so.6.2.0.
If I make this link - firefox32bit works well.

But as I said above, there is no possibility to change production environment.

=============================================== EXPECTATIONS

x_ignore_nofocus must detect for what architecture compiled library (32bit or 64bit)
and only after that load it.



Reported by sankin.alex on 2011-11-16 13:56:44

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

Reported by barancev on 2011-11-16 21:03:06

  • Labels added: Component-WebDriver, OpSys-Linux, Browser-Firefox
@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

I attached patch for this bug. The code detects for what architecture compiled library
(32bit or 64bit) and only after that load it. Just in case I attach source file that
is already patched. Could you apply it? 

Reported by sankin.alex on 2011-12-14 11:17:19


- _Attachment: [x_ignore_nofocus.c.patch](https://storage.googleapis.com/google-code-attachments/selenium/issue-2852/comment-2/x_ignore_nofocus.c.patch)_ - _Attachment: [x_ignore_nofocus.c](https://storage.googleapis.com/google-code-attachments/selenium/issue-2852/comment-2/x_ignore_nofocus.c)_
@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

Reported by dawagner on 2011-12-14 12:31:23

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

is anybody here? )

Reported by sankin.alex on 2012-01-19 08:59:11

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

the patch that I attached is working

Reported by sankin.alex on 2012-01-19 08:59:32

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

Thanks for the patch. Looks ok from a quick glance, I'll have a through look later this
week.

Reported by eran.mes on 2012-01-24 13:11:07

  • Status changed: Accepted
@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

I am having the same problem. I also do not have control over the production environment,
so it is not possible for to create the necessary symbolic links.

Reported by brady.mccary on 2012-02-07 20:03:51

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

installed 2.19 version. 

the same problem and do not have control over the production environment, so it is
not possible for to create the necessary symbolic links.

Reported by acmd2009 on 2012-02-17 15:34:47

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

Hello I, had probably same problem: 

My Error:
File "/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py",
line 81, in _wait_until_connectable
    self._get_firefox_output())
selenium.common.exceptions.WebDriverException: Message: 'The browser appears to have
exited before we could connect. The output was: Xlib:  extension "RANDR" missing on
display ":1023.0".\nFailed to dlopen /usr/lib/libX11.so.6\ndlerror says: /usr/lib/libX11.so.6:
wrong ELF class: ELFCLASS32\n'

My environment:
Fedora 14 X64
Firefox: 3.6.24 X64
Selenium 2.20.0

My Ugly but easy and working fix:
I did copy file:
/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/x86/x_ignore_nofocus.so
into:
/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/amd64/
(Note you may won't to backup the original file in case it won't work for you)

Will there be some fix to that - so I need not to fiddle with it for half a day? BTW
thanks for Selenium it's awesome tool - now I just wish it's running on my linux right
away...

Reported by bernatikv on 2012-03-18 20:07:11

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

This issue still exists for v2.24.1 (of standalone-server) on an x64 system running
Fedora 17 with Firefox 14.

Applied the ugly solution using symlink from lib64 to lib for libX11.so.6 and it now
works as expected. I'd have preferred that it'd had ran out ouf the box, though. A
fix would be highly appreciated.

Reported by amc68k on 2012-07-22 17:07:35

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

Having a look at the attached patch.

Reported by eran.mes on 2012-07-23 12:42:55

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

Before I can apply the patch, could the original contributor sign the CLA in http://goo.gl/qC50R
?

Reported by eran.mes on 2012-07-23 14:06:04

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

The main issue with the patch was that it assumed a 64-bit machine. I've re-worked it
to work on pure 32-bit machines as well. Since there's still a lot of the original
code in the patch I need the CLA signed before I can submit it.

Reported by eran.mes on 2012-07-23 21:16:45

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

I signed the CLA

Reported by sankin.alex on 2012-07-24 16:34:01

@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

Submitted in r17577.

Reported by eran.mes on 2012-07-25 11:31:06

  • Status changed: Fixed
@lukeis

This comment has been minimized.

Copy link
Member Author

commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:14:09

  • Labels added: Restrict-AddIssueComment-Commit
@lukeis lukeis closed this Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.