Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Mar 2007 18:05:13 GMT
From:      Murilo Opsfelder Araujo<mopsfelder@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/110348: Add an option to do not automatically run ls with -A for root
Message-ID:  <200703151805.l2FI5D9F059298@www.freebsd.org>
Resent-Message-ID: <200703151810.l2FIA42Q084321@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         110348
>Category:       bin
>Synopsis:       Add an option to do not automatically run ls with -A for root
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 15 18:10:04 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Murilo Opsfelder Araujo
>Release:        7.0-CURRENT
>Organization:
Personal
>Environment:
FreeBSD soc90.opsfelder.eti.br 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Wed Mar 14 20:30:36 BRT 2007     root@soc90:/usr/obj/usr/src/sys/PANDA  i386
>Description:
ls automatically add -A option for root user. I believe it's better to have a way to disable this at buildworld time.

This patch implements an option NO_LSAUTODOT, that can be used on make.conf to disable that feature.
>How-To-Repeat:

>Fix:
Index: bin/ls/Makefile
===================================================================
RCS file: /home/ncvs/src/bin/ls/Makefile,v
retrieving revision 1.26
diff -u -r1.26 Makefile
--- bin/ls/Makefile	25 May 2004 14:53:47 -0000	1.26
+++ bin/ls/Makefile	15 Mar 2007 17:45:14 -0000
@@ -6,6 +6,10 @@
 DPADD=	${LIBUTIL}
 LDADD=	-lutil
 
+.if defined(NO_LSAUTODOT)
+CFLAGS+= -DNO_LSAUTODOT
+.endif
+
 .if !defined(RELEASE_CRUNCH)
 CFLAGS+= -DCOLORLS
 DPADD+=	${LIBTERMCAP}
Index: bin/ls/ls.c
===================================================================
RCS file: /home/ncvs/src/bin/ls/ls.c,v
retrieving revision 1.85
diff -u -r1.85 ls.c
--- bin/ls/ls.c	24 Mar 2006 17:09:03 -0000	1.85
+++ bin/ls/ls.c	15 Mar 2007 17:45:17 -0000
@@ -338,8 +338,10 @@
 	argv += optind;
 
 	/* Root is -A automatically unless -I. */
+#ifndef NO_LSAUTODOT
 	if (!f_listdot && getuid() == (uid_t)0 && !f_noautodot)
 		f_listdot = 1;
+#endif
 
 	/* Enabling of colours is conditional on the environment. */
 	if (getenv("CLICOLOR") &&
Index: share/examples/etc/make.conf
===================================================================
RCS file: /home/ncvs/src/share/examples/etc/make.conf,v
retrieving revision 1.279
diff -u -r1.279 make.conf
--- share/examples/etc/make.conf	17 Jan 2007 12:43:06 -0000	1.279
+++ share/examples/etc/make.conf	15 Mar 2007 17:45:18 -0000
@@ -106,6 +106,7 @@
 #NO_MODULES=		# do not build modules with the kernel
 #NO_SHARE=		# do not go into the share subdir
 #NO_SHARED= 		# build /bin and /sbin statically linked (bad idea)
+#NO_LSAUTODOT=		# do not automatically enable -A for root on /bin/ls
 #
 # Variables that control how ppp(8) is built.
 #PPP_NO_NAT= 		# do not build with NAT support (see make.conf(5))
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703151805.l2FI5D9F059298>