Subject: bug#36828: 27.0.50; Uninstalled emacs shows installed documentation

From: Eli Zaretskii <[email-masked]>
Date: Tue, 30 Jul 2019 18:08:31 +0300

> From: Óscar Fuentes <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Mon, 29 Jul 2019 23:09:09 +0200
> 
> >> M-x describe-function shows the docstrings of the Emacs I'm executing,
> >
> > How do you know?  What is the value of doc-directory?
> 
> /home/oscar/dev/emacs/stable/build/etc/
> 
> The installed version is in /usr/local.

Hmm... then this is not the use case I had in mind, and some other
factor is at work here.  Your use case is supposed to be handled by
this fragment from init_callproc:

  if (data_dir == 0)
    {
      Lisp_Object tem, tem1, srcdir;
      Lisp_Object lispdir = Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH, 0));

      srcdir = Fexpand_file_name (build_string ("../src/"), lispdir);

      tem = Fexpand_file_name (build_string ("NEWS"), Vdata_directory);
      tem1 = Ffile_exists_p (tem);
      if (!NILP (Fequal (srcdir, Vinvocation_directory)) || NILP (tem1))
	{
	  Lisp_Object newdir;
	  newdir = Fexpand_file_name (build_string ("../etc/"), lispdir);
	  tem = Fexpand_file_name (build_string ("NEWS"), newdir);
	  tem1 = Ffile_exists_p (tem);
	  if (!NILP (tem1))
	    Vdata_directory = newdir;
	}
    }

So somehow the call to Fequal returns nil in your case, when it
shouldn't.  Please step with a debugger into this code and see why it
fails to detect that you are invoking Emacs from the source directory.
My crystal ball says some symlinks are involved.

> A quick look at info.el hints that data-directory is also used for
> locating the info file.

Only for the NS build.

> The change would amount to determine if we are running from an
> uninstalled build and, if positive, set data-directory et al. to the
> values they would have if no installed instance existed.

That's the code above, but it somehow isn't working in your case.