Skip to content

Commit

Permalink
Merge branch 'release/0.13.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed May 6, 2023
2 parents 8a17909 + 532dbbe commit f17ee5d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## Version 0.13.5 [2023-05-06]

### Bug Fixes

* Shorten the path lengths of the RStudio Server `server-data-dir` and
database `directory` folders by 17 characters.


## Version 0.13.4 [2023-04-17]

### New Features
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,20 @@ As before, the RStudio Server is available at
```sh
$ cd /path/to/software
$ curl -L -O https://github.com/UCSF-CBI/rstudio-server-controller/archive/refs/tags/0.13.4.tar.gz
$ tar xf 0.13.4.tar.gz
$ PATH=/path/to/softwarerstudio-server-controller-0.13.4/bin:$PATH
$ curl -L -O https://github.com/UCSF-CBI/rstudio-server-controller/archive/refs/tags/0.13.5.tar.gz
$ tar xf 0.13.5.tar.gz
$ PATH=/path/to/softwarerstudio-server-controller-0.13.5/bin:$PATH
$ export PATH
$ rsc --version
0.13.4
0.13.5
```
To verify that the tool can find R and the RStudio Server executables,
call:
```sh
$ rsc --version --full
rsc: 0.13.4
rsc: 0.13.5
RStudio Server: 2023.03.0+386 (Cherry Blossom) for Linux [/path/to/rstudio-server/bin/rstudio-server]
R: 4.2.3 (2023-03-15) -- "Shortstop Beagle" [/path/to/R/bin/R]
```
Expand Down
33 changes: 20 additions & 13 deletions bin/rsc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
### rsc config --full
### rsc log
###
### Version: 0.13.4
### Version: 0.13.5
### Copyright: Henrik Bengtsson (2022-2023) and Harry Putnam (2022)
### License: ISC

Expand Down Expand Up @@ -95,26 +95,31 @@ source "${incl}/system.sh"
# =========================================================================
# Utility functions
# =========================================================================
## If the length of '$HOME/.config' is 40 characters or more, we get an
## 'ERROR Unexpected exception: File name too long [system:36]; LOGGED
## If the length of the default
## '$server_data_dir/rstudio-rserver/session-server-rpc.socket', where
## server_data_="$HOME/.config/rsc/run/a", is 108 symbols or more, we get
## an 'ERROR Unexpected exception: File name too long [system:36]; LOGGED
## FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:941'.
## This errors occurs in
## <https://github.com/rstudio/rstudio/blob/09de542e287bdbfb6e90babf439eb1e2f9658f05/src/cpp/server/session/ServerSessionRpc.cpp#L229>
## when serverRpcSocketPath() returns a FilePath with an absolute path
## longer than 108 characters, e.g. /a/very/long/path/to/home/alice/.config/rsc/var/run/rstudio-server/rstudio-rserver/session-server-rpc.socket
## longer than 107 characters. Thus, if '$server_data_dir' has more than
## 65 characters, we hit this bug. Using the default, this means that
## user with a $HOME folder with more than 47 characters will be affected
## by this bug.
## /HB 2023-04-17
post_mortem_too_long_config_dir() {
post_mortem_too_long_server_data_dir() {
local path
path=$(config_dir)
if [[ ${#path} -ge 40 ]]; then
echo "Post-mortem analysis: The RStudio Server Controller configuration folder ($path) has ${#path} characters. A configuration folder with more than 40 characters will likely not work with RStudio Server version after 2022.02.4-500. Here we are using version $(rserver_version). Try setting 'export _RSC_RSERVER_DATA_DIR_=\"\$(mktemp -d)\"' before calling 'rsc start' as a workaround."
path=$(rserver_data_dir)
if [[ ${#path} -ge 66 ]]; then
echo "Post-mortem analysis: The RStudio Server 'server-data-dir' folder ($path) has ${#path} characters, which is more than 65 and will therefore not work with RStudio Server version after 2022.02.4-500. Try setting 'export _RSC_RSERVER_DATA_DIR_=\"\$(mktemp -d)\"' before calling 'rsc start' as a workaround."
fi
}

function rsc_error {
local msg extra
msg="$* This happened with rsc $(version), RStudio Server $(rserver_version_string) [$(rserver_path)], and R $(r_version_string) [$(r_path)]."
extra=$(post_mortem_too_long_config_dir)
extra=$(post_mortem_too_long_server_data_dir)
if [[ -n ${extra} ]]; then
msg="${msg} ${extra}"
fi
Expand Down Expand Up @@ -227,7 +232,7 @@ function make_config_dir {
local datadir

path=$(config_dir)
mkdir -p "${path}"/{run,tmp,var/lib/rstudio-server}
mkdir -p "${path}"/{lib,run,tmp}
secure_dir "${path}"

datadir=$(rserver_data_dir)
Expand Down Expand Up @@ -372,7 +377,8 @@ function make_database_conf {
assert_dir_exists "${workdir}"
{
echo "provider=sqlite"
echo "directory=${workdir}/var/lib/rstudio-server"
## Default: /var/lib/rstudio-server
echo "directory=${workdir}/lib"
} > "${workdir}/database.conf"
}

Expand Down Expand Up @@ -870,15 +876,16 @@ function rserver_data_dir {

if [[ -z ${_RSC_RSERVER_DATA_DIR_} ]]; then
workdir=$(config_dir)
path="${workdir}/var/run/rstudio-server"
## Default: /var/run/rstudio-server
path="${workdir}/run"
else
mdebug "_RSC_RSERVER_DATA_DIR_=${_RSC_RSERVER_DATA_DIR_}"
path=${_RSC_RSERVER_DATA_DIR_:?}

## WORKAROUND: This is needed to so that
## secure_dir "$(dirname "$(rserver_data_dir)")"
## is guaranteed to work, i.e. we need to append a sub folder
path=${path}/secure
path=${path}/a
fi

mdebug "rserver_data_dir(): ${path}"
Expand Down

0 comments on commit f17ee5d

Please sign in to comment.