:: Re: [DNG] Preferred automounter beh…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Didier Kryn
Fecha:  
A: dng
Asunto: Re: [DNG] Preferred automounter behavior?
Le 26/12/2015 13:42, aitor_czr a écrit :
> On 12/25/2015 09:03 PM, Steve Litt <slitt@???> wrote:
>>> Hi,
>>> >
>>> >One persistently tempting question about using Python, or any other
>>> >interpreted programming language, is why they are used?
>> I can answer that, always assuming speed and hardware interfacing
>> aren't an issue:
>>
>> 1) For performing the same task, Python's always much easier to
>>     program. And easier algorithms mean less dark corners for bugs to
>>     hide.

>>
>> 2) Python (and Perl, Ruby, Lua and Scheme) is already debugged and
>>     secure. Without C's pointers, overflowable arrays, manual garbage
>>     collection, matching of mallocs and frees, and other security
>>     problems, one can write a secure Python program with a lot less
>>     security knowledge.

>>
>> 3) Assuming your Python program doesn't import a bunch of seldom-used
>>     Python libraries, deployment is*much*  easier. Deploying a
>>     well-written Python program is a mere wget. I once had a distro with
>>     a bad or missing youtube-dl package. Because it's just a python
>>     script, I copied it from the Internet onto my path, and bang, I had
>>     youtube-dl. Try that with any C program.

>>
>> 4) Python has several ways of invoking a binary program, so if one part
>>     of the project absolutely requires C, that part can be a tiny C
>>     program that's easy and secure to program, and have it called by
>>     Python.

>>
>> 5) A lot of the functionality of a C program could be imitated by
>>     existing POSIX tools like cat, grep, awk, sed, cut, sort, gzip, and
>>     the like. Running these programs first, in order to cut way down on
>>     the data transfer, can allow the stdout to go into a Python program
>>     that can keep up with the process.

>>
>>
>> Truth be told, if I were a business' manager of software development,
>> any time somebody wanted to write something in C I'd make him/her
>> justify doing so by proving it would be disadvantageous to write it in
>> Python (or Perl or Ruby or Lua or Scheme or whatever).
>>
>>
>> SteveT
>
> In my opinion, python is a good tool for that. Easy to understand,
> easy to translate..., and a complement for C language, because they
> share libraries. You can also run shell scripts via os.system(). Add
> to this tools like PyGtk and PyQt for graphical interfaces.


     Although I don't know Python, I have read enough about it to know 
it fits well with the kind of job. I suggest using python-inotify rather 
than piping inotifywait to your daemon. I think it would be better 
because it is not so easy to manage a pair of daemons: when you kill 
your automounter, the associated inotifywait is not necessarily killed 
in the same time.


     I also suggest you create the mount point in /media for unknown 
media. For the others it could be listed in a config file containing a 
list of (uuid, mountpoint) pairs.


     Didier