Skip to contentSkip to conversation

libselinux: support building on older PCRE libs

PATCH Superseded Joe MacDonald 2 participants 6 messages Oct 22, 2013 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: support building on older PCRE libs

Versions of PCRE prior to 8.20 did not have pcre_free_study(). In its absence, use pcre_free() instead.

---

This will hit all uses of pcre_free_study() provided label_file.h gets included somewhere along the way. Also makes it cleaner to back out when ancient versions of libpcre fall off the support map and it keeps the code from being filled with all-caps.

 libselinux/src/label_file.h |    5 +++++
 1 file changed, 5 insertions(+)
libselinux/src/label_file.h +5 -0
index bf0c9e2..7d48832 100644
@@ -8,6 +8,11 @@
 #define SELINUX_MAGIC_COMPILED_FCONTEXT	0xf97cff8a
 #define SELINUX_COMPILED_FCONTEXT_MAX_VERS	1
 
+/* Prior to verison 8.20, libpcre did not have pcre_free_study() */
+#if (PCRE_MAJOR < 8 || PCRE_MINOR < 20)
+#define pcre_free_study  pcre_free
+#endif
+
 /* A file security context specification. */
 struct spec {
 	struct selabel_lookup_rec lr;	/* holds contexts for lookup result */
Signature · 7 lines
1.7.9.5


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 20 lines · [[PATCH] libselinux: support building on older PCRE libs] On 13.10.22 (Tue…

Versions of PCRE prior to 8.20 did not have pcre_free_study(). In its absence, use pcre_free() instead.

---

This will hit all uses of pcre_free_study() provided label_file.h gets included somewhere along the way. Also makes it cleaner to back out when ancient versions of libpcre fall off the support map and it keeps the code from being filled with all-caps.

 libselinux/src/label_file.h |    5 +++++
 1 file changed, 5 insertions(+)
libselinux/src/label_file.h +0 -0
index bf0c9e2..7d48832 100644
@@ -8,6 +8,11 @@
 #define SELINUX_MAGIC_COMPILED_FCONTEXT	0xf97cff8a

libselinux/src/label_file.h line 18

Quoted 10 lines
libselinux/src/label_file.h +5 -0
 #define SELINUX_COMPILED_FCONTEXT_MAX_VERS	1
 
+/* Prior to verison 8.20, libpcre did not have pcre_free_study() */
+#if (PCRE_MAJOR < 8 || PCRE_MINOR < 20)
+#define pcre_free_study  pcre_free
+#endif
+
 /* A file security context specification. */
 struct spec {
 	struct selabel_lookup_rec lr;	/* holds contexts for lookup result */

Hmm, actually, no. That's the same logic I had in the previous #if ... #endif block but it's wrong for cases where PCRE_MAJOR > 8. Sorry about that.

Signature · 2 lines
-Joe MacDonald.
:wq
#2 lore raw
Quoted 24 lines · [Re: [PATCH] libselinux: support building on older PCRE libs] On 13.10.22 (Tue…
Quoted 22 lines · [[PATCH] libselinux: support building on older PCRE libs] On 13.10.22 (Tue…

Versions of PCRE prior to 8.20 did not have pcre_free_study(). In its absence, use pcre_free() instead.

---

This will hit all uses of pcre_free_study() provided label_file.h gets included somewhere along the way. Also makes it cleaner to back out when ancient versions of libpcre fall off the support map and it keeps the code from being filled with all-caps.

 libselinux/src/label_file.h |    5 +++++
 1 file changed, 5 insertions(+)
libselinux/src/label_file.h +0 -0
index bf0c9e2..7d48832 100644
@@ -8,6 +8,11 @@
 #define SELINUX_MAGIC_COMPILED_FCONTEXT	0xf97cff8a
 #define SELINUX_COMPILED_FCONTEXT_MAX_VERS	1
 
Quoted 12 lines

libselinux/src/label_file.h line 18

Quoted 8 lines
libselinux/src/label_file.h +5 -0
+/* Prior to verison 8.20, libpcre did not have pcre_free_study() */
+#if (PCRE_MAJOR < 8 || PCRE_MINOR < 20)
+#define pcre_free_study  pcre_free
+#endif
+
 /* A file security context specification. */
 struct spec {
 	struct selabel_lookup_rec lr;	/* holds contexts for lookup result */

Hmm, actually, no. That's the same logic I had in the previous #if ... #endif block but it's wrong for cases where PCRE_MAJOR > 8. Sorry about that.

Sorry about the noise, this is what I intended and should be okay. And I can't even claim it's Monday morning ... :-}

Signature · 2 lines
-Joe MacDonald.
:wq
#3 lore raw
Quoted 39 lines · Joe MacDonald
Quoted 24 lines · [Re: [PATCH] libselinux: support building on older PCRE libs] On 13.10.22 (Tue…
Quoted 22 lines · [[PATCH] libselinux: support building on older PCRE libs] On 13.10.22 (Tue…

Versions of PCRE prior to 8.20 did not have pcre_free_study(). In its absence, use pcre_free() instead.

---

This will hit all uses of pcre_free_study() provided label_file.h gets included somewhere along the way. Also makes it cleaner to back out when ancient versions of libpcre fall off the support map and it keeps the code from being filled with all-caps.

 libselinux/src/label_file.h |    5 +++++
 1 file changed, 5 insertions(+)
libselinux/src/label_file.h +0 -0
index bf0c9e2..7d48832 100644
@@ -8,6 +8,11 @@
 #define SELINUX_MAGIC_COMPILED_FCONTEXT	0xf97cff8a
 #define SELINUX_COMPILED_FCONTEXT_MAX_VERS	1
 
Quoted 12 lines

libselinux/src/label_file.h line 18

Quoted 8 lines
libselinux/src/label_file.h +5 -0
+/* Prior to verison 8.20, libpcre did not have pcre_free_study() */
+#if (PCRE_MAJOR < 8 || PCRE_MINOR < 20)
+#define pcre_free_study  pcre_free
+#endif
+
 /* A file security context specification. */
 struct spec {
 	struct selabel_lookup_rec lr;	/* holds contexts for lookup result */

Hmm, actually, no. That's the same logic I had in the previous #if ... #endif block but it's wrong for cases where PCRE_MAJOR > 8. Sorry about that.

Quoted 2 lines

Sorry about the noise, this is what I intended and should be okay. And I can't even claim it's Monday morning ... :-}

I think you want PCRE_MAJOR < 8 || PCRE_MAJOR == 8 && PCRE_MINOR < 20 to avoid problems when we get to version 9.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#4 lore raw

PATCH v3 1/1 libselinux: support building on older PCRE libs

In reply to Joe MacDonald

Versions of PCRE prior to 8.20 did not have pcre_free_study(). In its absence, use pcre_free() instead.

---

[Re: [PATCH] libselinux: support building on older PCRE libs] On 13.10.22 (Tue

Quoted 2 lines · 11:56) Stephen Smalley wrote:

I think you want PCRE_MAJOR < 8 || PCRE_MAJOR == 8 && PCRE_MINOR < 20 to avoid problems when we get to version 9.

That is exactly what I wanted, thanks Stephen.

-J.

 libselinux/src/label_file.h |    5 +++++
 1 file changed, 5 insertions(+)
libselinux/src/label_file.h +5 -0
index bf0c9e2..0aad3e7 100644
@@ -8,6 +8,11 @@
 #define SELINUX_MAGIC_COMPILED_FCONTEXT	0xf97cff8a
 #define SELINUX_COMPILED_FCONTEXT_MAX_VERS	1
 
+/* Prior to verison 8.20, libpcre did not have pcre_free_study() */
+#if (PCRE_MAJOR < 8 || (PCRE_MAJOR == 8 && PCRE_MINOR < 20))
+#define pcre_free_study  pcre_free
+#endif
+
 /* A file security context specification. */
 struct spec {
 	struct selabel_lookup_rec lr;	/* holds contexts for lookup result */
Signature · 7 lines
1.7.9.5


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#5 lore raw
Quoted 4 lines · Joe MacDonald

Versions of PCRE prior to 8.20 did not have pcre_free_study(). In its absence, use pcre_free() instead.

Thanks, applied. I also applied the stat rename just for cleanliness, although I think the real problem lies elsewhere.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.