id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,blockedby,blocking,branch_state,votes 2742,"[Subshell] Support for ash + bugfixes for bash, fish",kriegaex,zaytsev,"This patch is related to a [http://mail.gnome.org/archives/mc-devel/2012-March/msg00000.html thread on mc-devel]. I am copying the main part of my [http://mail.gnome.org/archives/mc-devel/2012-March/msg00008.html previous post] to this ticket because I was asked to create one: > I have resolved the remaining issues with differentiating between ''!BusyBox ash'' and ''Debian ash (dash)''. I also refactored the subshell code and documentation a bit for all subshell types. I installed and tested '''all''' of them on my Ubuntu 11.10 64-bit desktop system plus ''Bash'' and ''!BusyBox ash'' on my embedded mipsel platform. > > I think now I have reached a mature enough code state for you to commit upstream because everything which worked before still does and several things which were buggy or unavailable before have been fixed/added. > > The patches currently contain the following changes: > > * ''030-bash_inputrc.patch'' > - Fix non-functional `INPUTRC` for ''bash'' (variable was unset and never used) > > * ''040-ash_as_subshell.patch'' > - Fix chdir for ''fish'': communication with subshell was not working and showing an error message because `pwd` returns abbreviated home directory ""~"" instead of full path name. So now we use `$PWD` and it works. This must have been broken for a while. This is unrelated to ''ash'', but I included it in the refactoring patch for ''src/subshell.c'' anyway because it is small and the same code section was also changed for other reasons (set ''fish'' prompt). > - All subshells now have a dynamic, meaningful prompt `user@host:cwd`. This was tricky for ''ash/dash'' and a little easier for the other shells. > - Shell type recognition for automatic subshell selection has been improved: Now not only the `SHELL` names are checked, but also their link targets in order to determine the correct type (e.g. if a ''ksh'' is really a ''zsh'' or if an ''ash'' is ''!BusyBox'' or ''dash'', if ''sh'' is whichever type or if ''bash'' is symlinked to ''!BusyBox'' (but ''BB'' still is just an ''ash'', never a ''bash''). Even if the type could not be determined or a compatible subshell not found via inspection of `SHELL` and ''/etc/passwd'', function `OS_Setup` in ''src/main.c'' now searches for known shells by their usual paths. For instance, if you have an exotic login shell called ''foosh'', you can now have subshell support anyway, if MC finds an ''ash'', ''bash'' etc. on the system. > - I have added many more comments to the code sections I changed. Maybe some of you think there are too many now, but I think this tricky part of the code base should be documented rather too much than not enough, so as to make it easier for maintainers to upgrade subshell support or add new subshell types in the future. Sometimes it is not enough to have working code, but helpful to understand '''why''' the code was written in a certain way. > > * ''040-ash_as_subshell_additional.patch'' > - ''ashrc'' init file added to config file list > - Subshell documentation page updated with a few corrections, better formatting and some new information (''doc/man/mc.1.in''), e.g. how to use init files for ''bash'' and ''ash'', how to manually call ''mc'' with `SHELL` variable set to another shell type if you want to have a specific subshell type. > > BTW, the patches have been created for mc-4.8.1, '''not''' for the trunk/master. But they should be easy to merge into the master. > > All in all I believe that adding these patches to MC will significantly improve subshell support, fixing two old issues and adding new subshell types often used on servers or embedded systems. That could make MC even more popular. E.g. I have heard from several people that they would like to get rid of feature-rich, but big shells like ''bash'', ''zsh'' or ''tcsh'' on such systems if they had ''!BusyBox'' or ''dash'' subshell support. I think ''MC'' is far from dead and did what I could with my humble means to improve a small part of it. > > Open issues (legacy, not created by my patches): > - Still open is the old issue of ''fish'' not reliably showing its prompt on the bottom line of ''mc''. With my limited knowledge I could not find out why this happens, but I noticed an interesting fact: If I start ''mc'' via ''strace'' (I did this because I was debugging/logging something during development), all of a sudden the ''fish'' prompt is shown reliably on my test machine. Maybe ''strace'' was slowing down something, so this might be a timing issue, possibly a race condition, but this is just a guess. It might be a starting point for further investigation by one of you guys. > - Another (old) open issue which still exists is that if you cd to another directory in full-screen mode (hide panels with ''Ctrl-O''), then show the panels again with ''Ctrl-O'', the new path is not immediately shown on the bottom line, but only after some user interaction such as pressing Tab twice, switching back and forth between left/right panel.",enhancement,closed,major,4.8.17,mc-core,4.8.16,fixed,,pahan@…,,,merged,committed-master