bin/chmod: set owner of symlinks

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

bin/chmod: set owner of symlinks

Martin Natano
When building with noperm the symlinks end up with the build user as
owner instead of root. Ok?

natano


Index: bin/chmod/Makefile
===================================================================
RCS file: /cvs/src/bin/chmod/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- bin/chmod/Makefile 6 Sep 2001 18:52:55 -0000 1.7
+++ bin/chmod/Makefile 10 Sep 2016 17:31:05 -0000
@@ -10,9 +10,11 @@ LINKS= ${BINDIR}/chmod ${BINDIR}/chgrp \
 afterinstall:
  (cd ${DESTDIR}/usr/sbin; \
     ln -sf ../../sbin/chown .; \
-    ln -sf ../../bin/chgrp .)
+    ln -sf ../../bin/chgrp .; \
+    chown -h root:wheel chown chgrp)
  (cd ${DESTDIR}/usr/bin; \
-    ln -sf ../../bin/chmod chflags)
+    ln -sf ../../bin/chmod chflags; \
+    chown -h root:wheel chflags)
 
 
 .include <bsd.prog.mk>

Reply | Threaded
Open this post in threaded view
|

Re: bin/chmod: set owner of symlinks

Philip Guenther-2
On Sat, 10 Sep 2016, Martin Natano wrote:
> When building with noperm the symlinks end up with the build user as
> owner instead of root. Ok?
...

> --- bin/chmod/Makefile 6 Sep 2001 18:52:55 -0000 1.7
> +++ bin/chmod/Makefile 10 Sep 2016 17:31:05 -0000
> @@ -10,9 +10,11 @@ LINKS= ${BINDIR}/chmod ${BINDIR}/chgrp \
>  afterinstall:
>   (cd ${DESTDIR}/usr/sbin; \
>      ln -sf ../../sbin/chown .; \
> -    ln -sf ../../bin/chgrp .)
> +    ln -sf ../../bin/chgrp .; \
> +    chown -h root:wheel chown chgrp)
>   (cd ${DESTDIR}/usr/bin; \
> -    ln -sf ../../bin/chmod chflags)
> +    ln -sf ../../bin/chmod chflags; \
> +    chown -h root:wheel chflags)

As with the sysctl symlink, I think these should be root:bin.

Also, let's follow best practice and s/;/ &&/ in those commands so that
failure propagates.

Reply | Threaded
Open this post in threaded view
|

Re: bin/chmod: set owner of symlinks

Alexander Hall
On Sat, Sep 10, 2016 at 01:46:05PM -0700, Philip Guenther wrote:

> On Sat, 10 Sep 2016, Martin Natano wrote:
> > When building with noperm the symlinks end up with the build user as
> > owner instead of root. Ok?
> ...
> > --- bin/chmod/Makefile 6 Sep 2001 18:52:55 -0000 1.7
> > +++ bin/chmod/Makefile 10 Sep 2016 17:31:05 -0000
> > @@ -10,9 +10,11 @@ LINKS= ${BINDIR}/chmod ${BINDIR}/chgrp \
> >  afterinstall:
> >   (cd ${DESTDIR}/usr/sbin; \
> >      ln -sf ../../sbin/chown .; \
> > -    ln -sf ../../bin/chgrp .)
> > +    ln -sf ../../bin/chgrp .; \
> > +    chown -h root:wheel chown chgrp)
> >   (cd ${DESTDIR}/usr/bin; \
> > -    ln -sf ../../bin/chmod chflags)
> > +    ln -sf ../../bin/chmod chflags; \
> > +    chown -h root:wheel chflags)
>
> As with the sysctl symlink, I think these should be root:bin.
>
> Also, let's follow best practice and s/;/ &&/ in those commands so that
> failure propagates.

My eyes agree, but for the record, from man(1):

SHELL COMMANDS
     ...
     Commands are executed using /bin/sh in "set -e" mode, unless '-' is
     specified.


/Alexander