7 ms·
Why are there both TMP and TEMP environment variables? (2015)
- Jedd 6mo ago1995-ish. Telstra (Australia Telecom). Probably about 50k desktop computers across the organisation. One day a small file turned up in everyone's network home directory called null. A *nix person had evidently had a go at writing a .bat file. Why do we need to adopt extant standards? (I was going to ask, why standardise? But realised that might confound the North Americans. : )
- lelanthran 6mo ago>One day a small file turned up in everyone's network home directory called null. A *nix person had evidently had a go at writing a .bat file I assume that they first tried /dev/null which failed, so then moved onto just plain null? Otherwise it would not make sense that a unix programmer did this. More likely ula dos programmer misspelled NUL as null.
- jtoledo 6mo agoI've already created a 'NULL' file, but it was not a Unix thing... It was just because I got confused if it was NULL as in the programming languages I usually use.
- 3form 6mo agoUnix programmer remembered that in there's no /dev/null in DOS and that it's something shorter, and tried null which worked. Didn't check the directory contents afterwards. So basically your first sentence - doesn't seem at all unlikely to me. (I mean, I think it happened to me at least once too)
- rep_lodsb 6mo agoFun fact: "/dev/nul" (with only one L) would have worked, even if there is no directory with that name. That's been a feature since DOS 2.0, there was even an undocumented option AVAILDEV to make the prefix mandatory, instead of having device names present everywhere. But it broke the common trick used to detect if a directory exists ("if exist c:\some\path\nul").
- cachius 6mo agoWhat text was in there that he tried to discard?
- drfloyd51 6mo agoAsking the real questions!
- ale42 6mo agoSome Logitech drivers installation program (not sure which version or what product) did it too... found a file named NULL on my HD, and of course there was a BAT file with something > NULL.
- xg15 6mo agoI didn't know it was such a chaos. So I guess the moral of the story is: Ensure they always point to the same path, or else...
- Semaphor 6mo ago> My recollection is that most CP/M programs were configured via patching. At least that’s how I configured them. I remember my WordStar manual coming with details about which bytes to patch to do what. There was also a few dozen bytes of patch space set aside for you to write your own subroutines, in case you needed to add custom support for your printer. Huh. That is interesting, it was before my time, and I never heard of this :D
- zabzonk 6mo agoYes, it was definitely a thing. The patching code had to be in Z80/8080 machine code. I wrote higher performance keyboard and display routines for my copy of Wordstar using this feature.
- Semaphor 6mo agoStuff like that is also cool (reminds me a bit of modding some games), patching machine code to improve performance of a compiled app? Very cool! (My dad might have done that, he has an old ZX81) But I thought specifically patching something to configure it is such a weird concept that I never would have thought of.
- matt_kantor 6mo agoThe line between "configuration" and "modding" is pretty thin. One could say that the difference is whether the developers intended the changes you're making to be possible or not, but what about programs with dedicated modding APIs?
- zabzonk 6mo agoAt the time (early to mid 1980s) I think we would say "patching". The Wordstar devs certainly did mean you to do this - the memory locations available were fully documented, and I seem to remember they supplied a small patch utility to incorporate your code into the Wordstar executable.
- QuantumNomad_ 6mo ago> My recollection is that most CP/M programs were configured via patching. I honestly would have liked that better for a lot of programs than the dotfiles they litter all over my home directory.
- ozlikethewizard 6mo agoYea this is something I'd love to see standardised, a distro that was able to enforce a .config folder somehow would be a winner for me. Think weve probably missed the boat though.
- 9dev 6mo agoAs these things go, there obviously is a standard for this called the XDG Base Directory Specification[0], which elegantly solves almost all configuration path needs—and has been ignored, violated, or only partially implemented, since forever. [0]: https://specifications.freedesktop.org/basedir/latest/ https://specifications.freedesktop.org/basedir/latest/
- fredoralive 6mo agoPart of the philosophy of the slightly odd suckless people is their projects are mostly configured by changing the source code and recompiling. This is I suppose a similar approach in a modern open source vein. Although their general asceticism makes their projects a bit of an acquired taste I suspect.
- NSPG911 6mo agoalways shove it to `%LOCALAPPDATA%/Temp`, or `~/AppData/Local/Temp`, and don't think otherwise
- MatejKafka 6mo agoNo, don't. There are many reasons why a user may want to move the temp dir somewhere.
- fooqux 6mo agoI'm confused by the CP/M reference. Author says it'll be important later then proceeds to explain how it had nothing to do with CP/M or the 8080 CPU.
- zabzonk 6mo agocould you quote the text you are referring to?
- fooqux 6mo ago"Rewind to 1973. The operating system common on microcomputers was CP/M. The CP/M operating system had no environment variables. That sounds like a strange place to start a discussion of environment variables, but it’s actually important."
- flohofwoe 6mo agoJust a few lines below: "Over time, programs were written with MS-DOS as their primary target, and they started to realize that they could use environment variables as a way to store configuration data. In the ensuing chaos of the marketplace, two environment variables emerged as the front-runners for specifying where temporary files should go: TEMP and TMP." And before that there are a few paragraphs describing the migration of applications from i8080/Z80 based CP/M towards x86 based DOS via mechanical translation.
- rendaw 6mo agoI was curious seeing this thread, and I just looked and don't get it either. AFAICT the CP/M references could have been entirely omitted and nothing in the narrative about TMP and TEMP would change.
- jodrellblank 6mo agoExcept that DOS was made to have its first programs ported from CP/M, so it’s relevant to explain that there were no environment variables to inherit from CP/M and no developer habits or program standards to inherit from CP/M programs.
- whobre 6mo ago< Rewind to 1973. The operating system common on microcomputers was CP/M OK. I love Raymond’s blog but this is crazy. Microcomputers existed only as a prototype in 1973 (things like Intel’s Intellec dev systems) and there were no operating systems for them. Strictly speaking, Kildall did start developing CP/M in 1973, but at that point it ran only on a simulator on a PDP-10 mainframe. 1979, sure. 1973? Way too early…
- deleted 6mo ago[deleted]
- Quekid5 6mo agoWikipedia says it was created in 1974, so something's definitely off with the time line here.
- adrian_b 6mo agoIntel 8080 was launched in April 1974 and the development system for it, "Intellec 8 Mod 80", was available soon after that. CP/M could be developed only after the launch of the 8080 and the delivery of the development system. In UNIX, the environment variables were added in the Seventh Edition (1979-01), together with the Bourne shell. I do not remember whether any other command interpreters used something equivalent with environment variables before the UNIX shell (excluding the interpreters for general-purpose programming languages, like LISP and APL, where you can run a function in REPL and that function can access global variables). Therefore the quoted year may be a typo for 1979, when environment variables appeared in the UNIX shell, but were not available in the CP/M Console Command Processor (CCP, the predecessor of COMMAND.COM).
- jhallenworld 6mo agoSee https://www.youtube.com/watch?v=TpHKygZ7OHY https://www.youtube.com/watch?v=TpHKygZ7OHY CP/M 1.0 was demoed to Intel in 1974, but they didn't buy it. iCOM FDOS was the first operating system that was available to people, and it sure didn't have environment variables. Anyway, these operating systems didn't have multiple directories. But you could use CP/M 2.x's ASSIGN command to bind a logical name to a physical name. Minicomputer operating systems had this, also IBM mainframe had JCL DD commands.
- J8K357R 6mo agoA great example of a decision that likely received little to no thought from an early developer but that has long legs and will stick around forever.
- DrNefario 6mo agoThere's nothing more permanent than a TMPorary decision.
- J8K357R 6mo agoI love that!
- joquarky 6mo agoOne table at the core of an S&P500 product I briefly worked on will always be named "attornies" because somehow nobody caught it early on.
- bombcar 6mo agoREFERER is forever in the http spec.
- shevy-java 6mo agoEnvironment variables on *nix are ... strange. I noticed this first when I assigned TZ to .tar.xz (or .tar.gz) as I was lazy. Then things suddenly no longer worked. Turns out TZ is ... timezone. So you should not define all variables, right? Well ... how to know that? People can perhaps read tons of documentation, but I want to ... minimize time investment here. So I learn mostly by learn-and-doing. And as far as I know there is no trivial way to know about "this can be dangerous". Those shells are fairly simple at all times - and not that sophisticated. TMP versus TEMP may also be trivial but ... who can remember the differences? And why is it important? I have come to think that environment variables are useful; I use them all the time. But they are a bit hackish and not super-elegant and may have side effects. This is not a very important side effect per se, as most people will not run into issues such as TZ or having to think which variable to use and which not, but in the moment when you DO get surprising results, and you don't know why, this may become a problem suddenly. I kind of semi-work around by prefixing via: MY_ This is even less elegant, to then have e. g.: MY_TEMP = /home/x/temp/ or something like that. But with the prefix "MY_" I rarely run into problems. So this then becomes my main pointer, e. g. MY_TEMP_DIRECTORY, and then TEMP and TMP may just be aliases to that. It's a bit stupid but it is also simple and kind of works. Beauty is not to be found here, but it is practical and that is not a bad thing. In my own ruby code I also have to use ENV[] sometimes, which is a wrapper over environment variables, but I also try to be as independent as possible from that. For instance, all my settings are stored in simple .yml files, and these are then used to autogenerate environment variables or handle things in environments where there are no environment variables available (this is sometimes the case; I had that issue with .cgi files many years ago, where I wanted to access all environment variables but for a reason I don't fully remember, this was not available. Then I transitioned into those .yml files and that problem went away; now of course I need to load those .yml files, if necessary, but this is trivial in ruby, YAML.load_file() works very well for the most part, and I find this is more reliable than depending on reading environment variables output. On some restricted environments this may be unavailable though; I had that on university campus running ancient linux systems, so I have to be flexible in this regard).
- assbuttbuttass 6mo agoI use lowercase for my personal environment variables. It works well since most programs only depend on variables in all caps. Hadn't thought of using MY_
- Someone 6mo agoAlso, chances are programs chose “TMP” because file extensions in MS-DOS were 3 characters, max, and programs used to use “.TMP” for names of temporary files.
- LoganDark 6mo ago> These surface vibrations are so minute that they are not critical from a mechanical point of view (unlike e.g. vibrations due to imbalance), but they can cause serious acoustic problems. The reason for this is that when the fan is running, there is a pressure difference between the intake and the outlet side of the fan (lower pressure on the upside of the blades, higher pressure on the downside of the blades). From an aero-acoustic point of view, this situation is similar to a stereo speaker where there is higher pressure inside the chassis and lower pressure outside the chassis. In both cases, the pressure difference leads to an efficient acoustic coupling, so the surface vibration of either the blades of the fan or the membrane of the speaker is transferred to the air. I love rotary woofers :) I hope to get one some day.
- bgro 6mo agoI have been pointing out these annoying things for decades with Microsoft. It’s funny because the “senior dev” know it all there person always used to have an answer. “Heh you see temp stands for temporary. Tmp stands for troubleshoot my pc. For debug logs. That’s why I’m a senior and you’re not.” As I’ve gotten more senior turns out I was right to question it and we can actually talk to the original Microsoft devs now and they explain the whoopsie and how they had to keep it for backwards compatibility. So then I ask why that excuse is valid, backwards compatibility, when many changes are frequently breaking core compatibility and active business flow (like New Outlook) and they go full hands off. Whoah I’m not the bad dev you’ll have to ask the new guys. You can’t ask the new guys. And they’re hiding behind leetcode screens. It’s no wonder why these real problems don’t get fixed and we have new outlook. It’s the senior dev from earlier who now works there. All the real devs are retired. Even when I do get a real answer from Microsoft on annoying things like the user home documents folder being used inappropriately by random programs or straight up forcefully deleted by onedrive in an oopsie, their answer they senior dev invented to give me or go on length about in a technical document or angry interview online is invalidated within 6 months when Microsoft just vibe pushes a random change that randomly alters how these things work in both not a good way and it invalidates their entire core argument. Just like notepad updates as another example off the top of my head. There are dev interviews talking about how this is a very simple program because it needs to be 0 risk. Then it gets a Microsoft auth login with copilot. The whole leetcode dev attitude and Microsoft culture really ruins the entire industry. We can’t have civil discussions. Everything turns into Nuh uh your argument is invalid because you don’t work at Microsoft. Google Chrome famously having chrome install into appdata to exploit and bypass admin rights is a core memory. That’s clearly not the actual intention of that feature for 3rd parties to use in order to bypass having administrator authority. But now this is retconned by the devs as an intended feature because chrome ended up being good at the time at having to sort out the mess of deploying a 3rd party exception program on millions of locked down business computers would’ve been a nightmare.
- vee-kay 6mo ago[dead]
- layer8 6mo agoIt’s similar to how Unix programs weren’t consistent on whether they look for http_proxy or for HTTP_PROXY, and nowadays many(?) are looking for both, but maybe not in the same order.
- unnouinceput 6mo agoOne of the first things I do (after using O&O ShutUp10++ of course) when setting a new installation is to create "C:\Temp\" folder and go to them variables to point there. Mind you, you have global TMP and TEMP, and you have user defined (which points to \Windows\Temp instead of %LOCALAPPDATA%/Temp) ones. All 4 will point to my folder and makes my life a lot easier in the long run