This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SYSTEMROOT, cygpath, and /proc funniness


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

Only when run with option 3 does the problem appear, which is
that cygpath hangs for up to 27 seconds on occasion. The 
following script runs 20 iterations, which seem enough to 
catch the hang situation several times (for me, at least). 
The sleep command increases the frequency of the hanging 
situation.
-------------------8<--------------------------
#!/bin/bash
[ $# -eq 1 ] || {
    echo "Usage: $0 {0|1|2|3}"
    exit 1
}
case $1 in
    0)  ;;
    1)  cd /proc
        ;;
    2)  SYSTEMROOT=$(cygpath "$SYSTEMROOT")
        ;;
    3)  cd /proc
        SYSTEMROOT=$(cygpath "$SYSTEMROOT")
        ;;
    *)  echo "$0: invalid parameter: $1"
        exit 1
        ;;
esac
echo "PWD=$PWD"
echo -n "SYSTEMROOT="; printenv SYSTEMROOT
for ((n=1; n<=20; n++))
do
    echo "Iteration $n at $(date) ..."
    time cygpath /proc
    sleep 1
done
exit
-------------------8<--------------------------

Here is an output fragment showing that cygpath took 27 
seconds at the first iteration:
-------------------8<--------------------------
Iteration 1 at Fri Apr 22 09:46:18 EDT 2011 ...
/proc

real    0m27.125s
user    0m0.030s
sys     0m0.031s
-------------------8<--------------------------

"cygcheck -svr > cygcheck.out" is attached.

--Ken Nellis

Attachment: cygcheck.out
Description: cygcheck.out

--
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]