1

I am on Ubuntu 11.04, Gnome 2. I had at a certain point installed Adobe Reader (acroread), however "off-tree" (at a non-standard location) - and I just noticed something weird about this executable.

First, which reports:

$ which acroread
/media/mydisk/AdobeReader/Adobe/Reader9/bin/acroread

Ok, so it is on a different partition than the system root /; in this case, I'd expect a symlink to this acroread to be present somewhere in the $PATH, e.g. in /usr/bin. So let's try locate:

$ locate acroread
~/.icons/All-blacks/scalable/apps/acroread.png
/usr/lib/pymodules/python2.7/orca/scripts/apps/acroread
/usr/lib/pymodules/python2.7/orca/scripts/apps/acroread/__init__.py
/usr/lib/pymodules/python2.7/orca/scripts/apps/acroread/__init__.pyc
/usr/lib/pymodules/python2.7/orca/scripts/apps/acroread/script.py
/usr/lib/pymodules/python2.7/orca/scripts/apps/acroread/script.pyc
/usr/share/app-install/desktop/acroread.desktop
/usr/share/app-install/icons/acroread.png
/usr/share/pyshared/orca/scripts/apps/acroread
/usr/share/pyshared/orca/scripts/apps/acroread/__init__.py
/usr/share/pyshared/orca/scripts/apps/acroread/script.py
/usr/share/scribus-trunk/icons/acroread16.png
/usr/share/scribus-trunk/icons/acroread22.png
/usr/share/scribus-trunk/icons/acroread32.png

Weird - nothing here seems related, except for acroread.desktop. I recall in Gnome, one can "register" an application by placing a .desktop file in a respective system directory; but if I check acroread.desktop:

$ cat /usr/share/app-install/desktop/acroread.desktop
[Desktop Entry]
X-AppInstall-Package=acroread
X-AppInstall-Proprietary=true
X-AppInstall-Channel=natty-partner
X-AppInstall-LicenseUri=/usr/share/app-install/channels/natty-partner.eula
X-AppInstall-Architectures=i386,amd64
Encoding=UTF-8
Name=Adobe Reader 9
Icon=acroread.png
Terminal=false
Type=Application
Categories=Application;Office;Viewer;
StartupNotify=true

... there's nothing in there about /media/mydisk location ?! Actually, this .desktop file looks like a pre-prepared icon, which would start the installer if you click it?!

So how come which finds this executable -- on a partition other than the system one? Maybe it's my .bashrc?:

$ grep 'acro\|Adobe' ~/.bashrc
$ 

Nope, nothing there.

So - how does the system know, that when I type acroread in the terminal, it should run /media/mydisk/.../acroread - and yet there is no symlink in system path, no mention in ~/.bashrc, and not even any relevant Gnome .desktop files in the root filesystem, either?

EDIT: The shell I use is bash , and type reports:

$ type acroread 
acroread is hashed (/media/mydisk/AdobeReader/Adobe/Reader9/bin/acroread)

I've also tried this:

$ while read line; do if [ -f "${line}" ]; then grep -rH 'acroread' "${line}"; fi; done < <(locate applications)
/usr/share/application-registry/gnome-vfs.applications:acroread
/usr/share/application-registry/gnome-vfs.applications: command=acroread

but the gnome-vfs.applications doesn't contain much about the location:

$ grep -A7 acroread /usr/share/application-registry/gnome-vfs.applications 
acroread
    command=acroread
    name=Adobe Acrobat Reader
    can_open_multiple_files=true
    expects_uris=false
    requires_terminal=false
    mime_types=application/pdf

applix

EDIT2: as @MichaelHomer noted, the reason the shell can call this executable is that the directory was in the $PATH:

$ for path in ${PATH//:/ }; do echo "$path" | grep 'Adobe\|acro'; done
/media/mydisk/AdobeReader/Adobe/Reader9/bin

However, the weird thing now is - how did this directory end up in $PATH? As mentioned earlier, certainly not by being added to my .bashrc - or for that matter, in any bashrc:

$ while read fnline; do if [ -f "${fnline}" ]; then echo "...(${fnline})..."; grep -rH 'acro\|Adobe' "${fnline}"; fi; done < <(locate bashrc)
...(/etc/bash.bashrc)...
...(/etc/skel/.bashrc)...
...(~/.bashrc)...
...(~/.bashrc-orig)...
...(~/.bashrc_mine)...
...(/home/aaa/.bashrc)...
...(/home/bbb/.bashrc)...
...(/usr/share/base-files/dot.bashrc)...
...(/usr/share/doc/adduser/examples/adduser.local.conf.examples/bash.bashrc)...
...(/usr/share/doc/adduser/examples/adduser.local.conf.examples/skel/dot.bashrc)...

... so the question now is: how did this directory end up in path?

  • 1
    What is $PATH? What does type acroread give you? What is your shell? – Michael Homer Jan 24 '15 at 23:15
  • 1
    Ubuntu 11.04 reached end of life years ago and has not been getting security fixes. You need to stop using it at once, as continuing to use an unsupported OS will get you hacked sooner or later. – psusi Jan 24 '15 at 23:18
  • 1
    You can get acroread from deb http://www.deb-multimedia.org wheezy main non-free. – Faheem Mitha Jan 24 '15 at 23:34
  • Many thanks, @MichaelHomer - see post update; it turns out my $PATH starts with /media/mydisk/AdobeReader/Adobe/Reader9/bin:/opt/OpenPrinting-lm1100/bin:... so that is the solution; feel free to post an answer, I'll accept it! Thanks @psusi - I'm well aware of that, unfortunately I'm working on a project using this older version; otherwise I would have updated a long time ago. Cheers! – sdaau Jan 24 '15 at 23:37
  • 1
    @sdaau binary packages which use standard location and are known to the package management system are better. – Faheem Mitha Jan 24 '15 at 23:39
1

Well, I was hoping I could reach an answer to this, without grepping through the entire filesystem; but apparently that was impossible - especially since this adding to the PATH it's apparently my doing :)

So, first I grepped through the entire root filesystem, making sure not to cross filesystem boundaries (-xdev), and grepping in binary mode (-ao) for either acroread or Adobe as characteristic word in the full path to the executable - saving the results in a different filesystem:

find / -xdev -type f -print0 2>/dev/null \
  | xargs -0 grep -Hao 'acroread\|Adobe....' 2>/dev/null \
  | tee /media/mydisk/found.txt

Once I had the found results, I inspected them visually, and found that this command for grepping through the found.txt results file would eventually give the answer:

while read tline; do \
  IFS=":"; declare -a arrIN=($tline); \
  grep -H Adobe/ "${arrIN[0]}" \
  | grep '\$PATH'; \
done < \
  <(grep Adobe/ /media/mydisk/found.txt | sort | uniq)

... and the answer is:

~/.profile:PATH="/media/mydisk/AdobeReader/Adobe/Reader9/bin:$PATH"

So, apparently there is also a ~/.profile file, where additions to the PATH are also registered/executed - and apparently I had appended (well, prepended) the Adobe Reader directory to the PATH environment variable there.

Well, mystery solved - thanks to all for their comments!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.