Skip to contentSkip to conversation

dev-tools: Remove no longer needed openvpn-plugin.h.in patching

PATCH In review David Sommerseth 2 participants 6 messages Apr 20, 2022 – Apr 21, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 dev-tools: Remove no longer needed openvpn-plugin.h.in patching

From: David Sommerseth <[email protected]...>

The bug in uncrustify 0.64 is no longer causing us issues as we now require at least v0.72.

This workaround was added as part of the initial reformat-all inclusion, in commit 2417d55c4945d491e.

---
 .../after_include_openvpn-plugin.h.in.patch         | 13 -------------
 .../before_include_openvpn-plugin.h.in.patch        | 13 -------------
 dev-tools/special-files.lst                         |  1 -
 3 files changed, 27 deletions(-)
 delete mode 100644 dev-tools/reformat-patches/after_include_openvpn-plugin.h.in.patch
 delete mode 100644 dev-tools/reformat-patches/before_include_openvpn-plugin.h.in.patch
dev-tools/reformat-patches/after_include_openvpn-plugin.h.in.patch deleted +0 -13
deleted file mode 100644
index 100da078..00000000
@@ -1,13 +0,0 @@
-diff --git a/include/openvpn-plugin.h.in b/include/openvpn-plugin.h.in
-index 05bffab..05b4b6a 100644
---- a/include/openvpn-plugin.h.in
-+++ b/include/openvpn-plugin.h.in
-@@ -169,7 +169,7 @@ typedef void *openvpn_plugin_handle_t;
- /*
-  * We are compiling OpenVPN.
-  */
--/* #define OPENVPN_PLUGIN_DEF        typedef */
-+#define OPENVPN_PLUGIN_DEF        typedef
- #define OPENVPN_PLUGIN_FUNC(name) (*name)
-
- #else  /* ifdef OPENVPN_PLUGIN_H */
dev-tools/reformat-patches/before_include_openvpn-plugin.h.in.patch deleted +0 -13
deleted file mode 100644
index 679c4149..00000000
@@ -1,13 +0,0 @@
-diff --git a/include/openvpn-plugin.h.in b/include/openvpn-plugin.h.in
-index 34ad18b..f4c5472 100644
---- a/include/openvpn-plugin.h.in
-+++ b/include/openvpn-plugin.h.in
-@@ -169,7 +169,7 @@ typedef void *openvpn_plugin_handle_t;
- /*
-  * We are compiling OpenVPN.
-  */
--#define OPENVPN_PLUGIN_DEF        typedef
-+// #define OPENVPN_PLUGIN_DEF        typedef
- #define OPENVPN_PLUGIN_FUNC(name) (*name)
-
- #else
dev-tools/special-files.lst +0 -1
index f3f77ea3..64ee9e1a 100644
@@ -1,4 +1,3 @@
 E:doc/doxygen/doc_key_generation.h     # @verbatim section gets mistreated, exclude it
 E:src/compat/compat-lz4.c              # Preserve LZ4 upstream formatting
 E:src/compat/compat-lz4.h              # Preserve LZ4 upstream formatting
-P:include/openvpn-plugin.h.in          # uncrustify segfaults, patch it before+after
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/3 dev-tools: Remove uncrusify -p

From: David Sommerseth <[email protected]...>

The -p option to uncrustify was providing debug information about decisions done by uncrustify. This was useful when debugging why certain formatting choices.

With newer versions of uncrusitfy the -p option can only be used on individual files and not a list of files. Since still supporting this would require a bigger rewrite of reformat-all.sh, it was chosen to instead remove the usage of this option. If certain behaviours needs to be debugged, running uncrusity on individual files directly will work fine anyhow.

---
 dev-tools/reformat-all.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
dev-tools/reformat-all.sh +2 -2
index dc2bfc4e..ff126b0f 100755
@@ -80,8 +80,8 @@ cd "$srcroot"
 
     # Kick off uncrustify
     echo
-    echo "** INFO ** Running: uncrustify -c $cfg --no-backup -l C -p debug.uncr -F $files"
-    uncrustify -c "$cfg" --no-backup -l C -p debug.uncr -F "$files" 2>&1
+    echo "** INFO ** Running: uncrustify -c $cfg --no-backup -l C -F $files"
+    uncrustify -c "$cfg" --no-backup -l C -F "$files" 2>&1
     res=$?
     echo "** INFO ** Uncrustify completed (exit code $res)"
 } | tee "${log}-1"  # Log needs to be closed here, to be processed in next block
Signature · 1 line
2.27.0
Acked-by on v1 2/3
#2 lore raw

[Openvpn-devel] [PATCH applied] Re: dev-tools: Remove uncrusify -p

As discussed on IRC. Fixed 3 typos ("uncrus*t*ify -p" etc).

Your patch has been applied to the master branch.

commit fbd81db5f6d5b9b9d86ed3ca198bfffb478f2508

Author: David Sommerseth
Date:   Wed Apr 20 14:13:21 2022 +0200
     dev-tools: Remove uncrusify -p

     Signed-off-by: David Sommerseth <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg24120.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#3 lore raw

PATCH 3/3 dev-tools: Avoid uncrustify mangling MAC_FMT macro

In reply to David Sommerseth

From: David Sommerseth <[email protected]...>

The MAC_FMT in src/openvpn/misc.h need to be formatted strictly, and uncrustify does not fully grasp the current code. So we tell it to not touch it.

---
 src/openvpn/misc.h | 2 ++
 1 file changed, 2 insertions(+)
src/openvpn/misc.h +2 -0
index 7970b60d..d8a15650 100644
@@ -212,7 +212,9 @@ struct buffer
 prepend_dir(const char *dir, const char *path, struct gc_arena *gc);
 
 #define _STRINGIFY(S) #S
+/* *INDENT-OFF* - uncrustify need to ignore this macro */
 #define MAC_FMT _STRINGIFY(%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx)
+/* *INDENT-ON* */
 #define MAC_PRINT_ARG(_mac) _mac[0], _mac[1], _mac[2],  \
         _mac[3], _mac[4], _mac[5]
 #define MAC_SCAN_ARG(_mac) &_mac[0], &_mac[1], &_mac[2], \
Signature · 1 line
2.27.0
Acked-by on v1 3/3
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: dev-tools: Avoid uncrustify mangling MAC_FMT macro

As pointed out, I do not like this particular macro and the _STRINGIFY() stuff, and it seems uncrustify agrees with me :-) - but until we can find a volunteer to make that code nicer on the eyes, this will at least avoid uncrustify breaking it.

As this is just C level comments, nothing needed to be tested.

Your patch has been applied to the master branch.

commit 9febbcbbcf3b1a786a1e77145d30a43eb7996dc4

Author: David Sommerseth
Date:   Wed Apr 20 14:13:22 2022 +0200
     dev-tools: Avoid uncrustify mangling MAC_FMT macro

     Signed-off-by: David Sommerseth <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg24121.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

Acked-by on v1 1/3
#5 lore raw
In reply to David Sommerseth

We've discussed this on IRC - this was a workaround for old uncrustify (which supposedly segfaulted on openvpn-plugin.h.in) but since we've converged on "0.72 or 0.74" now, this is no longer relevant.

Your patch has been applied to the master branch.

commit c5c68210c5a38b6ff03d3489aadc519e9a5dd855

Author: David Sommerseth
Date:   Wed Apr 20 14:13:20 2022 +0200
     dev-tools: Remove no longer needed openvpn-plugin.h.in patching

     Signed-off-by: David Sommerseth <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg24122.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering