Given that d is an alias for the internal command ‘dir’:

Why does it sometimes seem to randomly run a completely different kind of file listing program — one that appears to be d.exe from cygwin?:

^ Click here to see the full-size image, in case you can’t read this one ^
This should not happen.
I’d like to know myself!
Mood: interested in this problem
Music: Tiamat – Cain
January 2, 2009 at 11:57 PM
Yeah, looks like a shell bug to me. Is this in command.com or what?
January 3, 2009 at 12:48 AM
No, I haven’t used command.com since 1989ish… I used Norton’s superior NDOS command-line which became 4DOS which became 4NT… It had tab-completion a good 10+ years before Microsoft’s shell, aliases, and all that good stuff…
January 3, 2009 at 1:03 AM
Yeah, figured it wasn’t command.com. ;-) Still a pretty weird behavior…
January 3, 2009 at 1:11 AM
Yeah. It’s still one of those interesting mysteries. I do have my cygwin directory as a junction (symbolic link), so I was wondering if perhaps the filesystem can’t evaluate junctions as fast as it should… Because this seems to happen only when I’ve done a directory multiple times (I’m compulsive sometimes)…. And it seems to be cygwin’s d.exe that is the “alternate” d that runs. Very odd.
January 3, 2009 at 2:08 AM
Actually, that can’t be it. D.exe is the utility that requires processing a junction to get to. The internal alias d should really only do what I defined it to do. I guess it’s a 4NT error. I definitely don’t have the latest version…
January 3, 2009 at 11:32 PM
Which OS and which version of 4nt do you have?
Also, how is this junction set up? I’m not that familiar with junctions. I remember warnings always being attached to junctions, so I’ve stayed away from them; I’ve never had a need for them that couldn’t be dealt with another way.
January 4, 2009 at 1:28 PM
Dave:
The junction doesn’t really matter because ‘d’ is an internal alias for ‘dir’, so it should never be looking for a d.exe in the first place, regardless if it’s in the path or not, and regardless if that particular path points to a junction.
If it should never be looking for d.exe in the first place, then whether a junction is used actually seems irrelevant.
The junction merely moves c:\cygwin (in my path) to r:\cygwin (junction c:\cygwin r:\cygwin) to save space since that is my incoming drive (a blogpost about the situations where junction is the ONLY solution is in the works, and you will see that there are indeed several situations that can’t be dealt with another way).
Since I have no way of knowing if anything in cygwin references the path it was originally installed in, and am not interested in wasting time researching a pointless problem, I merely added the junction so anything hardcoded to c:\cygwin still functions just fine, even though I moved it to R:. Not sure how you’d save space without having to either research cygwin, adjust your path, check for any hard-coded calls in scripts (I don’t think I have any, since it’s in my path, but you never know… I’d grep all my batfiles for c:\cygwin\ and such.. but i’m thinking I never did that. But I’d still definitely check, and that takes time.).
If you just want to mindlessly move a few megs to another drive while tricking your environment into not knowing you moved it, and not having to adjust any path or scripts, then junction is the easy answer. Editing my path would be easier, but for all I know cygwin registered DLLs that will somehow break if I move them (does DLL registration work like that? I don’t know, and researching THAT would take longer than creating a junction). I’m scared of “unknown unknowns”. Better to fool the environment into thinking I never moved it in the first place, than to deal with researching the implications.
Anyway: WinXP Professional Version 2002 SP 3, but my 4NT version is only 5.00A and they’re up to 8 or something now. (I was using a newer one at work… But it did cause me to have to change some of my batfiles, re-affirming that I should never upgrade anything that works. And since this problem is harmless, it’s an interesting puzzle to me, not a reason for upgrade.)