From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9103 invoked by alias); 24 Apr 2011 21:17:07 -0000 Received: (qmail 9092 invoked by uid 22791); 24 Apr 2011 21:17:06 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_40,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-px0-f170.google.com (HELO mail-px0-f170.google.com) (209.85.212.170) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 24 Apr 2011 21:16:46 +0000 Received: by pxi19 with SMTP id 19so1213320pxi.15 for ; Sun, 24 Apr 2011 14:16:46 -0700 (PDT) Received: by 10.68.48.168 with SMTP id m8mr5379956pbn.113.1303679806102; Sun, 24 Apr 2011 14:16:46 -0700 (PDT) Received: from edith.local (c-67-183-23-114.hsd1.wa.comcast.net [67.183.23.114]) by mx.google.com with ESMTPS id c10sm3446287pbi.67.2011.04.24.14.16.44 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 24 Apr 2011 14:16:45 -0700 (PDT) Message-ID: <4DB49339.9030909@gmail.com> Date: Mon, 25 Apr 2011 14:08:00 -0000 From: Daniel Colascione User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: [PATCH] base-files-4.0.6: Change prompt if running with admin rights References: <4D964392.6080809@t-online.de> <4DB45230.4080106@t-online.de> In-Reply-To: <4DB45230.4080106@t-online.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig113BB274DF61EB57B9905373" X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-04/txt/msg00344.txt.bz2 --------------enig113BB274DF61EB57B9905373 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 842 On 4/24/11 9:39 AM, Christian Franke wrote: > On 2011-04-01, Christian Franke wrote: >> The attached patch for /etc/profile and /etc/bash.bashrc sets a root >> prompt ('#' instead of '$' or '%') if the shell runs with admin rights >> (local or domain admin group). >> >=20 > Any comment so far? Wrong list ? I like the idea, but your patch adds two subprocess invocations to the shell startup path. Each one takes ~200ms, and we can't afford to add any more. Instead of examining the group list, you can use something like local isadmin=3D0 [[ -w / ]] && isadmin=3D1 or local isadmin=3D0 [[ -w /cygdrive/c ]] && isadmin=3D1 Of course, that test assumes that only "administrators" can write to the drive root, and that's an imperfect proxy for administrative rights. You get the idea though: try to perform the test in pure bash code. --------------enig113BB274DF61EB57B9905373 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 195 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iEYEARECAAYFAk20kzsACgkQ17c2LVA10VtmggCdG8jOuqiLYTjBwo948VYYidym LVIAoMc7UnMeu/DTy4ctrcORzKymQQiX =C86B -----END PGP SIGNATURE----- --------------enig113BB274DF61EB57B9905373--