From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15091 invoked by alias); 28 Apr 2011 17:57:48 -0000 Received: (qmail 15073 invoked by uid 22791); 28 Apr 2011 17:57:45 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,TW_YG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ishtar.tlinx.org (HELO Ishtar.sc.tlinx.org) (173.164.175.65) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Apr 2011 17:57:31 +0000 Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id p3SHvNJa012681 for ; Thu, 28 Apr 2011 10:57:25 -0700 Message-ID: <4DB9AA83.9080300@tlinx.org> Date: Fri, 29 Apr 2011 05:00:00 -0000 From: Linda Walsh User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: SYSTEMROOT, cygpath, and /proc funniness References: <2BF01EB27B56CC478AD6E5A0A28931F20262E742@A1DAL1SWPES19MB.ams.acs-inc.net> In-Reply-To: <2BF01EB27B56CC478AD6E5A0A28931F20262E742@A1DAL1SWPES19MB.ams.acs-inc.net> X-Stationery: 0.5.1 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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/msg00411.txt.bz2 Nellis, Kenneth wrote: > In .bash_profile I use cygpath to convert several environment > variables that contain Windows paths to instead contain Unix > paths. One in particular, SYSTEMROOT, has caused several > problems, one of which is causing ClearCase's cleartool to be > non-functional. Another is strictly within Cygwin itself > where there seems to be some funny relationship between > SYSTEMROOT, having the working directory be /proc, and the > cygpath command. > > The script, below, demonstrates the problem. It takes the > following options: > 0: run with defaults > 1: run with cd /proc > 2: run with SYSTEMROOT cygpath'd > 3: run with both options ----- I tried your script on my system and couldn't reproduce the results. I altered the script to run all cases in succession. My results on all 4 cases (calling script with "test.sh all 3") case=all, count=3 5572: old priority 0, new priority -19 case = 0, PWD=/tmp, SYSTEMROOT=C:\Windows, Iter 0 @ 10:51:30: 0.07sec 0.01usr 0.00sys (19.73% cpu) Iter 0 @ 10:51:31: 0.07sec 0.01usr 0.00sys (19.23% cpu) Iter 0 @ 10:51:32: 0.07sec 0.01usr 0.00sys (19.23% cpu) case = 1, PWD=/proc, SYSTEMROOT=C:\Windows, Iter 1 @ 10:51:32: 0.08sec 0.00usr 0.03sys (37.80% cpu) Iter 1 @ 10:51:33: 0.07sec 0.03usr 0.00sys (39.24% cpu) Iter 1 @ 10:51:33: 0.08sec 0.00usr 0.01sys (18.75% cpu) case = 2, PWD=/tmp, SYSTEMROOT=/Windows, Iter 2 @ 10:51:34: 0.08sec 0.00usr 0.00sys (0.00% cpu) Iter 2 @ 10:51:35: 0.07sec 0.00usr 0.01sys (19.23% cpu) Iter 2 @ 10:51:35: 0.07sec 0.01usr 0.01sys (38.46% cpu) case = 3, PWD=/proc, SYSTEMROOT=/Windows, Iter 3 @ 10:51:36: 0.07sec 0.00usr 0.01sys (19.48% cpu) Iter 3 @ 10:51:36: 0.07sec 0.00usr 0.03sys (41.33% cpu) Iter 3 @ 10:51:37: 0.07sec 0.01usr 0.01sys (40.25% cpu) Script: #!/bin/bash TIMEFORMAT="%2Rsec %2Uusr %2Ssys (%P%% cpu)" case=-1 count=20 uname -a function usage { echo "Usage: $0 {0|1|2|3|all}" exit 1 } function _setup { local case=$1 count=${2:-$count} #echo "_setup1: case=$case, count=$count" case $case in 0) ;; 1) cd /proc ;; 2) SYSTEMROOT=$(cygpath "$SYSTEMROOT") ;; 3) cd /proc SYSTEMROOT=$(cygpath "$SYSTEMROOT") ;; all) ;; *) echo "$0: invalid parameter: $1" usage exit 1 ;; esac echo "$case $count" } function do_test { case=$1 use_count=$2 echo " case = $case, PWD=$PWD, SYSTEMROOT=$SYSTEMROOT, " for ((n=1; n<=use_count; n++)); do echo -n "Iter $1 @ $(date +'%H:%M:%S'): " time cygpath /proc &>/dev/null sleep 0.3 done } #get case & count from initial setup read case count<<< "$(_setup "$@")" echo "case=$case, count=$count" # try for highest priority to minimize other procs 'stealing' cpu cycles renice -19 $$ if [[ $case != all ]] ;then do_test $case $count elif [[ $case == all ]]; then for ((case=0; case<=3; ++case)); do # call setup before each 'do_test' to simulate original script and do # each in a subshell to isolate any unanticipated side-effects ( _setup $case $count &>/dev/null do_test $case $count ) done fi -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple