
The tale of aux.c - uyoakaoma
http://heirloom.sourceforge.net/mailx_aux_c.html
======
badsectoracula
So, all that text to tell people he is refusing to rename a single file? :-P

I encountered that issue a few times in the past, most recently when a couple
of years ago i was writing the console support for my 3d game engine and made
two files called `con.c` and `con.h`, checked them in to version control and
then at some point (much) later synced it on the Windows side. Fossil (the VCS
i use) simply skipped that file (maybe it complained? i don't remember, but
the files weren't created) and when i tried to build the engine it didn't work
- i thought that i forgot to add the files, rebooted to Linux, forced a re-
add, back to Windows and nothing again.

Eventually it clicked that "con" is a bad word in Windows filesystems, so i
simply renamed the files to `csl.c` and `csl.h` :-P. I found this a bit
irritating because my naming convention follows a mostly rigid pattern where
`xxx_` prefixed functions will always recide on `xxx.c/h` (or `xxx_yyy.c/h`
where yyy is a subsystem or specialization) and i really prefer the `con_`
prefix to the `csl_` one. So far i've kept the `con_` prefix and made a
special note for that in the readme file where i explain the naming
conventions, but every time i have to use or work with that part of the engine
i feel the irritation :-P.

~~~
cup-of-tea
I found it an interesting and well-written piece of history.

------
drfuchs
So, you smug Linux guys think it can't happen to you? Well, before you get off
my lawn, let me tell you a story...

Early versions of FrameMaker kept all resource files (internationalized
strings, dialog box layouts, etc.) in the two subdirectories
.../FrameMaker/Resources/{Unix,Core} (the first one for the Unix platform-
specific resources, and the second for the cross-platform ones also used by
the Mac and Windows ports). We had hundreds of happy customers, and had been
shipping for 4 years or more.

But one new customer was calling in a panic. They'd installed the product, and
it would work fine, but the next morning, it wouldn't even start up, and they
had to re-install it. And then it would break again over night. After much
pulling of hair and gnashing of teeth, it turns out that due to some other
flakey product they were running, they had previously instituted a nightly
cron job that ran around removing any core files it could find (since they
were large and wasteful of precious disk space back in the day). And the
knucklehead who wrote the script had it do a case-insensitive match on "core"
_and_ had it essentially do a "rm -rf" even though no true core file could be
a directory. So, every night, our Core resource directory was blown away.

We actually had to change the product, as this was a big, important customer,
and they outright refused to fix their cron script. Never had this problem on
the Windows and Mac ports.

~~~
jlgaddis
While an interesting story, this is more of a self-imposed customer screw-up
and not quite the same thing, IMO.

~~~
drfuchs
A more direct (though fictional) illustration that Unix also has reserved file
names that you'd better avoid: "I was writing a novel about digging to the
center of the Earth, entitled "core". One day I was running some program that
crashed, and my novel turned into a bunch of binary gibberish." Or how about:
"My video of my kid's first at-bat, in a file I named a.out, got mysteriously
clobbered when I took my first programming class." These are more insidious
than the MSDOS examples, which at least fail right away.

~~~
TorKlingberg
If we're going to criticise Unix file naming, I'd rather talk about how file
names with spaces in them break things, or how hard it is do delete a file
named "-".

~~~
zanchey
There's something in my environment that keeps creating a file called "-" in
my home directory, and it's driving me crazy.

~~~
jovial_cavalier
By convention, when a unix program is passed "\--" it means there are no more
flags being passed. Try the following:

$ rm -- -

~~~
zanchey
Oh, I can remove it... And a few hours or days later it's back!

~~~
jovial_cavalier
Okay, you're gonna want to type $sudo crontab -e...

~~~
codedokode
It is better to write EDITOR=nano sudo crontab ... otherwise instead of
edititng the crontab you will be solving the problem of exiting vi.

------
Grom_PE
On Windows, paths can be accessed with \\\?\ prefix:

    
    
        mkdir \\?\V:\con
        notepad \\?\V:\con\aux.txt
    

This avoids reserved filenames as well as 260-character length restriction.
But many programs that try to do any path processing fail after seeing an
unexpected prefix, even File Open dialog (on Win7 at least).

~~~
pjmlp
It was finally fixed on Windows 10.

~~~
Dylan16807
Not really. Windows 10 made it easier in certain ways for a program to support
long file names. But it still requires explicit support, and programs can and
did support it previously. And importantly _explorer_ still doesn't support it
properly.

~~~
pjmlp
It just requires enabling it, no special care from applications.

It is disabled by default due to backwards compatibility.

[https://msdn.microsoft.com/en-
us/library/windows/desktop/aa3...](https://msdn.microsoft.com/en-
us/library/windows/desktop/aa365247\(v=vs.85\).aspx)

The file explorer does not support it on purpose.

[https://superuser.com/questions/1114359/windows-10-home-
anni...](https://superuser.com/questions/1114359/windows-10-home-anniversary-
update-long-path-fix-not-working)

~~~
Dylan16807
Once you enable that, it still only works on applications that explicitly
declare support in their manifest.

The backwards compatibility here is only in the fine details of _how_ you deal
with long paths. The old way and the new way both require application support.
The new way is easier, but the old way worked fine even on XP and earlier.

This setting isn't actually future-looking. It was already possible to make
these files with certain tools. And they could have let it always be on for
programs that support it. This setting exists so you can signal to programs
that they _shouldn 't_ use long paths, even when they are capable of it.

> The file explorer does not support it on purpose.

Sure, it's on purpose, but it's a good example of how impotent the setting is.

------
spullara
In 1991 I was working at a place with a Novell Netware network. I decided to
make a system that would execute remote commands by writing them to a shared
directory and other machines would see the files and execute the commands. I
named those files COMXXXXX.TXT where the X's were a random number (yeah, that
was a bad idea). Every few days the system would hang and stop working. I
finally narrowed it down to the random number being 1-9 that would correspond
to the serial ports on the machine and it would then hang.

