2012/10/20 Renato Silva <br.renatosilva@gmail.com>

2012/10/20 Renato Silva <br.renatosilva@gmail.com>

2012/10/18 Keith Marshall <keithmarshall@users.sourceforge.net>
On 18/10/12 20:13, Renato Silva wrote:
> Thanks! yes, I like the link idea... Yes it is NTFS, but wouldn't symlinks
> work too?

I'm sure they would, but hard links are cheaper, and they don't require...

> Windows 7 supports them out-of-the-box, while in XP I think I can
> use
Link Shell Extension (
> ).

...any such support from the operating system, (nor from any add-on).
OTOH, hard links can only be used with physical disk files, and they
cannot span devices, (neither of which represents a problem in the
scenario under discussion).

> IIRC it is possible to get symlink name from a linked script (that
> is, to determine which command to call in the wrapper).

You can infer the name of the command from the link name itself;
something along the lines of:

   CMD=`basename "$0"`
   $CMD.exe "$@"

or, if you need to insert a command specific path:

   CMD=`basename "$0"`
   case $CMD in
     bzr) /path/to/$CMD.exe "$@" ;;

should do the trick, for either hard links or for symlinks.

Thanks, I didn't know or remember basename worked for links. So I have implemented something better than aliases with a script called /local/bin/runcrt.sh:

env -u TZ $(basename "$0").exe "$@"

Then I created symlinks, ruby, python and bzr for now, pointing to that script. They work, except for ruby, which is used in /etc/profile exactly to build value for TZ (through my posix-brst.rb script). When called from path in profile, ruby will run as a bash script (runcrt.sh), which for some reason causes /etc/profile, and even ~/.profile, and even on BASH_ENV="/not/etc/profile", to be recursively sourced, leading to bash not starting at all and adding a growing list of processes in task manager.

My workaround was to rather call the raw ruby executable directly in /etc/profile, like this:
export TZ="BRT+3BRST$($rubyexe /local/bin/posix-brst.rb)"

I'm sorry, the recursiveness is because I have BASH_ENV set to "/etc/profile" under windows. This is because I need TZ set for non-login/interactive shells as well, so for example, date command can work in my backup script. So solution above still applies.

These work too:
* [[ -z "$tzlock" ]] && export TZ="BRT+3BRST$(tzlock=acquired posix-brst.rb)"
* #!/c/programs/desenvolvimento/ruby/bin/ruby

As for TZ set for MSYS or unset for MSVCRT, I figured out I prefer the latter, specially due to ls command which becomes noticeably slow.
Now I'm curious on a way to run a bash script from one of the initialization scripts, without causing the bash initialization process to become recursive. I'm curious too about my "H" timezone returned by Windows API. Also, I think I'll try later to switch to the opposite approach, that is, using symlinks like ls and date to something like tzrun.sh (even though I would prefer to find a solution for the recursive problem, in case ls, date, and others get ever called from within initialization scripts).

So, still seeking for information and solutions.


Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
MinGW-users mailing list

This list observes the Etiquette found at
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

You may change your MinGW Account Options or unsubscribe at:
Also: mailto:mingw-users-request@lists.sourceforge.net?subject=unsubscribe