412 points · by mmastrac · 5y ago · 192 comments
The problem was introduced, IIRC, in MS-DOS.
This does bring back fond memories. In the early days of Windows 1.x, the way to get debug/log output was with the OutputDebugString() function. This wrote the output to the AUX device, which would be a serial terminal or printer. I didn't have one of those, but did have the IBM Monochrome display sitting idle while Windows ran on the CGA or EGA display.
So I wrote a little DOS driver called AUX.SYS (with source code in AUX.ASM) to redirect AUX output to the Monochrome display.
That did not work very well! I couldn't even edit my source file.
After a while I figured out the problem and renamed the driver to OX.SYS and OX.ASM for the source. Homophones to the rescue!
https://github.com/geary/OX.SYS
And as usual, Raymond Chen has some insights on why these special filenames "worked" regardless of file extension or directory location:
https://devblogs.microsoft.com/oldnewthing/20031022-00/?p=42...
only after the last 32-bit version of Windows 10 goes out of support will some of these things begin to get fixed. and even then it will not be a priority.
With no logging... But invariably, they would not want log files created in their production environment...
So, we would add at least an OutputDebugString() to the catch... prepare a build - then in the production environment we would use the Sysinternals "DebugView" to find out why things were breaking... (And typically - it was a missing dependency or DLL version miss-match from dev to production)
Fun times.
The basename (without the extension) had certain reserved names such as CON, PRN, AUX, PTR, PUN, etc. Originally these names always had a trailing colon to identify them as devices, but MS/DOS dropped that. MS/DOS kept the trailing colons for disk drive identification, but not much else.
This capability could be used to make a batch files (.BAT) without any editor on the system. One could type: COPY CON RUNME.BAT, and then type in the wanted lines of the batch file. The end-of-file character (^Z 0x1A) was the same on CP/M and DOS, unlike (^D 0x04) on Unix.
https://gordonbell.azurewebsites.net/Digital/RT-11%20System%...
coughs in Unix
You can even get it using the Unix path slashes in the 2.11 source code.
As for why default to uppercase instead of lower case, I think just a matter of style. Unix and C favour lower case, FORTRAN and COBOL and your keyboard keycaps favour upper case.
probably to make sensible use of limited display abilities of early hardware, fitting characters in 8x8 boxes and making it readable on blurry fat beam glowing green screens quickly becomes a problem with lowercase (size, readability, ascenders, descenders, baseline), whereas uppercase is comparatively easy.
Some years ago I was working on an embedded system that involved DisplayPort. For those unaware, DP's control channel is called AUX. One day, my new co-worker who used Windows asked me, who used Linux, why my AUX-related code wasn't checked in - which it most certainly was.
And that, folks, is how I learned about this absurd property of Windows that exists to this day.
I can only assume IBM pitched a fit and made MS remove it like they did with SWITCHAR.
If you didn't know about SWITCHAR it allowed you to change DOS to use Unix's "-" switch delimiter instead of "/". This is why DOS/Windows also accepted either "/" or "\" as path separators (and still do).
I wonder why didn’t they instead add a switch to bring back the requirement of a colon after the device name.
I'll guess that you didn't knew that DOS 1.x don't have any concept of directories. It's essentially a novo terra for DOS applications, and makes sense considering that Unix also standardised at /dev.
DJGPP even has a FAQ item about a similar issue: <http://www.delorie.com/djgpp/v2faq/faq22_21.html> (though that one is caused by DJGPP’s own Unix emulation layer)
I wonder why the blame is put on IBM; what problem did they have with this?
For system apps like cmd.exe or explorer.exe, a registry key would be a better solution. That way the end user or sys admin can turn it on or off, whereas the exe manifest is fixed at build time.
"2011-10-05T14:48:00.000Z" - Excel: I have no idea what this is.
Excel: when's that?
Ctrl+A then Alt H N T E enter to make the whole spreadsheet "Text" by default instead of "General". (Or Ctrl+A Alt H N A enter to default everything to "Accounting" if you are just going to be typing in a bunch of dollar amounts, etc.)
The tools are there to "opt out" of "I'm too lazy to set a data type so guess for me" mode and always have been.
We don't get data _that_ often. But when we do, there's 75% chance it's got this problem somewhere. So much so we've created stock template guides.
I'm sick of it. So sick of it.
Sure. I can go through the document one cell at a time and fix the issues. But I don't want to. It's a waste of my week.
If I could count the man hours I've wasted on this over my 10 years at this company....
I never, EVER, want to see another number in scientific notation unless I tell it too.
That said, it should be theoretically possible, but I believe any approach other than hooking into high level IO call will be problematic, and you'd probably lose access to many things like serial/parallel ports etc. (as applications wouldn't know the names you renamed them under).
The big problem here is bare device names, and device names with an extension – e.g. "COM1", "COM1.TXT". Device names with a colon, e.g. "COM1:", are not such a big problem, because colon is not an allowed character in file names on Windows (it is reserved as syntax to specify a drive or stream.) And while colon is a valid character in Unix file names, it is rarely used in practice, so Windows not supporting it is less of a problem than Windows not supporting files named "aux" or "con" is. So if they still recognised the device names with a colon, that would work fine for some programs that already use the colon, and for those that don't it should be an easy fix to just add it before updating the EXE manifest to opt-in to this feature.
Actually there is another fix – in Win32 programming you are recommended to prefix device names with "\\.\" anyway. That is actually mandatory when dealing with more than 9 serial ports (e.g there are multiport serial cards with more than 10 ports, or you might have two 8-port serial cards in your system). If you want to access COM10, you have to prefix it with "\\.\". And it is best practice to use those prefixes even with COM1-9. So programs already following that best practice would need no change. (And few programs directly use serial or parallel ports nowadays anyway.)
We ran into this recently when a bug in Ardour ended up creating files on disk named like "recorder:N". They were created correctly on the disk, and in the Ardour instance that had created them and thus had file handles for them, they could be read without issues. But ... close the program and restart it ... errors about not being able to find the files.
Fortunately, Notepad (I think) is one of the few applications that can handle these names (I have no idea why), and so it could be used to open and save the files under a "better" name.
ps. after 35 years in computing, I have not used Windows for more than 30 minutes in total. This account is based on being a developer of a cross-platform application who reads bug reports and interacts with users.
I wonder if they should only exist for command line apps although I wonder if there aren't still GUI apps that control industrial machinery by opening "COM1" as a file.
You can even demonstrate this with cmd.exe (which uses the Win32 API, it doesn't directly access the NT API)
`mkdir c:\con` will not work, says `The directory name is invalid.`
`mkdir \\?\c:\con` does work. But then to delete you have to use the \\?\ prefix again. And `cd \\?\c:\con\` doesn't work, you get the `CMD does not support UNC paths as current directories` error. (Win32 does, this is a cmd.exe limitation only)
My proposal was to have a way of getting the `\\?\` behaviour without having to explicitly provide that prefix.
Actually, not quite. There is one aspect of `\\?\` which is undesirable. The NT API only supports backslash as a directory separator. The Win32 API supports forward slash as well, it automatically converts forward slash to backslash. But `\\?\` turns that conversion off. I think you'd still want the forward to backslash conversion on, to maximise compatibility with Unix.
If anybody knows of anyone using those special files in programs running on modern Windows, I'd love to hear about it.
That's why they still work. For the same reason as other DOS Aliases, like C:
If you use UNC paths, you can bypass alias names, because your path will be unambiguous - however if you write such name into one of the "classic" visible name spaces, software that uses classic paths (for example because people are familiar with them, and because rewriting all strings to ensure you use UNC is annoying) might... Find issues ;-)
I was just pointing out that COPY was not the only use :)
But it wasn't insane to begin with. The insane part is never changing it.
cat /dev/urandom | aplay
Still works well on my machine, and I use it all the time to test :)Also, why 260?
Or for older Windows versions you can use UNC paths and skip the fixed-size Unicode normalization buffer than introduces the `MAX_PATH` limitation: https://docs.microsoft.com/en-us/dotnet/standard/io/file-pat...
You can have paths exceeding 260 chars for a long time now. The problem is that the older Win32 APIs that deal with files have structs with TCHAR[MAX_PATH] field in them, so changing that length would be a binary breaking change for apps.
So the new APIs allow for longer paths, but code has to be specifically written to take advantage of them. Some languages and frameworks - e.g. Node.js and Python - had that support for a while; others are still catching up.
Even remotely, <img src="file://c:/con/con"> on a website
Those were fun times
There are a bunch of these special files. [0]
[0] A list is deep on this page: https://docs.microsoft.com/en-us/windows/win32/fileio/naming...
So, for example, `C:\Users\ChrisSD\AUX` will be resolved to `\??\AUX`.
Even more surprisingly, any filename that starts with `aux.` will also be affected by this. E.g. `C:\Users\ChrisSD\aux.txt`.
azure-pipelines.yml
This is the 1980s holdout that bothers me much more. It's 2021 and Microsoft still clings to three-letter filename extensions? Curiously, they did abandon the 8 in 8.3, but not the 3.Yup, that's a timeless message :-)
A fun dive into windows history and backwards compatibility.
I thought they found a bug in ALGOL60 code or something, which would have been funny as last week's pentest was written in an arcane language like that and likely last updated around the same time (not something we see every day; quite the opposite in terms of reinventing the wheel actually).
It might not be a great feature anymore, but it's not a bug. A 40 year old bug is things like TCP didn't have timeouts in all states, so LAST_ACK sockets should stay around forever if you follow the spec, or that if the two peers get mixed up about where the seq and ack are, each ack will elicit an ack from the other side, and if the peers are near enough to each other, that can result in gigabits of useless ack traffic that never results in data exchange (thankfully this isn't a common state; I've only seen it as a result of a bug in one OSes syncookies that was fixed, and it is likely to end with a timeout)
The error message says that the file is too large for the destination file system (despite being under 10KB). It's unambiguously a bug.
https://news.ycombinator.com/item?id=20081056
> so given this is a choice between two options, I can either: 1. make rambly tweet-threads that some people hate and wish were blogs 2. make no blog posts
> I am sorry that I am picking #1, but it's really best for everyone.
If everyone took everything I ever said I "kinda wish" as a solid preference, I wouldn't be at all happy.
But what if he was a "bad" (in quotes) guy? Like the CEO from the recent repl.it debacle. What if he asks to stop linking to his bullying tweets? Nobody would side with him.
So.. where's the line? Is anything public fair play? Who decides if someone is bad or good? The collective internet mob? Surely nothing can go wrong with that.
Foone is more than competent enough to publish to the web with whatever access control they find agreeable. jwz is, as well, and doesn't like being linked from HN either, for example.
Posting on Twitter publicly is consent to be linked to, regardless of what other words are said.
Here is a temporary solution to I am using to fetch the JSON from the command line and make simple HTML. I did try Nitter but found that sometimes instances were exceeding rate limits.
json_reformat is from https://github.com/lloyd/yajl
this uses stunnel and nc but can easily be adapted to use openssl, bssl, haproxy, or whatever other ssl solution you prefer
example usage - read twitter.com/foone
1.sh foone > 1.json
1.sh < 1.json > 1.htm
firefox ./1.htm
#!/bin/sh
case $# in :)
;;0) # make simple html;
sed -n /{\"data\"/p|json_reformat|tr -cd '\12\40-\176'|sed -n -e 's/ *//' -e 's/\\n/ /g' \
-e '/created_at/p;/sation_id_str/p;/full_text/p'|grep -B2 full_text \
|sed 's,https://[^ \"]*,<a href=&>&</a>,g;s/\",$/&<br>/g;s/^--/&<br>/'
;;1) # fetch json;
M="GET"; V="HTTP/1.1";H="host: twitter.com";I="104.244.42.129:443";C="connection: close";
A="authorization: Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA";
P1="/i/api/graphql/Vf8si2dfZ1zmah8ePYPjDQ/UserByScreenNameWithoutResults?variables=%7B%22screen_name%22%3A%22$1%22%2C%22withHighlightedLabel%22%3Atrue%7D";
S1(){ printf "%s\n%s\n%s\n%s\n%s\n" "pid=$HOME/1.pid" "[ $$ ]" "accept=127.0.0.7:80" "client=yes" "connect=$I"|stunnel -fd 0;};
S2(){ kill -9 $(cat $HOME/1.pid);};
N(){ nc -n 127.7 80;};
S1;x=$(printf "%s %s %s\r\n%s\r\n%s\r\n\r\n" "$M" "/" "$V" "$H" "$C"|N|grep -o "gt=[^;]*"|sed 's/gt=//');t="x-guest-token: $x";
y=$(printf "%s %s %s\r\n%s\r\n%s\r\n%s\r\n%s\r\n\r\n" "$M" "$P1" "$V" "$H" "$A" "$t" "$C"|N|grep -o "rest_id\":\"[^\"]*"|sed 's/.*\"//');
p2="/i/api/graphql/Bn2jPG0Cy8VAOakAoyV_kA/UserTweets?variables=%7B%22userId%22%3A%22$y%22%2C%22count%22%3A500%2C%22withHighlightedLabel%22%3Atrue%2C%22withTweetQuoteCount%22%3Atrue%2C%22includePromotedContent%22%3Atrue%2C%22withTweetResult%22%3Afalse%2C%22withUserResults%22%3Afalse%2C%22withVoice%22%3Afalse%2C%22withNonLegacyCard%22%3Atrue%2C%22withBirdwatchPivots%22%3Afalse%7D";
printf "%s %s %s\r\n%s\r\n%s\r\n%s\r\n%s\r\n\r\n" "$M" "$p2" "$V" "$H" "$t" "$A" "$C"|N;S2;
esac # 1.sh username > 1.json
# 1.sh < 1.json > 1.htm
# or
# 1.sh username|1.sh > 1.htm
# firefox ./1.htm (zoom in)
case $# in :)
;;1)
public_ip=104.244.42.129:443;
public_host="Host: twitter.com";
public_token="Authorization: Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA";
printf "%s\n%s\n%s\n%s\n%s\n" "pid=$HOME/1.pid" "[ $$ ]" "client=yes" "accept=127.0.0.7:80" "connect=$public_ip"|stunnel -fd 0;
x=$(printf "GET / HTTP/1.1\r\n%s\r\nConnection: close\r\n\r\n" "$public_host"|nc -vvn 127.7 80|grep -o "gt=[^;]*"|sed 's/gt=//');
echo gt $x >/dev/stderr;y=$(printf "GET %s HTTP/1.1\r\n%s\r\n%s\r\n%s\r\nConnection: close\r\n\r\n" \
"/i/api/graphql/Vf8si2dfZ1zmah8ePYPjDQ/UserByScreenNameWithoutResults?variables=%7B%22screen_name%22%3A%22$1%22%2C%22withHighlightedLabel%22%3Atrue%7D" \
"$public_host" "$public_token" "X-Guest-Token: $x"|nc -vvn 127.7 80|grep -o "rest_id\":\"[^\"]*"|sed 's/.*\"//');
echo rest_id $y >/dev/stderr;printf "GET %s HTTP/1.1\r\n%s\r\n%s\r\n%s\r\nConnection: close\r\n\r\n" \
"/i/api/graphql/Bn2jPG0Cy8VAOakAoyV_kA/UserTweets?variables=%7B%22userId%22%3A%22$y%22%2C%22count%22%3A500%2C%22withHighlightedLabel%22%3Atrue%2C%22withTweetQuoteCount%22%3Atrue%2C%22includePromotedContent%22%3Afalse%2C%22withTweetResult%22%3Afalse%2C%22withUserResults%22%3Afalse%2C%22withVoice%22%3Afalse%2C%22withNonLegacyCard%22%3Atrue%2C%22withBirdwatchPivots%22%3Afalse%7D" "$public_host" "$public_token" "X-Guest-Token: $x"|nc -vvn 127.7 80
kill -9 $(cat "$HOME"/1.pid)
;;0)
x=$(echo x|exec tr x '\34');
sed -e 's/\\"/\"/g;s/\\n/ /g' -e "s/\"legacy\":/$x/g" \
|exec tr -cd '\34\11\12\40-\176'|exec tr -d '\12'|exec tr '\34' '\12' \
|exec grep -Eo '("created_at":"[^"]*)|("conversation_id_str":"[^"]*)|("url":"[^"]*)|("expanded_url":"[^"]*)|("full_text":"[^"]*)' \
|exec sed '/"created_at":"/s//<br>/; /"conversation_id_str":"/s///;/"url":"/{s///;s/"//g; s/.*/<a href=&>&<\/a>/;};
/"expanded_url":"/{s///;s/.*/<a href=&>&<\/a>/;};/"full_text":"/s///; s| https://[^ ]*| <a href=&>&</a> |g;s/> />/g;
/^RT @/s/$/ (RETWEET)/;s/$/<br>/;s/\\u.\{4\}//g'|uniq
esacMight be interesting, but feels like the wrong format.
I don't have ADHD but I certainly find a Twitter thread much more distracting than a blog post to read. I need to untrain my mind that the entire message isn't done by the end of the tweet. And ignore all the other crap that Twitter is trying to get me to click on in the trending topics. I have to be extremely interested in a Twitter thread to read it. It's just a horrible format.
its all so tiresome