Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mcvax!enea!tut!santra!news From: news@santra.UUCP (news) Newsgroups: comp.os.minix Subject: Bug in cc => fix for diff Message-ID: <7117@santra.UUCP> Date: Tue, 11-Aug-87 10:08:03 EDT Article-I.D.: santra.7117 Posted: Tue Aug 11 10:08:03 1987 Date-Received: Sat, 15-Aug-87 01:20:23 EDT Reply-To: ptk@hutcs.hut.fi (Pertti Kasanen) Distribution: world Organization: Helsinki University of Technology, Finland Lines: 41 Keywords: C cc diff Summary: Minix cc has problems with diff I've got strange line numbers from 1.2 diff and last night I looked in it. The problems are only with minix cc and everybody else using diff for sending files for fix seems to be using some other compiler (?). It's easy to find out if your diff has problems. Get a text file, change something in second line and diff the versions. Broken diff doesn't notice it. It never sees the second line and when there are differences it misses other lines too. Line numbers in hunks are always too small, fix will not work with them (patch works with lot of complains, it's still nice to have patch working under minix, thanks to Alan Bishop for good instructions how to make it). The problem were in read_line(). In line 108 the code checks if fgets() has found too long line for buffer to hold. This check is bit odd, chars tend to be unsigned ints. Minix cc gets confused of the comparison to '\377' and produces code to compare *16-bit* memory area against this pattern and newer succeeds. This is probably a bug in cc ? I fixed this with following diff. Changing p to register unsigned char *p; also fixed it, but l_text still is plain char array and changing it... --------------------- cut here for diff.diff ---------------------------------- 108c108 < if (p[1] != '\377' && *p != '\n') { --- > if (p[1] != -1 && *p != '\n') { --------------------------- _end_cut ------------------------------------------ P.S. Me too: Please post list of cc's flags ! --------------------------------------------------------------------------- Pertti Kasanen Internet: ptk@hutcs.hut.fi +358 0 753 3779 Bitnet: ptk%hutcs.uucp@fingate.bitnet Helsinki University of Technology UUCP: mcvax!hutcs!ptk