Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1448554 > unrolled thread
| Started by | Michal Marek <mmarek@suse.com> |
|---|---|
| First post | 2016-07-22 14:20 +0200 |
| Last post | 2016-07-22 14:50 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] builddeb: fix file permissions before packaging Michal Marek <mmarek@suse.com> - 2016-07-22 14:20 +0200
[PATCHv2] builddeb: fix file permissions before packaging Henning Schild <henning.schild@siemens.com> - 2016-07-22 14:50 +0200
Re: [PATCH] builddeb: fix file permissions before packaging Henning Schild <henning.schild@siemens.com> - 2016-07-22 14:50 +0200
| From | Michal Marek <mmarek@suse.com> |
|---|---|
| Date | 2016-07-22 14:20 +0200 |
| Subject | Re: [PATCH] builddeb: fix file permissions before packaging |
| Message-ID | <rXHAR-5Jd-7@gated-at.bofh.it> |
On 2016-07-07 16:50, Henning Schild wrote:
> 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 derives the "r" and "x" bits for all files from the file
> owner, all directories in the package will be 755.
>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
> scripts/package/builddeb | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index 86e56fe..615e0ed 100755
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -26,6 +26,11 @@ 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
> + # set permissions for dirs and derive "go"-"rx" permissions from "u"
> + find $pdir -type d -exec chmod 0755 {} +
> + find $pdir -type f -perm -u+r -exec chmod go+r {} +
> + find $pdir -type f -perm -u+x -exec chmod go+x {} +
This can be simplified as
chmod -R a+rX "$pdir"
Michal
[toc] | [next] | [standalone]
| From | Henning Schild <henning.schild@siemens.com> |
|---|---|
| Date | 2016-07-22 14:50 +0200 |
| Subject | [PATCHv2] builddeb: fix file permissions before packaging |
| Message-ID | <rXI3T-5Un-3@gated-at.bofh.it> |
| In reply to | #1448554 |
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(+)
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"
--
2.7.3
[toc] | [prev] | [next] | [standalone]
| From | Henning Schild <henning.schild@siemens.com> |
|---|---|
| Date | 2016-07-22 14:50 +0200 |
| Message-ID | <rXI3U-5Un-19@gated-at.bofh.it> |
| In reply to | #1448554 |
Am Fri, 22 Jul 2016 14:15:32 +0200
schrieb Michal Marek <mmarek@suse.com>:
> On 2016-07-07 16:50, Henning Schild wrote:
> > 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 derives the "r" and "x" bits for all files from the file
> > owner, all directories in the package will be 755.
> >
> > Signed-off-by: Henning Schild <henning.schild@siemens.com>
> > ---
> > scripts/package/builddeb | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> > index 86e56fe..615e0ed 100755
> > --- a/scripts/package/builddeb
> > +++ b/scripts/package/builddeb
> > @@ -26,6 +26,11 @@ 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
> > + # set permissions for dirs and derive "go"-"rx"
> > permissions from "u"
> > + find $pdir -type d -exec chmod 0755 {} +
> > + find $pdir -type f -perm -u+r -exec chmod go+r {} +
> > + find $pdir -type f -perm -u+x -exec chmod go+x {} +
>
> This can be simplified as
>
> chmod -R a+rX "$pdir"
That 'X' is much nicer than the finds, learned something new today,
Thanks!
Henning
> Michal
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web