Mailinglist Archive: opensuse (795 mails)

< Previous Next >
Re: [opensuse] KDE and directories
On Tue, 7 Nov 2017 12:29:20 +0100
Roger Oberholtzer <roger.oberholtzer@xxxxxxxxx> wrote:

On Tue, Nov 7, 2017 at 11:59 AM, Per Jessen <per@xxxxxxxxxxxx> wrote:
Roger Oberholtzer wrote:

I think I know the answer to this (and Google was no help), but I
thought I would ask in case I messed something very obvious:

Is it possible to have KDE run a program when you enter a
directory? Say in Dolphin. We want to sense if the current
directory contains a file with a specific name. If so, do
something. The point is that it should be automatic. And it must
be done for all directories. There is no name rule or pattern that
can be used.

I presume entering means changing current working directory to
<some
directory>.
Monitoring that sounds like a job for inotify - but I am not sure if
changing current working directory is a filesystem event.

How is the file created? It might be better to monitor all
directories for a user and only look for that file being created or
updated.

The file is updated independent of this. It contains status
information about the data in that directory. This status information
should be used to update a map (Navit) to reflect the status of the
data in that directory. It only applies to the current directory. So a
cron job is not appropriate. It must be triggered by the user entering
the directory.

I think you need to do more analysis on your problem and come up with a
different solution.

As others have said, what do you mean by 'the user entering the
directory'? Do you mean accessing one or more of the files in the
directory? Or accessing a directory listing including metadata about
the files? Or simply changing working directory, or what?

If the former, what if somebody accesses a file without entering the
directory (e.g. by providing a full path)? What if they access via a
symlink or a hard link? Why can't you trust the processes to update the
status information themselves?

I'd be more tempted by a system that kept the data in directories to
which the target processes had no access and then allowed them to
access the data via a gatekeeper process that had greater access rights
and which checked whether each process's requests were kosher and maybe
logged them.

But a search for 'linux how can i tell when a process accesses a
file' (without quotes) turns up a few interesting links, such as
https://unix.stackexchange.com/questions/18844/list-the-files-accessed-by-a-program

HTH, Dave

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups