From owner-ntemacs-users@june  Wed Jul 31 04:20:44 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Wed" "31" "July" "1996" "11:10:52" "+0100" "Andrew Innes" "andrewi@harlequin.co.uk" nil "58" "Re: NTFS File Streams and EMACS..." "^From:" nil nil "7" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id EAA04206 for <voelker@june.cs.washington.edu>; Wed, 31 Jul 1996 04:20:43 -0700
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id EAA30999 for <voelker@joker.cs.washington.edu>; Wed, 31 Jul 1996 04:20:43 -0700
Received: from holly.cam.harlequin.co.uk (holly.cam.harlequin.co.uk [193.128.4.58]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id DAA29040; Wed, 31 Jul 1996 03:11:51 -0700
Received: from propos.long.harlequin.co.uk by holly.cam.harlequin.co.uk; Wed, 31 Jul 1996 11:10:56 +0100
Received: from woozle.long.harlequin.co.uk (woozle [193.128.93.77]) by propos.long.harlequin.co.uk (8.6.12/8.6.12) with SMTP id LAA27110; Wed, 31 Jul 1996 11:10:52 +0100
Message-Id: <199607311010.LAA27110@propos.long.harlequin.co.uk>
In-Reply-To:  	<c=US%a=_%p=msft%l=RED-85-MSG-960731054554Z-12054@inet-01-imc.itg.microsoft.com> 	(message from Michael Hotchin on Tue, 30 Jul 1996 22:45:54 -0700)
From: Andrew Innes <andrewi@harlequin.co.uk>
To: mhotchin@microsoft.com
Cc: voelker@cs.washington.edu, ntemacs-users@cs.washington.edu
Subject: Re: NTFS File Streams and EMACS...
Date: Wed, 31 Jul 1996 11:10:52 +0100

On Tue, 30 Jul 1996 22:45:54 -0700, Michael Hotchin <mhotchin@microsoft.com> said:
>Apparently, NTFS partitions support the notions of having multiple
>streams in a file, like so:

[ foo contains "Boo!" in primary stream, and "Hi There" in stream "bar" ]

>The file naming convention confuses EMACS, though.  It seems that a file
>name with a colon in it like this:
>
>e:\projects\OO7\tmp\foo:bar
>
>is interpreted as the file 'bar' on O:.  All the rest is thrown away.
>
>This is using EMACS 19.30.1 (i386-*-nt-3.50), running on NT 4.0 build
>1381.

I wasn't aware there was a simple syntax for accessing file streams
other than the primary one, but looking in the SDK docs it looks like
this is true.

The parsing of file names containing `:' was changed for 19.31 so that
`:' is only considered to be part of a drive specifier if it is preceded
by a single letter (either at the beginning of the string, or after a
directory separator in some cases).  So, from 19.31 onwards the file
name itself will not be truncated by Emacs.

It turns out that this is almost sufficient to allow Emacs to access
other streams in an NTFS file.  In fact, Emacs is able to *write* data
to alternate streams (which can then be seen using the "more < foo:bar"
trick in the shell), but Emacs seems unable to read alternate streams.

For example, if I open the file d:/tmp/foo:bar, I end up with a new file
which I can then save okay (and see the contents from the shell), but
when I reopen the file, Emacs again thinks it is a new file.

The reason is simply that Emacs first checks to see if the file exists
before attempting to open it and read its contents (as does
GetOpenFileName, apparently, since Notepad and other Win32 editors won't
load the alternate stream either).

More specifically, insert-file-contents calls stat() first to find out
things like the file modification timestamp and to check that it is an
ordinary file (this is more relevant for Unix, where the file might be a
named pipe say, but the code is called on NT as well).

I could modify the NT implementation of stat (Emacs has its own version
to fix bugs in the MSVC version, and fake inode numbers) to understand
the alternate stream syntax, but I'm not sure that pretending
`file:stream' is a normal file in its own right is the right thing to do
(it will still not appear in a directory listing, for instance).

If you want to be able to edit alternate streams, you could write a bit
of elisp that called (shell-command "more < file:stream" buffer), or
some variation, to read the contents of the stream, and then set up the
buffer file name etc as if the file had been loaded by find-file.
Saving the buffer would not require any special action.

AndrewI

From owner-ntemacs-users@june  Tue Jul 30 23:21:29 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Tue" "30" "July" "1996" "22:45:54" "-0700" "Michael Hotchin" "mhotchin@microsoft.com" nil "38" "NTFS File Streams and EMACS..." "^From:" nil nil "7" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id XAA08465 for <voelker@june.cs.washington.edu>; Tue, 30 Jul 1996 23:21:29 -0700
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id XAA37389 for <voelker@joker.cs.washington.edu>; Tue, 30 Jul 1996 23:21:27 -0700
Received: from inet-01-imc.itg.microsoft.com (mail1.microsoft.com [131.107.3.41]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id WAA05165; Tue, 30 Jul 1996 22:46:19 -0700
Received: by inet-01-imc.itg.microsoft.com with SMTP (Microsoft Exchange Server Internet Mail Connector Version 4.0.993.5) 	id <01BB7E68.DFD0EB10@inet-01-imc.itg.microsoft.com>; Tue, 30 Jul 1996 22:45:57 -0700
Message-ID: <c=US%a=_%p=msft%l=RED-85-MSG-960731054554Z-12054@inet-01-imc.itg.microsoft.com>
X-Mailer:  Microsoft Exchange Server Internet Mail Connector Version 4.0.993.5
Encoding: 38 TEXT
From: Michael Hotchin <mhotchin@microsoft.com>
To: "'voelker@cs.washington.edu'" <voelker@cs.washington.edu>
Cc: "'ntemacs-users@cs.washington.edu'" <ntemacs-users@cs.washington.edu>
Subject: NTFS File Streams and EMACS...
Date: Tue, 30 Jul 1996 22:45:54 -0700

Apparently, NTFS partitions support the notions of having multiple
streams in a file, like so:

E:\projects\OO7\tmp>echo Boo! > foo

E:\projects\OO7\tmp>echo Hi There >> foo:bar

E:\projects\OO7\tmp>ls
    E:\projects\OO7\tmp\*.*
foo
    7 (7) bytes in 1 files

E:\projects\OO7\tmp>more < foo
Boo!

E:\projects\OO7\tmp>more < foo:bar
Hi There

E:\projects\OO7\tmp>ls
    E:\projects\OO7\tmp\*.*
foo
    7 (7) bytes in 1 files

E:\projects\OO7\tmp>

The file naming convention confuses EMACS, though.  It seems that a file
name with a colon in it like this:

e:\projects\OO7\tmp\foo:bar

is interpreted as the file 'bar' on O:.  All the rest is thrown away.

This is using EMACS 19.30.1 (i386-*-nt-3.50), running on NT 4.0 build
1381.

	Mike H.
>
>