~~~
tedunangst
Lesson: always zero pad.

~~~
jsymolon
Be careful with that. Using leading zeros (in KSH) treats them as octal and
doing things "old" school will break.

------
feelin_googley
If I had to guess I would bet that none of the commenters in this thread have
ever used the Heirloom version of "mailx", and some have never used, or would
ever want to use, the BSD mailx either.

It is a shame because I think Mr. Ritter deserves more recognition for his
work.

IMHO, some of his versions are real improvements over the BSD ones, e.g.,
troff (doctools) and nailx.

I for one am very thankful for the Heirloom Project and very glad to see it
live on.

~~~
sevensor
I know of him through the version of vi that comes with Arch. I really
appreciate that there's somebody keeping a conservative version of vi around.
Even if I'm mostly going to use vi-like editors with more features, I'm glad
there's a vi to fall back on.

------
pcwalton
We ran into this issue in Servo too.
[https://github.com/servo/servo/issues/1226](https://github.com/servo/servo/issues/1226)

~~~
JoshTriplett
Same thing in Cargo: [http://sasheldon.com/blog/2017/05/07/how-i-broke-cargo-
for-w...](http://sasheldon.com/blog/2017/05/07/how-i-broke-cargo-for-windows/)
[https://github.com/rust-lang/cargo/issues/3982](https://github.com/rust-
lang/cargo/issues/3982)

~~~
catwell
... and the Linux kernel itself.

[https://bugs.eclipse.org/bugs/show_bug.cgi?id=509072](https://bugs.eclipse.org/bugs/show_bug.cgi?id=509072)

I learned about this when I added cloning the Linux kernel repository to an
integration test suite for a cross-platform filesystem. I had to use another
project because of that file :)

------
condescendence
>But nowadays, people confuse Microsoft Windows, the successor to DOS, with a
Unix operating system, and want to run mailx on it.

...huh

>If you want to use mailx, there is the technically and morally sane option of
using a free Unix implementation.

I mean it's really not that hard to release a Windows compatible version. You
change a single file name?

This just sounds like throwing gas on the flame war that is unix vs windows.

~~~
jstanley
It was written in 2007. There was much greater tension between Microsoft and
free software at that time.

~~~
condescendence
yeah I just noticed that, good point. Although releasing as much OSS/Free
software to every OS (regardless of status) would have been a better fighting
route than "*uck you."

------
billpg
Is this when I get to complain about operating systems that allow spaces in
filenames which also have a shell language that makes it difficult to use
those files?

------
trothamel
Even if Microsoft keeps this behavior, I'm surprised they don't modify it to
check the filename extension. It's one thing to change a device like CON that
people might expect to exist, but it seems like not distinguishing CON and
con.c is just asking for trouble.

~~~
dfox
That behavior is intentional and is workaround for programs that does not let
user change file extension on saving.

~~~
ploxiln
The funny part is, that is not the purpose at all any more. It was probably
only for a handful of years that this trick was needed to "trick" programs
which thought they were saving a normal file and forcing the correct extension
to actually use a printer or serial port. No one has used a printer or serial
port by File -> Save As to "lpt.txt" in decades!

Now it's just because some code hidden away under 10s of layers a millions of
lines in some obscure line-of-business applications is accidentally dependent
on this quirk and "it works now" and no one will ever fix it.

~~~
kevin_thibedeau
This isn't an issue for contemporary human facing UIs. Somewhere there is
guaranteed to be a crusty POS system still in use that is sending receipt data
to LPT.TXT or AUX.TXT.

~~~
flukus
They could remove it in a new version of windows, that crusty POS system is
going to be doing a lot of testing before they upgrade the version of windows
it's running on. Even more likely is that they'll never upgrade from whatever
ancient version they're using so it won't affect anyone.

I think they just keep it because it feeds into the backwards compatibility
myth that MS has built up.

~~~
colejohnson66
Or they could just create a registry flag that enables the backwards
compatible behavior. Then all default installs don't have the "bug", while
those that need it can enable it.

~~~
captainmuon
They could probably make the new behavior opt-in in the application manifest.

Without a manifest, you'll see pre-XP common controls, and GetVersion will
return an old version, so every modern application has it anyway.

~~~
therein
They could even incorporate this into some sort of... Compatibility Mode.

------
tasty_freeze
This is an entirely different mechanism, but was bitten not long ago by a
surprising feature of the C++ language. It was as surprising to me as I
imagine saving a file to aux.c would be.

I was working on a C++ program, editing, compiling, debugging as one does.
After a while, my efforts to compile were stymied due to a flood of weird
compiler errors that didn't make sense. After rewinding recent changes to a
point where I knew it used to compile, it still refused to compile.

Finally I figured it out. During debugging, I created two copies of log file,
one called "old" and one called "new". Somewhere in an include file (which
probably included other files, etc), there was a statement "#include <new>".
Rather that picking up the library source code, it tried to interpolate the
contents of the local file "new" during the compile phase.

------
tedunangst
Every time I read this I have to wonder how many windows users are really
interested in running mailx.

------
pjc50
See also
[https://news.ycombinator.com/item?id=12129647](https://news.ycombinator.com/item?id=12129647)
"Git for Windows accidentally creates NTFS alternate data streams"

------
Theodores
I came from a BBC Micro background and found MS-DOS to be a step backwards
from what I knew. I couldn't believe how naff MS-DOS was and how lazy the
coders must have been to make it so primitive. I also found PC vendors to be
lazy too, it wasn't as if any of them made an effort to do any code to improve
on matters, they just shoved the same old MS-DOS in the box.

What I had not realised before reading this article was that the file system
was as flat as Acorn's ADFS, i.e. no hierarchy. How this joke of a product
came to take over the world and take us from networked computing to standalone
'personal computing' was a tragedy, holding computing back 'decades' rather
than enabling a better world.

~~~
Triave
ADFS allowed directories, but used "." as the separator, giving you paths like
"Letters.Memo1".

Were you thinking of DFS?

~~~
Theodores
You couldn't do hierarchy though, it was only one deep.

~~~
to3m
That was true for DFS, but not ADFS.

------
D-Coder
Does anyone remember Basic-4 systems?

I transferred several programs, in those days and on that system with a
maximum of six characters for the name, from one machine to another via
magtape. One was named "CR" (customer report or credit report, who knows). It
disappeared on the new system because it was mistaken for the Card Reader.

------
libeclipse
Lol, a huge wall of text because the OP doesn't want to rename a single file.

Jeez.

~~~
wruza
Most of that text explains the often forgotten issue, it is only the last
paragraph that tells his preferences. I didn't even know that CP/M was sane in
its naming scheme and thought it was CP/M legacy, not Microsoft's madness.
Pretty informative, though not much surprising.

------
dustingetz
"{S /con/con" in AOL chat used to BSOD everybody's computers - {s was a
directive to play a sound

~~~
rasz
you could do the same thing to Internet Explorer with simple image link

------
JosephRedfern
What happens if you create a file called aux.c under a different OS, and then
mount the drive on Windows?

~~~
sophacles
This is the type of question that leads to new classes of exploit... well
thought!

~~~
emerged
Except it's one of the first things each of the thousands (likely more) of
professional and hobbyist hackers have already tried after learning about this
particular OS quirk

------
richard_todd
I wonder if the restricted names are still with us in ReFS? I don't have one
handy to check it on, but it seems like if there were ever a good time to
break backwards-compatibiliy, ReFS would be it.

~~~
colejohnson66
The restriction isn't in the filesystem. You can mount an NTFS filesystem on a
Linux box, create a file called "aux.c", then mount that filesystem on
Windows.

See also:
[https://news.ycombinator.com/item?id=15335209](https://news.ycombinator.com/item?id=15335209)
and
[https://news.ycombinator.com/item?id=15335474](https://news.ycombinator.com/item?id=15335474)

~~~
dom0
With default mount options you can even create files/folders named foo\bar.

