🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1400

GNU diff 1.4 bug fix: typo in test for directories

#1400
From: Paul Eggert
Date: Thu, 03 Nov 1988 03:04
27 lines
1284 bytes
GNU diff 1.4 does not correctly test whether a file is a directory.
The code says (S_IFDIR == (mode & S_IFDIR)) where it should say (S_IFDIR ==
(mode & S_IFMT)).  The bug is rarely exercised because (under SunOS 4.0,
anyway) only block special files and sockets are mishandled.

Here is a fix.

*** 1.4/diff.c	Wed Nov  2 18:59:24 1988
--- fix/diff.c	Wed Nov  2 18:56:31 1988
***************
*** 381,383 ****
  	  else
! 	    inf[i].dir_p = (S_IFDIR == (inf[i].stat.st_mode & S_IFDIR));
  	}
--- 381,383 ----
  	  else
! 	    inf[i].dir_p = (S_IFDIR == (inf[i].stat.st_mode & S_IFMT));
  	}
***************
*** 484,486 ****
  	  inf[dir_arg].dir_p
! 	    = (S_IFDIR == (inf[dir_arg].stat.st_mode & S_IFDIR));
  	  if (inf[dir_arg].dir_p)
--- 484,486 ----
  	  inf[dir_arg].dir_p
! 	    = (S_IFDIR == (inf[dir_arg].stat.st_mode & S_IFMT));
  	  if (inf[dir_arg].dir_p)
Technical Details
Message-ID: <8811030304.AA11039@sea.sm.unisys.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!SM.UNISYS.COM!eggert

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!SM.UNISYS.COM!eggert
From: eggert@SM.UNISYS.COM (Paul Eggert)
Newsgroups: gnu.utils.bug
Subject: GNU diff 1.4 bug fix: typo in test for directories
Message-ID: <8811030304.AA11039@sea.sm.unisys.com>
Date: 3 Nov 88 03:04:30 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 27