Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Unix Operating Systems Software

Billennium's Over - Anything Break? 265

An Anonymous Coward writes: "The billennium party at OpenProjects.Net rocked! Check out the log for the whole event over here. Please don't forget to use one of the mirrors. Thanks :-)" Well, anyone have anything break due to the rollover?
This discussion has been archived. No new comments can be posted.

Billennium's Over - Anything Break?

Comments Filter:
  • really small stuff (Score:5, Interesting)

    by KFury ( 19522 ) on Monday September 10, 2001 @03:21AM (#2272404) Homepage
    I use a thingy that portions my web logfiles into daily files, each prepended with the current unix timestamp. I found that scripts I run to do stuff with the most recent day's logfile broke because 1000000000access_log.gz comes before 999999999access_log.gz.

    The simple solution is to move the old 999 files to another directory. This problem wouldn't have cropped up since 1973 when it passed eight 9s, and won't happen again for another 300 years when it passes ten 9s.

    Still, a bug's a bug, and that's one more than I had in the new millenium.
    • by Cef ( 28324 ) on Monday September 10, 2001 @03:27AM (#2272417)
      You could just prepend a 0 to the front of the old filenames, and it'll sort them all correctly.

      See what happens when you don't use leading zeros? *grin*
      • by Bronster ( 13157 )
        You could just prepend a 0 to the front of the old filenames, and it'll sort them all correctly.

        See what happens when you don't use leading zeros? *grin*


        So you'd recommend using 000000000000000000000000000000000000access_log.txt
        just in case then?

        Seriously though, in this case there's a known maximum size of that value, and one more 0 would have been enough (at least until we go 64bit time_t)

        Jumping down to shorter values though (say 3 digit long), do you write:

        23 387 96 1 12 32 43

        or

        023 387 096 001 012 032 043

        or even
        00000023 00000387 00000096 00000001 00000012 00000032 00000043

        I vote for realising that you have a numeric value and splitting the int off the start and sorting by that. Bit hard in shell scripts though.
      • You could just prepend a 0 to the front of the old filenames, and it'll sort them all correctly.

        It's attitudes like that that get us all into trouble mister! That sort of talking till get us all into trouble! You should know that 13 and 013 are different numbers, one being 13, and the other being 11 :-) Of course 011 is 9 but I digress :-)

      • "You could just prepend a 0 to the front of the old filenames, and it'll sort them all correctly."

        "See what happens when you don't use leading zeros?*grin*"


        Workarounds are for when you can't do it right. In this case the solution is way too simple to merit a workaround. Simply do math on scalar types, not strings. If your language doesn't know the difference never use it for anything again. If you don't know the difference, learn. Simple, see?
      • Have you ever programmed in C?

        Leading zeros change things... 031 != 31

        031 == 25....

        The reason is that C interprets the leading 0 to be an indicator that the number is written in octal.

        (Why do programmers always get Haloween and Christmas confused? Because Oct(31)==Dec(25))

        Anyway, leading zeros are not always the answer...
      • Alternatively, you could fix directory sorting so that it accurately reflects the way most people save their files.
    • by Anonymous Coward

      Ah, this proves the point that people must have written extraordinarily bad code to get caught to this bug (I'm not directing at you, I've done worse). Thats the advantage of these "rollover" bugs. All the hastily coded apps come out of the woodwork.

      If you insist on using the filename to find the recent file, you should have set it up to find that 1,000,000,000 is actually a bigger integer than 999,999,999 .. rather than relying on a rather funky sort.

      Why dont you check the file timestamp instead of the file name? I assume you have a valid reason such as the file getting transported around?
    • I suppose you used something like this for sorting the files:
      ls |sort |tail -n 1

      Than the solution to get it working ALWAYS, is very simple:
      ls -t |head -n 1
    • Or just use ISO-8601 format dates, and your problems won't show up until 10000AD :)

      2001-09-10T18:36:40
    • by zdzichu ( 100333 )
      >The simple solution is to move the old 999 files >to another directory. This problem wouldn't have >cropped up since 1973 when it passed eight 9s,
      >and won't happen again for another 300 years when
      >it passes ten 9s.

      Do I remember correctly that another 300 years won't happen, because in 2038 timer will roll-over?
      If we not got 64-bit timestamp, of course.
  • Oh yeah... (Score:5, Funny)

    by SamMichaels ( 213605 ) on Monday September 10, 2001 @03:23AM (#2272407)
    I stored the date as a 9 character string in the MySQL table. Oops.

    I increased it to 10 chars but now it doesn't sort it correctly. Ooops.

    I had the expire date on the cookies set to "999999999". Ooops.

    I'm sure loads more will pop up.

    The Y2k+1 "bug" really got me.
  • by CSIP ( 31272 )
    its just wrong to see a unix timestamp start with a 1 im gonna end up trying to debug a problem that doesnt exist...
  • I know that back when I was young and stupid I wrote something that looked a lot like:

    next unless m/^(\d{9}\.\d{3}) +(\d+) (\d{1,3}\.\d{1,3} ....

    Thinking that that would be more accurately representing what's in the file. Luckily I know for a fact that that tool is no longer in use (a pity, it did very nice nearly-real-time accounting of user per user (mapped to logins with Samba per IP) from ipchains and squid logs).

    Hopefully it will be mainly little tools written by college students with a perl manual and no clue *raises hand* that break, and not anything that's in serious production.

    My tool would of course just skip every line, and hence it would look like there was no use. Because ipchains traffic would still be recorded it might even take some time for the admin to notice a problem.

  • by romanm ( 178782 ) on Monday September 10, 2001 @03:28AM (#2272419) Homepage
    Apparently there is a bug in older version of KMail from KDE 1.x that prevents KMail from correctly displaying the current date since billenium. More information about KMail billenium bug [kde.org] is on www.kde.org.
  • by mbadolato ( 105588 ) on Monday September 10, 2001 @03:28AM (#2272420)
    Well, anyone have anything break due to the rollover?

    This was sent out to the freebsd mailing lists by John Polstra:

    This morning a bug was discovered in most versions of CVSup up to and including SNAP_16_1c. The bug causes all newly-updated files to receive incorrect timestamps. Usually the files receive timestamps from early in 1970. This bug has been present for a very long time,
    but it only began to have an effect when the Unix representation of the date and time passed 1,000,000,000. That occurred on 9 September
    2001 at 01:46:40 UTC. Yes, other people had Y2K bugs, but I managed to produce an S1G bug.

    There was more, but that was the jist.

  • 1. For one thing my monitor nearly shattered from the torrent of flood that was flowing into #billennium. I live in Houston, and yet I've never seen that much flood in my life.

    2. At the very instant the clock rolled over, I got an error message from Ximian Evolution. I think I ought to file this one under bugzilla...
  • Anything Break? (Score:4, Insightful)

    by rchatterjee ( 211000 ) on Monday September 10, 2001 @03:33AM (#2272430) Homepage
    From my understanding the major problem doesn't occur till 2038 when 32-bit time reaches 2,147,483,647 seconds. 2,147,483,647 is the biggest number a 32-bit system can register.
    • By my projections, by that time all existing 32bit computers will be in a museum somewhere, which would promptly go out of business...
      • Re:Anything Break? (Score:4, Interesting)

        by rchatterjee ( 211000 ) on Monday September 10, 2001 @03:41AM (#2272447) Homepage
        We hope but remember what happened for Y2K, a mad dash to rewrite 20 - 30 year old COBOL and other progs that listed the date in only 2 digits and the original programmers thought would be replaced years before Y2K came up.

        • Hmm..true, but in the past 20 years we have progressed from approximately 4 bits to 32 bits. It would be ridiculous to think that 37 years from now, 32-bit computers would not be living in museums. I think the greatest concern would be die-hard win95 addicts, who would have to be content with the final blue screen of death when this happens.
          • Hey, I bought a Sega Mega CD II *new* from a local department store just under a month ago. I also bought a Mega Drive II to match. I believe they each have a 68000 in them, and that's 16 bit (at least externally). Old CPUs fade away much slower than you think.
          • Ah, but 64-bit processors aren't a full solution. They solve the source of the problem, but I'm sure we'll find all sorts of odd 32-bit assumptions and "clever" things wrt keeping a handle on that number-of-seconds-of-unix. Hopefully it'll all add up to a small problem, though
          • And what about embedded systems? Many of them still use 8 bit microprocessors.

      • Since 8-bit computers are still in use today [slashdot.org] we can't just expect all 32bit computers to be gone by 2038!
        • by Anonymous Coward
          Actually, 4-bit computers are still commonly used in small things - like microwaves, VCRs, remotes. Lucikly, I haven't seen the infamous "end-of-the-week bug" occuring at the day 7 rollover.
    • That is only the maximum of a signed integer,
      unsigned integers go twice as far (somewhere around 2106)

      Jeroen
    • Re:Anything Break? (Score:5, Informative)

      by IvyMike ( 178408 ) on Monday September 10, 2001 @04:28AM (#2272491)

      Nope, there are some more dates with problems prior to 2038, see this list [uic.edu] for some of the more important ones. (I saw a more extensive list once during the pre-Y2K buildup, but those web sites have mostly disappeared. Anyone?)

    • Re:Anything Break? (Score:4, Informative)

      by Björn Stenberg ( 32494 ) on Monday September 10, 2001 @07:04AM (#2272641) Homepage
      2,147,483,647 is the biggest number a 32-bit system can register.

      Umm, no. That'd be a 31-bit number, as is the case with time_t which is a SIGNED integer. A 32-bit value can hold 2^32-1 = 4,294,967,295.

      Can anyone tell me why this is a Real Problem? The obvious solution is to simply change the compilers from:

      typedef long time_t;

      to:

      typedef unsigned long time_t;

      And we can merrily keep using time_t on our 32-bit systems until 2106.

      Yeah, fubar systems will break. And yeah, we'll have to change some kernel API parameter types. Cry me a river!

      • Re:Anything Break? (Score:2, Informative)

        by RuneB ( 170521 )
        As a guess, probably because of the way the time() function works.

        You can pass a pointer to time(), and it will store the current time in the specified memory location, in addition to returning the value.

        What happens when you pass an invalid pointer to the function? errno is supposed to be EFAULT, and thus time() can return -1.

        In Linux, system calls directly return the errno as a negative number, and the kernel and libc reserve the first 4095 negative numbers for this purpose. Since time_t is signed, this isn't a problem. However, you would have a problem if you could not distinguish an errno return from a valid return value.

        Now, forcing everyone to use gettimeofday() instead of time() would help solve this problem.

    • 4Gigaseconds is the larges for 32bit ints. However, I'll bet 50% of the programs out there use a signed data type.. :(

  • by acb ( 2797 ) on Monday September 10, 2001 @03:33AM (#2272432) Homepage
    Hmmm... the Melbourne General Post Office was gutted by fire [theage.com.au] at around the same time as the Billennium. Do you suppose...?
  • by bee-yotch ( 323219 ) on Monday September 10, 2001 @03:36AM (#2272438) Homepage
    Now that you mention it one of my hard drives completely stopped working. At first I thought it was because i had it sitting on my floor and I stepped on it. I didn't even realize that it was probably from the whole 1 billion thing. Man, what was I thinking?
  • knode (Score:4, Informative)

    by anshil ( 302405 ) on Monday September 10, 2001 @03:37AM (#2272441) Homepage
    knode (0.4)

    The kde news reader now orders incoming messages false. All new messages after the billenium are ordered older than the ones from before.
  • One of the most popular webboards suffers due to this error. Read the fix: here [ibhackers.com].
  • by krausedw ( 52581 ) on Monday September 10, 2001 @03:58AM (#2272461) Homepage
    Updates to Fix the CVSup 1000000000 Second Bug
    http://people.freebsd.org/~jdp/s1g/
  • BTW, (Score:2, Informative)

    Thanks for the Log [properkernel.com]. The commentary was brilliant.
  • It uses strings of unix time to sort the messages in the message list by date. So after the billenium all new messages where going to the bottom..

    Anyway, i've made a small fix, incase anyone wants it..
    Put it in MessageList.pm line 530.

    # fix for billenium, we want to be able to make sure all string that get sorted are the same length so no boo boo's happen
    if (length($row[5]) == 9)
    {
    my $tmp = $row[5];
    $row[5] = "0$tmp";
    }
    • As a Python bigot (flame-bait me!) I'll point out that Perl, PHP and a few other Unix-y scripting languages are especially prone to this problem because they don't distinguish between strings and integers. I always knew that there would be a payoff in Python requiring me to explicitly convert.

      This seems like a cheap shot but really there is a systemic issue here. Perl trades robustness for succintness whereas Python tends to require you to say what you mean explicitly. With perfect programmers there would be no difference. In the real world, programmers are not perfect and a language that helps you to find potential problems can yield quantitatively more robust code.
      • The only time this matters is in comparisons and sorting. Perl has explicit numeric and string tests for both of these activities.

        $a &lt=&gt $b :- sort numericaly
        $a cmp $b :- sort as strings

        $i lt $j :- compare as strings
        $i &lt $j :- compare numericaly

        ... if someone uses the wrong test they've no one but themselves to blame.
      • by Chagrin ( 128939 ) on Monday September 10, 2001 @04:55AM (#2272512) Homepage
        The fact that Perl has vague distinctions between strings and numbers has very little to do with the situation at hand. The problem with the billennium bug is that there's a risk that programmers did not allocate enough digits to hold a date correctly; since both Perl and Python reallocate memory to handle larger values internally, your Python will succeed or fail in an equal number of situations as Perl. It's not an issue of the actual program language, the issue is how the date is persistently stored when the program ends (a database, columnar text file, or whatever).

        You're not flamebait because you're a Python bigot, you're flamebait because your post is an invalid rant and off-topic.
        • by GreyPoopon ( 411036 ) <[gpoopon] [at] [gmail.com]> on Monday September 10, 2001 @08:15AM (#2272736)
          The problem with the billennium bug is that there's a risk that programmers did not allocate enough digits


          Actually, I think most of the posts I've read so far indicate not a problem in storage allocation, but instead a problem in sorting -- IE, they used a string sort rather than numeric.


          your Python will succeed or fail in an equal number of situations as Perl


          Sorry, I disagree. I'm neither a Python nor Perl biggot (don't have much time to devote to either), but the point made in the parent post was that in a strongly typed language like Python, programmers are prevented from using the wrong form of comparison. Yes, Perl has different comparison methods for numeric and string and yes, the programmer has nobody to blame but themselves if they make such a mistake, but having the language do a bit of idiot-proofing will ultimately yield fewer bugs. So no, I don't think there will be an equal number of failures in Python.


          Note that I don't think this makes Python "better" or Perl "worse." It's just a feature that needs to be considered when choosing a language for a project.

          • Python, programmers are prevented from using the wrong form of comparison

            Sure, except we have already seen in another strongly typed language (SQL) where programmers chose to store time_t's in char (or varchar) variables, so the built in sorting can screw them.

            Now I think Python programmers are frequently smarter then SQL programmers :-) they can still make the same mistake. (I actually do think they are on the whole a little smarter, but only because many SQL users are forced to use it, and don't want to, while most Python programmers chose to use Python...)

            So you see strongly typed languages don't remove all type errors...

          • See http://slashdot.org/comments.pl?sid=21493&cid=2272 567 [slashdot.org]. The problem is in GTK+'s sorting algorithm (alphanumeric) and has nothing to do with the interfacing language.

            So, if pronto had been written in Python, what would be the likelihood of the same bug popping up? It would be equal, thus your post has little relevance to the problem at hand. Any language would fall prey to this problem if its programmer overlooked the fact that the widget's interface sorts alphanumerically, even your wonderful "strongly-typed-makes-me-a-better-programmer" languages.
        • I can't believe this guy was modded up to 4. You moderators are really showing off your lack of understanding of the issue. Here's the original problem report:

          It uses strings of unix time to sort the messages in the message list by date.

          Python sorts time_t's as integers, not strings. Perl sorts integers and strings the same unless you tell it otherwise. I saw my first report of this kind of Perl sorting bug within a few hours of the billenium. When I saw a second one on slashdot my "crappy software sucks" meter went past the "trashing other languages isn't politically correct" threshold. Perl is full of these little insecurities.

          People have a naive faith that there is no real cost to Perl's short-cuts but here is some more anecdotal evidence as if we needed any..

      • You got moderated to 3 without providing any examples?

        Perl does distinguish between strings and integers. Just try using ("foo" == "foo") in a comparison and see how far you get.

        Please supply an example of where Perl's "non-string-discriminatory" behaviour gets it into trouble.

        Sometimes you have to be specific, and tell Perl to do comparisons as numeric operations:

        my %hash;

        $hash{23} = "first";
        $hash{126} = "second";
        $hash{246} = "third";

        foreach my $item (sort {$a <=> $b} keys %hash) {
        print $hash{$item} . " ($item)\n";
        }

        That's because Perl is a text-processing language that knows how to do math, not because Perl is especially prone to S1G bugs! Yes, your comment is a cheap shot, because due to your Python bigotry you assume that anything that isn't Python is flawed.

      • Neither is a product that I want my mail reader written in. If I'm going to have something that I want fast, that is running in my native gui, that does not need to be portable and is not running a scripting task, I would prefer for it to be in compiled machine code. Even emacs lets you compile as much of it's scripting as it can.
      • I'm missing something. Why would the fact that length(time()) just jumped from 9 to 10 matter? I take it as a matter of faith that anyone who can write Perl code that would care can write Python, C++, Java or Pascal that will fail in all sorts of interesting ways as well.

        You can code "shoot self in foot" in any language. Python just makes you use a particular caliber gun which Guido feels is the only right way that one should shoot one's own foot.

        Larry, on the other hand feels that assembly is too restrictive in its foot-shooting options.

        To each his own.
    • I just wanted to clarify things a bit here as the reason Pronto [muhri.net] broke was not Perl related. It was because Gtk+ (Which I depend on it for sorting) used alpha numeric sorts. I just replaced the default Gtk+ sort routines with my own PERL sort routine and its fixed.

      PS, What can I do to get my nickname muhri back? I changed my email since the last time I logged onto slashdot and now I can't seem to get it to mail me my password, I feel like a hotmail user hehe, muhri2!!
  • Canon S10 (Score:3, Informative)

    by AftanGustur ( 7715 ) on Monday September 10, 2001 @04:24AM (#2272485) Homepage



    I haven't had time to fully investigate the cause but the software that came with my Canon S10 digital camera now claims that I took all my pictures on August the 26th (at different times though that day).


    The software (is supposed) to read the time from a field in the images .jpg comment field.


    The cause could be 1) The software in the camera that stores the dates in the images or 2) the photo viewing software itself. or 3) Something totally different. (Windows ?)

  • by che ( 1178 ) on Monday September 10, 2001 @04:24AM (#2272486) Homepage
    I submitted this as a story, but I guess it never got accepted. Ah well..

    OpenLDAP [openldap.org] has massive breakage both in the 1.2 and 2.x series with the S2G Unix time rollover.

    The slurpd server completely fails to push updates from the master server to the slaves, due to string compares of timestamps in 1.2 and a related problem in 2.x. There are patches for both in OpenLDAP CVS [openldap.org].

    The problem is detailed in the openldap-bugs mailing list [openldap.org] -- it was extremely scary to come to work this morning and find out that all the LDAP servers had stopped pushing updates, causing account creations to fail and mail to bounce!

    • I thought that I could go to your user info page and leave you a message since you didn't have an email addy supplied... silly me.

      I was going to ask you some more questions regarding OpenLDAP and how you're using it (I'm trying to do the same types of things you described) but alas and alack, I must ask through the general messageboard. :-(

  • There are some funny goings-on with BeBS (a Cit-86 style BBS package that runs on BeOS) 2.0 test2 that happened after the rollover. Rooms are reporting incorrect numbers of read/unread posts and some various functions are just plain funky. Luckily, 2.0 hasn't been released and the author (my friend) has a couple test boards up to check all this stuff out, but it's been interesting checking out new posts.

    Oh, and I'm sure he'll appreciate a link to the board if anyone wants to help with beta-testing.
    http://bebs.net/
    telnet://bebs.net:8088
  • Anything with "illennium" in it should be taken out in the over-hype word pasture and be shot.

    We (as in most IT people in some support role or other) have put up with this useless combination of letters since the whole Y2K overblown mess, we don't need to hear about it again for quite some time, thank you very much.

    Am I cranky? Sure, but I thought there would be a better choice of words than some puff-pastry attempt at commemorating the billion-second turnover. Too late now, you've already ruined it.

    Hotblack_Desiato

  • ...yes, I was monitoring my servers at work from my home Linux box, after verifying that everything was fine I turned around ... and my Windows box had crashed, it was the damndest thing < grin > .
  • When Anonymous Coward wrote "The billennium party at OpenProjects.Net rocked!" I thought thay had organised some major event, with music, drinks, party food and maybe even a chick or two. I checked out the link and it's just a bunch of nerdy unix guys talking crap on IRC, what a dissapointment.

    If the open source movement is ever going to get anywhere they need to know how to throw a good party.
  • Had a party to celebrate, got drunk and very nearly broke my skull open on the floor as I fell.

    Does that count? *grin*
  • by Lord Bitman ( 95493 ) on Monday September 10, 2001 @06:08AM (#2272588)
    It's the GOD DAMN APOCOLYPSE Outside! Dont any of you guys ever even open a Window!? sheesh... after all those rants about how the military should switch to linux, the world ended yesterday.
    Well anyway, I declare myself God until further notice.
  • cvsup broke (Score:4, Redundant)

    by OpperNerd ( 16084 ) on Monday September 10, 2001 @06:11AM (#2272592) Homepage
    This morning a bug was discovered in most versions of CVSup up to
    and including SNAP_16_1c. The bug causes all newly-updated files to
    receive incorrect timestamps. Usually the files receive timestamps
    from early in 1970. This bug has been present for a very long time,
    but it only began to have an effect when the Unix representation of
    the date and time passed 1,000,000,000. That occurred on 9 September
    2001 at 01:46:40 UTC. Yes, other people had Y2K bugs, but I managed
    to produce an S1G bug.

    I have fixed the bug and have released a new snapshot of CVSup,
    SNAP_16_1d. I have also created binary packages for FreeBSD-4.x which
    can be installed using "pkg_add". For information about updating your
    CVSup installation, look here:

    http://people.freebsd.org/~jdp/s1g/

    To fix the bug, both the client and the server need to be upgraded to
    SNAP_16_1d. The FreeBSD mirror site maintainers have been working
    feverishly to upgrade their installations. Many of them are already
    upgraded, and the rest will be upgraded soon. Meanwhile, all CVSup
    users should upgrade their CVSup installations.

    I apologize for the inconvenience caused by this bug, and thank you
    in advance for your patience.

    John Polstra
  • by Dave Dribin ( 300396 ) on Monday September 10, 2001 @06:24AM (#2272598) Homepage
    My ISPs IMAP server broke. It used the maildir format and got *really* confused with file names like:

    % ls -tr | tail
    999878615.18243.pop.xxx.com:2,S*
    999882709.76833.pop.xxx.com:2,RS*
    999883989.13343.pop.xxx.com:2,S*
    999900385.97510.pop.xxx.com:2,S*
    999906796.21947.pop.xxx.com:2,S*
    999914926.66179.pop.xxx.com:2,S*
    999922220.49590.pop.xxx.com:2,S*
    999975475.10798.pop.xxx.com:2,S*
    1000040737.72591.pop.xxx.com:2,S*
    1000062814.85554.pop.xxx.com:2,*

    I think it was an old version of uw-imapd with maildir patches.

    I wrote a short script to rename all files created before 1,000,000,000 with a leading zero. The resulting file names with "09*" fixed the problem!

    -Dave

  • by Anonymous Coward on Monday September 10, 2001 @06:24AM (#2272599)

    I would like to make your attention on bug which was introduced tonight and can affect some people who are using (var)char field to store timestamp data.

    It is not worst security bug. It affects only people who already had bug in their code. Just now this bug become visible/exploitable.

    This is not MySQL bug. This is how people use their database. Also similar situation can be found in other software. I would like to inform people in public list as maybe some people have to search similar problems.

    The problem: Computers store time and date usually as integer value representing amount of seconds from 1 January 1970. Tonight it overrolled from 999999999 to 1000000000.

    Possible bug and exploit relies on fact that some people have used character type of field to store this seconds information (we have already such case)

    example:

    mysql> create table session (expire varchar(100) not null);
    Query OK, 0 rows affected (0.31 sec)

    mysql> insert into session values (999999997), (999999998), (999999999),
    (1000000000), (1000000001);
    Query OK, 5 rows affected (0.00 sec)
    Records: 5 Duplicates: 0 Warnings: 0

    mysql>
    mysql> select * from session;
    +------------+
    | expire |
    +------------+
    | 999999997 |
    | 999999998 |
    | 999999999 |
    | 1000000000 |
    | 1000000001 |
    +------------+
    5 rows in set (0.00 sec)

    mysql>

    Let's assume that this table contains values we use somewhere to authenticate users. After user logs in, we write down session expiry time and later we check it like this:

    mysql> select count(*) from session where expire >= '1000032535';
    +----------+
    | count(*) |
    +----------+
    | 3 |
    +----------+
    1 row in set (0.00 sec)

    mysql>

    WOW, what happened? Shouldn't be 100003253 bigger than any value in table? It worked yesterday!

    In MySQL we suggested people to use quotation marks around integer values. This can avoid many web-based attacks targeted to modify SQL commands (more information on http://www.mysql.com/doc/G/e/General_security.html ). This is the reason why people put quotation marks around integer expressions and this is correct. Also automatic type casting will fix the source problem is column data is integer or some time/date vale. But when both column is character type and expression, they get compared as strings. And as we know, strings get sorted in order:

    1,11,2,22

    but integers:

    1.2.11.22

    So, this is why 100003253

    It is possible that some web applicatons have endless expiry times now and not only in MySQL contexts.

  • by Salsaman ( 141471 ) on Monday September 10, 2001 @06:58AM (#2272639) Homepage
    ...like it's time_t 1E9 !!

    (Shamelesly ripped from ntk.net).

  • I was expecting to have everything reset back to 1970. I was looking forward to men again on the moon and the Boston Bruins having a championship-caliber team.

    Then again, I could do without the Vietnam War Redux. Oh well.
  • Using string comparisons for dates stored as seconds since the epoch is not a very good idea.

    Use the Date format that your database has, as it should be able to do much better comparisons with dates in SQL, instead of seconds stored as text.

    Did I miss anything?

  • Veritas Netbackup (Score:3, Informative)

    by TBone ( 5692 ) on Monday September 10, 2001 @08:18AM (#2272740) Homepage
    Veritas issued an alert that the indexing on it's backup files was broken - don't remember what it said, but basically everything would show as Jan 1, 1970 00:00:00. The datestamps were right, but the conversion routine for displaying the dates was broken. A patch that fixed the display routine fixed things up.
  • pine / UW IMAP (Score:4, Informative)

    by tmu ( 107089 ) <.todd-slashdot. .at. .renesys.com.> on Monday September 10, 2001 @08:31AM (#2272770) Homepage
    We use an older version of UW IMAP ad UW Pine both patched to use Maildir support (because they are too short-sighted to integrate such support themselves).

    After the roll-over both programs started mis-sorting newly arrived messages to the top of the folder, rather than the bottom (but newly arrived messages are still sorted below older, within each category of 'before' and 'after' the 1 billion second point). Also getting 'mailbox changed unexpectedly, reloading' messages constantly.
    • Excellent! I did something similar:

      #!/usr/bin/perl
      #
      # pinefix
      # Fixing the maildir pine driver bug that occurred when the 1000000000
      # second roll-over happened.

      use File::Find;
      $maildir = shift(@ARGV);

      if (!(-d $maildir)){
      die "$maildir must be a Maildir";
      }

      print "Working on $maildir\n";

      find(\&pinefix, $maildir);

      sub pinefix(){
      $fullpath = $File::Find::name;
      $dir = $File::Find::dir;
      $filename = $_;
      if ( $filename =~ /^9.*/ ){
      $newpath = $dir . "/0" . $filename;
      link $fullpath, $newpath;
      unlink $fullpath;
      print "In pinefix renamed $fullpath to $newpath\n";
      } else {
      print "$filename does not need renaming\n";
      }

      }
  • For all you talker fans out there, Neil Robertson's NUTS code (or derivitives - MoeNUTS, AmNUTS, etc.) has a constant named "DNL" that keeps track of the length of the date in seconds. This is set to 11 and will need to be switched to 12, although my talker [foreverbeyond.org] ran fine w/o changing it. I'm sure I would have seen something wrong down the road.
  • by NNKK ( 218503 ) on Monday September 10, 2001 @10:18AM (#2273116) Homepage
    Incase someone wants this in a bit plainer english, let me explain. (Thank you, Jesse Liberty)

    In C, C++, and probably most other programming languages (I'm not a guru on programming), an integer is either "signed" or "unsigned". They are also either "long" or "short". The reason for the distinctions is primarily memory-related, using a long int (4 bytes) is a waste of memory if you're just going to store say, a number up to 300 in it, in which case a short int would be more appropriate. And if you're only going to store a single byte (such as 1 or 0) there's usualy something like the int type "bool", a 1-byte long int, that allows a 1-byte value to be stored (technicaly this value could be 0 to 9, I'm not sure if negatives are allowed).

    An unsigned integer is (rather obviously if you think about it) a positive-only number, you can't have a negative number in an unsigned int (well, you can try, but it'll just wrap around to its maximum value).
    an unsigned long int can go from 0 to 4,294,967,295

    Now, with time_t, the time is being stored in a signed long int. This can be any value from -2,147,438,648 to 2,147,483,647 (you've just split the area avalible for values between negative and positive) on a 32bit system. Unfortunitely, in 2038, that's no longer enough (DOH!) as the # of seconds from UNIX Epoch will pass the maximum (positive) value of a signed long int, and suddenly our system clocks (on POSIX-compliant, and even some/many non-compliant UNIXish systems) will wrap around to, well, the turn of the century. This is *precisely* what the fear was with Y2K, just further in the future. And this isn't theory based on a couple systems, this is a real fear, because POSIX compliant systems WILL do this. Fortunitely we have ~36 years to solve this problem.

    The first solution, and probably the cleanest, is to go to 64bit systems, this transition is just beginning, but personaly I think it will be complete within 30 years... ancient business systems might still have something to worry about (as with Y2K) but I doubt it.

    The other, not-as-clean-but-quick-and-simple, solution is to bump the variable holding the time to a signed long int. This could be done by a newbie with a C book, and will allow UNIX time to go to 4,294,967,295, sometime after 2100 (I think it was 2106?). This is a band-aid and doesn't really fix the end problem that what we need is an EFFICIENT dynamicaly allocated int type, but just moving to an unsigned long will buy us time if, for some reason, we haven't fixed these damn problems by 2038.
    (I THINK Java has dynamic int variables, but i don't think they're efficient. I'd have to grab an extensive book on Java, and I don't have that kind of time or patience:).

    And no, we can't just make infinite-sized variables in our current infrastructure, the first one that got initialized would use all the memory and lock the system :)
    • So, that's an excellent explanation of the time_t size issue that'll rear its ugly head in thirty-six years.


      But it has nothing to do with the billionth-second issue that this article is about.


      'Informative', perhaps, but also 'Offtopic'.

    • (I THINK Java has dynamic int variables, but i don't think they're efficient. I'd have to grab an extensive book on Java, and I don't have that kind of time or patience:).

      Java has the following integer types:

      byte: 8 bits
      short: 16 bits
      int: 32 bits
      long: 64 bits

      All types are signed and are actually quite efficient on most machines. Dates are not a problem either as they are calculated as the number of milliseconds since January 1, 1970 and stored in a long integer. This gives us several million years breathing room. :-) On top of that, we don't have the many incorrect date results (e.g. The leap year in 2000) due to the fact that the Date and Calendar objects were designed by experts in chronology. Check the JavaDocs sometime and you'll find a complete disertation on time and how it is tracked.
    • Java already uses 64-bit longs to hold date values (max value 9223372036854775807), in fact for fun once I made the case in an app that we should allow five digits for the year field to avoid the coming Y10k problem...

      Java does have dynamic int classes like BigInteger, but I think they would be too inefficient for something with such widespread use as dates.

    • There are so many errors in this that I find it very worrying that it ever got a score of 4.

      • There are several other integer types in C and C++, in particular plain 'int' and 'unsigned int'. These are often equivalent to the corresponding short or long types, but this is not necessarily so.
      • The bool type is specific to C++, and it holds a single bit. The number of bytes used for its representation varies between implementations.
      • The number of bytes used for a 'long int' also varies between implementations.
      • The type that time_t is typedef'd to be also varies between implementations, but it is true that on Unix it is generally a 32-bit signed integer.
      • Consequently it is not necessary to use a 64-bit system; only to change the typedef for time_t. Unfortunately this will break a lot of code that was written with the assumption that time_t means int or that it means long or that it can safely be converted to and from that type. Such assumptions were never valid.
      • I think you mean to change time_t to be an unsigned long int. This should work since this type is guaranteed to hold at least 32 bits. Unfortunately it would also break a lot of that code written under invalid assumptions.
    • And if you're only going to store a single byte (such as 1 or 0) there's usualy something like the int type "bool", a 1-byte long int, that allows a 1-byte value to be stored (technicaly this value could be 0 to 9, I'm not sure if negatives are allowed).

      Um, no. A byte (I don't think I've ever seen a signed byte, although there's no reason why you couldn't have one) can range from 0 (0x00) to 255 (0xFF) on systems with 8-bit bytes. That's most systems now in use, including the computer you're likely using right now. I first learned to program on a DECsystem 10, which had 36-bit words which were (usually) considered to be 6 bytes of 6 bits each, although there was no hard-and-fast rule requiring this. In MACRO-10, bytes could be of arbitrary length up to the size of the word. Naturally we tended to work in octal rather than hex because a single byte could be expressed as a two-digit octal number from 00 to 77 (63 dec). Yes, there was a fairly limited character set, but in those days you were usually working in all-caps anyway.

      Now I work on VMS systems, which effectively do not have date issues. Neener-neener, O Unix freaks!

      The other, not-as-clean-but-quick-and-simple, solution is to bump the variable holding the time to a signed long int.

      You of course meant to say an unsigned long int. That wouldn't work for the reason others have mentioned: -1 is reserved as an error return. Yes, you could do it and come up with some other error reporting mechanism, but there's a whole big bunch of code that would have to be rewritten to take advantage of it.

  • by edashofy ( 265252 ) on Monday September 10, 2001 @12:39PM (#2273976)
    ...I run Windows :)
  • My propane grill died about 1 minute shy of the Billennium causing me to pan fry burgers for our Epoch party...

  • billenium non-bug (Score:2, Informative)

    by Paolomania ( 160098 )
    one of my perl scripts that sorted some stuff via timestamp broke over the billenium because i was using "cmp" instead of "<=>". silly me.
  • by Glorat ( 414139 )
    My very major company whom I am working for this summer got bitten. They had to release an emergency turnover/fix to fix it. Apparently, they got stuck with an old version of the Perl Date::Manip library (version 1.33 I believe)


    Apparently, this version of the library could not perform the "epoch" for seconds beyond the billenium and would report a year 1000 years too early! Of course, this bug was fixed in 1.34 and in fact the current version of Date::Manip is 1.40. Unfortunately, this company doesn't update as often as it should since upgrades can break backward compatibility and need extensive testing. But there you have it, a top company got bitten!

  • I guess I'll have to start planning early for the next party in 2032.
  • My stomach broke as a result of the 1-billion second turnover. Of course, I _did_ celebrate with lots (and lots) of Thai curry...

Beware of Programmers who carry screwdrivers. -- Leonard Brandwein

Working...