Hello,
when i run python script tridupdate.py version 1.10 by command line like:
python tridupdate.py
MD5: fb37f9555675a80ebbf8e92eaa9e7f51
Checking last version online...
MD5: 31c180feb51111c89ecfcb2b68eefd73
Downloading new defs...
Checking defs integrity...
OK.
But after making script executable (chmod a+x tridupdate.py) i tried to run
script with shebang magic by command line like:
./tridupdate.py
: No such file or directory
Now i get the error message ": No such file or directory".
The used system was suse Linux with python version 2.7.8.
After some time i found what was wrong. In the python script carriage return
line feed combination (CR NL) was used as line terminator. So i convert
line terminators to UNIX type line terminators (NL) by command like:
dos2unix tridupdate.py
Now direct calling script works as expected.
Furthermore i transfered that UNIX variant to Windows system with python
version 2.7.10. There this variant and also the old type works as expected.
But now i get an ugly side effect. If i open script in text editor like
notepad then text is bad formated as one big line because such editors assume
that stored text has CRNL line terminators.
So i look further. After some time i saw that python script is stored as
text file inside archive. This can be verified by running command like
unzip -Z -v tridupdate.zip | grep "file type"
apparent file type: text
When extracting archive with command like
unzip -x tridupdate.zip
this is treated as binary file by unzip version 6.00 with default
configuration. According to man page unzip(1) -a option convert text files.
So i run now command like
unzip -xa tridupdate.zip
Now i get directly UNIX variant. I verified this by comparing command
cmp -b -l
So it would be nice to mention this fact as zip comment or in download
section as text like:
python script is stored as "text" in zip archive.
Use option "-a" when extracting archive by unzip command.
Furthermore i saw that tridupdate.py store trid database "triddefs.trd" in
current directory. I think this is not what user really wants. I think
update should replace the database used by trid program as default.
That is "triddefs.trd" in same directory as trid executable for version 2.24.
For UNIX like systems then directory structure now look like:
/usr/bin/trid
/usr/bin/triddefs.trd
But that violates UNIX philosophy where executables can be stored read-only
in a directory and configuration or database parts are stored in another
place. So expected directory structure should look like:
/usr/bin/trid
/var/lib/trid/triddefs.trd
So trid programs should be recoded that software can determine the default
directory where database is stored. May be this can be easily done by an
environment variable like "TRID_HOME".
Furthermore the multi-user aspect should be considered. By default a system
wide database is used, but a user defined database should be preferred if
exist. Then directory structure on UNIX system maybe looks like:
/usr/bin/trid
$HOME/.trid/triddefs.trd
/var/lib/trid/triddefs.trd
Maybe also a variable like TRID_OPTS can be used to store default command
line options like the unzip command with UNZIP_OPTS do.
I hope that my proposals can be used in future version of trid programs.
With best wishes
J?rg Jenderek