git: 78d590c1287a - main - devel/RStudio: Fix crash caused by the std::bad_cast exception in RStudio-server

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Mon, 28 Aug 2023 23:28:30 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=78d590c1287a4c5cdc5e51404e0702bbb6e7d2c6

commit 78d590c1287a4c5cdc5e51404e0702bbb6e7d2c6
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-08-28 23:25:46 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-08-28 23:28:28 +0000

    devel/RStudio: Fix crash caused by the std::bad_cast exception in RStudio-server
    
    This caused users to be unable to log in.
    The workround is now in place.
---
 devel/RStudio/Makefile                             |  2 +-
 ...patch-src_cpp_server_auth_ServerAuthHandler.cpp | 26 ++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/devel/RStudio/Makefile b/devel/RStudio/Makefile
index 218a96db00d2..dcc39863ecb0 100644
--- a/devel/RStudio/Makefile
+++ b/devel/RStudio/Makefile
@@ -4,7 +4,7 @@
 PORTNAME=	RStudio
 DISTVERSIONPREFIX=	v
 DISTVERSION=	2022.12.0+353
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	devel math java
 MASTER_SITES=	https://s3.amazonaws.com/rstudio-buildtools/dictionaries/:dictionaries \
 		https://s3.amazonaws.com/rstudio-buildtools/:buildtools
diff --git a/devel/RStudio/files/patch-src_cpp_server_auth_ServerAuthHandler.cpp b/devel/RStudio/files/patch-src_cpp_server_auth_ServerAuthHandler.cpp
new file mode 100644
index 000000000000..50698fa7bb48
--- /dev/null
+++ b/devel/RStudio/files/patch-src_cpp_server_auth_ServerAuthHandler.cpp
@@ -0,0 +1,26 @@
+- workaround for the std:bad_cast exception in the licensed user info retrievel code
+- that isn't even used on FreeBSD
+- see https://github.com/rstudio/rstudio/issues/12377
+- resolution: the offending function's body is commented out for the time being
+
+--- src/cpp/server/auth/ServerAuthHandler.cpp.orig	2023-08-28 18:24:18 UTC
++++ src/cpp/server/auth/ServerAuthHandler.cpp
+@@ -383,6 +383,7 @@ Error getUserFromDatabase(const boost::shared_ptr<ICon
+                           boost::posix_time::ptime* pLastSignin,
+                           bool* pExists)
+ {
++#if 0
+    LOG_DEBUG_MESSAGE("Getting user from database: " + user.getUsername());
+    
+    *pLocked = true;
+@@ -439,6 +440,10 @@ Error getUserFromDatabase(const boost::shared_ptr<ICon
+    }
+ 
+    *pExists = foundUser;
++#endif
++
++   *pExists = false;
++
+    return Success();
+ }
+