Re: Setting a default location for files
[email protected] Tue, 11 Jan 2011 13:25:25 -0500
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Message-ID | <[email protected]> |
Eugene Crosser <[email protected]> writes: > > Hi all, > > I think that the problem of the shebang line being taken as a path to > the interpreter in its entirety did exist in Linux maybe a decade ago, > or more. (A number of other potential problems is described here: > http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Portability). In the > past years, constructions like > > #!/usr/bin/perl -w > > worked quite well. However, it's quite likely the interpreter's > responsibility to parse the command line into the arguments vector, > while the kernel only selects the part till the first whitespace to pass > it to exec*(). It might be that perl (in my example) and shell (as used > most of the time) are capable of breaking the command line into the arg > vector, while crm interpreter is not? Just a hypothesis. > > On another note, I'd suggest to *not* put crm scripts into /var. I think > the proper place for them is either /usr/lib, or even better /usr/share > (as they are architecture independent). > > Eugene AHA!!! Yes, that tickled the bug. If I put a #!/usr/bin/crm into the .sh file as the first command then indeed I get a bad result, ie: #! /usr/bin/crm '-{window; output /HERE YOU GO!\n :*:_arg1: \n :*:_arg2:\n :*:_arg3: \n/;}' foo bar yields: bash-4.1$ ./crmdebug.sh /usr/bin/crm: *UNTRAPPABLE ERROR* Couldn't open the file: '-{window; output /HERE YOU GO!\n :*:_arg1: \n :*:_arg2: \n :*:_arg3: \n/;}' foo bar Sorry, but I can't recover from that. This happened at line 0 of file '-{window; output /HERE YOU GO!\n :*:_arg1: \n :*:_arg2: \n :*:_arg3: \n/;}' foo bar (runtime system location: crm_compiler.c(105), in routine: crm_load_csl) bash-4.1$ cat ./crmdebug.sh #! /usr/bin/crm '-{window; output /HERE YOU GO!\n :*:_arg1: \n :*:_arg2: \n :*:_arg3: \n/;}' foo bar bash-4.1$ and taking the tic quotes off of the program i.e.: bash-4.1$ cat ./crmdebug.sh #! /usr/bin/crm -{window; output /HERE YOU GO!\n :*:_arg1: \n :*:_arg2: \n :*:_arg3: \n/;} foo bar You have new mail in /var/spool/mail/wsy bash-4.1$ yields: bash-4.1$ ./crmdebug.sh HERE YOU GO! -{window; output /HERE YOU GO!\n :*:_arg1: \n :*:_arg2: \n :*:_arg3: \n/;} foo bar ./crmdebug.sh :_arg3: /usr/bin/crm: *ERROR* Statement 5 is bogus!!! Here's the text: foo bar Sorry, but this program is very sick and probably should be killed off. This happened at line 5 of file (from command line) (runtime system location: crm_exec_engine.c(239) in routine: crm_invoke) The line was: --> foo bar <-- bash-4.1$ So, the good news is that the error is (sorta) reproduceable. The bad news is that case 3 above demonstrates that it's coming in from exec() and not inside crm114, just as: http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Portability describes. As an intermediate fix, if you are running a .sh file, and you do NOT put #! at the start of the first line, then the behavior seems to be correct. Will that fix it for you? - Bill Yerazunis ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl