Loading ...
Sorry, an error occurred while loading the content.

49246Re: VIM and NTFS streams

Expand Messages
  • krischik
    Feb 4, 2008
      On 2 Feb., 19:47, Alexei Alexandrov <alexei.alexand...@...>
      wrote:
      > krischik wrote:
      > > On 31 Jan., 19:57, Alexei Alexandrov <alexei.alexand...@...>
      > > wrote:
      >
      > >> 2 notes here:
      >
      > >> 1. I think NTFS streams is useless feature.
      >
      > > NTFS Streams can be used for the very same stuff resource streams on
      > > MacOS or extended attributes on OS/2 / Linux are used.
      >
      > I'm not aware well of Linux mechanisms for storing extended attributes
      > inside files on Linux.

      Open a console and type "man 5 attr"? Or look here:

      http://linux.die.net/man/5/attr

      > Word "Linux" looks strange to me here in fact -
      > it might a property of extX filesystem, but it doesn't have to do
      > anything with Linux I think since I may use other systems for root mount
      > point - reiserfs, for example.

      No it has nothing to do with Linux. FreeBSD, Solaris and Mac OS X
      support extended attributes as well. See:

      http://en.wikipedia.org/wiki/Extended_file_attributes

      > Do you have exact answers to the
      > following questions:

      > * Which mechanism is used on Linux to store these extended attributes on
      > Linux? Is it filesystem-based? If yes, which filesystems currently have
      > it implemented?

      Quote Wikipedia: "In Linux, the ext2, ext3, ext4, JFS, ReiserFS and
      XFS filesystems support extended attributes (abbreviated xattr) if the
      libattr feature is enabled in the kernel configuration. "

      Which it is ever since about SuSE 9.0

      > * Which applications use this feature on Linux? Are they OS-specific?

      Sadly I know only of two applications: setxattr and getxattr. But they
      are not OS specific - they are supported via the "libattr" library.


      > Are there application programs that use this? Are those programs
      > portable? If yes, how they deal with absence of this feature on other
      > file systems? These are exactly questions which I would ask myself if I would be
      > designing something new and would be considering using NTFS file
      > streams.

      These are also exactly the questions which hold back software
      engineering for the last 20 years or so.

      > Will there be FAT32 file system clients? Would I care to port
      > the program to other system some time later? Et cetera. And most (if not
      > all) programs choose to use simple abstractions (files/directories)
      > available on all modern systems because it works well, because you'd
      > better keep it simple and because there are more important things to
      > focus on.

      On the other hand use of extended attributes could solve a problem
      with 5 lines of code where solving the same problem without could cost
      you 50. Determine file types, text file line endings and text file
      encoding come to my mind here. Ask Bram how many line of code he
      needed in Vim to determine these three informations. With consequent
      use of xattribs it would have been 6 lines:

      char mime_type[64];
      char mime_encoding[64];
      char line_ending[64];

      getxattr (filename, "Content-Type",mime_type, sizeof mime_type);
      getxattr (filename, "Line-Ending", line_ending, sizeof line_ending);
      getxattr (filename, "Content-Encoding",mime_encoding, sizeof
      mime_encoding);

      And best of all: you know before you open the file. AFAIK Bram need to
      close and reopen files in unfortunate combinations.

      It is often overlooked that not only using a new feature posses risks
      but not using as well.

      How often I ended up with xxx.yyy.htm after a download... Or ever
      better: the amount of frustrated SymbianOS users which tried to
      download a theme (named xxx.utz) and ended up with xxx.zip. All
      because some webserver and or browser made a mistake when trying to
      determining the file type (utz and zip share the same file header).

      And it is precisely those "simple abstractions (files/directories)
      available on all modern systems" which bring those problems. Only:
      It's not "modern systems" - it's "between 1 and 2 decades old
      systems". Truly modern operating systems support extended attributes.

      > P.S. I do see some cases where the data streams feature might be useful.
      > For example, anti-virus program might store some information about the
      > scanned file in a separate stream.

      To late: there are already anti virus solutions which do that.

      Martin
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 25 messages in this topic