]> gitweb.factorcode.org Git - factor.git/commitdiff
io.monitors.windows: ADS pathnames crashing the monitors threads is the
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 3 Nov 2015 05:19:12 +0000 (21:19 -0800)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 3 Nov 2015 05:19:12 +0000 (21:19 -0800)
real culprit. Back out change and print out the crash and error message instead of ignoring
errors!

basis/io/monitors/windows/windows.factor
basis/vocabs/refresh/monitor/monitor.factor

index 9419570902bd709515439619a58001b95cd0e712..434437dddc82d4d28cad630abeec665075c859d0 100644 (file)
@@ -1,13 +1,11 @@
 ! Copyright (C) 2008 Doug Coleman, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types alien.data alien.strings libc destructors
-locals kernel math assocs namespaces make continuations sequences
-hashtables sorting arrays combinators math.bitwise strings
-system accessors threads splitting io.backend
-io.files.windows io.monitors io.ports
-io.buffers io.files io.timeouts io.encodings.string literals
-io.encodings.utf16n io windows.errors windows.kernel32 windows.types
-io.pathnames classes.struct ;
+USING: accessors alien alien.data arrays classes.struct
+combinators continuations destructors io.backend
+io.encodings.string io.encodings.utf16n io.files.windows
+io.monitors io.pathnames io.ports kernel literals locals make
+math sequences system threads windows.errors windows.kernel32
+windows.types ;
 IN: io.monitors.windows
 
 : open-directory ( path -- handle )
@@ -54,14 +52,9 @@ TUPLE: win32-monitor < monitor port ;
 : memory>u16-string ( alien len -- string )
     memory>byte-array utf16n decode ;
 
-! Files on an NTFS downloaded from the internet may contain an
-! ADS (alternate data stream) such as foo.txt:Zone.Identifier
-! which the win32 API reports as the filename. We wish to strip this off
-! and instead work on the actual file contents instead of ADS data.
 : parse-notify-record ( buffer -- path changed )
     [
-        [ FileName>> ] [ FileNameLength>> ] bi
-        memory>u16-string ":Zone.Identifier" ?tail drop
+        [ FileName>> ] [ FileNameLength>> ] bi memory>u16-string
     ] [ Action>> parse-action ] bi ;
 
 : (file-notify-records) ( buffer -- buffer )
index 13e1e7beb3feda370af769f0c726f7561400e15a..8eee46f19c6acf85a9f7cf684cc0c9cead740852 100644 (file)
@@ -1,10 +1,9 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs command-line concurrency.messaging
-continuations init io.backend io.files io.monitors io.pathnames
-kernel libc namespaces sequences sets splitting threads fry
-tr vocabs vocabs.loader vocabs.refresh vocabs.cache
-io.files.links ;
+USING: accessors command-line continuations fry init io
+io.backend io.files io.monitors io.pathnames kernel namespaces
+prettyprint sequences splitting threads tr vocabs vocabs.cache
+vocabs.loader vocabs.refresh ;
 IN: vocabs.refresh.monitor
 
 TR: convert-separators "/\\" ".." ;
@@ -43,8 +42,12 @@ TR: convert-separators "/\\" ".." ;
     [ [ t <monitor> monitor-loop ] with-monitors ] [ drop ] if ;
 
 : start-vocab-monitor ( vocab-root -- )
-    [ '[ [ _ (start-vocab-monitor) ] ignore-errors ] ]
-    [ "Root monitor: " prepend ]
+    [
+        dup '[
+            [ _ (start-vocab-monitor) ]
+            [ [ _ "fatal error for monitor root ``" "``: " surround write . flush ] with-global ] recover
+        ]
+    ] [ "Root monitor: " prepend ]
     bi spawn drop ;
 
 : init-vocab-monitor ( -- )