Re: selinux - help - directory policy syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux