diff mbox

[PATCHv2] builddeb: fix file permissions before packaging

Message ID 1469191612-21934-1-git-send-email-henning.schild@siemens.com (mailing list archive)
State New, archived
Headers show

Commit Message

Henning Schild July 22, 2016, 12:46 p.m. UTC
Builddep is not very explicit about file permissions. Actually the file
permissions in the package are largely influenced by the umask of the
user cloning the git and building the package. If that umask does not
set go+r the resulting linux-headers package will prevent non-root users
from building out-of-tree modules. And that is probably just one
unexpected effect.
Being a packaging/install tool builddep should make sure the file
permissions are set correctly and not just derived from a value that is
never checked.

This patch sets ugo read permissions for all packaged files and derives
the executable bit for directories and executables from the file-owner.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 scripts/package/builddeb | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michal Marek July 26, 2016, 8:27 p.m. UTC | #1
Dne 22.7.2016 v 14:46 Henning Schild napsal(a):
> Builddep is not very explicit about file permissions. Actually the file
> permissions in the package are largely influenced by the umask of the
> user cloning the git and building the package. If that umask does not
> set go+r the resulting linux-headers package will prevent non-root users
> from building out-of-tree modules. And that is probably just one
> unexpected effect.
> Being a packaging/install tool builddep should make sure the file
> permissions are set correctly and not just derived from a value that is
> never checked.
> 
> This patch sets ugo read permissions for all packaged files and derives
> the executable bit for directories and executables from the file-owner.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  scripts/package/builddeb | 2 ++
>  1 file changed, 2 insertions(+)

Applied to kbuild.git#misc, thanks.

Michal

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 86e56fe..f72ba49 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -26,6 +26,8 @@  create_package() {
 	# Fix ownership and permissions
 	chown -R root:root "$pdir"
 	chmod -R go-w "$pdir"
+	# in case we are in a restrictive umask environment like 0077
+	chmod -R a+rX "$pdir"
 
 	# Create the package
 	dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"