Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Friday August 21 2020, @05:21AM   Printer-friendly
from the cleaning-the-window-sill dept.

A 35-year-old bug in patch found in efforts to restore 29 year old 2.11BSD:

Larry Wall posted patch 1.3 to mod.sources on May 8, 1985. A number of versions followed over the years. It's been a faithful alley [sic] for a long, long time. I've never had a problem with patch until I embarked on the 2.11BSD restoration project. In going over the logs very carefully, I've discovered a bug that bites this effort twice. It's quite interesting to use 27 year old patches to find this bug while restoring a 29 year old OS...

After some careful research, this turned out to be a fairly obscure bug in an odd edge case caused by "the state of email in the 1980s." which can be relegated to the dustbin of history...


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2) by FatPhil on Friday August 21 2020, @07:25AM (3 children)

    by FatPhil (863) <reversethis-{if.fdsa} {ta} {tnelyos-cp}> on Friday August 21 2020, @07:25AM (#1039808) Homepage
    As so often, the bug is associated with (not caused by, as such) a magic number:
    "So why '4' in the second 'if' in the quoted code above? what's so magic about it? Indeed, if we hack the patch to have 6 lines of context instead of 3, it applies correctly."

    Had that code said:
    /* Sometimes we're missing blank lines at the end of patches, magic them back. */
    #define MISSING_LINES_FIXUP 4
    ...
    if(p_max - p_end < MISSING_LINES_FIXUP) {
    ...
    (With a better comment and a better name for the macro) then that would be a honking great warning sign that this might be where the dragons are.

    I do think this is progress, the prior fixup was a kludge. However, you're also right, it's asking for the same hackish non-solution to be recreated at a future point in time. The ultimate fix is to programatically detect which of the two behaviours is most likely to be required, and - akin to the fuzzing messages - at least warn when an assumption has been programatically made, so that you can know that the program attempted to Do The Right Thing(tm) in the face of ambiguity.
    --
    Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2  
  • (Score: 2) by Mojibake Tengu on Friday August 21 2020, @02:16PM (2 children)

    by Mojibake Tengu (8598) on Friday August 21 2020, @02:16PM (#1039879) Journal

    If patch/diff was designed with some initial sanity on mind (technically, it is a strict imperative command language), it would use separate checksum for every command issued at least.

    Instead, while email/news did not guarantee a fixed transfer of text files, Unix freaks imposed a space hell on themselves, including tabs hell in makefiles.

    A magic number like this is a shameless shame.

    --
    Respect Authorities. Know your social status. Woke responsibly.
    • (Score: 2) by FatPhil on Friday August 21 2020, @03:42PM (1 child)

      by FatPhil (863) <reversethis-{if.fdsa} {ta} {tnelyos-cp}> on Friday August 21 2020, @03:42PM (#1039932) Homepage
      Oh, yeah, adding semantic meaning to differences in whitespace was a terrible idea. Thank goodness nobody ever repeated that misnake.
      --
      Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves