On 07/07/2019 02:53, Tim via users wrote:
On Sun, 2019-07-07 at 00:35 -0600, Robin Laing wrote:
I want to modify a policy to allow a more localized directory for
creating thumbnails for videos and such.  Presently the policy
"thumb_exec_t" is set for "thumb_home_t"

I cannot find out in anything I have searched what the syntax
description for the two directories under this policy.

/home/[^]+/\.cache/thumbnail(/.*)?

/home/[^]+/\.thumbnail(/.*)?

So, does the  [^] mean the "user" home directory?

Does the + mean this directory? or something else?

That looks like regular expression, regex or regexp, to me.  A very
fancy, and hard to understand form of wildcarding.

See:  https://en.wikipedia.org/wiki/Regular_expression for a basic
explanation.

^ carat marks a starting point

[] square-brackets contain a bunch of characters that can be part of a
match

+ plus allows the previous characters to match one, or more, times
(e.g. if the wildcard specified matching ab, then abab and ababab would
also match).

. dot matches any character, or the dot itself when used inside
brackets.  Outside of brackets, you escape it with a backslash.

* asterisk matches the previous thing, one or more times (slightly
similar to how the plus operator works).

? question-mark matches the previous things zero or more times
(slightly similar to how the plus and asterisk operators).

I hate the mental gynmastics of understanding regex, but that
wildcarding looks like (to me) that it means:

Any file in any .cache/thumbnail or .thumbnail named sub-directories
within a user's homespace (as opposed to such-named directories
somewhere else in the directory tree).

The path must start with /home
and
Match anything after that
and
Has ".cache/thumbnail" in the path (one or more times)
then
Any files inside them.

If I've read it right, the match zero or more incidences means that
things like the following filepaths will all be matches for those
rules:

/home/tim/stuff/.thumbnail/diagram.jpeg
/home/tim/edits/.thumbnails/picture.jpg
/home/tim/.cache/thumbnail/image.png
/home/tim/.cache/thumbnails/graphic.tiff
/home/tim/.cache/thumbnail/.cache/thumbnails/example.gif

There was a bug report about not being able to create thumbnails in
the current directory where the thumbnail program is run.  Ideally
that is what I would like or a related directory.  I want to create a
large number of thumbnails which would be more than the /home/{user}
directory.

If you mean to create thumbnail files in the same directory as the
original images, that's doable but with care.  I've nearly always done
things like the following for websites:

/home/tim/pictures/
/home/tim/thumbnails/

Using adjacent directories, so I don't have recursion explosions.


Thanks.

I never thought of regex and didn't see it documented anywhere but when you look at something long enough, you can miss the obvious.

Robin
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to