Commit graph

5 commits

Author SHA1 Message Date
ed464af779
*: xattr can Update()
This is a gnarly patchset that has been mashed together.
It uncovered that some aspects of Check were never really working
correctly for `xattr` keywords, but also the `Update()` had been left
undone for a while.

This includes some API changes around the `Keyword` and `KeyVal` types.

Also I would like to update the signature for the `UpdateKeywordFunc` to
just accept a `KeyVal` as an argugment, rather than a keyword AND the
value. with this context there would be no need to guess on the value of
what's passed to the xattr update function of whether it needs or
already is base64 encoded.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-24 15:05:24 -04:00
14721e6869 keyval: cleaner struct functions
KeyVal specific functions can be a part of the struct.
Also add tests and fix the NewValue functions for suffixes

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-24 07:01:29 -04:00
4eec68be4b
*: make Keyword and KeyVal pervasive
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-11-17 21:38:01 -05:00
5d26726bb1
keyword: unify keyword synonyms
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-11-16 15:42:53 -05:00
Aleksa Sarai
d0f7e8cb8b
keywords: correctly handle time keywords
Previously, the time generation code would inexplicably drop parts of
the nanotime -- potentially causing validation to succeed when it should
fail. This was probably do to a bug in the remainder logic, but instead
we should be using .Nanosecond() anyway.

After changing the time of a file with a test case like this:

    // Change the time to something known with nanosec != 0.
    chtime := time.Unix(100, 987654321)
    if err := os.Chtimes("somefile", chtime, chtime); err != nil {
	// panic
    }

timeKeywordFunc() would return the wrong value (time=100.000000021).
This fixes the issue and adds a test case.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-11-01 17:47:06 +11:00