[R-sig-Debian] why is KEYWORDS.db not in '/usr/lib/R/doc/' but in '/usr/share/R/doc/'?

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Tue Jun 6 19:20:27 CEST 2023


Hi Johan,

On 6 June 2023 at 18:55, Johan Andresen wrote:
| Hi r-sig-debian,
| 
| I feel lucky to have found out that `/doc/KEYWORDS.db` is in `/usr/share/R/`,
| not in `usr/lib/R/` where rpy2 in python apparently looks for it when
| trying to search help in R from the python environment. it returned this
| error: `cannot open file '/usr/lib/R/doc/KEYWORDS.db': No such file or
| directory`.
| 
| What to do now?
| - is this a problem with rpy2 looking for `/doc/KEYWORDS.db` that should
| not be in `usr/lib/R/`? -> *edit its script to point at the correct path?*

Yes, in essence.  The longer story is that for (many, MANY) years we followed
_Debian_ Policy where architecture-dependent files are in /usr/lib and
architecture-indepdendent files are in /usr/share.  As such we (ie Debian)
differ from a "plain vanilla from source" installation.  But then all (or
most) other distros do too.  It is the right (and/or was when multi-arch ie
32 and 64 bit was more common).

Even R itself recently patched another accessor because the right way to do
this is to expand the R.home() function rather than to append to the
environment variable R_HOME (or RHOME).

To show, on my system:

   > file.path( R.home("doc"), "KEYWORDS.db" )
   [1] "/usr/share/R/doc/KEYWORDS.db"
   > 

So ideally rpy2 to should try to figure out where doc/ is for R and then
append KEYWORDS.db. I am CCing Laurent now.

| - or is it a problem with R for debian bullseye putting  `/doc/KEYWORDS.db`
| in '/usr/share/R/doc/' where it should not be? -> why does it do that?
| Should it be this way? Can I change it?

It was change brought to me (as Debian maintainer) by other Debian developers
/ Debian Policy.  As such it is pretty irreversible.

But "R known" and access via e.g. R.home() is the right way. Also not that
/etc/R/Makeconf has, inter alia

   '--datadir=/usr/share/R/share'

and

   include $(R_SHARE_DIR)/make/vars.mk
   MKINSTALLDIRS = "$(R_HOME)/bin/mkinstalldirs"
   R_XTRA_CPPFLAGS =  -I"$(R_INCLUDE_DIR)" -DNDEB

so R does have the notion of different directories just fine. Also:

   > envs <- Sys.getenv()
   > envs[grepl("^R_", names(envs))]
   R_ARCH                                                      
   R_BROWSER                                                   xdg-open
   R_BZIPCMD                                                   /bin/bzip2
   R_DOC_DIR                                                   /usr/share/R/doc
   R_GZIPCMD                                                   /bin/gzip -n
   R_HOME                                                      /usr/lib/R
   R_INCLUDE_DIR                                               /usr/share/R/include
   R_LIBS_SITE                                                 /usr/local/lib/R/site-library:/usr/lib/R/site-library
   R_LIBS_USER                                                 
   R_MAX_NUM_DLLS                                              500
   R_PAPERSIZE                                                 letter
   R_PAPERSIZE_USER                                            letter
   R_PDFVIEWER                                                 /usr/bin/xdg-open
   R_PLATFORM                                                  x86_64-pc-linux-gnu
   R_PRINTCMD                                                  /usr/bin/lpr
   R_RD4PDF                                                    times,inconsolata,hyper
   R_SESSION_TMPDIR                                            /tmp/RtmpoU2ifO
   R_SHARE_DIR                                                 /usr/share/R/share
   R_STRIP_SHARED_LIB                                          strip --strip-unneeded
   R_STRIP_STATIC_LIB                                          strip --strip-debug
   R_SYSTEM_ABI                                                linux,gcc,gxx,gfortran,gfortran
   R_TEXI2DVICMD                                               /usr/bin/texi2dvi
   R_UNZIPCMD                                                  /usr/bin/unzip
   R_ZIPCMD                                                    /usr/bin/zip
   >
   
| To be sure, searching help in RStudio and `help('help`) in R from the
| terminal both worked. I installed both the way you suggest on lib.stat.cmu/R
| /CRAN/bin/linux/debian/.
| 
| See also https://github.com/rpy2/rpy2/issues/1033

Oh, nice, I should link back to this reply once it hits the mailing list archive.

| Johan
| with his first question on a, not just thus, mail list

Thanks for the detailed and high-quality post. Keep'em coming!

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-SIG-Debian mailing list