Skip to content

CDRIVER-4680 Remove ENABLE_ICU option and related code #1342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 18, 2023

Conversation

joshbsiegel
Copy link
Contributor

@joshbsiegel joshbsiegel commented Jul 13, 2023

Summary

This PR will remove any references to the now unused ICU dependency.

Background

#1317 implemented SASLprep natively, removing the need for the heavyweight and sometimes problematic ICU library. As such, we can remove all code related to this library, which will allow users to have sha-256 encryption without downloading an external dependency.

What's New

  • Removed all ICU related variables and logic in various CMakeLists.txt
  • Removed all ICU references in the Evergreen scripts
  • Removed all ICU related logic (#ifdefs) in the driver
  • Removed all ICU related tests

@joshbsiegel joshbsiegel marked this pull request as draft July 13, 2023 22:54
@joshbsiegel joshbsiegel changed the title CDRIVER-4680: Remove ENABLE_ICU option and related code CDRIVER-4680 Remove ENABLE_ICU option and related code Jul 14, 2023
@joshbsiegel joshbsiegel marked this pull request as ready for review July 15, 2023 00:38
@joshbsiegel joshbsiegel requested a review from kevinAlbs July 17, 2023 13:56
@kevinAlbs kevinAlbs requested a review from rcsanchez97 July 17, 2023 18:24
Copy link
Contributor

@rcsanchez97 rcsanchez97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we vendor the RPM spec file, and as a result we avoid directly modifying it. The correct way to modify it for our builds is to carry the desired changes in spec.patch. I recommend that you make the following changes (to restore the spec file and then move your proposed changes to the patch):

diff --git a/.evergreen/etc/mongo-c-driver.spec b/.evergreen/etc/mongo-c-driver.spec
index aec5a5010..230b4fc11 100644
--- a/.evergreen/etc/mongo-c-driver.spec
+++ b/.evergreen/etc/mongo-c-driver.spec
@@ -37,6 +37,7 @@ BuildRequires: openssl-devel
 BuildRequires: pkgconfig(libsasl2)
 BuildRequires: pkgconfig(zlib)
 BuildRequires: pkgconfig(snappy)
+BuildRequires: pkgconfig(icu-uc)
 BuildRequires: pkgconfig(libzstd)
 %if %{with tests}
 BuildRequires: mongodb-server
@@ -122,6 +123,7 @@ Documentation: http://mongoc.org/libbson/%{version}/
     -DENABLE_SSL:STRING=OPENSSL \
     -DENABLE_SASL:STRING=CYRUS \
     -DENABLE_MONGODB_AWS_AUTH:STRING=ON \
+    -DENABLE_ICU:STRING=ON \
     -DENABLE_AUTOMATIC_INIT_AND_CLEANUP:BOOL=OFF \
     -DENABLE_CRYPTO_SYSTEM_PROFILE:BOOL=ON \
     -DENABLE_MAN_PAGES:BOOL=ON \
diff --git a/.evergreen/etc/spec.patch b/.evergreen/etc/spec.patch
index 18fe23281..ee110274c 100644
--- a/.evergreen/etc/spec.patch
+++ b/.evergreen/etc/spec.patch
@@ -1,6 +1,6 @@
---- mongo-c-driver.spec.orig   2021-11-04 16:34:50.350572049 -0400
-+++ mongo-c-driver.spec        2021-11-04 16:37:54.962271319 -0400
-@@ -10,17 +10,17 @@
+--- mongo-c-driver.spec.orig   2023-07-17 14:42:52.236247070 -0400
++++ mongo-c-driver.spec        2023-07-17 14:43:16.572305452 -0400
+@@ -10,7 +10,7 @@
  %global gh_project   mongo-c-driver
  %global libname      libmongoc
  %global libver       1.0
@@ -9,9 +9,7 @@
  #global up_prever    rc0
  # disabled as require a MongoDB server
  %bcond_with          tests
- 
- # disable for bootstrap (libmongocrypt needs libbson)
- %bcond_without       libmongocrypt
+@@ -20,7 +20,7 @@
  
  Name:      mongo-c-driver
  Summary:   Client library written in C for MongoDB
@@ -20,3 +18,19 @@
  Release:   1%{?dist}
  # See THIRD_PARTY_NOTICES
  License:   Apache-2.0 AND ISC AND MIT AND Zlib
+@@ -37,7 +37,6 @@
+ BuildRequires: pkgconfig(libsasl2)
+ BuildRequires: pkgconfig(zlib)
+ BuildRequires: pkgconfig(snappy)
+-BuildRequires: pkgconfig(icu-uc)
+ BuildRequires: pkgconfig(libzstd)
+ %if %{with tests}
+ BuildRequires: mongodb-server
+@@ -123,7 +122,6 @@
+     -DENABLE_SSL:STRING=OPENSSL \
+     -DENABLE_SASL:STRING=CYRUS \
+     -DENABLE_MONGODB_AWS_AUTH:STRING=ON \
+-    -DENABLE_ICU:STRING=ON \
+     -DENABLE_AUTOMATIC_INIT_AND_CLEANUP:BOOL=OFF \
+     -DENABLE_CRYPTO_SYSTEM_PROFILE:BOOL=ON \
+     -DENABLE_MAN_PAGES:BOOL=ON \

Additionally, I recommend emailing the RPM maintainer, Remi, whenever the next release is made that incorporates this change (I'm guessing that will be 1.25.0) to let him know that ICU stuff can be dropped. You could also include the changes that you are proposing to the spec file in this PR.

Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, I recommend emailing the RPM maintainer, Remi, whenever the next release is made that incorporates this change (I'm guessing that will be 1.25.0) to let him know that ICU stuff can be dropped. You could also include the changes that you are proposing to the spec file in this PR.

I suggest adding this to the top of the NEWS file to serve as a reminder for the 1.25.0 release. The 1.25.0 release is not yet planned:

libmongoc 1.25.0 (Unreleased)
=============================

Improvements:

  * Remove optional dependency of libicu.

@joshbsiegel joshbsiegel requested a review from rcsanchez97 July 17, 2023 20:28
Copy link
Contributor

@rcsanchez97 rcsanchez97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kevinAlbs
Copy link
Collaborator

Remove these paragraphs from authentication.rst:

Passwords for SCRAM-SHA-256 undergo the preprocessing step known as SASLPrep
specified in `RFC 4013 <https://tools.ietf.org/html/rfc4013>`_. SASLPrep will
only be performed for passwords containing non-ASCII characters.  SASLPrep
requires libicu. If libicu is not available, attempting to authenticate over
SCRAM-SHA-256 with non-ASCII passwords will result in error.

Usernames *never* undergo SASLPrep.

By default, when building the C driver libicu is linked if available. This can
be changed with the ``ENABLE_ICU`` cmake option. To specify an installation
path of libicu, specify ``ICU_ROOT`` as a cmake option. See the
`FindICU <https://cmake.org/cmake/help/v3.7/module/FindICU.html>`_ documentation
for more information.

Since libicu is no longer a concern to users, I think mention of SASLPrep is unnecessary.

@joshbsiegel joshbsiegel merged commit c100d44 into mongodb:master Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants