Page 1 of 1

Filename is too long

Posted: Mon Apr 12, 2004 5:59 pm
by Jonathan
softsdvia32-func_ms-windows-media-audio-encoder_tough51-64kbps-1pass_v9r10-beta_winxp_msvc-dot-net-13-00-9466_wmt_ssg_0301_007.wmt^softsdvia32-func_ms-windows-media-audio-encoder_tough51-64kbps-1pass_v9r10-beta_winxp_msvc-dot-net-13-00-9466_wmt_ssg_0301_007.wmt.log

266 characters, baby. Now I gotta figure out how to truncate that in a meaningful fashion.

Posted: Mon Apr 12, 2004 6:01 pm
by Jonathan
Linux 2.4 kernel wrote:#define EXT2_NAME_LEN 255
Stupid 255 character limit.

Posted: Mon Apr 12, 2004 6:14 pm
by Peijen
you could probably take out _- and get it to 255

Posted: Mon Apr 12, 2004 8:44 pm
by Jonathan
Yeah, that's pretty much what I wound up doing. I guard against removing _- next to numbers, though, because I want to preserve the numbers. I also have to allow for the possibility of new files with the same base plus a new extension being created. I determined that the longest file name extension we commonly use is 37 characters long, so to trim it that long I am deleting letters in the middle of words.

Posted: Mon Apr 12, 2004 9:01 pm
by Peijen
you also have filename^filename.log

you could make it filename.log

Posted: Mon Apr 12, 2004 9:02 pm
by Jonathan
Unfortunately, there is meaning in the repetition. There's a proposal on the table to change the format to filename^2t.log, but for now all our scripts only recognize the filename^filename.log format.

Posted: Mon Apr 12, 2004 10:30 pm
by quantus
Why the heck are they trying to store so much information in the filename in the first place?!?! Since most of the filename is the options, dump that info into a comment or something at the head of the file so it's identifiable if renamed. Then rename everything with unique short names and make a hash out of new names with the key as the long name. Stick the hash in between all calls for files and you're done. Of course, if you used poor programming style, then you won't be able to change your file handling routine to use the hash and will instead have to do it at EVERY instance of an open or close. I'd think this would be preferable in the long term to just hacking in a ^2t or some such.

Posted: Tue Apr 13, 2004 12:26 am
by Jonathan
Why long filenames? The short answer is it is a convention spiralling out of control.

The long answer is we don't have a program which parses this file. We also don't have a file. This file naming scheme is used to group a variety of completely different files into a logical whole. This group of files is then parsed and processed by an assload of connected scripts.

The convention came about because people were naming files stuff like 147vo_12893749_82_20000.log, which made no sense to anyone. Quite sensibly, they defined a standard format which provided all the info anyone might ever want. Unfortunately, no one put any limits on the length of the fields. Eventually, the format was institutionalized because all filenames were produced by the same program. People felt compelled to put info in because the field was there, blank and waiting. Eventually, new and creative uses strained the limits of the system. They're now talking about changing it to a more sensible scheme which omits some of the useless information while still retaining the key info. However, that's an institutional change which takes forever to get consensus and takes forever to get implemented.

Posted: Tue Apr 13, 2004 1:35 am
by quantus
You have to love crappy conventions :P