diff mbox series

[2/2] builddeb: Consolidate consecutive chmod calls into one

Message ID 20201026193217.402412-2-svenjoac@gmx.de (mailing list archive)
State New, archived
Headers show
Series [1/2] builddeb: Fix rootless build in setuid/setgid directory | expand

Commit Message

Sven Joachim Oct. 26, 2020, 7:32 p.m. UTC
No need to call chmod three times when it can do everything at once.

Signed-off-by: Sven Joachim <svenjoac@gmx.de>
---
 scripts/package/builddeb | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

--
2.28.0

Comments

Masahiro Yamada Oct. 28, 2020, 6:52 a.m. UTC | #1
On Tue, Oct 27, 2020 at 4:32 AM Sven Joachim <svenjoac@gmx.de> wrote:
>
> No need to call chmod three times when it can do everything at once.
>
> Signed-off-by: Sven Joachim <svenjoac@gmx.de>
> ---
>  scripts/package/builddeb | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index 91a502bb97e8..81ec6414726c 100755
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -42,11 +42,7 @@ create_package() {
>         else
>                 chown -R root:root "$pdir"
>         fi
> -       chmod -R go-w "$pdir"
> -       # in case we are in a restrictive umask environment like 0077
> -       chmod -R a+rX "$pdir"
> -       # in case we build in a setuid/setgid directory
> -       chmod -R ug-s "$pdir"
> +       chmod -R go-w,a+rX,ug-s "$pdir"


You added the comment in 1/2, then
you are deleting it in this patch.

Could you keep the comments for clarification?


# a+rX in case we are in a restrictive umask environment like 0077
# ug-s in case we build in a setuid/setgid directory
chmod -R go-w,a+rX,ug-s "$pdir"






>         # Create the package
>         dpkg-gencontrol -p$pname -P"$pdir"
> --
> 2.28.0
>


--
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 91a502bb97e8..81ec6414726c 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -42,11 +42,7 @@  create_package() {
 	else
 		chown -R root:root "$pdir"
 	fi
-	chmod -R go-w "$pdir"
-	# in case we are in a restrictive umask environment like 0077
-	chmod -R a+rX "$pdir"
-	# in case we build in a setuid/setgid directory
-	chmod -R ug-s "$pdir"
+	chmod -R go-w,a+rX,ug-s "$pdir"

 	# Create the package
 	dpkg-gencontrol -p$pname -P"$pdir"