X-Spam-Check-By: sourceware.org Date: Sun, 14 May 2006 12:50:02 -0700 From: clayne AT anodized DOT com To: cygwin AT cygwin DOT com Subject: a simple cygwin snapshot regression finding script i wrote in bash Message-ID: <20060514195002.GE1783@ns1.anodized.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline User-Agent: Mutt/1.5.11 X-Assp-Spam-Prob: 0.00000 X-Assp-Whitelisted: Yes X-Assp-Envelope-From: clayne AT ns1 DOT anodized DOT com X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I wrote this script to help people streamline testing snapshot issues when they identify an issue in a snapshot but do not necessarily know where the issue might have occured (for instance they do not iteratively keep up on snapshot releases). Based on the snapshots available at "http://www.cygwin.com/snapshots/" the script performs a binary deduction (simple divide/conquer) to provide quick automation of switching snapshot dlls to narrow down a regression or new bug so that it is trivialized into cut/paste -> test -> next. This is mainly useful to people who *have an alternate unix shell* which they typically connect to through putty, nx, etc., i.e. any system out of band from cygwin. For instance, through my own dedicated host, I run the script and it provides me with the proper order of snapshots to test to narrow down between what two snapshot releases a difference in behavior has been seen. It requires you to simple input "a" for "absent, doesn't exist," or "s" for "seen" as in you're still seeing the issue. You can also add an explicit first argument to specify the snapshot you're currently using - which will split the tree differently. In addition you can also use a template file which will be sourced after each iteration which is where the cut/paste action will come in. Apologies to everyone in advance for the long text after this, I'm just trying to show an example so it makes sense what I'm talking about. Example: Let's say I'm troubleshooting a new bug, such as rsync randomly crashing, for instance, in the latest snapshot I've switched to. Now you could go through each snapshot in a linear fashion, but that's pointless when there are better ways. [clayne AT ns1 ~]$ bash /tmp/csnap.sh ------------------------- :: date: 20060223 :: dll: http://www.cygwin.com/snapshots/cygwin1-20060223.dll.bz2 :: debug: http://www.cygwin.com/snapshots/cygwin1-20060223.dbg.bz2 :: source: http://www.cygwin.com/snapshots/cygwin-src-20060223.tar.bz2 :: winsup: http://www.cygwin.com/snapshots/winsup-src-20060223.tar.bz2 :: install: http://www.cygwin.com/snapshots/cygwin-inst-20060223.tar.bz2 :: diffs: http://www.cygwin.com/snapshots/winsup-changelog-20060222-20060223 :: changelog: http://www.cygwin.com/snapshots/winsup-diffs-20060222-20060223 :: :: [(l)og,(d)iff,(a)bsent,(s)een] --> a I specify that the behavior is absent, after testing this snapshot with a test case which can duplicate the behavior. ------------------------- :: date: 20060321 :: dll: http://www.cygwin.com/snapshots/cygwin1-20060321.dll.bz2 :: debug: http://www.cygwin.com/snapshots/cygwin1-20060321.dbg.bz2 :: source: http://www.cygwin.com/snapshots/cygwin-src-20060321.tar.bz2 :: winsup: http://www.cygwin.com/snapshots/winsup-src-20060321.tar.bz2 :: install: http://www.cygwin.com/snapshots/cygwin-inst-20060321.tar.bz2 :: diffs: http://www.cygwin.com/snapshots/winsup-changelog-20060320-20060321 :: changelog: http://www.cygwin.com/snapshots/winsup-diffs-20060320-20060321 :: :: [(l)og,(d)iff,(a)bsent,(s)een] --> a Same. ------------------------- :: date: 20060413 :: dll: http://www.cygwin.com/snapshots/cygwin1-20060413.dll.bz2 :: debug: http://www.cygwin.com/snapshots/cygwin1-20060413.dbg.bz2 :: source: http://www.cygwin.com/snapshots/cygwin-src-20060413.tar.bz2 :: winsup: http://www.cygwin.com/snapshots/winsup-src-20060413.tar.bz2 :: install: http://www.cygwin.com/snapshots/cygwin-inst-20060413.tar.bz2 :: diffs: http://www.cygwin.com/snapshots/winsup-changelog-20060412-20060413 :: changelog: http://www.cygwin.com/snapshots/winsup-diffs-20060412-20060413 :: :: [(l)og,(d)iff,(a)bsent,(s)een] --> a Same. ------------------------- :: date: 20060424 :: dll: http://www.cygwin.com/snapshots/cygwin1-20060424.dll.bz2 :: debug: http://www.cygwin.com/snapshots/cygwin1-20060424.dbg.bz2 :: source: http://www.cygwin.com/snapshots/cygwin-src-20060424.tar.bz2 :: winsup: http://www.cygwin.com/snapshots/winsup-src-20060424.tar.bz2 :: install: http://www.cygwin.com/snapshots/cygwin-inst-20060424.tar.bz2 :: diffs: http://www.cygwin.com/snapshots/winsup-changelog-20060421-20060424 :: changelog: http://www.cygwin.com/snapshots/winsup-diffs-20060421-20060424 :: :: [(l)og,(d)iff,(a)bsent,(s)een] --> s At this point I see the observed behavior so I specify "seen." ------------------------- :: date: 20060418 :: dll: http://www.cygwin.com/snapshots/cygwin1-20060418.dll.bz2 :: debug: http://www.cygwin.com/snapshots/cygwin1-20060418.dbg.bz2 :: source: http://www.cygwin.com/snapshots/cygwin-src-20060418.tar.bz2 :: winsup: http://www.cygwin.com/snapshots/winsup-src-20060418.tar.bz2 :: install: http://www.cygwin.com/snapshots/cygwin-inst-20060418.tar.bz2 :: diffs: http://www.cygwin.com/snapshots/winsup-changelog-20060417-20060418 :: changelog: http://www.cygwin.com/snapshots/winsup-diffs-20060417-20060418 :: :: [(l)og,(d)iff,(a)bsent,(s)een] --> a Once again, don't see it. ------------------------- :: date: 20060421 :: dll: http://www.cygwin.com/snapshots/cygwin1-20060421.dll.bz2 :: debug: http://www.cygwin.com/snapshots/cygwin1-20060421.dbg.bz2 :: source: http://www.cygwin.com/snapshots/cygwin-src-20060421.tar.bz2 :: winsup: http://www.cygwin.com/snapshots/winsup-src-20060421.tar.bz2 :: install: http://www.cygwin.com/snapshots/cygwin-inst-20060421.tar.bz2 :: diffs: http://www.cygwin.com/snapshots/winsup-changelog-20060418-20060421 :: changelog: http://www.cygwin.com/snapshots/winsup-diffs-20060418-20060421 :: :: [(l)og,(d)iff,(a)bsent,(s)een] --> a Once again, don't see it - so it could only be between 0421 and 0424: ------------------------- :: SUSPECT: Suggest examination of changelog and/or diff :: :: date: 20060424 :: dll: http://www.cygwin.com/snapshots/cygwin1-20060424.dll.bz2 :: debug: http://www.cygwin.com/snapshots/cygwin1-20060424.dbg.bz2 :: source: http://www.cygwin.com/snapshots/cygwin-src-20060424.tar.bz2 :: winsup: http://www.cygwin.com/snapshots/winsup-src-20060424.tar.bz2 :: install: http://www.cygwin.com/snapshots/cygwin-inst-20060424.tar.bz2 :: diffs: http://www.cygwin.com/snapshots/winsup-changelog-20060421-20060424 :: changelog: http://www.cygwin.com/snapshots/winsup-diffs-20060421-20060424 :: :: [(l)og,(d)iff] --> l ChangeLog for 20060421 to 20060424 ---------- winsup/cygwin/ChangeLog ---------- 2006-04-24 Christopher Faylor [ rest of changelog here ] You can also use a template like so: [clayne AT ns1 ~]$ bash /tmp/csnap.sh -f /tmp/csnap.f ------------------------- :: date: 20060223 :: dll: http://www.cygwin.com/snapshots/cygwin1-20060223.dll.bz2 :: debug: http://www.cygwin.com/snapshots/cygwin1-20060223.dbg.bz2 :: source: http://www.cygwin.com/snapshots/cygwin-src-20060223.tar.bz2 :: winsup: http://www.cygwin.com/snapshots/winsup-src-20060223.tar.bz2 :: install: http://www.cygwin.com/snapshots/cygwin-inst-20060223.tar.bz2 :: diffs: http://www.cygwin.com/snapshots/winsup-changelog-20060222-20060223 :: changelog: http://www.cygwin.com/snapshots/winsup-diffs-20060222-20060223 :: ------------------------- mkdir -p /var/tmp/snap/20060223 /usr/bin/curl http://www.cygwin.com/snapshots/cygwin1-20060223.dll.bz2 | bzip2 -cd > /var/tmp/snap/20060223/cygwin1.dll ( handle cygwin | egrep pid | awk '{print $3}' | sort -u | xargs /bin/kill -f ) & # # cmd.exe specific: # copy c:\cygwin\var\tmp\snap\20060223\cygwin1.dll c:\cygwin\bin net start sshd ------------------------- :: [(l)og,(d)iff,(a)bsent,(s)een] --> a ------------------------- :: date: 20060321 :: dll: http://www.cygwin.com/snapshots/cygwin1-20060321.dll.bz2 :: debug: http://www.cygwin.com/snapshots/cygwin1-20060321.dbg.bz2 :: source: http://www.cygwin.com/snapshots/cygwin-src-20060321.tar.bz2 :: winsup: http://www.cygwin.com/snapshots/winsup-src-20060321.tar.bz2 :: install: http://www.cygwin.com/snapshots/cygwin-inst-20060321.tar.bz2 :: diffs: http://www.cygwin.com/snapshots/winsup-changelog-20060320-20060321 :: changelog: http://www.cygwin.com/snapshots/winsup-diffs-20060320-20060321 :: ------------------------- mkdir -p /var/tmp/snap/20060321 /usr/bin/curl http://www.cygwin.com/snapshots/cygwin1-20060321.dll.bz2 | bzip2 -cd > /var/tmp/snap/20060321/cygwin1.dll ( handle cygwin | egrep pid | awk '{print $3}' | sort -u | xargs /bin/kill -f ) & # # cmd.exe specific: # copy c:\cygwin\var\tmp\snap\20060321\cygwin1.dll c:\cygwin\bin net start sshd ------------------------- :: [(l)og,(d)iff,(a)bsent,(s)een] --> Which is where I think the real speed will come in in going through snapshots, because it's just a cut and paste deal which is what we're really looking for. I paste the top 3 commands into a cygwin shell or putty->localhost session. I then paste the remaining 2 lines that are cmd.exe specific into a cmd window. Rinse repeat until one narrows it down. Let me know of any issues. If someone wants to make it into a CGI somehow, have at it - but I'm fine with the bash script. Script and template file are attached to the email. Yes, there are fragilities and assumptions, but it's really a get-it-done script. Specific variables are at the top. -cl --6TrnltStXW4iwmi0 Content-Type: application/x-sh Content-Disposition: attachment; filename="csnap.sh" Content-Transfer-Encoding: quoted-printable #!/usr/local/bin/bash=0A= =0A= CURL=3D$(which curl)=0A= CURLOPT=3D"-s"=0A= SELF=3D$(basename $0)=0A= PID=3D$$=0A= TMP=3D"/tmp/${SELF}.${PID}"=0A= SNAPOUT=3D${TMP}/${SELF}.out=0A= =0A= CW_SNAPURL=3D"http://www.cygwin.com/snapshots/"=0A= CW_CLOG=3D( "winsup-changelog" "" )=0A= CW_DIFF=3D( "winsup-diffs" "" )=0A= CW_WSUP=3D( "winsup-src" "tar.bz2" )=0A= CW_DLL=3D( "cygwin1" "dll.bz2" )=0A= CW_DBG=3D( "cygwin1" "dbg.bz2" )=0A= CW_INST=3D( "cygwin-inst" "tar.bz2" )=0A= CW_SRC=3D( "cygwin-src" "tar.bz2" )=0A= =0A= cleanup()=0A= {=0A= [[ -n ${TMP} ]] && rm -rf ${TMP}=0A= exit=0A= }=0A= =0A= cs_args()=0A= {=0A= while [[ -n "$1" ]]; do=0A= if [[ "$1" =3D=3D "-f" ]]; then=0A= shift=0A= [[ -e "$1" ]] && cs_tfile=3D$1=0A= else=0A= cs_pre=3D$1=0A= fi=0A= =0A= shift=0A= done=0A= =0A= return=0A= }=0A= =0A= cs_snap_get()=0A= {=0A= ${CURL} ${CURLOPT} ${CW_SNAPURL} > ${SNAPOUT} || exit=0A= }=0A= =0A= cs_filt()=0A= {=0A= cat ${SNAPOUT} | egrep "href=3D.*$1" | sed -e "s#.*href=3D\"$1-\([0-9-]\+\= ).*#\1#g"=0A= }=0A= =0A= cs_init()=0A= {=0A= for i in CLOG DIFF WSUP DLL DBG INST SRC; do=0A= eval CS_${i}=3D$((b++))=0A= done=0A= =0A= mkdir ${TMP} || exit=0A= }=0A= =0A= print_data()=0A= {=0A= printf -- "\n-------------------------\n"=0A= [[ -n $1 ]] && [[ -n $2 ]] && printf ":: %10s: %s\n::\n" "$1" "$2"=0A= printf ":: %10s: %s\n" "date" "${cs_all[m]}"=0A= printf ":: %10s: %s\n" "dll" "$(eval echo ${CW_SNAPURL}\${cs_${cs_all[m]}[= ${CS_DLL}]})"=0A= printf ":: %10s: %s\n" "debug" "$(eval echo ${CW_SNAPURL}\${cs_${cs_all[m]= }[${CS_DBG}]})"=0A= printf ":: %10s: %s\n" "source" "$(eval echo ${CW_SNAPURL}\${cs_${cs_all[m= ]}[${CS_SRC}]})"=0A= printf ":: %10s: %s\n" "winsup" "$(eval echo ${CW_SNAPURL}\${cs_${cs_all[m= ]}[${CS_WSUP}]})"=0A= printf ":: %10s: %s\n" "install" "$(eval echo ${CW_SNAPURL}\${cs_${cs_all[= m]}[${CS_INST}]})"=0A= printf ":: %10s: %s\n" "diffs" "$(eval echo ${CW_SNAPURL}\${cs_${cs_all[m]= }[${CS_CLOG}]})"=0A= printf ":: %10s: %s\n" "changelog" "$(eval echo ${CW_SNAPURL}\${cs_${cs_al= l[m]}[${CS_DIFF}]})"=0A= printf "::\n"=0A= =0A= if [[ -n ${cs_tfile} ]]; then=0A= printf -- "-------------------------\n"=0A= source ${cs_tfile}=0A= printf -- "-------------------------\n"=0A= fi=0A= }=0A= =0A= cs_args $*=0A= cs_init=0A= cs_snap_get=0A= =0A= cs_pre=3D"$1"=0A= cs_pre_i=3D0=0A= cs_clog=3D( $(cs_filt ${CW_CLOG[0]}) )=0A= cs_all=3D( $(cs_filt ${CW_WSUP[0]}) )=0A= max=3D${#cs_all[*]}=0A= a=3D0=0A= =0A= for i in ${cs_all[*]}; do=0A= [[ -n ${cs_pre} ]] && [[ ${i} =3D=3D "${cs_pre}" ]] && cs_pre_i=3D$a=0A= eval "cs_${i}=3D( \=0A= ${CW_CLOG[0]}-${cs_clog[a]} \=0A= ${CW_DIFF[0]}-${cs_clog[a++]} \=0A= ${CW_WSUP[0]}-${i}.${CW_WSUP[1]} \=0A= ${CW_DLL[0]}-${i}.${CW_DLL[1]} \=0A= ${CW_DBG[0]}-${i}.${CW_DBG[1]} \=0A= ${CW_INST[0]}-${i}.${CW_INST[1]} \=0A= ${CW_SRC[0]}-${i}.${CW_SRC[1]} \=0A= )"=0A= done=0A= =0A= let l=3Dcs_pre_i=0A= let r=3Dmax-1=0A= let m=3D(r-l)/2+l=0A= =0A= while [[ $l -le $r ]]; do=0A= while [[ ${cont:=3D0} -eq 0 ]]; do=0A= print_data=0A= printf ":: [(l)og,(d)iff,(a)bsent,(s)een] --> "; read tmp=0A= =0A= if [[ ${tmp:0:1} =3D=3D "l" ]]; then=0A= ${CURL} ${CURLOPT} "$(eval echo ${CW_SNAPURL}\${cs_${cs_all[m]}[${CS_CLO= G}]})"=0A= elif [[ ${tmp:0:1} =3D=3D "d" ]]; then=0A= ${CURL} ${CURLOPT} "$(eval echo ${CW_SNAPURL}\${cs_${cs_all[m]}[${CS_DIF= F}]})"=0A= elif [[ ${tmp:0:1} =3D=3D "a" ]]; then=0A= let r=3Dm-1=0A= cont=3D1=0A= elif [[ ${tmp:0:1} =3D=3D "s" ]]; then=0A= let l=3Dm+1=0A= cont=3D1=0A= fi=0A= done=0A= =0A= let m=3D(r-l)/2+l=0A= cont=3D0=0A= done=0A= =0A= [[ $((m-1)) -lt ${cs_pre_i} ]] && echo "Nothing else to try." && cleanup=0A= [[ ${m} -eq $max ]] && echo "Nothing else to try." && cleanup=0A= let m=3Dm-1=0A= =0A= while [[ ${cont} -eq 0 ]]; do=0A= print_data "SUSPECT" "Suggest examination of changelog and/or diff"=0A= printf ":: [(l)og,(d)iff] --> "; read tmp=0A= =0A= if [[ ${tmp:0:1} =3D=3D "l" ]]; then=0A= ${CURL} ${CURLOPT} "$(eval echo ${CW_SNAPURL}\${cs_${cs_all[m]}[${CS_CLOG= }]})"=0A= elif [[ ${tmp:0:1} =3D=3D "d" ]]; then=0A= ${CURL} ${CURLOPT} "$(eval echo ${CW_SNAPURL}\${cs_${cs_all[m]}[${CS_DIFF= }]})"=0A= else=0A= cont=3D1=0A= fi=0A= done=0A= =0A= cleanup=0A= --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="csnap.f" echo "mkdir -p /var/tmp/snap/${cs_all[m]}" echo "/usr/bin/curl $(eval echo ${CW_SNAPURL}\${cs_${cs_all[m]}[${CS_DLL}]}) | bzip2 -cd > /var/tmp/snap/${cs_all[m]}/cygwin1.dll" echo "( handle cygwin | egrep pid | awk '{print \$3}' | sort -u | xargs /bin/kill -f ) &" echo "#" echo "# cmd.exe specific:" echo "#" echo "copy c:\\cygwin\\var\\tmp\\snap\\${cs_all[m]}\\cygwin1.dll c:\\cygwin\\bin" echo "net start sshd" --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --6TrnltStXW4iwmi0--