The default bug view has changed. See this FAQ.

Firefox does not run when what is called through $PATH is a symbolic link and a file of the same name exists in the current directory

VERIFIED FIXED in Firefox 7

Status

()

Core
XPCOM
VERIFIED FIXED
6 years ago
6 years ago

People

(Reporter: Jeff Hammel, Unassigned)

Tracking

({regression, verified-beta})

Trunk
mozilla8
x86
Linux
regression, verified-beta
Points:
---

Firefox Tracking Flags

(firefox7+ fixed)

Details

(Whiteboard: [qa!])

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
Since sometime in the Firefox 7 days, my symbolic link ~/bin/firefox, which poins to ~/firefox/firefox, stopped working.  This is pretty bad.  I can no longer launch firefox from my menu (ubuntu 11.04, fluxbox), nor click on links in gnome-terminals, nor do my wealth of scripts work to open links.  In short, its a big deficiency for me.  I'm happy to help try things to debug, but am not really sure what to do

│which firefox
/home/jhammel/bin/firefox
│firefox
Couldn't load XPCOM.
│strace firefox
execve("/home/jhammel/bin/firefox", ["firefox"], [/* 42 vars */]) = 0
brk(0)                                  = 0x9a0f000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7750000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=118805, ...}) = 0
mmap2(NULL, 118805, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7732000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/libpthread.so.0", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20M\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=121644, ...}) = 0
mmap2(NULL, 98824, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7719000
mmap2(0xb772e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15) = 0xb772e000
mmap2(0xb7730000, 4616, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7730000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/libdl.so.2", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\n\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=9736, ...}) = 0
mmap2(NULL, 12408, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7715000
mmap2(0xb7717000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0xb7717000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/libstdc++.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340B\4\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=930044, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7714000
mmap2(NULL, 959532, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7629000
mmap2(0xb7708000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xde) = 0xb7708000
mmap2(0xb770d000, 25644, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb770d000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/libm.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\2604\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=149392, ...}) = 0
mmap2(NULL, 151680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7603000
mmap2(0xb7627000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23) = 0xb7627000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/libgcc_s.so.1", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\37\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=108040, ...}) = 0
mmap2(NULL, 111148, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb75e7000
mmap2(0xb7601000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19) = 0xb7601000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220o\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1434180, ...}) = 0
mmap2(NULL, 1444360, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7486000
mprotect(0xb75e0000, 4096, PROT_NONE)   = 0
mmap2(0xb75e1000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15a) = 0xb75e1000
mmap2(0xb75e4000, 10760, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb75e4000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7485000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7484000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb74846e0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb75e1000, 8192, PROT_READ)   = 0
mprotect(0xb7601000, 4096, PROT_READ)   = 0
mprotect(0xb7627000, 4096, PROT_READ)   = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7483000
mprotect(0xb7708000, 16384, PROT_READ)  = 0
mprotect(0xb7717000, 4096, PROT_READ)   = 0
mprotect(0xb772e000, 4096, PROT_READ)   = 0
mprotect(0xb776f000, 4096, PROT_READ)   = 0
munmap(0xb7732000, 118805)              = 0
set_tid_address(0xb7484748)             = 14683
set_robust_list(0xb7484750, 0xc)        = 0
futex(0xbf824180, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0xbf824180, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, bf824190) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGRTMIN, {0xb771d6e0, [], SA_SIGINFO}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0xb771d760, [], SA_RESTART|SA_SIGINFO}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
uname({sys="Linux", node="jhammel-THINK", ...}) = 0
getcwd("/home/jhammel", 4096)           = 14
lstat64("/home/jhammel/firefox", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/home/jhammel/firefox", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getrusage(RUSAGE_SELF, {ru_utime={0, 0}, ru_stime={0, 4000}, ...}) = 0
lstat64("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/home/jhammel", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/home/jhammel/libxpcom.so", 0xbf820f9c) = -1 ENOENT (No such file or directory)
futex(0xb7718064, FUTEX_WAKE_PRIVATE, 2147483647) = 0
readlink("/etc/malloc.conf", 0xbf81ff1d, 4096) = -1 ENOENT (No such file or directory)
mmap2(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7383000
mmap2(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7283000
munmap(0xb7283000, 1048576)             = 0
mmap2(0xb7300000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7283000
munmap(0xb7283000, 1048576)             = 0
mmap2(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7183000
munmap(0xb7183000, 2097152)             = 0
mmap2(0xb7200000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7200000
open("/home/jhammel/libxpcom.so", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "Couldn't load XPCOM.\n", 21Couldn't load XPCOM.
)  = 21
exit_group(255)                         = ?
│^C
│ls -l `which firefox`
lrwxrwxrwx 1 jhammel jhammel 29 2011-06-21 16:34 /home/jhammel/bin/firefox -> /home/jhammel/firefox/firefox
(Reporter)

Comment 1

6 years ago
This is a problem on three of my computers.  Dunno what the deal is :(
Possibly from bug 552864? Regression range?
I'm pretty sure this is related to bug 552864. I don't know if that was Jeff that mentioned that on irc shortly after bug 552864 landed, but I was aware of someone having that issue, though I can't reproduce the problem...
Okay I could reproduce. It only happens when running "firefox". If you use the full path to the symbolic link, it works.
Summary: firefox does not run via a symbolic link anymore → firefox does not run when what is called through $PATH is a symbolic link
(In reply to comment #4)
> Okay I could reproduce. It only happens when running "firefox". If you use
> the full path to the symbolic link, it works.

It's even more subtle. It only happens when running "firefox" and the current directory contains a "firefox" file or directory.
Summary: firefox does not run when what is called through $PATH is a symbolic link → Firefox does not run when what is called through $PATH is a symbolic link and a file of the same name exists in the current directory
Blocks: 552864
Created attachment 545323 [details] [diff] [review]
When looking for the executable path on Unix, only use realpath() when we got a file path in the first place
Attachment #545323 - Flags: review?(benjamin)
Duplicate of this bug: 671397
Component: General → XPCOM
Product: Firefox → Core
QA Contact: general → xpcom
Seems like we should track this regression for 7....  It'll cause starting the browser to mysteriously fail for people in some cases.
status-firefox7: --- → affected
tracking-firefox7: --- → ?
Keywords: regression
tracking-firefox7: ? → +
Tracking for Firefox 7.
Comment on attachment 545323 [details] [diff] [review]
When looking for the executable path on Unix, only use realpath() when we got a file path in the first place

Please use strchr instead of index: index is legacy.
Attachment #545323 - Flags: review?(benjamin) → review+
http://hg.mozilla.org/integration/mozilla-inbound/rev/6738896ce429
Whiteboard: [inbound]
http://hg.mozilla.org/mozilla-central/rev/6738896ce429
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla8
(Reporter)

Comment 13

6 years ago
Confirmed.  This now works on my nightly.  Thanks a bunch!  Life is good again
Comment on attachment 545323 [details] [diff] [review]
When looking for the executable path on Unix, only use realpath() when we got a file path in the first place

See comment 8
Attachment #545323 - Flags: approval-mozilla-aurora?

Comment 15

6 years ago
Comment on attachment 545323 [details] [diff] [review]
When looking for the executable path on Unix, only use realpath() when we got a file path in the first place

Approved for mozilla-aurora. Please land asap.
Attachment #545323 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
http://hg.mozilla.org/releases/mozilla-aurora/rev/7d7d783b8663
status-firefox7: affected → fixed
I was able to reproduce the "Couldn't load XPCOM." error on Ubuntu with Firefox 7 beta 1 (Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20100101 Firefox/7.0)

Steps:
1. Removed previous Firefox version
2. Unpacked Firefox 7 beta 1
3. Launched Firefox from the download directory
   -> double click on "firefox" in directory -> works fine
   -> from command line: # ./firefox -> works fine
   -> from command line: # firefox -> bash: /usr/bin/firefox: No such file or directory -> this might be because Firefox script doesn't create any shortcut
4. If I copy Firefox script in /bin and run it, I get:
      /bin$ firefox
      Couldn't load XPCOM.

  If I create a symlink of firefox file in bin/firefox 
      Downloads/firefox# ln -s firefox /bin/firefox
   and run /bin $ firefox, I get: 
      /bin$ firefox
      bash: /bin/firefox: Too many levels of symbolic links
  If I create a symlink of run-mozilla.sh in bin/firefox
      /Downloads/firefox# ln -s run-mozilla.sh /bin/firefox
  and run /bin $ firefox, I get: 
      bash: /bin/firefox: No such file or directory
(In reply to Mihaela Velimiroviciu from comment #17)
> I was able to reproduce the "Couldn't load XPCOM." error on Ubuntu with
> Firefox 7 beta 1 (Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20100101
> Firefox/7.0)
> 
> Steps:
> 1. Removed previous Firefox version
> 2. Unpacked Firefox 7 beta 1
> 3. Launched Firefox from the download directory
>    -> double click on "firefox" in directory -> works fine
>    -> from command line: # ./firefox -> works fine
>    -> from command line: # firefox -> bash: /usr/bin/firefox: No such file
> or directory -> this might be because Firefox script doesn't create any
> shortcut
> 4. If I copy Firefox script in /bin and run it, I get:
>       /bin$ firefox
>       Couldn't load XPCOM.

"firefox" is not a script. So copying "firefox" in /bin is not going to work nor is it supposed to.

>   If I create a symlink of firefox file in bin/firefox 
>       Downloads/firefox# ln -s firefox /bin/firefox
>    and run /bin $ firefox, I get: 
>       /bin$ firefox
>       bash: /bin/firefox: Too many levels of symbolic links

That is because you created a /bin/firefox symbolic that points to itself. You need to do ln -s /path/to/Downloads/firefox/firefox /bin/firefox

>   If I create a symlink of run-mozilla.sh in bin/firefox
>       /Downloads/firefox# ln -s run-mozilla.sh /bin/firefox
>   and run /bin $ firefox, I get: 
>       bash: /bin/firefox: No such file or directory

Running "run-mozilla.sh" is not going to start firefox. And you're doing the same mistake as above, except now /bin/firefox points at /bin/run-mozilla.sh.
I created the symlink again and it works now:
~/Downloads/firefox$ sudo ln -s /home/mihaelavelimiroviciu//Downloads/firefox/firefox /bin/firefox

~/Downloads/firefox$ firefox
/bin$ firefox
-> firefox launches successfully
Based on comment 19, QA can call this VERIFIED.
Status: RESOLVED → VERIFIED
Whiteboard: [qa!]
Keywords: verified-beta
You need to log in before you can comment on or make changes to this bug.