[apparmor] [patch] Make.rules: sort capabilities with LANG=C

Christian Boltz apparmor at cboltz.de
Tue Aug 25 19:30:58 UTC 2015


Hello,

Am Dienstag, 25. August 2015 schrieb intrigeri:
> Christian Boltz wrote (25 Aug 2015 17:09:19 GMT) :
> > this patch changes Make.rules to sort capabilities using LANG=C.
> > 
> > This is needed to make building apparmor.vim reproducable -
> > otherwise
> > the sorting depends on the locale.
> 
> Excellent, I had this one on my radar, thanks for beating me to it!
> 
> > LANG=C sort)
> 
> Isn't LC_COLLATE=C needed as well? IIRC if it's set it can override
> $LANG for some aspects of sorting.

Good question, let's test it ;-)

cb at geeko:~> export LC_COLLATE=de_DE at euro ; LANG=C locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE=de_DE at euro
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=
cb at geeko:~> export LC_COLLATE=de_DE at euro ; LC_ALL=C locale
LANG=de_DE at euro
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C

I never thought I'll need to send a v2 of that patch, but using LC_ALL 
seems to be the better choice (it doesn't touch LANG, but that 
hopefully shouldn't matter).

[ make-rules-sort-capabilities.diff ]

=== modified file 'common/Make.rules'
--- common/Make.rules   2015-01-30 21:15:53 +0000
+++ common/Make.rules   2015-08-25 17:00:00 +0000
@@ -82,7 +82,7 @@
 # =====================
 
 # emits defined capabilities in a simple list, e.g. "CAP_NAME CAP_NAME2"
-CAPABILITIES=$(shell echo "\#include <linux/capability.h>" | cpp -dM | LC_ALL=C sed -n -e '/CAP_EMPTY_SET/d' -e 's/^\#define[ \t]\+CAP_\([A-Z0-9_]\+\)[ \t]\+\([0-9xa-f]\+\)\(.*\)$$/CAP_\1/p' | sort)
+CAPABILITIES=$(shell echo "\#include <linux/capability.h>" | cpp -dM | LC_ALL=C sed -n -e '/CAP_EMPTY_SET/d' -e 's/^\#define[ \t]\+CAP_\([A-Z0-9_]\+\)[ \t]\+\([0-9xa-f]\+\)\(.*\)$$/CAP_\1/p' | LC_ALL=C sort)
 
 .PHONY: list_capabilities
 list_capabilities: /usr/include/linux/capability.h




Regards,

Christian Boltz
-- 
[Virenscanner] Stattdessen gehört auf einen Windows-Arbeitsplatz ein
guter, selbstaktualisierender lokaler Scanner, der die Windows-Kiste so
richtig schön langsam beim Öffnen von Dateien macht, um den
Windows-Anwender zu motivieren, auf Linux umzusteigen.
[Kristian Koehntopp in suse-linux]




More information about the AppArmor mailing list