From vouillon at seas.upenn.edu Fri Oct 8 11:45:00 2010 From: vouillon at seas.upenn.edu (vouillon at seas.upenn.edu) Date: Fri, 8 Oct 2010 11:45:00 -0400 Subject: [Unison-hackers] [unison-svn] r464 - in branches/2.40/src: . system Message-ID: <201010081545.o98Fj0Dt002340@yaws.seas.upenn.edu> Author: vouillon Date: 2010-10-08 11:44:59 -0400 (Fri, 08 Oct 2010) New Revision: 464 Modified: branches/2.40/src/Makefile branches/2.40/src/RECENTNEWS branches/2.40/src/fpcache.ml branches/2.40/src/mkProjectInfo.ml branches/2.40/src/osx.ml branches/2.40/src/recon.ml branches/2.40/src/system/system_win_stubs.c Log: * Fixed fingerprint cache: do not cache file properties * Fixed O_APPEND mode for open under Windows (the previous attempt in revision 422 was incomplete) * Fixed String.sub invalid argument error when an AppleDouble file does not contain a finder information field Modified: branches/2.40/src/Makefile =================================================================== --- branches/2.40/src/Makefile 2010-09-06 16:37:04 UTC (rev 463) +++ branches/2.40/src/Makefile 2010-10-08 15:44:59 UTC (rev 464) @@ -61,10 +61,10 @@ -include Makefile.ProjectInfo Makefile.ProjectInfo: mkProjectInfo.ml $(wildcard ../.bzr/branch/last-revision) - ocaml str.cma unix.cma ./mkProjectInfo.ml > $@ + ./mkProjectInfo > $@ -#mkProjectInfo: mkProjectInfo.ml -# ocamlc -o $@ unix.cma str.cma $^ +mkProjectInfo: mkProjectInfo.ml + ocamlc -o $@ unix.cma str.cma $^ clean:: $(RM) mkProjectInfo Modified: branches/2.40/src/RECENTNEWS =================================================================== --- branches/2.40/src/RECENTNEWS 2010-09-06 16:37:04 UTC (rev 463) +++ branches/2.40/src/RECENTNEWS 2010-10-08 15:44:59 UTC (rev 464) @@ -1,5 +1,14 @@ CHANGES FROM VERSION 2.40.16 +* Fixed fingerprint cache: do not cache file properties +* Fixed O_APPEND mode for open under Windows (the previous attempt in + revision 422 was incomplete) +* Fixed String.sub invalid argument error when an AppleDouble file does + not contain a finder information field + +------------------------------- +CHANGES FROM VERSION 2.40.16 + * Small patch from Stephane Glondu to make Unison compile with Ocaml 3.12. ------------------------------- Modified: branches/2.40/src/fpcache.ml =================================================================== --- branches/2.40/src/fpcache.ml 2010-09-06 16:37:04 UTC (rev 463) +++ branches/2.40/src/fpcache.ml 2010-10-08 15:44:59 UTC (rev 464) @@ -238,15 +238,17 @@ let fingerprint fastCheck currfspath path info optDig = let res = try - let (oldDesc, oldDig, oldStamp, oldRess) as res = + let (cachedDesc, cachedDig, cachedStamp, cachedRess) = PathTbl.find tbl (Path.toString path) in if - not (clearlyUnchanged fastCheck path info oldDesc oldStamp oldRess) + not (clearlyUnchanged + fastCheck path info cachedDesc cachedStamp cachedRess) then raise Not_found; debug (fun () -> Util.msg "cache hit for path %s\n" (Path.toDebugString path)); - res + (info.Fileinfo.desc, cachedDig, Fileinfo.stamp info, + Fileinfo.ressStamp info) with Not_found -> if fastCheck then debug (fun () -> Util.msg "cache miss for path %s\n" Modified: branches/2.40/src/mkProjectInfo.ml =================================================================== --- branches/2.40/src/mkProjectInfo.ml 2010-09-06 16:37:04 UTC (rev 463) +++ branches/2.40/src/mkProjectInfo.ml 2010-10-08 15:44:59 UTC (rev 464) @@ -118,3 +118,4 @@ + Modified: branches/2.40/src/osx.ml =================================================================== --- branches/2.40/src/osx.ml 2010-09-06 16:37:04 UTC (rev 463) +++ branches/2.40/src/osx.ml 2010-10-08 15:44:59 UTC (rev 464) @@ -291,7 +291,7 @@ readDoubleFromOffset dataFspath dataPath doubleFspath inch ofs 32 with Not_found -> - "") + String.make 32 '\000') (fun () -> close_in_noerr inch) in close_in inch; Modified: branches/2.40/src/recon.ml =================================================================== --- branches/2.40/src/recon.ml 2010-09-06 16:37:04 UTC (rev 463) +++ branches/2.40/src/recon.ml 2010-10-08 15:44:59 UTC (rev 464) @@ -163,7 +163,7 @@ ("Including the preference \\texttt{-nodeletion \\ARG{root}} prevents \ Unison from performing any file deletion on root \\ARG{root}.\n\n\ This preference can be included twice, once for each root, if you \ - want to prevent any creation.") + want to prevent any deletion.") let noUpdate = Prefs.createStringList "noupdate" Modified: branches/2.40/src/system/system_win_stubs.c =================================================================== --- branches/2.40/src/system/system_win_stubs.c 2010-09-06 16:37:04 UTC (rev 463) +++ branches/2.40/src/system/system_win_stubs.c 2010-10-08 15:44:59 UTC (rev 464) @@ -45,7 +45,7 @@ }; static int open_create_flags[12] = { - 0, 0, 0, 0, 0, O_CREAT, O_TRUNC, O_EXCL, 0, 0, 0, 0 + 0, 0, 0, 0, O_APPEND, O_CREAT, O_TRUNC, O_EXCL, 0, 0, 0, 0 }; /****/ From vouillon at seas.upenn.edu Fri Oct 8 11:46:46 2010 From: vouillon at seas.upenn.edu (vouillon at seas.upenn.edu) Date: Fri, 8 Oct 2010 11:46:46 -0400 Subject: [Unison-hackers] [unison-svn] r465 - in trunk/src: . system Message-ID: <201010081546.o98Fkk2f002435@yaws.seas.upenn.edu> Author: vouillon Date: 2010-10-08 11:46:46 -0400 (Fri, 08 Oct 2010) New Revision: 465 Modified: trunk/src/Makefile trunk/src/RECENTNEWS trunk/src/fpcache.ml trunk/src/mkProjectInfo.ml trunk/src/osx.ml trunk/src/recon.ml trunk/src/system/system_win_stubs.c Log: * Fixed fingerprint cache: do not cache file properties * Fixed O_APPEND mode for open under Windows (the previous attempt in revision 422 was incomplete) * Fixed String.sub invalid argument error when an AppleDouble file does not contain a finder information field Modified: trunk/src/Makefile =================================================================== --- trunk/src/Makefile 2010-10-08 15:44:59 UTC (rev 464) +++ trunk/src/Makefile 2010-10-08 15:46:46 UTC (rev 465) @@ -60,11 +60,11 @@ # NAME, VERSION, and MAJORVERSION, automatically generated -include Makefile.ProjectInfo -Makefile.ProjectInfo: mkProjectInfo.ml $(wildcard ../.bzr/branch/last-revision) - ocaml str.cma unix.cma ./mkProjectInfo.ml > $@ +Makefile.ProjectInfo: mkProjectInfo $(wildcard ../.bzr/branch/last-revision) + ./mkProjectInfo > $@ -#mkProjectInfo: mkProjectInfo.ml -# ocamlc -o $@ unix.cma str.cma $^ +mkProjectInfo: mkProjectInfo.ml + ocamlc -o $@ unix.cma str.cma $^ clean:: $(RM) mkProjectInfo Modified: trunk/src/RECENTNEWS =================================================================== --- trunk/src/RECENTNEWS 2010-10-08 15:44:59 UTC (rev 464) +++ trunk/src/RECENTNEWS 2010-10-08 15:46:46 UTC (rev 465) @@ -1,3 +1,12 @@ +CHANGES FROM VERSION 2.43.7 + +* Fixed fingerprint cache: do not cache file properties +* Fixed O_APPEND mode for open under Windows (the previous attempt in + revision 422 was incomplete) +* Fixed String.sub invalid argument error when an AppleDouble file does + not contain a finder information field + +------------------------------- CHANGES FROM VERSION 2.43.6 * A small fix suggested by Jerome. Still thinking about what needs to Modified: trunk/src/fpcache.ml =================================================================== --- trunk/src/fpcache.ml 2010-10-08 15:44:59 UTC (rev 464) +++ trunk/src/fpcache.ml 2010-10-08 15:46:46 UTC (rev 465) @@ -238,15 +238,17 @@ let fingerprint ?(newfile=false) fastCheck currfspath path info optDig = let res = try - let (oldDesc, oldDig, oldStamp, oldRess) as res = - PathTbl.find tbl (Path.toString path) in + let (cachedDesc, cachedDig, cachedStamp, cachedRess) = + PathTbl.find tbl (Path.toString path) in if - not (clearlyUnchanged fastCheck path info oldDesc oldStamp oldRess) + not (clearlyUnchanged + fastCheck path info cachedDesc cachedStamp cachedRess) then raise Not_found; debug (fun () -> Util.msg "cache hit for path %s\n" (Path.toDebugString path)); - res + (info.Fileinfo.desc, cachedDig, Fileinfo.stamp info, + Fileinfo.ressStamp info) with Not_found -> if fastCheck then debug (fun () -> Util.msg "cache miss for path %s\n" Modified: trunk/src/mkProjectInfo.ml =================================================================== --- trunk/src/mkProjectInfo.ml 2010-10-08 15:44:59 UTC (rev 464) +++ trunk/src/mkProjectInfo.ml 2010-10-08 15:46:46 UTC (rev 465) @@ -52,3 +52,4 @@ Printf.printf "NAME=%s\n" projectName;; + Modified: trunk/src/osx.ml =================================================================== --- trunk/src/osx.ml 2010-10-08 15:44:59 UTC (rev 464) +++ trunk/src/osx.ml 2010-10-08 15:46:46 UTC (rev 465) @@ -291,7 +291,7 @@ readDoubleFromOffset dataFspath dataPath doubleFspath inch ofs 32 with Not_found -> - "") + String.make 32 '\000') (fun () -> close_in_noerr inch) in close_in inch; Modified: trunk/src/recon.ml =================================================================== --- trunk/src/recon.ml 2010-10-08 15:44:59 UTC (rev 464) +++ trunk/src/recon.ml 2010-10-08 15:46:46 UTC (rev 465) @@ -163,7 +163,7 @@ ("Including the preference \\texttt{-nodeletion \\ARG{root}} prevents \ Unison from performing any file deletion on root \\ARG{root}.\n\n\ This preference can be included twice, once for each root, if you \ - want to prevent any creation.") + want to prevent any deletion.") let noUpdate = Prefs.createStringList "noupdate" Modified: trunk/src/system/system_win_stubs.c =================================================================== --- trunk/src/system/system_win_stubs.c 2010-10-08 15:44:59 UTC (rev 464) +++ trunk/src/system/system_win_stubs.c 2010-10-08 15:46:46 UTC (rev 465) @@ -45,7 +45,7 @@ }; static int open_create_flags[12] = { - 0, 0, 0, 0, 0, O_CREAT, O_TRUNC, O_EXCL, 0, 0, 0, 0 + 0, 0, 0, 0, O_APPEND, O_CREAT, O_TRUNC, O_EXCL, 0, 0, 0, 0 }; /****/ From vouillon at seas.upenn.edu Mon Oct 11 09:29:10 2010 From: vouillon at seas.upenn.edu (vouillon at seas.upenn.edu) Date: Mon, 11 Oct 2010 09:29:10 -0400 Subject: [Unison-hackers] [unison-svn] r466 - branches/2.40/src Message-ID: <201010111329.o9BDTB5d023640@yaws.seas.upenn.edu> Author: vouillon Date: 2010-10-11 09:29:09 -0400 (Mon, 11 Oct 2010) New Revision: 466 Modified: branches/2.40/src/RECENTNEWS branches/2.40/src/mkProjectInfo.ml branches/2.40/src/terminal.ml Log: * Fixed incompatibility with OpenSSH 5.6. Modified: branches/2.40/src/RECENTNEWS =================================================================== --- branches/2.40/src/RECENTNEWS 2010-10-08 15:46:46 UTC (rev 465) +++ branches/2.40/src/RECENTNEWS 2010-10-11 13:29:09 UTC (rev 466) @@ -1,5 +1,10 @@ CHANGES FROM VERSION 2.40.16 +* Fixed incompatibility with OpenSSH 5.6. + +------------------------------- +CHANGES FROM VERSION 2.40.16 + * Fixed fingerprint cache: do not cache file properties * Fixed O_APPEND mode for open under Windows (the previous attempt in revision 422 was incomplete) Modified: branches/2.40/src/mkProjectInfo.ml =================================================================== --- branches/2.40/src/mkProjectInfo.ml 2010-10-08 15:46:46 UTC (rev 465) +++ branches/2.40/src/mkProjectInfo.ml 2010-10-11 13:29:09 UTC (rev 466) @@ -119,3 +119,4 @@ + Modified: branches/2.40/src/terminal.ml =================================================================== --- branches/2.40/src/terminal.ml 2010-10-08 15:46:46 UTC (rev 465) +++ branches/2.40/src/terminal.ml 2010-10-11 13:29:09 UTC (rev 466) @@ -208,7 +208,12 @@ exit 127 end | childPid -> - Unix.close slaveFd; +(*JV: FIX: we are leaking a file descriptor here. On the other hand, + we do not deal gracefully with lost connections anyway. *) + (* Keep a file descriptor so that we do not get EIO errors + when the OpenSSH 5.6 child process closes the file + descriptor before opening /dev/tty. *) + (* Unix.close slaveFd; *) (Some (Lwt_unix.of_unix_file_descr masterFd), childPid) end From vouillon at seas.upenn.edu Mon Oct 11 09:29:27 2010 From: vouillon at seas.upenn.edu (vouillon at seas.upenn.edu) Date: Mon, 11 Oct 2010 09:29:27 -0400 Subject: [Unison-hackers] [unison-svn] r467 - trunk/src Message-ID: <201010111329.o9BDTRXk023677@yaws.seas.upenn.edu> Author: vouillon Date: 2010-10-11 09:29:27 -0400 (Mon, 11 Oct 2010) New Revision: 467 Modified: trunk/src/RECENTNEWS trunk/src/mkProjectInfo.ml trunk/src/terminal.ml Log: * Fixed incompatibility with OpenSSH 5.6. Modified: trunk/src/RECENTNEWS =================================================================== --- trunk/src/RECENTNEWS 2010-10-11 13:29:09 UTC (rev 466) +++ trunk/src/RECENTNEWS 2010-10-11 13:29:27 UTC (rev 467) @@ -1,3 +1,8 @@ +CHANGES FROM VERSION 2.43.10 + +* Fixed incompatibility with OpenSSH 5.6. + +------------------------------- CHANGES FROM VERSION 2.43.7 * Fixed fingerprint cache: do not cache file properties Modified: trunk/src/mkProjectInfo.ml =================================================================== --- trunk/src/mkProjectInfo.ml 2010-10-11 13:29:09 UTC (rev 466) +++ trunk/src/mkProjectInfo.ml 2010-10-11 13:29:27 UTC (rev 467) @@ -53,3 +53,4 @@ + Modified: trunk/src/terminal.ml =================================================================== --- trunk/src/terminal.ml 2010-10-11 13:29:09 UTC (rev 466) +++ trunk/src/terminal.ml 2010-10-11 13:29:27 UTC (rev 467) @@ -208,7 +208,12 @@ exit 127 end | childPid -> - Unix.close slaveFd; +(*JV: FIX: we are leaking a file descriptor here. On the other hand, + we do not deal gracefully with lost connections anyway. *) + (* Keep a file descriptor so that we do not get EIO errors + when the OpenSSH 5.6 child process closes the file + descriptor before opening /dev/tty. *) + (* Unix.close slaveFd; *) (Some (Lwt_unix.of_unix_file_descr masterFd), childPid) end From bcpierce at seas.upenn.edu Thu Oct 14 14:18:47 2010 From: bcpierce at seas.upenn.edu (bcpierce at seas.upenn.edu) Date: Thu, 14 Oct 2010 14:18:47 -0400 Subject: [Unison-hackers] [unison-svn] r468 - branches/2.40/src Message-ID: <201010141818.o9EIIlrj023881@yaws.seas.upenn.edu> Author: bcpierce Date: 2010-10-14 14:18:46 -0400 (Thu, 14 Oct 2010) New Revision: 468 Modified: branches/2.40/src/mkProjectInfo.ml Log: Touch for export Modified: branches/2.40/src/mkProjectInfo.ml =================================================================== --- branches/2.40/src/mkProjectInfo.ml 2010-10-11 13:29:27 UTC (rev 467) +++ branches/2.40/src/mkProjectInfo.ml 2010-10-14 18:18:46 UTC (rev 468) @@ -6,7 +6,7 @@ let projectName = "unison" let majorVersion = 2 let minorVersion = 40 -let pointVersionOrigin = 409 (* Revision that corresponds to point version 0 *) +let pointVersionOrigin = 409 (* Revision that corresponds to point version 0 *) (* Documentation: This is a program to construct a version of the form Major.Minor.Point, @@ -96,27 +96,3 @@ Printf.printf "MAJORVERSION=%d.%d\n" majorVersion minorVersion;; Printf.printf "VERSION=%d.%d.%d\n" majorVersion minorVersion pointVersion;; Printf.printf "NAME=%s\n" projectName;; - - - - - - - - - - - - - - - - - - - - - - - - From bcpierce at seas.upenn.edu Thu Oct 14 14:22:35 2010 From: bcpierce at seas.upenn.edu (bcpierce at seas.upenn.edu) Date: Thu, 14 Oct 2010 14:22:35 -0400 Subject: [Unison-hackers] [unison-svn] r469 - branches/2.40/src Message-ID: <201010141822.o9EIMZe1023982@yaws.seas.upenn.edu> Author: bcpierce Date: 2010-10-14 14:22:35 -0400 (Thu, 14 Oct 2010) New Revision: 469 Modified: branches/2.40/src/mkProjectInfo.ml Log: Touch for export Modified: branches/2.40/src/mkProjectInfo.ml =================================================================== --- branches/2.40/src/mkProjectInfo.ml 2010-10-14 18:18:46 UTC (rev 468) +++ branches/2.40/src/mkProjectInfo.ml 2010-10-14 18:22:35 UTC (rev 469) @@ -42,7 +42,7 @@ (* ---------------------------------------------------------------------- *) (* You shouldn't need to edit below. *) -let revisionString = "$Rev: 425$";; +let revisionString = "$Rev: 468 $";; (* BCP (1/10): This bit was added to help with getting Unison via bazaar, but it was never used much and I'm not confident it's working. I'll comment it out Property changes on: branches/2.40/src/mkProjectInfo.ml ___________________________________________________________________ Modified: svn:keywords - Rev + Id From bcpierce at seas.upenn.edu Thu Oct 14 14:23:04 2010 From: bcpierce at seas.upenn.edu (bcpierce at seas.upenn.edu) Date: Thu, 14 Oct 2010 14:23:04 -0400 Subject: [Unison-hackers] [unison-svn] r470 - branches/2.40/src Message-ID: <201010141823.o9EIN5qr024008@yaws.seas.upenn.edu> Author: bcpierce Date: 2010-10-14 14:23:04 -0400 (Thu, 14 Oct 2010) New Revision: 470 Modified: branches/2.40/src/mkProjectInfo.ml Log: Touch for export Modified: branches/2.40/src/mkProjectInfo.ml =================================================================== --- branches/2.40/src/mkProjectInfo.ml 2010-10-14 18:22:35 UTC (rev 469) +++ branches/2.40/src/mkProjectInfo.ml 2010-10-14 18:23:04 UTC (rev 470) @@ -42,7 +42,7 @@ (* ---------------------------------------------------------------------- *) (* You shouldn't need to edit below. *) -let revisionString = "$Rev: 468 $";; +let revisionString = "$Rev$";; (* BCP (1/10): This bit was added to help with getting Unison via bazaar, but it was never used much and I'm not confident it's working. I'll comment it out Property changes on: branches/2.40/src/mkProjectInfo.ml ___________________________________________________________________ Modified: svn:keywords - Id + Rev From rrnewton at gmail.com Fri Oct 15 16:02:05 2010 From: rrnewton at gmail.com (Ryan Newton) Date: Fri, 15 Oct 2010 16:02:05 -0400 Subject: [Unison-hackers] Unison -repeat over ssh stalls ONLY on mac os -- anyone else seen this? Message-ID: This is a problem I've beet having day in and day out for a while. I love to use unison to "tether" two code working copies across different machines when compiling or benchmarking in different places. Normally I can set up whole chains -- sometimes involving three unison processes over four computers (you'd be amazed what proxies and VPN's can make you do). This is all great, except the endpoint is always my mac laptop. And my unison -repeat processes on my mac laptop chug along happily for a while but eventually get stuck (this never happens on the linux<->linux links). I've had to train myself to visit those windows, and type Ctrl-C to restart. I'm running 10.6.4 with its included openssh 5.2p1 install (openssl 0.9.81). Is this something funky about how apple configures ssh? I've never had a problem with my normal ssh terminal sessions... just the unisons. I can't imagine that it would be timeout, because unison is sending packets back and forth every two seconds to verify that nothing has changed, isn't it? -Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From bcpierce at seas.upenn.edu Wed Oct 27 14:23:28 2010 From: bcpierce at seas.upenn.edu (bcpierce at seas.upenn.edu) Date: Wed, 27 Oct 2010 14:23:28 -0400 Subject: [Unison-hackers] [unison-svn] r471 - trunk/src Message-ID: <201010271823.o9RINTEC019481@yaws.seas.upenn.edu> Author: bcpierce Date: 2010-10-27 14:23:28 -0400 (Wed, 27 Oct 2010) New Revision: 471 Modified: trunk/src/RECENTNEWS trunk/src/fsmonitor.py trunk/src/mkProjectInfo.ml Log: * Incorporated new version of fsmonitor.py from Christophe Gohle Modified: trunk/src/RECENTNEWS =================================================================== --- trunk/src/RECENTNEWS 2010-10-14 18:23:04 UTC (rev 470) +++ trunk/src/RECENTNEWS 2010-10-27 18:23:28 UTC (rev 471) @@ -1,3 +1,8 @@ +CHANGES FROM VERSION 2.43.12 + +* Incorporated new version of fsmonitor.py from Christophe Gohle + +------------------------------- CHANGES FROM VERSION 2.43.10 * Fixed incompatibility with OpenSSH 5.6. Modified: trunk/src/fsmonitor.py =================================================================== --- trunk/src/fsmonitor.py 2010-10-14 18:23:04 UTC (rev 470) +++ trunk/src/fsmonitor.py 2010-10-27 18:23:28 UTC (rev 471) @@ -74,70 +74,99 @@ mymesg('failed to open log file %s for writing',op.outfile) def mangle_filename(path): - """because the FSEvents system returns 'real' paths we have to figure out + """because the FSEvents system returns 'real' paths we have to figure out if they have been aliased by a symlink and a 'follow' directive in the unison configuration or from the command line. This is done here for path. The return value is the path name using symlinks """ - try: - op.symlinks - except AttributeError: - #lets create a dictionary of symlinks that are treated transparently here - op.symlinks = {} - fl = op.follow - try: - foll = [f.split(' ',1) for f in fl] - except TypeError: - foll = [] - for k,v in foll: - if not k=='Path': - mymesg('We don\'t support anything but path specifications in follow directives. Especially not %s',k) - else: - p = v.strip('{}') - op.symlinks[os.path.realpath(os.path.join(op.root,p))]=p + try: + op.symlinks + except AttributeError: + make_symlinks() + #now lets do it + result = path + for key in op.symlinks: + #print path, key + if path.startswith(key): + result = os.path.join(op.root,os.path.join(op.symlinks[key]+path[len(key):])) + #print 'Match!', result - #now lets do it - result = path - for key in op.symlinks: - #print path, key - if path.startswith(key): - result = os.path.join(op.root,op.symlinks[key]+path[len(key):]) - #print 'Match!', result - - return result + return result + +def make_symlinks(): + #lets create a dictionary of symlinks that are treated transparently here + op.symlinks = {} + fl = op.follow + try: + foll = [f.split(' ',1) for f in fl] + except TypeError: + foll = [] + for k,v in foll: + if not k=='Path': + mymesg('We don\'t support anything but path specifications in follow directives. Especially not %s',k) + else: + p = v.strip('{}') + if not p[-1]=='/': + p+='/' + op.symlinks[os.path.realpath(os.path.join(op.root,p))]=p + mydebug('make_symlinks: symlinks to follow %s',op.symlinks) def relpath(root,path): - """returns the path relative to root (which should be absolute) - if it is not a path below root or if root is not absolute it returns None - """ + """returns the path relative to root (which should be absolute) + if it is not a path below root or if root is not absolute it returns None + """ - if not os.path.isabs(root): - return None + if not os.path.isabs(root): + return None - abspath = os.path.abspath(path) - mydebug('relpath: abspath(%s) = %s', path, abspath) + abspath = os.path.abspath(path) + mydebug('relpath: abspath(%s) = %s', path, abspath) - #make sure the root and abspath both end with a '/' - if not root[-1]=='/': - root += '/' - if not abspath[-1]=='/': - abspath += '/' + #make sure the root and abspath both end with a '/' + if not root[-1]=='/': + root += '/' + if not abspath[-1]=='/': + abspath += '/' - mydebug('relpath: root = %s', root) + mydebug('relpath: root = %s', root) - #print root, abspath - if not abspath[:len(root)]==root: - #print abspath[:len(root)], root - return None + #print root, abspath + if not abspath[:len(root)]==root: + #print abspath[:len(root)], root + return None + mydebug('relpath: relpath = %s',abspath[len(root):]) + return abspath[len(root):] - return abspath[len(root):] - def my_abspath(path): """expand path including shell variables and homedir to the absolute path """ return os.path.abspath(os.path.expanduser(os.path.expandvars(path))) + +def update_follow(path): + """ tries to find a follow directive that matches path + and if path refers to a symbolic link the real path of the symbolic + link is returned. """ + try: + op.symlinks + except AttributeError: + make_symlinks() + rpath = relpath(op.root, path) + mydebug('update_follow: rpath %s', rpath) + result = None + foll = None + for k in op.symlinks: + v = op.symlinks[k] + if v==rpath: + result = os.path.realpath(os.path.abspath(path)) + foll = v + mydebug('update_follow: link %s, real %s',v,result) + break + if result: + op.symlinks[result] = foll + + return result, foll def conf_parser(conffilepath, delimiter = '=', dic = {}): """parse the unison configuration file at conffilename and populate a dictionary @@ -146,7 +175,7 @@ try: conffile = open(conffilepath,'r') except IOError: - mymesg('could not open configuration file at %s',conffilepath) + mydebug('could not open configuration file at %s',conffilepath) return None res = dic @@ -174,6 +203,8 @@ import pyinotify class HandleEvents(pyinotify.ProcessEvent): + wm = None + #def process_IN_CREATE(self, event): # print "Creating:", event.pathname @@ -193,20 +224,68 @@ # print "attributes:", event.pathname def process_default(self, event): - print "Default:", event + mydebug('process_default: event %s', event) +# code for adding dirs is obsolete since there is the auto_add option +# if event.dir: +# if event.mask&pyinotify.IN_CREATE: +# print 'create:', event.pathname , self.add_watch(event.pathname,rec=True) +# elif event.mask&pyinotify.IN_DELETE: +# print 'remove', event.pathname, self.remove_watch(event.pathname) +# pass +# elif event.mask&pyinotify.IN_MOVED_FROM: +# print 'move from', event.pathname, self.remove_watch(event.pathname, rec=True) +# pass +# elif event.mask&pyinotify.IN_MOVED_TO: +# print 'move to', event.pathname, self.add_watch(event.pathname,rec=True) +# else: +# pass + #handle creation of links that should be followed + if os.path.islink(event.pathname): + #special handling for links + mydebug('process_default: link %s created/changed. Checking for follows', event.pathname) + p, l = update_follow(event.pathname) + if p: + self.add_watch(p,rec=True,auto_add=True) + mydebug('process_default: follow link %s to %s',l,p) + #TODO: should handle deletion of links that are followed (delete the respective watches) update_changes([event.pathname]) + + def remove_watch(self, pathname, **kwargs): + if self.watches.has_key(pathname): + return self.wm.rm_watch(self.watches.pop(pathname),**kwargs) + return None + + def add_watch(self, pathname, **kwargs): + neww = self.wm.add_watch(pathname, self.mask, **kwargs) + self.watches.update(neww) + return neww + + def init_watches(self, abspaths, follows): + self.watches = {} + for abspath in abspaths: + self.watches.update(self.wm.add_watch(abspath,self.mask,rec=True,auto_add=True)) + #we have to add watches for follow statements since pyinotify does + #not do recursion across symlinks + make_symlinks() + for link in op.symlinks: + mydebug('following symbolic link %s',link) + if not self.watches.has_key(link): + self.watches.update(self.wm.add_watch(link,self.mask,rec=True,auto_add=True)) + + mydebug('init_watches: added paths %s\n based on paths %s\n and follows %s',self.watches,op.abspaths, op.follow) def linuxwatcher(): p = HandleEvents() wm = pyinotify.WatchManager() # Watch Manager - mask = pyinotify.IN_CREATE | pyinotify.IN_DELETE | pyinotify.IN_MODIFY | pyinotify.IN_ATTRIB | pyinotify.IN_MOVED_TO | pyinotify.IN_MOVED_FROM # watched events + p.wm = wm + p.mask = pyinotify.IN_CREATE | pyinotify.IN_DELETE | pyinotify.IN_MODIFY | pyinotify.IN_ATTRIB | pyinotify.IN_MOVED_TO | pyinotify.IN_MOVED_FROM # watched events notifier = pyinotify.Notifier(wm, p) - watches = [wm.add_watch(abspath,mask,rec=True) for abspath in op.abspaths] - print op.abspaths, watches + p.init_watches(op.abspaths, op.follow) notifier.loop() - + + ################################################# # END Linux specific code ################################################# @@ -302,6 +381,7 @@ result.extend(filelevel_approx(path)) mydebug('Dirs sent: %s',eventPaths) + #TODO: handle creation/deletion of links that should be followed update_changes(result) try: @@ -312,11 +392,27 @@ mymesg('failed to open status file %s', op.absstatus) def my_FSEventStreamCreate(paths): - if op.verbose: - print 'selected paths are: %s'%paths + mydebug('my_FSEventStreamCreate: selected paths are: %s',paths) if op.sinceWhen == 'now': op.sinceWhen = kFSEventStreamEventIdSinceNow + + try: + op.symlinks + except AttributeError: + make_symlinks() + + for sl in op.symlinks: + #check if that path is already there + found=False + ln = op.symlinks[sl] + for path in paths: + if relpath(op.root,path)==ln: + found = True + break + if not found: + mydebug('my_FSEventStreamCreate: watch followed link %s',ln) + paths.append(os.path.join(op.root,ln)) streamRef = FSEventStreamCreate(kCFAllocatorDefault, fsevents_callback, @@ -326,7 +422,7 @@ float(op.latency), int(op.flags)) if streamRef is None: - print("ERROR: FSEVentStreamCreate() => NULL") + mymesg("ERROR: FSEVentStreamCreate() => NULL") return None if op.verbose: @@ -339,10 +435,10 @@ def macosxwatcher(): #since when? if it is 'now' try to read state if op.sinceWhen == 'now': - dict = conf_parser(op.absstatus) - if dict and dict.has_key('last_item'): - #print dict['last_item'][-1] - op.sinceWhen = dict['last_item'][-1] + di = conf_parser(op.absstatus) + if di and di.has_key('last_item'): + #print di['last_item'][-1] + op.sinceWhen = di['last_item'][-1] #print op.sinceWhen streamRef = my_FSEventStreamCreate(op.abspaths) Modified: trunk/src/mkProjectInfo.ml =================================================================== --- trunk/src/mkProjectInfo.ml 2010-10-14 18:23:04 UTC (rev 470) +++ trunk/src/mkProjectInfo.ml 2010-10-27 18:23:28 UTC (rev 471) @@ -54,3 +54,4 @@ + From daniel+unisonhackers at pelleg.org Sat Oct 30 09:23:00 2010 From: daniel+unisonhackers at pelleg.org (Dan Pelleg) Date: Sat, 30 Oct 2010 15:23:00 +0200 Subject: [Unison-hackers] unison-devel not suitable for parallel build Message-ID: <20101030132300.GA21584@atoz.libagent.org> Forwarding a report from Matthias Andree: > unison-devel fails to build if MAKE_JOBS_NUMBER is >= 1, for instance, > on multicore computers. I have set it to MAKE_JOBS_UNSAFE for the > nonce, however, I'd propose that this be fixed. This is usually a sign > that there is a lack of dependency information in the build machinery. This is for unison 2.32.52. Any ideas or comments? The full bug report is at: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/151785 -- Dan Pelleg From bcpierce at cis.upenn.edu Sun Oct 31 11:23:06 2010 From: bcpierce at cis.upenn.edu (Benjamin C. Pierce) Date: Sun, 31 Oct 2010 11:23:06 -0400 Subject: [Unison-hackers] unison-devel not suitable for parallel build In-Reply-To: <20101030132300.GA21584@atoz.libagent.org> References: <20101030132300.GA21584@atoz.libagent.org> Message-ID: <098B08C8-B0BF-463B-B929-BA4F385C0AA4@cis.upenn.edu> I'd be happy to incorporate a patch if someone wants to investigate, but it builds so fast on a single processor that I don't view this as a high-priority fix... -B On Oct 30, 2010, at 9:23 AM, Dan Pelleg wrote: > Forwarding a report from Matthias Andree: > >> unison-devel fails to build if MAKE_JOBS_NUMBER is >= 1, for instance, >> on multicore computers. I have set it to MAKE_JOBS_UNSAFE for the >> nonce, however, I'd propose that this be fixed. This is usually a sign >> that there is a lack of dependency information in the build machinery. > > This is for unison 2.32.52. Any ideas or comments? > > The full bug report is at: > > http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/151785 > > -- > Dan Pelleg > _______________________________________________ > Unison-hackers mailing list > Unison-hackers at lists.seas.upenn.edu > http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers