Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Ender.uNF posted:

The real horror is MAX_PATH, a gift that will keep on giving.

You mean PATH_MAX?

Adbot
ADBOT LOVES YOU

npe
Oct 15, 2004
For some serious coding horrors, think of how you'd use the win32 api hack/workaround for longer paths from a C# application. The horror at the time I had to do this was me. :(

Edit: for a good discussion of why this is so horrific to do, see http://blogs.msdn.com/b/bclteam/archive/2007/02/13/long-paths-in-net-part-1-of-3-kim-hamilton.aspx

npe fucked around with this message at 17:10 on Aug 26, 2013

EssOEss
Oct 23, 2006
128-bit approved
The disease of MAX_PATH can even cross OS boundaries. The Team Foundation client plugin for Eclipse running on Mac OS X complains about MAX_PATH being hit at the 260 character limit.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
The real horror is seeing MAX_PATH used all over a project to statically size strings that aren't even paths.

Dr Monkeysee
Oct 11, 2002

just a fox like a hundred thousand others
Nap Ghost

Ender.uNF posted:

The real horror is MAX_PATH, a gift that will keep on giving.

I had Visual Studio fail to build a project due to a source tree that had too deep a directory structure. It was fine for a long time until I added one more subfolder that broke its back and suddenly it was failing the build as "12 of 12 projects built successfully; build failed". There was no error message in the build output even after turning on maximum verbosity. Just "everything built successfully; build failed." After reorganizing the folders to be less nested everything magically worked again.

This wasn't a Java project so I guess the horror was me.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
You're already at a disadvantage in Visual Studio if you let it set up your sources under your Documents and Settings hierarchy since that just tacks on a bunch of other stuff. But I suppose you can swing the whole mess the other way and make another horror by putting your sources under C:\s or something.

Dr Monkeysee
Oct 11, 2002

just a fox like a hundred thousand others
Nap Ghost
That was more or less what happened. My svn repo was under AppData/Local because That's How You Do Things in the brave new world of UAC. Moving it up to C:\ temporarily fixed the problem (though the directory structure was a legit horror and I fixed that too).

Another fun horror: if you run a local website under IIS and the folder is somewhere under your User directory instead of out in the wild of C:\ you end up with all kinds of weird static file handler permissions issues that are tricky to work around as you can't just slap an ACL on it and call it a day.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



npe posted:

For some serious coding horrors, think of how you'd use the win32 api hack/workaround for longer paths from a C# application. The horror at the time I had to do this was me. :(

Edit: for a good discussion of why this is so horrific to do, see http://blogs.msdn.com/b/bclteam/archive/2007/02/13/long-paths-in-net-part-1-of-3-kim-hamilton.aspx

How the gently caress do they figure that it's reasonable for a long file name to bypass every other file name restriction, too? I guess it'd take a bunch of disk IO to check a really stupidly deep folder structure, but that doesn't strike me as a good reason, just a dumb excuse.

Amarkov
Jun 21, 2010
We are using a unit test to initialize the database.

Except that the unit test does not actually check the configuration files, and thus attempts to initialize localhost:3306 and localhost:27017 regardless of where the rest of the build thinks the databases are located.

I have no words.

No Safe Word
Feb 26, 2005

Windows path horrors? It makes me laugh to no end that poo poo like this still works:

code:
C:\Program Files\Microsoft Office\Templates\Presentation Designs>dir
 Volume in drive C has no label.
 Volume Serial Number is 10DD-E606

 Directory of C:\Program Files\Microsoft Office\Templates\Presentation Designs

07/22/2013  08:28 PM    <DIR>          .
07/22/2013  08:28 PM    <DIR>          ..
09/29/2012  04:11 PM             1,466 Maple.gif
               1 File(s)          1,466 bytes
               2 Dir(s)  391,930,040,320 bytes free

C:\Program Files\Microsoft Office\Templates\Presentation Designs>cd \

C:\>cd PROGRA~1\MICROS~1\TEMPLA~1\PRESEN~1

C:\PROGRA~1\MICROS~1\TEMPLA~1\PRESEN~1>dir
 Volume in drive C has no label.
 Volume Serial Number is 10DD-E606

 Directory of C:\PROGRA~1\MICROS~1\TEMPLA~1\PRESEN~1

07/22/2013  08:28 PM    <DIR>          .
07/22/2013  08:28 PM    <DIR>          ..
09/29/2012  04:11 PM             1,466 Maple.gif
               1 File(s)          1,466 bytes
               2 Dir(s)  391,930,040,320 bytes free
This is on Windows 8 x64.

Volte
Oct 4, 2004

woosh woosh
Everything that has ever worked will continue to work, forever.

pseudorandom name
May 6, 2007

No Safe Word posted:

Windows path horrors? It makes me laugh to no end that poo poo like this still works:

code:
C:\Program Files\Microsoft Office\Templates\Presentation Designs>dir
 Volume in drive C has no label.
 Volume Serial Number is 10DD-E606

 Directory of C:\Program Files\Microsoft Office\Templates\Presentation Designs

07/22/2013  08:28 PM    <DIR>          .
07/22/2013  08:28 PM    <DIR>          ..
09/29/2012  04:11 PM             1,466 Maple.gif
               1 File(s)          1,466 bytes
               2 Dir(s)  391,930,040,320 bytes free

C:\Program Files\Microsoft Office\Templates\Presentation Designs>cd \

C:\>cd PROGRA~1\MICROS~1\TEMPLA~1\PRESEN~1

C:\PROGRA~1\MICROS~1\TEMPLA~1\PRESEN~1>dir
 Volume in drive C has no label.
 Volume Serial Number is 10DD-E606

 Directory of C:\PROGRA~1\MICROS~1\TEMPLA~1\PRESEN~1

07/22/2013  08:28 PM    <DIR>          .
07/22/2013  08:28 PM    <DIR>          ..
09/29/2012  04:11 PM             1,466 Maple.gif
               1 File(s)          1,466 bytes
               2 Dir(s)  391,930,040,320 bytes free
This is on Windows 8 x64.

That spreadsheet you created on Windows 3.11 and then updated once on Windows 95 before the Office 95 upgrade had better keep working, or else people will be pissed.

Workaday Wizard
Oct 23, 2009

by Pragmatica
I am guilty of using PROGRA~1 more than once. Escaping paths is :effort:

E: This was on 32bit and for personal purposes only thankfully.

Dr Monkeysee
Oct 11, 2002

just a fox like a hundred thousand others
Nap Ghost

pseudorandom name posted:

That spreadsheet you created on Windows 3.11 and then updated once on Windows 95 before the Office 95 upgrade had better keep working, or else people will be pissed.

No joke this accounts for a significant number of Windows horrors. Dominant market share is a double-edged sword.

omeg
Sep 3, 2012

pseudorandom name posted:

That spreadsheet you created on Windows 3.11 and then updated once on Windows 95 before the Office 95 upgrade had better keep working, or else people will be pissed.

code:
C:\Windows\system32>fsutil behavior query disable8dot3
The registry state of NtfsDisable8dot3NameCreation is 1 (Disable 8dot3 name creation on all volumes).
It broke! :argh:

pseudorandom name
May 6, 2007

TechNet says it is per-volume now.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

qntm posted:

See also: GNU make.

Example: You can't build busybox in a directory where any component has
a colon in it. Odd case, yes, but it really annoyed me.

I think the problem is with the make language itself, rather than the
GNU make implementation. I recall being told that make's awful syntax is
from the fact that the designed didn't know how to properly use yacc, so
the first implementation had a hacked together parser. He later learned
how to do it properly, but by then he had a user, so couldn't fix it,
and we've been paying for this ever since.

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction

Shinku ABOOKEN posted:

I am guilty of using PROGRA~1 more than once. Escaping paths is :effort:

E: This was on 32bit and for personal purposes only thankfully.

mklink /d "c:\program files (x86)" c:\bin32
mklink /d "c:\program files" c:\bin

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Amarkov posted:

We are using a unit test to initialize the database.

Except that the unit test does not actually check the configuration files, and thus attempts to initialize localhost:3306 and localhost:27017 regardless of where the rest of the build thinks the databases are located.

I have no words.

You could always fix the test to read the config file.

Amarkov
Jun 21, 2010

Volmarias posted:

You could always fix the test to read the config file.

Or I could do the sane thing and make it a separate part of the automated build process.

Then again, all of the configuration files look auto-generated, so it's conceivable that nobody actually understood what Maven does.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Amarkov posted:

Or I could do the sane thing and make it a separate part of the automated build process.

Then again, all of the configuration files look auto-generated, so it's conceivable that nobody actually understood what Maven does.

You mean aside from backing up the internet?

Opinion Haver
Apr 9, 2007

Edison was a dick posted:

Example: You can't build busybox in a directory where any component has
a colon in it. Odd case, yes, but it really annoyed me.

I think the problem is with the make language itself, rather than the
GNU make implementation. I recall being told that make's awful syntax is
from the fact that the designed didn't know how to properly use yacc, so
the first implementation had a hacked together parser. He later learned
how to do it properly, but by then he had a user, so couldn't fix it,
and we've been paying for this ever since.

Are you posting from emacs with auto-fill-mode or something?

xtal
Jan 9, 2011

by Fluffdaddy
We follow PEP 8 around here.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

yaoi prophet posted:

Are you posting from emacs with auto-fill-mode or something?

Firefox with Vimperator plugin. I opened up vim with ^I to fix something since I find text boxes too constraining and habitually reformatted the text.

I get called a nerd by professional software engineers for doing this.

TheresaJayne
Jul 1, 2011

Gazpacho posted:

The real horror is seeing MAX_PATH used all over a project to statically size strings that aren't even paths.

The weird thing is that when i see MAX_PATH in the forum i hear a voice in my head saying something like
"Max Path sat down at his desk, when there was a knock on his door. "Yep" he said as a gorgeous gal drifted in the opening door."

:)

Pilsner
Nov 23, 2002

Monkeyseesaw posted:

I had Visual Studio fail to build a project due to a source tree that had too deep a directory structure. It was fine for a long time until I added one more subfolder that broke its back and suddenly it was failing the build as "12 of 12 projects built successfully; build failed". There was no error message in the build output even after turning on maximum verbosity. Just "everything built successfully; build failed." After reorganizing the folders to be less nested everything magically worked again.

This wasn't a Java project so I guess the horror was me.
I had a working and building solution on my computer that failed on another dev's. Turns out that with my source root being "c:\dev", everything was fine, but the guy has his stuff in "c:\SourceControl", which made the total path including a ridiculously long and verbose service reference too long on his machine.

tef
May 30, 2004

-> some l-system crap ->

No Safe Word posted:

Windows path horrors? It makes me laugh to no end that poo poo like this still works:

This is on Windows 8 x64.

http://blogs.msdn.com/b/oldnewthing/archive/2005/07/15/439261.aspx

If you delete a file and create a new one with the same name it inherits the properties of the old one

IT BEGINS
Jan 15, 2009

I don't know how to make analogies
php:
<?
extract($vals);
$ref = $referencenotes;
if (!strstr ("XDXD", "$CUSTCODE$")) {
    $refnum      = $vals["referencenotes2"];
    $brk = "; ";
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["referencenotes3"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custponum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custinvnum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custdeptnum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["department"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;
}
?>
Somehow, I don't think think this was the best way to handle this. If you're wondering what $CUSTCODE$ is, seems they decided to implement a pre-processor for php. :what:

substitute
Aug 30, 2003

you for my mum

Vasja posted:

php:
<?
extract($vals);
$ref = $referencenotes;
if (!strstr ("XDXD", "$CUSTCODE$")) {
    $refnum      = $vals["referencenotes2"];
    $brk = "; ";
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["referencenotes3"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custponum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custinvnum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custdeptnum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["department"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;
}
?>
Somehow, I don't think think this was the best way to handle this. If you're wondering what $CUSTCODE$ is, seems they decided to implement a pre-processor for php. :what:

Also, extract() creates key/value pairs from an array. So, they could use $whatever instead of $vals['whatever'] after the extract.

nielsm
Jun 1, 2009



Vasja posted:

php:
<?
extract($vals);
$ref = $referencenotes;
if (!strstr ("XDXD", "$CUSTCODE$")) {
    $refnum      = $vals["referencenotes2"];
    $brk = "; ";
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["referencenotes3"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custponum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custinvnum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custdeptnum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["department"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;
}
?>
Somehow, I don't think think this was the best way to handle this. If you're wondering what $CUSTCODE$ is, seems they decided to implement a pre-processor for php. :what:

PHP code:
$keys = array("referencenotes");
if (!strstr ("XDXD", "$CUSTCODE$"))
  array_push($keys, "referencenotes2", "referencenotes3", "custponum", "custinvnum", "custdeptnum", "department");
$refarr = array();
foreach ($keys as $k)
  if (strlen($vals[$k]))
    $refarr[] = $vals[$k];
$ref = implode("; ", $refarr);
What I do every day.

(I'm pretty sure one of the array_intersect family functions could avoid that loop and make it fewer lines, but they still seem really useless to me. All I ever want is to pull out the values from one array using another as the keys to pull out, and that's the one thing I can't find something for.)

IT BEGINS
Jan 15, 2009

I don't know how to make analogies

nielsm posted:

What I do every day.

PHP, uniting us through horrible code and worse coders.

I just don't understand how people who have been using a language for upwards of a decade don't know about its most basic features or best practices. I end up saying things like "there are array functions now, and you probably shouldn't use globals and extract() everywhere" or "pg_result was deprecated in 2001 and removed from all available documentation in 2003, why is it still being added to our codebase in 2013?" way too often.

IT BEGINS fucked around with this message at 15:22 on Aug 27, 2013

Edison was a dick
Apr 3, 2010

direct current :roboluv: only
GNU BC is a project so old its version control is a series of tarballs on ftp.gnu.org.
This is a problem, since if you try to compile its latest release, which was made in 2000, trying to use its built-in math library causes it to segfault.
A compiler optimisation added to modern gcc will optimise away calls to the function that allocates space for functions.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Edison was a dick posted:

GNU BC is a project so old its version control is a series of tarballs on ftp.gnu.org.
This is a problem, since if you try to compile its latest release, which was made in 2000, trying to use its built-in math library causes it to segfault.
A compiler optimisation added to modern gcc will optimise away calls to the function that allocates space for functions.

ftp://alpha.gnu.org/pub/gnu/bc/

Last release was made in 2006.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

Alpha release, and 7 years is still too long.

The tip-off is much appreciated though. I'll try it out; I much prefer
using upstream sources to maintaining patches.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
alpha.gnu.org is just the name of the gnu project hosting site, it's not an alpha release.

But yes, GNU bc has been without a maintainer for a long time now, and every distribution adds a patch to that release to fix an obvious crasher bug. It's an unfortunate state of affairs.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender
Just use nickle instead, honestly.

Opinion Haver
Apr 9, 2007

OK, so techically this isn't really a PHP horror since you could do this in any language. But I'm going to put it in the 'lol, PHP' category anyway.

senrath
Nov 4, 2009

Look Professor, a destruct switch!


that link posted:

Well I need to have users added to the operating system, and I'd like that to be through a web browser. (Again this is on a closed network).

that link posted:

I agree with you, and I'm aware of the security holes. But this isn't a publicly faced server, it's on a closed network. It has now become more frustrating as to why it doesn't work, I'm going to use a different method.

that link posted:

I mean it's on a closed network and just a few friends are using it so

I agree with the one comment about this being awe inspiringly bad.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

Suspicious Dish posted:

alpha.gnu.org is just the name of the gnu project hosting site, it's not an alpha release.

alpha.gnu.org is listed on the bc project page under the test releases heading.
I wouldn't be surprised if it was intended to be a stable release, but the maintainer forgot the credentials for ftp.gnu.org.

Adbot
ADBOT LOVES YOU

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

yaoi prophet posted:

OK, so techically this isn't really a PHP horror since you could do this in any language. But I'm going to put it in the 'lol, PHP' category anyway.

I don't know what's worse, the OP or all of the people who don't understand why this is bad.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply