Gentoo Archives: gentoo-user

From: Etaoin Shrdlu <shrdlu@×××××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Set a property on a file and have it remove when the file is modified?
Date: Sat, 01 Mar 2008 15:29:22
Message-Id: 200803011640.20067.shrdlu@unlimitedmail.org
In Reply to: [gentoo-user] Set a property on a file and have it remove when the file is modified? by Erik
1 On Saturday 1 March 2008, Erik wrote:
2 > Is it possible to set a property on a file and have it remove
3 > automatically when the file is modified?
4 >
5 > Suppose that we have a style checker that checks a lot of source code
6 > files. Once it examined a file and found it to be clean, it should set
7 > a property on the file ("style-clean"). Whenever the style checker is
8 > executed it skips files with this property. Whenever the file is
9 > modified, the filesystem removes the property.
10 >
11 > Is this possible? Which filesystems does it work on?
12
13 This is just an idea, and take it for what it is.
14
15 I seem to remember that on fat filesystems, files used to have
16 the "archive" attribute (along with the "hidden", "system", "readonly"
17 attributes), which (back in the DOS/Win9x days) was meant to inform
18 backup programs that the file was to be archived. The way it worked was
19 more or less like this: when a file was created or modified, the OS set
20 the "archive" flag for the file. The backup program, after backing up
21 the file, cleared the flag.
22
23 *If* linux implementations of the fat filesystem handle the "archive"
24 flag (ie, set it when a file is modified), it should be possible to
25 exploit this feature to your advantage.
26 Just have the syntax checker clear the flag for a file upon succesful
27 check, and have it run only on files with the flag set. When an
28 application modifies the file, the flag will automatically be set again
29 for that file (if it wasn't already, of course).
30 If the above is true, "mattrib" (from the mtools package) can be used to
31 manipulate fat attributes for a file.
32 --
33 gentoo-user@l.g.o mailing list