News for hackers. Stuff that matters.
Re:MS Teams channels cannot contain MS-DOS device names by owlninja on Thursday August 10, 2023 @10:31AM (#37076633)
Words: forms, CON, CONIN$, CONOUT$, PRN, AUX, NUL, COM1 to COM9, LPT1 to LPT9, desktop.ini, _vti_
Re:MS Teams channels cannot contain MS-DOS device names by Brian_K_White on Thursday August 10, 2023 @10:46AM (#37076829)
I was about to say "Which is essentially leaking the existence of something terrible inside. They should be embarrassed to say something like this in public. Like saying you can't have %s or $PS1. Why the hell not? What are you doing with this user-supplied input?"

But maybe it's more about what everyone else might do with a channel name. Ie they might cut & paste it anywhere, and I guess windows users aren't expected to escape their own strings when pasted into cmd or powershell or wsl.

Re:MS Teams channels cannot contain MS-DOS device names by dharmab on Thursday August 10, 2023 @10:55AM (#37076947)
The Something Terrible in this case is early DOS which did not have separate folders. So the device files were in the same namespace as the user's files, so the user couldn't name a file CON or LPT1. These are preserved for backwards compatibility. To this day you can write a program that writes to a CON file in any folder, and the program will print the write to console.
Re:MS Teams channels cannot contain MS-DOS device names by ChrisSD on Thursday August 10, 2023 @11:15AM (#37077215)
This has actually changed a bit in the last few years. In Windows 11 writing to `.\CON` will write to the file but writing to `CON` will still write to the console.
Re:MS Teams channels cannot contain MS-DOS device names by xp84 on Thursday August 10, 2023 @03:09PM (#37080417)
Another interesting aspect of this, which I remember specifically from reading MS-DOS manuals in the 90s as a kid (I was an incredibly fun 12 year old) is that this choice was an intentional one done in the name of flexibility. These device names were correctly written with a colon, but you are allowed to omit the colons. For instance:

copy con lpt1

And

copy con: lpt1:

were interchangeable. If they’d chosen to not save users keystrokes and force colons when referencing devices, I’m not positive, but I think it would have eliminated the need for many of these reserved words in file names in general.

Also, side note, the “copy con outputfilename.txt” idiom is one that I still can’t ever remember how to do the equivalent on UNIX/Linux!

Re:MS Teams channels cannot contain MS-DOS device names by gnosek on Thursday August 10, 2023 @04:41PM (#37081489)
> Also, side note, the “copy con outputfilename.txt” idiom is one that I still can’t ever remember how to do the equivalent on UNIX/Linux!

cat > outputfilename.txt

Re:MS Teams channels cannot contain MS-DOS device names by xp84 on Monday August 14, 2023 @12:44PM (#37123160)
But it's not CTRL-Z to end, right? That's the part I forget every time :D
Re:MS Teams channels cannot contain MS-DOS device names by Brian_K_White on Thursday August 10, 2023 @07:23PM (#37083027)
One of my favorite bbs sig tags was "REAL programmers use COPY CON FILE.EXE"
Re:MS Teams channels cannot contain MS-DOS device names by vel0city on Thursday August 10, 2023 @10:52AM (#37076909)
> What are you doing with this user-supplied input?

Creating Sharepoint shares which can be mounted as network shares in Windows where these filenames are not allowed?

Re:MS Teams channels cannot contain MS-DOS device names by tapoxi on Thursday August 10, 2023 @10:49AM (#37076864)
I thought this as well but there's plenty of dangerous commands that aren't escaped here. I'm assuming it's a limitation of it actually writing something to the filesystem, hopefully your own (with the desktop app) and not one in Azure.
Re:MS Teams channels cannot contain MS-DOS device names by cueo on Thursday August 10, 2023 @12:25PM (#37078220)
> I was about to say

Yet you said it twice[1].

[1] https://news.ycombinator.com/item?id=37076913

Re:MS Teams channels cannot contain MS-DOS device names by Ekaros on Thursday August 10, 2023 @11:16AM (#37077240)
Now I actually wonder were there ever any machines that had LPT9, COM9 I could barely see.
Re:MS Teams channels cannot contain MS-DOS device names by blueflow on Thursday August 10, 2023 @11:26AM (#37077396)
You can reassign real device to any of these names
Re:MS Teams channels cannot contain MS-DOS device names by Ekaros on Thursday August 10, 2023 @12:04PM (#37077931)
Reassign and actually use all of them are different things.
Re:MS Teams channels cannot contain MS-DOS device names by zaxomi on Thursday August 10, 2023 @12:06PM (#37077957)
MSDOS 3.3 had COM1, COM2, COM3, COM4, LPT1, LPT2, and LPT3. LPT4-9 and COM5-9 was not part of MSDOS.
Re:MS Teams channels cannot contain MS-DOS device names by olyjohn on Thursday August 10, 2023 @06:03PM (#37082359)
IIRC those were mapped to specific I/O and IRQ Ports back in the day.

  COM1: I/O port 0x3F8, IRQ 4
  COM2: I/O port 0x2F8, IRQ 3
  COM3: I/O port 0x3E8, IRQ 4
  COM4: I/O port 0x2E8, IRQ 3
I also remember, there was a while where there was no IRQ sharing. So some machines couldn't use all the COM ports available. Or you'd add in like a modem, and would have to disable the onboard COM port if it was using the same IRQ.
Re:MS Teams channels cannot contain MS-DOS device names by fredoralive on Thursday August 10, 2023 @12:42PM (#37078451)
If you do embedded stuff you can easily get above COM100 if you're doing something like testing (if a USB to serial converter has a serial number, it gets a unique COM port). Although I don't think these high numbers have any effect on the file system, just the legacy low numbered ones DOS could have.
Re:MS Teams channels cannot contain MS-DOS device names by tssva on Thursday August 10, 2023 @03:30PM (#37080649)
Back in the day many of my clients had Windows NT/2000 machines running RAS or RRAS with multi-port serial cards connected to modems for employee remote access. Usually these would be 8 or 16 serial ports per card with multiple cards installed per server.
Re:MS Teams channels cannot contain MS-DOS device names by transitorykris on Thursday August 10, 2023 @11:25AM (#37077372)
In the mid-90s there was a fun and short period of time where IRC clients like mIRC could be set to auto-receive files through DCC.. and would happily write to names like LPT1 (which of course would just write the data directly to the recipient’s printer)
Re:MS Teams channels cannot contain MS-DOS device names by grishka on Thursday August 10, 2023 @01:09PM (#37078798)
Also, send a COM1 file containing "+++ATH" to someone you dislike to see them disconnect. I just made this up but it should work, right?
Re:MS Teams channels cannot contain MS-DOS device names by zten on Thursday August 10, 2023 @05:31PM (#37082057)
For the absolute worst modems, I believe you could just send that in a PING on IRC and their client would write the string back and hang up