Skip to contentSkip to conversation

policycoreutils: fixfiles: honor last exclude line without newline

PATCH In review Stephen Smalley 1 participant 3 messages Oct 27 SELinux security module

lore
Share & tools
lore

Stephen Smalley

author maintainer
#0 lore raw

PATCH 1/1 policycoreutils: fixfiles: honor last exclude line without newline

From: Vaibhav Bhope <[email protected]>

exclude_dirs_from_relabelling() uses while read, which exits with status 1 at EOF when the final line lacks a trailing newline, so that entry is silently dropped from -e exclusions. Process the leftover buffer with || [ -n "$i" ] so the last path is still applied.

---
 policycoreutils/scripts/fixfiles | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
policycoreutils/scripts/fixfiles +1 -1
index e266da77..d6ce37aa 100755
@@ -81,7 +81,7 @@ exclude_dirs_from_relabelling() {
     local f
     exclude_from_relabelling=
     f=$(selinux_resolve fixfiles_exclude_dirs) || return 0
-    while read i
+    while read -r i || [ -n "$i" ]
     do
 	# skip blank line and comment
 	# skip not absolute path
Signature · 1 line
2.56.0
author maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Stephen Smalley

From: Vaibhav Bhope <[email protected]>

exclude_dirs_from_relabelling() uses while read, which exits with status 1 at EOF when the final line lacks a trailing newline, so that entry is silently dropped from -e exclusions. Process the leftover buffer with || [ -n "$i" ] so the last path is still applied.

author maintainer
#2 lore raw
Quoted 6 lines · Stephen Smalley
Quoted 3 lines · Stephen Smalley

From: Vaibhav Bhope <[email protected]>

Quoted 8 lines
Quoted 6 lines

exclude_dirs_from_relabelling() uses while read, which exits with status 1 at EOF when the final line lacks a trailing newline, so that entry is silently dropped from -e exclusions. Process the leftover buffer with || [ -n "$i" ] so the last path is still applied.

This has been merged.