[There is a FIXME in sanity.sh about how the diffmerge2 test should be replaced by a shorter test (to be faster, take up less space, and be easier to understand). I played around trying to duplicate the bug with a small test case, without success. The next step is to actually understand what that code in diff is doing (gulp), for example by running the buggy case under a debugger. To trigger the bug, add "return;" at the start of shift_boundaries in diff/analyze.c. Then run the diffmerge2 test (the real one, not the one from this patch). If you have correctly triggered the bug, the diffmerge2_diff test will produce the following output instead of the correct behavior which is empty output. ------------------------------ begin output Index: sgrid.h =================================================================== RCS file: /home/kingdon/tmp/cvs-sanity/cvsroot/diffmerge2/sgrid.h,v retrieving revision 1.1.2.1 diff -r1.1.2.1 sgrid.h 178a179,184 > /*--------------------------------------------------------------------------- > INLINE FUNCTION : HORIZONTALLINES > NOTES : Description at the end of the file > ---------------------------------------------------------------------------*/ > uint16 horizontalLines( void ); > ------------------------------ end output -kingdon] Index: sanity.sh =================================================================== RCS file: /home2/cvsroot/ccvs/src/sanity.sh,v retrieving revision 1.318 diff -u -r1.318 sanity.sh --- sanity.sh 1997/11/09 17:45:28 1.318 +++ sanity.sh 1997/11/09 19:50:35 @@ -11619,695 +11619,112 @@ ;; diffmerge2) + # More tests of the guts of diff/merge. + + mkdir 1; cd 1 + dotest diffmerge2-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest diffmerge2-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + cat >file1 <file1 < /*-------------------------------------------------------------- - # > INLINE FUNCTION : HORIZONTALLINES - # > NOTES : Description at the end of the file - # > ----------------------------------------------------------------*/ - # > uint16 horizontalLines( void ); - # > - # - # I did a cvs diff -c -r 1.1 -r 1.1.2.1 sgrid.h and patched those - # differences to sgrid.h version 1.1 and got the correct result - # so it looks like the built in patch is faulty. - # ------------------------------------------------------------------- - # - # This is the RCS file, sgrid.h,v, that he sent: - - echo "head 1.1; -access; -symbols - Review_V1p3:1.1.2.1 - Review_V1p3C:1.1.2.1 - Review_1p3A:1.1.2.1 - Review_V1p3A:1.1.2.1 - Review_Phase_2_Enhancements:1.1.0.2 - Review_V1p2:1.1 - Review_V1p2B:1.1 - Review_V1p2A:1.1 - Review_V1p1:1.1 - Review_1p1:1.1; -locks; strict; -comment @ * @; - - -1.1 -date 97.04.02.11.20.05; author colinl; state Exp; -branches - 1.1.2.1; -next ; - -1.1.2.1 -date 97.06.09.10.00.07; author colinl; state Exp; -branches; -next ; - - -desc -@@ - - -1.1 -log -@Project: DEV1175 -DCN: -Tested By: Colin Law -Reviewed By: -Reason for Change: Initial Revision of all files - -Design Change Details: - -Implications: -@ -text -@/* \$Header: /home/cvsroot/ximbiot/cvs/cvshome/cyclic/cvs/unoff-diffmerge2.txt,v 1.1.1.1 2001/04/14 00:10:26 dprice Exp $ */ -/* - * \$Log: unoff-diffmerge2.txt,v $ - * \Revision 1.1.1.1 2001/04/14 00:10:26 dprice - * \Initial import of cvshome.org web site. - * \ - * \Revision 1.318 1997/11/09 17:45:28 kingdon - * \ * sanity.sh (diffmerge1, diffmerge2): new tests, for bugs, or - * \ potential bugs, in ../diff/analyze.c which were fixed by Paul - * \ Eggert's patch. - * \ - * - * Rev 1.1.1.0 24 Jan 1996 14:59:20 PAULT - * Branched - * - * Rev 1.1 24 Jan 1996 12:09:52 PAULT - * Consolidated 4100 code merged to trunk - * - * Rev 1.0.2.0 01 Jun 1995 14:18:58 DAVEH - * Branched - * - * Rev 1.0 19 Apr 1995 16:32:48 COLINL - * Initial revision. -*/ -/***************************************************************************** -FILE : SGRID.H -VERSION : 2.1 -AUTHOR : Dave Hartley -SYSTEM : Borland C++ -DESCRIPTION : The declaration of the scrolling grid class - -*****************************************************************************/ -#if !defined(__SGRID_H) -#define __SGRID_H - -#if !defined(__SCROLL_H) -#include -#endif - -#if !defined(__GKI_H) -#include \"gki.h\" -#endif - -#if defined PRINTING_SUPPORT -class Printer; -#endif - -/***************************************************************************** -CLASS : ScrollingGrid -DESCRIPTION: This class inherits from a grid and a scrollable, and - can therefore use all the PUBLIC services provided by these - classes. A description of these can be found in - GRID.H and SCROLL.H. - A scrolling grid is a set of horizontal and vertical lines - that scroll and continually update to provide a complete grid - -*****************************************************************************/ - -class ScrollingGrid : public Scrollable -{ - public: -#if defined _WINDOWS -/*--------------------------------------------------------------------------- -FUNCTION : CONSTRUCTOR -DESCRIPTION : sets up the details of the grid, ready for painting -ARGUMENTS : name : sgColour - - the colour of the grid - sgLineType - - the syle of line - sgHorizontalTotal - - the total number of horizontal grid lines - verticalSpacingMin - - the min distance between the vertical grid lines - on the scrolling axis - currentTimestamp - - timestamp value now - ticksPerSecond - - number of timestamp ticks per second - ticksPerPixel - - number of timestamp ticks per pixel required - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType, - uint16 sgHorizontalTotal, - uint16 verticalSpacingMin, uint32 currentTimestamp, - uint16 ticksPerSecond, uint32 ticksPerPixel ); -#else -/*--------------------------------------------------------------------------- -FUNCTION : CONSTRUCTOR -DESCRIPTION : sets up the details of the grid, ready for painting -ARGUMENTS : name : sgColour - - the colour of the grid - sgLineType - - the syle of line - sgHorizontalTotal ( THE MAX NUMBER OF LINES IS 100 ) - - the total number of horizontal grid lines - sgVerticalSpacing - - the distance between the vertical grid lines - on the scrolling axis - -RETURN : None -NOTES : If the caller does not get the total grid lines value, synced - with the overall size of the viewport, the spacing between - grid lines will not be consistent. - ----------------------------------------------------------------------------*/ - ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType - , uint16 sgHorizontalTotal, uint16 sgVerticalSpacing ); -#endif -/*--------------------------------------------------------------------------- -FUNCTION : DESTRUCTOR -DESCRIPTION : tidies it all up -ARGUMENTS : name : - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - ~ScrollingGrid( void ); - -/*--------------------------------------------------------------------------- -FUNCTION : ATTACH -DESCRIPTION : This service overloads the base class service, as it does - additional work at the time of attachment. - -ARGUMENTS : name : tDrawingArea - - the scrolled viewport to attach this trend to - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void attach( SViewport *tDrawingArea ); - -#if defined _WINDOWS -/*--------------------------------------------------------------------------- -FUNCTION : calculateVerticalSpacing -DESCRIPTION : determines optimum spacing along time axis -ARGUMENTS : -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void calculateVerticalSpacing(); - -/*--------------------------------------------------------------------------- -FUNCTION : gridSpacingTicks -DESCRIPTION : Provides the grid spacing in the time axis in ticks -ARGUMENTS : -RETURN : Number of ticks -NOTES : ----------------------------------------------------------------------------*/ - uint32 gridSpacingTicks(); - -#endif - -/*--------------------------------------------------------------------------- -INLINE FUNCTION : HORIZONTALLINES -NOTES : Description at the end of the file ----------------------------------------------------------------------------*/ - uint16 horizontalLines( void ); - -#if defined _WINDOWS -// In Windows the OnDraw() function replaces paint() -/*--------------------------------------------------------------------------- -FUNCTION : ScrollingGrid OnDraw -DESCRIPTION : Paints the given area of the grid. - Pure virtual -ARGUMENTS : pDC pointer to the device context to use for display - Note that the device context operates in the coords - of the window owning the viewport -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - virtual void OnDraw( CDC *pDC ); - -#else // not Windows - -/*--------------------------------------------------------------------------- -FUNCTION : PAINT -DESCRIPTION : This extends the standard grid paint method to paint the - viewport relative to its current position. - -ARGUMENTS : name : - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void paint( void ); -#endif - -/*--------------------------------------------------------------------------- -FUNCTION : P A I N T T E X T M A R K E R S -DESCRIPTION : this service allow the text markers to be painted seperatley - from the grid lines - -ARGUMENTS : name : - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void paintTextMarkers(); - -#if defined PRINTING_SUPPORT -/*--------------------------------------------------------------------------- -FUNCTION : P R I N T -DESCRIPTION : This print service prints a grid marker ( being either a - timestamp or a date, IF there is one at the plot position - given - -ARGUMENTS : name : - displayPosition - - Where in the log to look to see if there is an - entry to print - - - printerPtr - the printer to print to - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void print( uint16 currentPrintPos, Printer *printerPtr ); -#endif - -/*--------------------------------------------------------------------------- -FUNCTION : S E T D R I V E D I R E C T I O N -DESCRIPTION : Sets direction for update and scrolling forwards or backwards -ARGUMENTS : direction - required direction -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void setDriveDirection( ScrollDirection direction ); - -/*--------------------------------------------------------------------------- -FUNCTION : S E T U P -DESCRIPTION : service that will setup the grid prior to a paint - -ARGUMENTS : name : - - newTimestamp - - - - newTimeBase - the number of ticks that represent a plot point on - the trendgraph. - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void setup( uint32 newTimestamp, uint32 newTimeBase ); - -#if defined PRINTING_SUPPORT -/*--------------------------------------------------------------------------- -FUNCTION : S E T U P F O R P R I N T -DESCRIPTION : This service iis to be called prior to printing. It allows - the grid to prepare its markers ready for the print - commands - -ARGUMENTS : name : - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void setupForPrint(); -#endif - -/*--------------------------------------------------------------------------- -FUNCTION : UPDATE -DESCRIPTION : When this service is called it will calculate what needs to - be painted and fill in the display again. - -ARGUMENTS : name : timeStamp - - the reference time of this update. - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void update( uint32 timeStamp ); - -/*--------------------------------------------------------------------------- -FUNCTION : U P D A T E B U F F E R -DESCRIPTION : When a display update is not required, use this method. It - updates the internal data ready for a call to paint that - will then show the grid in the right position - -ARGUMENTS : name : - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void updateBuffer( void ); - - private: - -/*--------------------------------------------------------------------------- -FUNCTION : M A K E G R I D M A R K E R -DESCRIPTION : service that perpares a string for display. The string will - either be a short date, or short time. this is determined - by the current setting of the dateMarker flag - -ARGUMENTS : name : timestampVal - - the value to convert - - storePtr - - the place to put the string - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void makeGridMarker( uint32 timestampVal, char *storePtr ); - -/*--------------------------------------------------------------------------- -FUNCTION : P A I N T G R I D M A R K E R -DESCRIPTION : given a position will put the string on the display - -ARGUMENTS : name : - yPos - - were it goes on the Y-axis - - gridMarkerPtr - - what it is - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void paintGridMarker( uint16 yPos, char *gridMarkerPtr ); - -#if defined _WINDOWS -/*--------------------------------------------------------------------------- -FUNCTION : PAINTHORIZONTALLINES -DESCRIPTION : responsible for painting the grids horizontal lines -ARGUMENTS : pRectToDraw pointer to rectangle that needs refreshing. - in viewport coords - pDC pointer to device context to use - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void paintHorizontalLines(RectCoords* pRectToDraw, CDC* pDC ); -#else -/*--------------------------------------------------------------------------- -FUNCTION : PAINTHORIZONTALLINES -DESCRIPTION : responsible for painting the grids horizontal lines -ARGUMENTS : name: xStart - - the starting X co-ordinate for the horizontal line - xEnd - - the ending X co-ordinate for the horizontal line - -RETURN : None -NOTES : Remember lines are drawn from origin. The origin in a - horizontal viewport will be the top. ----------------------------------------------------------------------------*/ - void paintHorizontalLines( uint16 xStart, uint16 xEnd ); -#endif - -#if defined _WINDOWS -/*--------------------------------------------------------------------------- -FUNCTION : PAINTVERTICALLINES -DESCRIPTION : responsible for painting the grids vertical lines -ARGUMENTS : pRectToDraw pointer to rectangle that needs refreshing. - in viewport coords - offset offset from rhs that rightmost line would be - drawn if rectangle included whole viewport - pDC pointer to device context to use -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void paintVerticalLines( RectCoords* pRectToDraw, uint16 offset, - CDC* pDC ); -#else -/*--------------------------------------------------------------------------- -FUNCTION : PAINTVERTICALLINES -DESCRIPTION : responsible for painting the grids vertical lines -ARGUMENTS : name : yStart - - the starting Y co-ordinate for the vertical line - yEnd - - the ending Y co-ordinate for the vertical line - offset - - a starting point offset that determines at what X - position the first line will be drawn - - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void paintVerticalLines( uint16 yStart, uint16 yEnd, uint16 offset ); -#endif - -#if defined _WINDOWS -/*--------------------------------------------------------------------------- -FUNCTION : PAINTVERTICALLINE -DESCRIPTION : paints one line at the position specified, and length -ARGUMENTS : name : yStart - - the starting point on the y axis for the line - yEnd - - the end point on the y axis for the line - xPosition - - The horizontal offset from the start of the viewport - pDC pointer to device context to use - -RETURN : None -NOTES : There is not an equivalent horizontal method as yet. This - is a seperate method because the service is useful to a - derivation of this class ----------------------------------------------------------------------------*/ - void paintVerticalLine( uint16 yStart, uint16 yEnd - , uint16 xPosition, CDC *pDC ); -#else -/*--------------------------------------------------------------------------- -FUNCTION : PAINTVERTICALLINE -DESCRIPTION : paints one line at the position specified, and length -ARGUMENTS : name : yStart - - the starting point on the y axis for the line - yEnd - - the end point on the y axis for the line - xPosition - - The horizontal offset from the start of the viewport - -RETURN : None -NOTES : There is not an equivalent horizontal method as yet. This - is a seperate method because the service is useful to a - derivation of this class ----------------------------------------------------------------------------*/ - void paintVerticalLine( uint16 yStart, uint16 yEnd - , uint16 xPosition ); -#endif - -/*--------------------------------------------------------------------------- -INLINE FUNCTION : VERTICALSPACING -NOTES : Description at the end of the file ----------------------------------------------------------------------------*/ - uint16 verticalSpacing( void ); - - - // Position in viewport that we are now writing to if going forwards - // Note that if this is greater than viewport length then we have - // just scrolled and value must be adjusted before use. - sint16 forwardsOutputPosition; - - // Position in viewport that we are now writing to if going backwards - // Note that if this is less than zero then we have - // just scrolled and value must be adjusted before use. - sint16 backwardsOutputPosition; - - // position in grid cycle of forwards output position. - // if zero then it is time to output a grid line - sint16 forwardsIntervalCount; - - // position in grid cycle of forwards output position. - // if zero then it is time to output a grid line - sint16 backwardsIntervalCount; - - uint32 lastUpdateTimestamp; - uint32 timeBase; // ticks per pixel - uint16 currentOutputPosition; - uint16 gridTimestampSpacing; - uint16 intervalCount; - uint16 horizontalTotal; - uint16 vSpacing; -#if defined PRINTING_SUPPORT - uint16 numberOfGridMarkersPrinted; -#endif - bool firstTime; // indicates first time through - bool dateMarker; - - GkiLineType lineType; - GkiColour gridColour; - - #if defined _WINDOWS - uint16 ticksPerSec; // number of time ticks per second - uint16 vSpacingMin; // minimum pixels per division along time axis - CPen *pPen; // the pen to use for drawing in windows - #endif - -}; - - -/***************************************************************************** - I N L I N E F U N C T I O N S -*****************************************************************************/ - -/*--------------------------------------------------------------------------- -FUNCTION : HORIZONTALLINES -DESCRIPTION : supplies the number of horizontal lines in the grid -ARGUMENTS : name : - -RETURN : -NOTES : ----------------------------------------------------------------------------*/ -inline uint16 ScrollingGrid::horizontalLines( void ) -{ - return( horizontalTotal ); -} -/*--------------------------------------------------------------------------- -FUNCTION : VERTICALSPACING -DESCRIPTION : returns the distance between adjacent vertical lines -ARGUMENTS : name : - -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ -inline uint16 ScrollingGrid::verticalSpacing( void ) -{ - return( vSpacing ); -} - -#endif -@ - - -1.1.2.1 -log -@DEV1194:DS4 Provision of major and minor grid lines -@ -text -@d1 1 -a1 1 -/* \$Header: /home/cvsroot/ximbiot/cvs/cvshome/cyclic/cvs/unoff-diffmerge2.txt,v 1.1.1.1 2001/04/14 00:10:26 dprice Exp $ */ -d3 1 -a3 12 - * \$Log: unoff-diffmerge2.txt,v $ - * \Revision 1.1.1.1 2001/04/14 00:10:26 dprice - * \Initial import of cvshome.org web site. - * \ - * \Revision 1.318 1997/11/09 17:45:28 kingdon - * \ * sanity.sh (diffmerge1, diffmerge2): new tests, for bugs, or - * \ potential bugs, in ../diff/analyze.c which were fixed by Paul - * \ Eggert's patch. - * \ - * Revision 1.1 1997/04/02 11:20:05 colinl - * Project: DEV1175 - * DCN: - * Tested By: Colin Law - * Reviewed By: - * Reason for Change: Initial Revision of all files - * - * Design Change Details: - * - * Implications: - * -d58 6 -a63 5 -ARGUMENTS : name : majorColour colour for major grid lines - minorColour colour for minor grid lines - sgLineType line type for minor grid lines - yMajorGridLines number of major y lines on grid - yMinorGridLines number of major y lines on grid -d77 2 -a78 3 - ScrollingGrid( GkiColour majorColour, GkiColour minorColour, - GkiLineType sgLineType, - uint16 yMajorGridLines, uint16 yMinorGridLines, -a137 17 -FUNCTION : DrawHorizontalGridLines - -DESCRIPTION : Draws major or minor grid lines -ARGUMENTS : pDC device context - pPen pen to use - numLines total lines required - yLow, yHigh, xLow, xHigh rectangle to draw in - yMax max y value -RETURN : None -NOTES : ----------------------------------------------------------------------------*/ - void DrawHorizontalGridLines( CDC* pDC, CPen* pPen, - uint16 numLines, - uint16 yLow, uint16 yHigh, uint16 xLow, uint16 xHigh, - uint16 yMax ); - -/*--------------------------------------------------------------------------- -d148 6 -d448 1 -a448 2 - uint16 m_yMajorGridLines; - uint16 m_yMinorGridLines; -d456 2 -a457 3 - GkiLineType lineType; // line type for minor grid lines - GkiColour m_majorColour; - GkiColour m_minorColour; -d462 1 -a462 2 - CPen *pMajorPen; // pen to use for drawing major grid lines - CPen *pMinorPen; // pen to use for drawing minor grid lines -d472 12 -@" > diffmerge2/sgrid.h,v - - # We have to put the RCS file in the repository by hand for - # this test: - mkdir ${CVSROOT_DIRNAME}/diffmerge2 - cp diffmerge2/sgrid.h,v ${CVSROOT_DIRNAME}/diffmerge2/sgrid.h,v - rm -rf diffmerge2 - dotest diffmerge2_co \ - "${testcvs} co diffmerge2" "${DOTSTAR}U ${DOTSTAR}" - cd diffmerge2 - dotest diffmerge2_update \ - "${testcvs} update -j Review_Phase_2_Enhancements sgrid.h" \ - "${DOTSTAR}erging ${DOTSTAR}" # This is the one that counts -- there should be no output: - dotest diffmerge2_diff \ - "${testcvs} diff -r Review_V1p3 sgrid.h" '' + dotest diffmerge2-10 "${testcvs} diff -r br1 file1" '' + + # For debugging: + cvs -q diff -u -r 1.1 -r 1.1.2.1 file1 + cd ../.. + rm -r 1 + rm -rf ${CVSROOT_DIRECTORY}/first-dir ;; *)