X-Recipient: archive-cygwin AT delorie DOT com 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 Message-ID: <4DB49339.9030909@gmail.com> Date: Sun, 24 Apr 2011 14:16:41 -0700 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 AT cygwin DOT com Subject: Re: [PATCH] base-files-4.0.6: Change prompt if running with admin rights References: <4D964392 DOT 6080809 AT t-online DOT de> <4DB45230 DOT 4080106 AT t-online DOT 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 AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------enig113BB274DF61EB57B9905373 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iEYEARECAAYFAk20kzsACgkQ17c2LVA10VtmggCdG8jOuqiLYTjBwo948VYYidym LVIAoMc7UnMeu/DTy4ctrcORzKymQQiX =C86B -----END PGP SIGNATURE----- --------------enig113BB274DF61EB57B9905373--