<body>
I discovered what is wrong with the perl files that dows not uses shebangs. <br>The perl file postprocess/rebase.pl is a valid executable script, but it does not uses shebang.<br><br>I took /usr/share/file/magic and there it is a mention for that kind of "magic" sign:<br>...<br> # commands: file(1) magic for various shells and interpreters<br>0 string : shell archive or script for antique kernel text<br>...<br><br>And tried to execute on command line this file. It is properly executed. So it is a valid script to run.<br><br>I have managed to grep the /usr/share/file/magic and the string "\ script" (with space) will manage to sort out just the executable ones.<br><br>So I changed my script to search for "\ script" using "grep" and "file" commands and no more file type (extensions) exclusion patterns.<br><br>It was tested here and attached on this email. <br><br>Francisco Kem Iti Saito
<br><br>< #Use test as argument to find the files that are not executable for file command but have the execution bit set<br>< #The use of "\ script" was based on /usr/share/file/magic which is used by "file" command.<br>---<br>> # Set the exclusion pattern (e.g. not all perl files - pl - are detected as executable by file command because they use evaland there is no shebang)<br>><br>> EXCLUSIONS="*.pl$|*.excludeme$"<br>12a14,15<br>><br>> #Use test as argument to find the files that are not executable for file command but have the execution bit set<br>16c19<br>< find . -perm /u+x -type f -print0 |xargs -0 -n1 file|grep -v "\ script" |cut -d: -f1<br>---<br>> find . -perm /u+x -type f -print0 |xargs -0 -n1 file|grep -v executable|cut -d: -f1|grep -E -v ''$EXCLUSIONS''<br>22c25<br>< find . -perm /u+x -type f |xargs -n1 file |grep -v "\ script"|cut -d: -f1|xargs chmod -x<br>---<br>> find . -perm /u+x -type f |xargs -n1 file |grep -v executable|cut -d: -f1|grep -E -v ''$EXCLUSIONS''|xargs chmod -x<br><br>and the output of grep "\ script" on my Debian machine: <br><br>$ grep "\ script" /usr/share/file/magic<br>0 string : shell archive or script for antique kernel text<br>0 string/b #!\ /bin/sh Bourne shell script text executable<br>0 string/b #!\ /bin/csh C shell script text executable<br>0 string/b #!\ /bin/ksh Korn shell script text executable<br>0 string/b #!\ /bin/tcsh Tenex C shell script text executable<br>0 string/b #!\ /usr/local/tcsh Tenex C shell script text executable<br>0 string/b #!\ /usr/local/bin/tcsh Tenex C shell script text executable<br>0 string/b #!\ /bin/zsh Paul Falstad's zsh script text executable<br>0 string/b #!\ /usr/bin/zsh Paul Falstad's zsh script text executable<br>0 string/b #!\ /usr/local/bin/zsh Paul Falstad's zsh script text executable<br>0 string/b #!\ /usr/local/bin/ash Neil Brown's ash script text executable<br>0 string/b #!\ /usr/local/bin/ae Neil Brown's ae script text executable<br>0 string/b #!\ /bin/nawk new awk script text executable<br>0 string/b #!\ /usr/bin/nawk new awk script text executable<br>0 string/b #!\ /usr/local/bin/nawk new awk script text executable<br>0 string/b #!\ /bin/gawk GNU awk script text executable<br>0 string/b #!\ /usr/bin/gawk GNU awk script text executable<br>0 string/b #!\ /usr/local/bin/gawk GNU awk script text executable<br>0 string/b #!\ /bin/awk awk script text executable<br>0 string/b #!\ /usr/bin/awk awk script text executable<br>#0 regex BEGIN[[:space:]]*[{] awk script text<br>0 string/b #!\ /bin/rc Plan 9 rc shell script text executable<br>0 string/b #!\ /bin/bash Bourne-Again shell script text executable<br>0 string/b #!\ /usr/local/bin/bash Bourne-Again shell script text executable<br>>15 string >\0 %s script text executable<br>>16 string >\0 %s script text executable<br># PHP scripts<br>0 string/c =<?php PHP script text<br>0 string =<?\n PHP script text<br>0 string =<?\r PHP script text<br>0 string/b #!\ /usr/local/bin/php PHP script text executable<br>0 string/b #!\ /usr/bin/php PHP script text executable<br>0 string Zend\x00 PHP script Zend Optimizer data<br>0 string WNGZWZSC Wingz compiled script<br>0 string/b #!\ /bin/perl perl script text executable<br>0 string eval\ "exec\ /bin/perl perl script text<br>0 string/b #!\ /usr/bin/perl perl script text executable<br>0 string eval\ "exec\ /usr/bin/perl perl script text<br>0 string/b #!\ /usr/local/bin/perl perl script text<br>0 string eval\ "exec\ /usr/local/bin/perl perl script text executable<br>0 string eval\ '(exit\ $?0)'\ &&\ eval\ 'exec perl script text<br>0 string """ a python script text executable<br>0 string/b #!\ /usr/bin/python python script text executable<br># varied.script: file(1) magic for various interpreter scripts<br>>3 string >\0 %s script text executable<br>>3 string >\0 %s script text executable<br>>2 string >\0 %s script text executable<br><br><br>Em 24/03/2011 ās 03:07 horas, "Tor Lillqvist" <tlillqvist@novell.com> escreveu:<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><pre>> Note: The exclusion pattern was needed because I have noted that some perl <br>> files are not using shebang, so the "file command" cannot detect it as <br>> executable.<br><br>But if a Perl (or some other) script doesn't start with a #!, then it isn't executable. It can't be run as a command just by itself, the kernel (or Cygwin) doesn't know what interpreter to use. It has to be passed on the command-line as a parameter to the intended interpreter. So, such files should not have the executable bit set. Presumably they are run from the makefiles using an explicit Perl interpreter.<br><br>Now, another question is then whether we should add a suitable #! line to such scripts, and change the makefilery where necessary to just run them as commands? There probably are various complications here that won't show up on most systems/platforms, but will show up on some.<br><br>> Can you send me the git-hook pre-commit so I can try to modify it to make <br>> this tests automatically?<br><br>I am no git expert, but it should be in your git clone, surely?<br><br>--tml<br><br><br>_______________________________________________<br>LibreOffice mailing list<br>LibreOffice@lists.freedesktop.org<br><a href="http://lists.freedesktop.org/mailman/listinfo/libreoffice" target="_blank">lists.freedesktop.org/mailman/listinfo/libreoffice</a>
</pre></blockquote>
</body>