Barriere, Francois <fra...@at...> écrit :
> Le 20/11/2014 08:47, Barriere, Francois a écrit :
> > The problem occurs when I start a script (I wrote for testing)
> > from LSF (job dispatcher, like SunGrid), but not when I run the
> > same script in an interactive session.
> Me, again,
>
> digging further, I see a difference in the way the alias is
> treated compared to the unalias. This in the case of an alias
> with no argument (in the case of an alias with arguments, it
> seems, the selection alias vs func is the same).
>
> Looking at output_unset_alias() and output_set_alias() in utility.c,
> it seems:
>
> - in "set" mode, if the shell is "bash" and the shell is interactive,
> an "alias" is generated. So in my case, with LSF, the shell should
> not be considered "interactive", and a function() is generated.
>
> - in "unset" mode, if the shell is bash, if the value of the alias
> contains parameters, the function is unset.
> But if the value of the alias does not contain any parameter,
> "unalias" is used, without testing the "interactive" nature of
> the shell...
>
> It seems, I have triggered a corner case, when the shell is not
> interactive, the shell is bash and the alias does not contain
> any parameter...
> May be, considering the interactive nature of the shell is
> the "unalias" case should fix my problem... Or should I remove
> the test on is_interactive() is output_set_alias()?
thanks for digging to the code.
you're rigth, alias definition as alias or function is interactive vs non interactive shell
while unset is not.
bic-soft:~ > cat tt2.sh
#!/bin/sh
load=`LOADEDMODULES=mod_alias _LMFILES_=./mod_alias MODULEPATH=. modulecmd bash load mod_alias`
echo $load
unload=`LOADEDMODULES=mod_alias _LMFILES_=./mod_alias MODULEPATH=. modulecmd bash unload mod_alias`
echo $unload
bic-soft:~ > ./tt2.sh
alias toto='ls -l';
unset LOADEDMODULES;unset _LMFILES_;unalias toto;
bic-soft:~ > ssh localhost ./tt2.sh
toto() { ls -l;};
unset LOADEDMODULES;unset _LMFILES_;unalias toto;
at first glance I would say that output_unset_alias should take care of the
shell status as output_set_alias does
thanks for reporting this problem, and insvestigate it.
Eric
>
> François.
>
> --
> Francois Barriere
> CAD wizard / Atmel Corporation
> Tel: +33 442 536 198
> fra...@at... / www.atmel.com
>
> *********************************
> To lift an autumn hair is no sign of great strength; to see the sun and
> moon is no sign of sharp sight; to hear the noise of thunder is no sign
> of a quick ear. (The art of war, Sun Zu).
> *********************************
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
|