Skip to contentSkip to conversation

fix Makefile BASE_MODS and MOD_MODS detection

PATCH In review Johan Fischer 2 participants 4 messages Nov 9, 2005 – Nov 25, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix Makefile BASE_MODS and MOD_MODS detection

Hi,

quick patch to fix the modules detection from the modules.conf file...

before:

$ awk '/^[[:blank:]]*[[:alpha:]]/{ if ($3 == "module") print $1 }'
policy/modules.conf
(no result)

after:

$ awk '/^[[:blank:]]*[[:alpha:]]*/{ if ($3 == "module") print $1 }'
policy/modules.conf
apm
apache
bluetooth

Cheers.
J.

Signature · 8 lines
Johan Fischer
Capital Markets CRC Limited
Level 2, 9 Castlereagh Street, Sydney NSW 2000
Tel: +61 2 9233 7999   Direct: +61 2 9236 9150
Fax: +61 2 9236 9177   http://www.cmcrc.com

Capital Markets CRC Ltd (CMCRC) - Confidential Communication
The information contained in this e-mail is confidential.  It is intended solely for the addressee. If you receive this e-mail by mistake please promptly inform us by reply e-mail and then delete the e-mail and destroy any printed copy. You must not disclose or use in any way the information in the e-mail. There is no warranty that this e-mail is error or virus free. It may be a private communication, and if so, does not represent the views of the CMCRC and its associates. If it is a private communication, care should be taken in opening it to ensure that undue offence is not given.

? Makefile.diff
Index: Makefile
===================================================================
RCS file: /cvsroot/serefpolicy/refpolicy/Makefile,v retrieving revision 1.24

Makefile +2 -2
diff -u -r1.24 Makefile
@@ -199,8 +199,8 @@
 MODMOD := module
 
 # extract settings from modules.conf
-BASE_MODS := $(foreach mod,$(shell awk '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(MODBASE)") print $$1 }' $(MOD_CONF) 2> /dev/null),$(subst ./,,$(shell find -iname $(mod).te)))
-MOD_MODS := $(foreach mod,$(shell awk '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(MODMOD)") print $$1 }' $(MOD_CONF) 2> /dev/null),$(subst ./,,$(shell find -iname $(mod).te)))
+BASE_MODS := $(foreach mod,$(shell awk '/^[[:blank:]]*[[:alpha:]]*/{ if ($$3 == "$(MODBASE)") print $$1 }' $(MOD_CONF) 2> /dev/null),$(subst ./,,$(shell find -iname $(mod).te)))
+MOD_MODS := $(foreach mod,$(shell awk '/^[[:blank:]]*[[:alpha:]]*/{ if ($$3 == "$(MODMOD)") print $$1 }' $(MOD_CONF) 2> /dev/null),$(subst ./,,$(shell find -iname $(mod).te)))
 
 HOMEDIR_TEMPLATE = tmp/homedir_template
 
#1 lore raw
Quoted 7 lines · Johan Fischer

quick patch to fix the modules detection from the modules.conf file...

before:

$ awk '/^[[:blank:]]*[[:alpha:]]/{ if ($3 == "module") print $1 }'
policy/modules.conf
(no result)
Quoted 6 lines

after:

$ awk '/^[[:blank:]]*[[:alpha:]]*/{ if ($3 == "module") print $1 }'
policy/modules.conf
apm
apache
bluetooth

I can't reproduce this behavior. I don't believe this patch is correct, as it makes the regex too inspecific. With the change, the regex matches all lines, so if the second word in a comment was "module", it would print out "#", causing errors.

Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
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.
#2 lore raw

FYI,

the solution to the problem....

make sure that you're using gawk and not mawk as the default awk on your system.

possibly the gawk and mawk way of adding extra anchors might be different making it fail on my installation ( I don't how when I installed mawk or why, but anyway....)

Cheers.
J.

Quoted 26 lines · Christopher J. PeBenito
Quoted 7 lines · Johan Fischer

quick patch to fix the modules detection from the modules.conf file...

before:

$ awk '/^[[:blank:]]*[[:alpha:]]/{ if ($3 == "module") print $1 }'
policy/modules.conf
(no result)
Quoted 8 lines

after:

$ awk '/^[[:blank:]]*[[:alpha:]]*/{ if ($3 == "module") print $1 }'
policy/modules.conf
apm
apache
bluetooth

I can't reproduce this behavior. I don't believe this patch is correct, as it makes the regex too inspecific. With the change, the regex matches all lines, so if the second word in a comment was "module", it would print out "#", causing errors.

Signature · 14 lines
Johan Fischer
Capital Markets CRC Limited
Level 2, 9 Castlereagh Street, Sydney NSW 2000
Tel: +61 2 9233 7999   Direct: +61 2 9236 9150
Fax: +61 2 9236 9177   http://www.cmcrc.com

Capital Markets CRC Ltd (CMCRC) - Confidential Communication
The information contained in this e-mail is confidential.  It is intended solely for the addressee. If you receive this e-mail by mistake please promptly inform us by reply e-mail and then delete the e-mail and destroy any printed copy. You must not disclose or use in any way the information in the e-mail. There is no warranty that this e-mail is error or virus free. It may be a private communication, and if so, does not represent the views of the CMCRC and its associates. If it is a private communication, care should be taken in opening it to ensure that undue offence is not given.


--
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.
#3 lore raw
Quoted 8 lines · Johan Fischer

the solution to the problem....

make sure that you're using gawk and not mawk as the default awk on your system.

possibly the gawk and mawk way of adding extra anchors might be different making it fail on my installation ( I don't how when I installed mawk or why, but anyway....)

Perhaps the awk commands should be changed to gawk. I wouldn't think it would be a problem; it doesn't seem likely that a policy will be built on a non-GNU system.

Quoted 29 lines
Quoted 26 lines · Christopher J. PeBenito
Quoted 7 lines · Johan Fischer

quick patch to fix the modules detection from the modules.conf file...

before:

$ awk '/^[[:blank:]]*[[:alpha:]]/{ if ($3 == "module") print $1 }'
policy/modules.conf
(no result)
Quoted 8 lines

after:

$ awk '/^[[:blank:]]*[[:alpha:]]*/{ if ($3 == "module") print $1 }'
policy/modules.conf
apm
apache
bluetooth

I can't reproduce this behavior. I don't believe this patch is correct, as it makes the regex too inspecific. With the change, the regex matches all lines, so if the second word in a comment was "module", it would print out "#", causing errors.

Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
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.