Wednesday, 30 March 2011

tcl file_copy_rsync proc

# Name:   file_copy_rsync
# Inputs: sFromFile:    path and file name to copy from
#         sToFileOrDir: path (or path and file name) to copy file to
# Output: file copied or not, puts info
# Desc:   tcl rsync-style file copy,
#         quite a bit more crude than proper rsync
#         copy files only if size or mtime has changed
#         substitute for file copy (or file copy -force) when log files are copied multiple times
# test and usage file copy / file rsync
#  set sToDir "P:/destdir/d/d"
#  set sFromDir "A:/fromdir/foo"
#  set sLogFile test_30_03_11_09_24_36.log
#  file_copy_rsync ${sFromDir}/$sLogFile ${sToDir}/Logs
#  file_copy_rsync ${sFromDir}/$sLogFile ${sToDir}/Logs/
#  file_copy_rsync ${sFromDir}/$sLogFile ${sToDir}/Logs/$sLogFile
#  #file copy -force ${sFromDir}/$sLogFile ${sToDir}/Logs/
# Author: James Coleman, 30/3/2011
proc file_copy_rsync {sFromFile sToFileOrDir} {

  if {[file isdirectory $sToFileOrDir]} {
    # get base file name and set sToFile to be full dir path + dest file name
    set sFromFileBaseName [string range $sFromFile [expr [string last "/" $sFromFile] + 1]  end]
    set sToFile $sToFileOrDir/$sFromFileBaseName
    puts "sToFile=$sToFile"
  } else {
    set sToFile $sToFileOrDir

  set iFromSize [file size $sFromFile]
  #puts "from size:$iFromSize"
  file stat $sFromFile aFromStat
  #parray aFromStat
  catch {
    set iToSize [file size $sToFile]
    #puts "to size:$iToSize"
    file stat $sToFile aToStat
    #parray aToStat
  } sError
  #puts "sError:$sError"
  if {"$sError" != "" || $iFromSize != $iToSize || $aFromStat(mtime) != $aToStat(mtime) } {
     #puts "DO FILE COPY"
     file copy -force $sFromFile $sToFile
  } else {
     puts "Not doing FILE COPY, size $iFromSize == $iToSize, mtime $aFromStat(mtime) == $aToStat(mtime), err $sError"

The real rsync is here:

Thursday, 17 March 2011

local cycle + walk, Glendruid/Brennanstown Dolmen and Tully's high cross

Today, lá fheile Padraic, we went to scout mass, had Irish breakfast at home, cycled to near Brennanstown luas, jumped over a wall, visited dolmen and stream and valley. Met Mary and Rocky. Cycled on Laghanstown road to Tully's church. Cycled on cul de sac, over motorway, over 2 gates home via Kilternan. Whew! 17k cycle.

3 bananas, 2 apples, 2 oranges, water, apple, purple dilutable

Glendruid/Brennanstown Dolmen

We continued minor Freeciv craze. Maeve played a bit then gave up and played on cbeebies website. Kate started playing. As the Irish.,-6.2677&spn=0.232165,0.580902&z=11&om=0

We more or less used the directions from Brennanstown Vale on megalithomania site. The lane in Brennanstown lane now ends in a new 6ft wall which we climbed over. The start of that route should be changed to Carrickmines Luas stop. No wall climbing needed from there.

Start at Carrickmines Luas stop. Walk along the Luas line until Brennanstown Luas stop (not an operating Luas stop). There is plenty space to walk beside Luas line now (Mar 2011) planting is still very young. At Brennanstown Luas stop climb rail and climb over wall into valley directly OR easier to go longer way around out of Luas stop on other side, enter field and go around under the bridge into the valley. 

The walk in the valley beside stream in woods with big old trees is very nice. It is suspected that this might be NAMA lands now. A shopping center and housing/buisness developments might have been constructed here!! :-P 

Tully's high crosses and church:

NAMA properties ? - That NAMAland app - NAMA blog and NAMA info

The database: Google Doc of NAMA properties
From the database, the following entry contains "Land at Glendruid (Cabinteely)" and "Lands at Lehaunstown Lane (Cabinteely)"

Treasury Holdings  

Johnny Ronan(John Ronan), Mary Ronan (estranged wife), Richard Barrett, Dick Barrett, Treasury China Trust (CREO), REO Securities Limited, Real Estate Opportunities PLC, John Bruder, Ickendale, Decocter Limited, Havenview Investments Limited, Castlemarket Holdings Limited (Castle Market Holdings),Hutchison Port Holdings, CMH CMBS Borrower Limited, CMH, Fastrock Holdings, Willie McAteer, Spencer Dock Convention Centre Dublin Limited (SDCCD) Limited, Construction Management Partnership (CMP), John Sisk and Son Limited, Spencer Dock Convention Centre Limited (2) (CCD), John Ronan (son), James Ronan (son), Jodie Ronan (daughter), Swinwood Limited, Trio Group, Tamorbrick Limited, Saundby Limited, Ballymun Shopping Centre Limited, Drocarne  

Battersea Power Station, NAMA HQ, Spencer Dock, Bewleys Coffee House, Malting Tower, Westin Hotel, Central Park (Sandyford, Leopardstown ), Montevetro (Barrow Street, Dublin), 88 Kirtling Street (Battersea), Heather Cottage, Merchant Quay Shopping Centre, Stillorgan Shopping Centre, Alto Vetro, 40-42 Mespil Road, Lafayette Building (Westmoreland Street), Southbank House (Barrow Street), Baggot Building (Upper Baggot Street), M1 Business Park (Balbriggan), Port Bremore (Dublin), Blakes Restaurant (Stillorgan), Ballymun Shopping Centre, 43-49 Mespil Road, Roundwood Park Estate, Milverton (Skerries Bay), Lands at Enniskerry, Land at Glendruid (Cabinteely), 35 Barrow Street, 35 Henry Street, Crampton Buildings (Temple Bar), Russel Court (St Stephen's Green), Lands at Lehaunstown Lane (Cabinteely), Clonburris Town Centre, Lands at Kinsealy, North Wall Quay, Nazareth Lands (Sligo), Collinstown (Kildare), Lad Lane (Dublin), Leisureplex (Stillorgan), Charlemont House (Glennon House, Dublin), 3 College Green, Crescent Hall (Mount Street Crescent), 41 St Stephen's Green, Lands at East Mountain (Howth), 16 Westmoreland Street, Houses at Stillorgan Shopping Centre, 97 St Stephen's Green, 98 St Stephen's Green, 99 St Stephen's Green, Rear of 22 St Stephen's Green, 95 St Stephen's Green, 49 St Lawrences Park (Stillorgan), 72 St Lawrences Park (Stillorgan), Gordon Street (Ringsend), Durrow Mews (Dublin), Network House (Barrow Street), Stewarts Road (Battersea), Cheswick Grange and Hardwick Grange (Warrington), Spencer Dock, National Convention Centre, Ritz-Carlton/Ritz Carlton (Powerscourt,Wicklow), Town Bar and Grill (Dublin), 301-bed hotel and a 54-hole golf complex on the 377-acre Roundwood Park Estate(Sean T O'Ceallaigh Sean T O'Kelly estate, Wicklow),development in Tangdao Bay(Qingdao, China), 427-acre site at Milverton Demesne (Skerries, Dublin), Ballymun Shopping Centre (Dublin), 125-acre tract of Co Louth land            

Tuesday, 1 March 2011

Solved cygwin + windows7 STATUS_ACCESS_VIOLATION problem

[1 Mar 2011 12:39:14] Solved cygwin + windows7 STATUS_ACCESS_VIOLATION problem.

User that installed cygwin was "Someone Else" Administrator.
ls -R /cygdrive/c/cygwin # showed mixed ownership between "Someone Else" and "Me Myself" both Administrator.

  export PATH=/usr/bin:$PATH
  chown -R me.myself /cygdrive/c/cygwin
  chmod 777 $TMP
  # stop all cygwin processes (close windows and use Task Manager to kill hangers on)
  start ash and run rebaseall

Killing processes in ash:

  export PATH=/usr/bin:$PATH
  ps -e
  PIDS=$(ps -e |grep -E -v "ash|PID" |sed s/^.// |awk '{print $1}')
  kill $PIDS
  kill -9 $PIDS
  ps -e

This is why chmod 777 $TMP is needed:
  ash$ rebaseall
  rebaseall: '/cygdrive/c/Users/JAMES~1.COL/AppData/Local/Temp' is not writable

This also happened:
  ash$ rebaseall 
  ReBaseImage (/usr/bin/cygcrypt-0.dll) failed with last error = 6

  ash$ cd \cygwin\bin
  ash$ mv cygcrypt-0.dll cygcrypt-0.dll.hmm  #?
  ash$ cp cygcrypt-0.dll.hmm cygcrypt-0.dll  #?

  ash$ rebaseall
  /usr/bin/cygcrypto-0.9.8.dll: skipped because nonexistent
  /usr/bin/cygssl-0.9.8.dll: skipped because nonexistent

Cygwin now working.
Final step to make sure all is clean: Run cygwin setup.exe to update.

What happened to cause problem:
Cygwin was pre-installed by another user someone.else.
And I ran a cygwin update as my user me.myself.
No obvious cygwin errors but cygwin DLL must have been updated and rebaseing had errors.
 errors are gone

Finally found this on web which had part of this solution:

Actually, you might be able to get away with something like this from
the DOS prompt.

cd \cygwin\bin
ren cygcrypt-0.dll cygcrypt-0.dll.hmm
copy cygcrypt-0.dll.hmm cygcrypt-0.dll

If you can do the rename but not the copy then reinstalling (via
setup.exe's Reinstall option) cygcrypt-0.dll from the crypt package
might work.


Oops, I figured out why this was happening and it was rather silly on
my part. I installed cygwin under the Administrator account and was
trying to run rebaseall under a different account. I thought using the
"run as administrator" option when opening ash would give it enough
privileges but apparently it's not enough. Running ash under the
actual Administrator account made the error go away and solved my
status_access_violation problems. Thanks for the help everyone.

Also changed Microsoft Security Essentials exclude scans in C:\cygwin and C:\cygwin\bin
Re: frequently getting a STATUS_ACCESS_VIOLATION exception under win7

Symptoms of problem:
Under cygwin any cmd prone to failing and whether fail or not results in 0 or more messages like this:

bash-3.2$ tclsh
656645530 [main] bash 9244 exception::handle: Exception: STATUS_ACCESS_VIOLATION
656646262 [main] bash 9244 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
656781862 [main] bash 9256 exception::handle: Exception: STATUS_ACCESS_VIOLATION
656782603 [main] bash 9256 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 9348 child_copy: linked dll data write copy failed, 0x2DD000..0x2E14A4, done 0, windows pid 9348, Win32 error 487

e.g. output from startup of Hudson:

      1 [main] bash 7312 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    618 [main] bash 7312 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 6288 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    440 [main] bash 6288 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 7796 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    430 [main] bash 7796 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 9352 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    427 [main] bash 9352 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 5496 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    452 [main] bash 5496 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 9960 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    443 [main] bash 9960 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 9080 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    494 [main] bash 9080 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      2 [main] bash 3228 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    601 [main] bash 3228 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 9304 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    479 [main] bash 9304 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] sh 4124 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    602 [main] sh 4124 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      1 [main] sh 8324 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    427 [main] sh 8324 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      2 [main] sh 4848 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    953 [main] sh 4848 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      1 [main] sh 9296 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    429 [main] sh 9296 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      2 [main] sh 8316 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    575 [main] sh 8316 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      1 [main] sh 7712 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    621 [main] sh 7712 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      2 [main] sh 9656 fork: child -1 - died waiting for longjmp before initialization, retry 0, exit code 0x600, errno 11
1022408 [main] sh 9712 exception::handle: Exception: STATUS_ACCESS_VIOLATION
1023148 [main] sh 9712 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
Running from: C:\CR1\Hudson\hudson.war
[Winstone 2011/03/03 10:51:59] - Beginning extraction from war file
hudson home directory: c:\CR1\Hudson\HudsonHome\.hudson
[Winstone 2011/03/03 10:52:02] - HTTP Listener started: port=8080
[Winstone 2011/03/03 10:52:02] - Error during AJP13 listener init or shutdown Address already in use: JVM_Bind
        at Method)
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)

Using one-time self-signed certificate
[Winstone 2011/03/03 10:52:02] - Winstone Servlet Engine v0.9.10 running: controlPort=disabled
03-Mar-2011 10:52:02 hudson.model.Hudson$4 onAttained
INFO: Started initialization
03-Mar-2011 10:52:02 hudson.model.Hudson$4 onAttained
INFO: Listed all plugins
03-Mar-2011 10:52:03 hudson.model.Hudson$4 onAttained
INFO: Prepared all plugins
03-Mar-2011 10:52:06 hudson.model.Hudson$4 onAttained
INFO: Started all plugins

There are files like bash.exe.stackdump and sh.exe.stackdump dumped to current dir.

They look like this:
$ cat bash.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=61020137
eax=00B442A8 ebx=6123A614 ecx=7595783F edx=002E41B8 esi=00000000 edi=0022FA04
ebp=61020890 esp=0022C7D4 program=C:\cygwin\bin\bash.exe, pid 6796, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame     Function  Args
End of stack trace

$ cat sh.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=610C51B9

Windows Error 487 is ERROR_INVALID_ADDRESS, when DLL lib loading has symbol resolution error.