Hi,

On 12/12/06, David Bitseff <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have the rm command aliased to use the --verbose switch.  This patch tells
> psub to use the rm executable instead of the rm function I've declared.
>

Thanks for the patch.

This patch highlights an interesting problem. Unlike other shells, a
plain fish installation runs a lot of shellscripts. Fish contains
roughly 7000 lines of shellscript. This has many advantages:

* Shellscript is a suitable language for the things done by the
relevant shellscripts.
* Writing a large body of code in a language is a good way to find
rough spots and missing features.
* You don't need to know C to extend fish and contribute to its development.
* The main program is made smaller, meaning it's easier to read the
code, and there are less bugs
* Fish gets a pretty large test suite for free.
* There are plenty of examples on how to write shellscript included
with fish. Looking at the shellscripts can be a good form of
introduction to shellscripting in fish.

Unfortunatly, there are also problems. These scripts are all written
with the assumption that standard tools like ls, rm, cd and grep are
Posix compliant. This assumption can obviously easily be invalidated
by a user that creates a wrapper function around any command. Some
commands, like GNU grep can be made to be non-compliant by setting
special environment variables. Solaris needs to be forced into Posix
compliance by editing the PATH.

I don't really see any reasonable way to completely avoid this
problem. One could add some arcane magic that ignores user defined
wrappers when executing shellscript code shipped with the system, but
I think that is a _really_ bad idea, the potential for confusion and
bugs is pretty horrendous.

Another option is to drop all shellscripts shipped with fish and
replace them with C code. I don't think that is a good idea, at all,
since in my view, the advantages outlined above are pretty big.

As far as I can see, the only way to deal with the problem is to try
and make the best of it. We should document the fact that it is a bad
idea to make commands posix incompliant, if you e.g. want grep to use
extended regular expressions by default, consider using egrep instead
of setting GREP_OPTIONS, etc.. On the other hand, we should also use
the 'command' builtin whenever using a command that a user could
reasonably want to override, since redefining e.g. ls is rather
common. Fish does it...

> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> _______________________________________________
> Fish-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/fish-users

-- 
Axel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to