1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971
|
2025-04-08 Jim Meyering <meyering@meta.com>
version 3.12
* NEWS: Record release date.
tests: cmp: increase timeout to avoid failure on a very busy-IO system
* tests/cmp: Increase timeout from 0.1 to 0.4s, to avoid false-failure
on a system with lots of IO congestion. Reported by Nelson Beebe
in https://lists.gnu.org/r/diffutils-devel/2025-04/msg00007.html
2025-04-04 Jim Meyering <meyering@meta.com>
build: update gnulib to latest; and update bootstrap
2025-03-28 Jim Meyering <meyering@meta.com>
maint: ensure that new "make syntax-check"-run sc_codespell passes
* cfg.mk (codespell_ignore_words_list): Ignore false-positive "words".
2025-03-27 Jim Meyering <meyering@meta.com>
maint: rather than exempt "hight" as a spelling false-positive...
* src/diff3.c (output_diff3): Rename lowt,hight to low_t,high_t.
2025-02-28 Paul Eggert <eggert@cs.ucla.edu>
tests: test for diff -y crash
* tests/side-by-side-seq: New test.
* tests/Makefile.am (TESTS): Add it.
diff: fix allocation typo leading to crashes
But reported by Nick Smallbone, with one-line fix by
Collin Funk <https://bugs.gnu.org/76613>.
* src/io.c (find_and_hash_each_line): Fix size computation.
tests: make seq replacement more available
This refactoring should let other future tests use ‘seq’.
* tests/diff3 (seq): Move from here ...
* tests/init.cfg: ... to here.
2025-02-21 Paul Eggert <eggert@cs.ucla.edu>
maint: mention bug#76452 in NEWS
2025-02-21 Collin Funk <collin.funk1@gmail.com>
diff: add a test case for the recent empty file bug
* tests/empty-file: New file.
* tests/Makefile.am (TESTS): Add the test.
2025-02-21 Paul Eggert <eggert@cs.ucla.edu>
diff: don't treat empty files as a different file type
Reported by Kate Deplaix <kit-ty-kate@outlook.com> in
<https://lists.gnu.org/r/bug-diffutils/2025-02/msg00005.html>.
* src/diff.c (compare_prepped_files): Don't rely on string
file type, as that might not agree with our idea of a file type.
2025-02-03 Simon Josefsson <simon@josefsson.org>
cmp, diff, diff3, sdiff: support gnulib-l10n
* src/cmp.c (main): Call bindtextdomain for gnulib-l10n.
* src/diff.c (main): Likewise.
* src/diff3.c (main): Likewise.
* src/sdiff.c (main): Likewise.
2025-02-02 Jim Meyering <meyering@meta.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.11
* NEWS: Record release date.
maint: continue writing base64-encoded checksums to announcement
* cfg.mk (announce_gen_args): Set to --cksum-checksums.
tests: avoid "make check" hang on CentOS Stream 9 with valgrind-3.19.0
* tests/init.cfg (require_timeout_): New function, from grep.
(require_valgrind_): Use it, to kill -9 after 3 seconds, because the
default SIGINT was insufficient.
tests: avoid test failure due to inadequate Solaris 10 tr
* tests/init.cfg (require_utf8_locale_): Solaris 10's /usr/bin/tr
silently malfunctions with multibyte input, so attempt to find a
better one, trying /usr/xpg4/bin/tr and "gtr".
Failing that, skip the test. Reported by Collin Funk in
https://lists.gnu.org/r/diffutils-devel/2025-02/msg00004.html
maint: once again distribute .tar.gz files
* configure.ac: Reenable distribution of gzip-compressed tarballs,
to help reduce the size of the Guix seed, as discussed at
https://lists.gnu.org/r/coreutils/2020-02/msg00042.html and
https://lists.gnu.org/r/sed-devel/2020-01/msg00013.html
* NEWS (Release): Mention this.
Requested by Nicolas Boos
2025-02-01 Jim Meyering <meyering@meta.com>
maint: reflect gnulib module renamings
* bootstrap.conf: Some gnulib modules are now deprecated, in
favor of new names with a "-h" suffix (and stdbool->bool).
Induce this change with the following:
re='inttypes|signal|stdckdint|stdint|sys_types|sys_wait|unistd'
perl -pi -e 's{^('"$re"')$}{$1-h};s{^stdbool$}{bool}' bootstrap.conf
Then, sort the module names.
build: update gnulib to latest; and update bootstrap
2025-01-05 Jim Meyering <meyering@meta.com>
doc: rewrite the "Unusual File Names" section
* doc/diffutils.texi (Unusual File Names): Rewrite to reflect
that file names with e.g., NL and TAB are now quoted.
Reported by Matěj Cepl in <https://bugs.gnu.org/68695>.
2025-01-05 Bruno Haible <bruno@clisp.org>
diff: Fix failure of --no-dereference option (regression 2023-07-01)
* configure.ac: Move system-related tests closer together. Define
O_PATH_SUPPORTS_FSTAT if O_PATH exists and is supported by fstat().
* src/diff.c (O_PATHSEARCH): Don't use O_PATH if it is defined but not
supported by fstat().
doc: reference continuous integration URLs
* README-hacking (Continuous integration): New section:
list the gitlab and github CI links.
2025-01-03 Jim Meyering <meyering@meta.com>
maint: update all copyright dates via "make update-copyright"
build: update gnulib to latest
2024-10-13 Collin Funk <collin.funk1@gmail.com>
maint: use Gnulib's stat-time over our own version
* bootstrap.conf (gnulib_modules): Add stat-time.
* configure.ac: Remove check for the st_blksize in struct stat.
* src/system.h: Include stat-time.h.
(STAT_BLOCKSIZE): Remove definition.
* src/analyze.c (diff_2_files):
* src/cmp.c (main):
* src/diff3.c (read_diff):
* src/io.c (sip): Use ST_BLKSIZE instead of STAT_BLOCKSIZE.
2024-09-10 Jim Meyering <meyering@meta.com>
maint: avoid old-FSF-address syntax-check failure
* man/help2man: Update to help2man-1.48.5, but merging in the
latest #!/usr/bin/env change. Bruno Haible reported that it
failed a new gnulib syntax-check due to an old FSF mailing
address in https://bugs.gnu.org/73139
2024-07-22 Bruno Haible <bruno@clisp.org>
build: Fix use of perl on Guix, FreeBSD, NetBSD
* man/help2man: Search for perl in $PATH.
build: Generate programs' man pages in the source directory, per GCS
* man/Makefile.am ($(dist_man1_MANS)): Generate the *.1 files in
$(srcdir), not in the build dir.
2024-07-21 Bruno Haible <bruno@clisp.org>
build: Fix a build failure in a VPATH build
* src/Makefile.am (cmp.$(OBJEXT) etc.): Depend on version.h.
2024-07-15 Paul Eggert <eggert@cs.ucla.edu>
maint: adjust to Gnulib -Wsystem-headers change
* configure.ac (WERROR_CFLAGS): No need to disable
-Wsystem-headers as Gnulib no longer enables it by default.
build: update gnulib submodule to latest
2024-07-04 Jim Meyering <meyering@meta.com>
build: update gnulib to latest; and update bootstrap
2024-07-04 Collin Funk <collin.funk1@gmail.com>
maint: import tests/init.sh from Gnulib during bootstrap
* bootstrap.conf (bootstrap_post_import_hook): Use gnulib-tool
--copy-file to import tests/init.sh.
* tests/init.sh: Remove file.
* .gitignore (/tests/init.sh): Add entry.
2024-06-23 Collin Funk <collin.funk1@gmail.com>
tests: don't fail when --program-transform-name is used
Problem reported by Jun T <https://bugs.gnu.org/48062>.
* tests/diff3: Use --diff-program=diff since --program-transform-name
is applied after install.
* tests/help-version (sdiff_setup, diff3_setup): Likewise.
2024-06-19 Paul Eggert <eggert@cs.ucla.edu>
diff: avoid memory leak with --color-palette
Problem found indirectly by Coverity, reported by Wasser Mai
(Bug#71535). Although the Coverity report was wrong, there was a
different potential memory leak nearby. Fix the problem by
modifying the string in place, avoiding the need to call malloc.
* src/util.c (color_ext_list, struct color_ext_type):
Remove. Not needed, as the list wasn’t used.
All uses removed.
(get_funky_string): Omit last argument output_count, as it’s
easily calculated by caller. This lets us call this function
when we don’t care about the count.
(color_palette): Now char *, not char const *, since we
now update through it.
(set_color_palette): Likewise.
(parse_diff_color): Process color palette into itself, to avoid
unnecessary malloc and free calls. This pacifies Coverity, saves
a bit of space in the normal case, and avoids a memory leak in
some cases. Do not process the palette twice, as its memory
has been modified and this function had no effect on the
color indicators the second time.
maint: update .gitignore to add lib/stdbit.h
2024-06-11 Paul Eggert <eggert@cs.ucla.edu>
diff: port to FreeBSD, NetBSD
Problem reported by Bruno Haible <https://bugs.gnu.org/71486>.
* src/diff.c (NOFOLLOW_SYMLINK_ERRNO): New constant.
(compare_files): Use it instead of ELOOP. When it is not ELOOP,
treat ELOOP as a failure in resolving the parent directory;
this saves a syscall in some situation.
2024-06-11 Bruno Haible <bruno@clisp.org>
tests: Fix ignore-case failure on several platforms
* tests/ignore-case: Don't compare 'Ⓐ' with 'ⓐ'; this doesn't work on
NetBSD 10.0 and Solaris 11.4. Don't compare 'Ꞻ' with 'ꞻ'; this doesn't
work on CentOS 7, macOS, and Solaris 11 OmniOS.
2024-06-11 Paul Eggert <eggert@cs.ucla.edu>
maint: port ‘make distcheck’ to Ubuntu 24.04
* configure.ac: Don’t use -Wsystem-headers, as <stdbit.h>
uses static functions that couldn’t be called from
extern inline functions if they were in user code.
maint: pacify ‘make sc_tight_scope’
Problem reported by Bruno Haible <https://bugs.gnu.org/71455>.
* src/system.h (same_file, stat_size): Add ‘extern’.
maint: port to birthtime platforms
Problem reported by Bruno Haible <https://bugs.gnu.org/71456>.
* src/system.c (same_file): Fix typo on platforms with birthtime.
2024-05-21 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
2024-05-16 Paul Eggert <eggert@cs.ucla.edu>
maint: adjust to Gnulib stdbit splitup
* bootstrap.conf (gnulib_modules): Remove stdbit; add stdc_bit_width.
build: update gnulib submodule to latest
2024-05-15 Paul Eggert <eggert@cs.ucla.edu>
maint: move same_file and stat_size into system.c
Now that we have a system.c, there’s little point to these
being extern inline functions.
* src/system.c (same_file, stat_size): Move here from system.h,
and make them ordinary extern functions.
(proc_dev, symlink_size_ok): Now static, and private to their
functions.
* src/system.h (same_file, stat_size): Now just decls.
build: update gnulib submodule to latest
2024-05-14 Paul Eggert <eggert@cs.ucla.edu>
maint: be less fancy when defining extern vars
Bug reported by Bruno Haible in <https://bugs.gnu.org/70951>.
I never did like the XTERN macro and its descendants, as this
“extension” to C causes more confusion than it cures, so let’s
just get rid of it and use plain ‘extern’.
* cfg.mk (_gl_TS_extern): Remove XTERN, SYSTEM_EXTERN.
* src/Makefile.am (cmp_SOURCES, diff3_SOURCES, sdiff_SOURCES)
(diff_SOURCES): Add system.c.
* src/cmp.c, src/diff.c, src/diff3.c, src/sdiff.c (SYSTEM_INLINE):
Remove.
* src/diff.c: Define vars declared in diff.h.
* src/diff.h (DIFF_EXTERN): Remove. All uses removed.
Just use ‘extern’ when declaring extern vars.
* src/system.h (SYSTEM_EXTERN): Likewise.
* src/system.c: New file.
build: update gnulib submodule to latest
2024-05-12 Paul Eggert <eggert@cs.ucla.edu>
maint: pacify GCC 14 -Wmissing-variable-declarations
* src/Makefile.am (version.c): Have it include version.h,
so that it checks its own interface.
* src/diff.c (DIFF_INLINE): Define this instead of GDIFF_MAIN,
for consistency with SYSTEM_INLINE.
* src/diff.h (DIFF_EXTERN): New macro, replacing XTERN.
All uses changed. Adjust to GDIFF_MAIN→DIFF_INLINE change.
* src/system.h (SYSTEM_EXTERN): Now takes an argument.
All uses changed.
2024-05-11 Paul Eggert <eggert@cs.ucla.edu>
diff: prefer stdbit to count-leading-zeros
stdbit.h is standardized in C23, so use that instead of
the GNU-specific count-leading-zeros module.
* bootstrap.conf (gnulib_modules): Remove count-leading-zeros.
Add stdbit.
* src/system.h: Include stdbit.h instead of count-leading-zeros.h.
(floor_log2): Implement via stdc_bit_width instead of via
count_leading_zeros_ll.
maint: update bootstrap to Gnulib version
build: update gnulib submodule to latest
2024-05-09 Paul Eggert <eggert@cs.ucla.edu>
diff: improve GCC 13.3’s static checking
* src/io.c (slurp): GCC bug 110014 should be fixed in GCC 13.3.
2024-02-18 Paul Eggert <eggert@cs.ucla.edu>
diff: restrict scope of GCC bug 110014 workaround
* src/io.c (slurp): Work around GCC bug 110014 only if GCC 13,
since it’s reportedly fixed in GCC 14.
2024-01-05 Jim Meyering <meyering@meta.com>
maint: make update-copyright
build: update gnulib to latest; also update bootstrap
build: suppress -Wmaybe-uninitialized for one function
* src/sdiff.c (edit): Suppress gcc's -Wmaybe-uninitialized warning
for this function. Whenever "cmd1 == 'e'", cmd2 **is** initialized.
2023-09-20 Paul Eggert <eggert@cs.ucla.edu>
diff: go back to C quoting for diff -c/-u headers
Gleb Fotengauer-Malinovskiy reported <https://bugs/gnu/org/66095>
that the recent change to quoting style broke GNU patch.
* src/util.c: Include quotearg.h.
(current_name): New static var, replacing the the old
current_name0 and current_name1. All uses changed.
(begin_output): Go back to quoting file names for C,
not for the shell, when they contain troublesome characters.
This is not a simple revert, as the revised code handles
multi-byte characters even in non-UTF-8 locales.
* tests/filename-quoting: Revert previous change to this file.
build: update gnulib submodule to latest
2023-09-16 Jim Meyering <meyering@meta.com>
build: avoid new build failure
* src/util.c (output_1_line): Append a semicolon to "default:"
label, now that the following line is a declaration. Avoids this:
error: a label can only be part of a statement and a declaration is\
not a statement
2023-09-16 Paul Eggert <eggert@cs.ucla.edu>
maint: fix NEWS typos
diff: tune when O_PATH fails with ELOOP
* src/diff.c (compare_files): If openat (..., "a/b/.../e/f",
O_PATH | ...) fails with ELOOP, one of a, a/b, ..., a/b/.../e
must be a symlink loop; a/b/.../e/f cannot itself be a symlink loop.
So in this case fail immediately rather than following up with
fstatat (..., "a/b/.../e/f", ..., AT_SYMLINK_NOFOLLOW).
diff: tune 'diff --no-dereference --no-file-name-case SYMLINK DIR'
* src/diff.c (compare_files): If find_dir_file_pathname tells
us the file type, use that info to avoid unnecessary calls
to openat.
* src/dir.c (find_dir_file_pathname): New arg DETYPE. All uses changed.
2023-09-15 Paul Eggert <eggert@cs.ucla.edu>
maint: fix comment typo
2023-09-15 Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org> (tiny change)
diff: fix regression affecting the counting of diff context lines
This regression was introduced on 2023-05-22 in commit
v3.10-9-gda1697dcb6 ("diff: C99 decl style in context.c") during a code
style change.
This regression was discovered using the GNU patch testsuite:
FAIL: preserve-c-function-names
FAIL: reject-format
* src/context.c (minus_prefix_lines): Initialize with a reversed value.
2023-09-15 Paul Eggert <eggert@cs.ucla.edu>
diff: publish attributes
* src/diff.h (translate_line_number, find_change):
Move attribute here ...
* src/util.c: ... from here.
2023-09-13 Paul Eggert <eggert@cs.ucla.edu>
diff: respond faster to write failures
* src/util.c (output_1_line): Check for signals even
if there is a write failure, for faster response when
hammering on /dev/full etc.
maint: be clearer about when ctype is needed
Include <ctype.h> and <c-ctype.h> only in modules where needed.
* src/cmp.c, src/context.c, src/diff.c, src/diff3.c, src/ifdef.c:
* src/sdiff.c: Include <c-ctype.h>.
* src/io.c: Include <ctype.h>.
* src/system.h: Do not include either <ctype.h> or <c-ctype.h>.
maint: diff no longer uses isblank directly
* bootstrap.conf (gnulib_modules): Remove isblank.
2023-09-12 Paul Eggert <eggert@cs.ucla.edu>
diff: improve util.c multi-byte handling
* bootstrap.conf (gnulib_modules): Add c32isprint.
* src/util.c: Include mcel.h.
(output_1_line): Return immediately on output error.
Scan multi-byte characters and count their widths.
(analyze_hunk): Ignore multi-byte white space too.
sdiff: port to odd isspace locales
* src/sdiff.c (skip_white): Use c_isspace, not isspace.
We are parsing diff output, and c_isspace is better here.
2023-09-07 Paul Eggert <eggert@cs.ucla.edu>
diff: port --no-dereference changes to non-O_PATH
This fixes a recently-introduced portability bug
when running on platforms like Solaris 10 that lack O_PATH.
* src/diff.c (compare_files): On platforms without O_PATH,
when running 'diff --no-dereference symlink dir' do not
report an error merely because dir/symlink is a symbolic link
and cannot be opened for reading.
maint: switch to gnulib mcel
Drop diffutils-specific library code that has been moved into Gnulib.
* gl/lib/exclude.c, gl/lib/mbscasecmp.c, gl/lib/mcel.c:
* gl/lib/mcel.h, gl/modules/mcel, gl/modules/mcel-prefer:
* gl/modules/mcel-tests, gl/tests/test-mcel.c:
Remove; now taken from Gnulib.
build: update gnulib submodule to latest
2023-08-30 Paul Eggert <eggert@cs.ucla.edu>
maint: define GNULIB_MBRTOC32_REGULAR
* configure.ac (GNULIB_MBRTOC32_REGULAR): Define.
diffutils itself already assumes this, so it might as well
assume it in Gnulib code as well.
2023-08-24 Paul Eggert <eggert@cs.ucla.edu>
diff: port mcel.h designated initializers to C99
* gl/lib/mcel.h (mcel_ch, mcel_err): Use C-standard notation
for designated initializers, instead of a GNU extension.
2023-08-22 Paul Eggert <eggert@cs.ucla.edu>
maint: pacify ‘make syntax-check’
* cfg.mk: Update exclude_file_name_regexp lists.
2023-08-21 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
diff: avoid mbuiter
* bootstrap.conf (avoided_gnulib_modules):
Avoid mbuiter.
* gl/lib/exclude.c: New file, with an mcel option.
diff: modularize and tune mcel code
Go back to a single mcel module, instead of trying to break it up
into ucore and mcel pieces, as breaking it up hurt performance.
Use gnulib-tool’s --local-dir to create diffutils-specific modules
for mcel; the idea is that this will eventually migrate into Gnulib.
* bootstrap.conf (avoided_gnulib_modules): Add mbuiterf.
(gnulib_modules): Add mbscasecmp, mcel-prefer.
(gnulib_tool_option_extras): Add --local-dir=gl to pick up new files.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_doubled_word):
Do not exclude now-removed files lib/ucore.c, lib/ucore.h.
* lib/Makefile.am: Adjust to use of modules.
(noinst_HEADERS): Remove mcel.h, ucore.h.
(libdiffutils_a_SOURCES): Remove mcel.c, mcel-casecmp.c, ucore.c
* lib/mcel-casecmp.c, lib/ucore.c, lib/ucore.h: Remove.
* lib/mcel.h: Switch to LGPLv2.1+. Do not include ucore.h.
All uses of ucore_t changed back to using char32_t.
Do what ucore.h used to do: include verify.h, limits.h, stddef.h,
uchar.h; require config.h, define _GL_LIKELY, _GL_UNLIKELY.
(MCEl_CHAR_MAX, MCEL_ERR_MIN, MCEL_ERR_MAX): New constants.
(mcel_t): Switch from single ucore_t c to a char32_t ch and
unsigned char err. This has significantly better performance on
Fedora 38 x86-64. All uses changed. Check that unsigned char
promotes to int.
(mcel_ch, mcel_err, mcel_cmp, mcel_tocmp): New functions.
(MCEL_ERR_SHIFT): Rename from MCEL_ENCODING_ERROR_SHIFT.
All uses changed.
(mcel_isbasic): Add a _GL_LIKELY to help compilers. All uses changed.
(mcel_scan, mcel_scant): Simplify by using mcel_ch, mcel_err.
(mcel_casecmp): Remove decl. Callers changed to use mbscasecmp.
* gl/lib/mcel.c, gl/lib/mcel.h: Rename from lib/mcel.c, lib/mcel.h.
* gl/lib/mbscasecmp.c: New file.
* gl/modules/mcel, gl/modules/mcel-prefer, gl/modules/mcel-tests:
* gl/tests/test-mcel.c:
New files.
* src/io.c: Revert use of ucore API. Use plain c32isspace etc.
instead of ucore_is. Use .err instead of ucore_iserr.
(same_ch_err): Bring back, and use it instead of ucore_cmp.
* src/side.c (print_half_line): Use .err instead of ucore_iserr.
diff: omit ignore_file_name_case test
* src/dir.c (compare_names): Omit redundant test.
2023-08-20 Paul Eggert <eggert@cs.ucla.edu>
diff: fix recently-introduced file name case bug
* src/diff.c (compare_files): When ignoring file name case
and comparing a file f to a directory d at the top level,
make sure that if we end up comparing f to d/F then
don’t mistakenly try to open d/f instead.
* src/dir.c (compare_collated): Do not worry about
ignore_file_name_case here.
(compare_names): Worry about it here instead.
That way, we do the right thing with the test case.
* tests/ignore-case: Test for the bug.
2023-08-19 Jim Meyering <meyering@meta.com>
maint: avoid syntax-check for doubled word "TO to" in lib/ucore.h
* cfg.mk (exclude_file_name_regexp--sc_prohibit_doubled_word):
Also exempt lib/ucore.h.
2023-08-15 Paul Eggert <eggert@cs.ucla.edu>
maint: update .gitignore
* .gitignore: Remove lib/charset.alias, lib/configmake.h,
lib/ref-add.sed, lib/ref-del.sed. Add lib/c-file-type.c,
lib/file-type.h. Sort.
diff: simplify multi-byte code (mbcel -> mcel)
* lib/Makefile.am: Adjust to file renamings and additions.
* lib/mbcel.c, lib/mbcel.h: Split into two APIs, replacing with ...
* lib/mcel.c, lib/mcel.h, lib/ucore.c, lib/ucore.h: ... these new files.
* lib/mcel.h: Simplify by assuming ucore.h is included.
Check that bytes have 8 bits.
(MCEL_LEN_MAX, mcel_t, MCEL_INLINE, MCEL_ENCODING_ERROR_SHIFT)
(mcel_scan, mcel_scant, mcel_scanz, mcel_casecmp):
Rename from MBCEL_LEN_MAX, mbcel_t, MBCEL_INLINE,
MBCEL_ENCODING_ERROR_SHIFT, mbcel_scan, mbcel_scanz, mbcel_scant,
mbcel_casecmp.
(mcel_t): New member c, replacing old members ch and err.
All uses changed.
(MBCEL_UCHAR_FITS, MBCEL_UCHAR_EASILY_FITS): Remove.
All uses removed. No longer needed now 8-bit bytes are assumed.
(MCEL_ENCODING_ERROR_SHIFT): Check that it matches UCORE_ERR_MIN.
(mcel_isbasic): New function. Use it where appropriate.
(mbcel_cmp, mbcel_casecmp): Remove; replaced by ucore_cmp,
ucore_tocmp. All uses changed.
* lib/mcel-casecmp.c: Rename from lib/mbcel-strcasecmp.c.
Include mcel.h instead of mbcel.h.
(mcel_casecmp): Rename from mbcel_strcasecmp. All uses changed.
Assert that UCHAR_MAX <= INT_MAX, as POSIX requires,
and simplify code accordingly. Use mcel rather than mbcel.
* lib/ucore.h: Include verify.h.
(ucore_t): New type.
(UCORE_CHAR_MAX, UCORE_ERR_MIN, UCORE_ERR_MAX, UCORE_C32_SAFE):
New constants. Check that information is not lost by encoding
errors as integers; this is a weaker test than CHAR_BIT == 8.
(ucore_iserr, ucore_is, ucore_to): New functions.
(ucore_cmp, ucore_tocmp): New functions, replacing the old
mbcel_cmp, mbcel_casecmp. All uses changed.
* src/dir.c, src/io.c, src/side.c: Use mcel rather than mbcel.
* src/io.c (same_ch_err): Remove. All uses replaced by ucore_cmp.
2023-08-14 Paul Eggert <eggert@cs.ucla.edu>
diff: improve symlink handling, avoiding a race
* bootstrap.conf (gnulib_modules): Add c-file-type
and remove file-type.
* po/POTFILES.in: Add lib/c-file-type.c, remove lib/file-type.c
* src/diff.c (O_PATH_DEFINED): New constant.
(detype_from_mode): Remove; no longer used.
(dir_p): Go back to the old way of using S_ISDIR.
(compare_prepped_files): Use filetype and stat macros, not detype.
Pass symlink fd and "" to careadlinkat if available, as that
avoids a race. Test for dir vs file earlier, so that a missing
file is treated consistently with dir/file vs file.
(compare_files): New arg DETYPE replacing the old DETYPE0 and DETYPE1.
All uses changed. st_size for nonexistent files is 0, not -1.
Set up .filetype, not .detype, as .filetype is finer-grained.
Open symlinks with O_PATH on GNU/Linux, since we can then
use readlinkat on the resulting file descriptor and this
avoids a race.
* src/diff.h (struct file_data): Remove detype member.
Add filetype member; it’s finer-grained. All uses changed.
* tests/no-dereference: Add test that the previous commit failed.
tests: fix comment numbering
* tests/no-dereference: Omit comment numbers that didn’t correspond
to test case ordering.
build: update gnulib submodule to latest
diff: simplify compare_files statting
* src/diff.c (compare_files): Simplify the test for whether to get
file status. Although this change means diff sometimes will call
fstat or fstatat when not needed, these occasions are so rare that
the optimization is not worth the code complexity.
diff: refactor compare_files
Break out a good chunk of the body of compare_files into
a new function compare_prepped_files. This simplifies
indenting and code slightly.
* src/diff.c (compare_prepped_files): New function, taken
from compare_files.
(compare_files): Use it.
diff: report special file major+minor
* bootstrap.conf (gnulib_modules): Add sys_types,
for MAJOR_IN_MKDEV and MAJOR_IN_SYSMACROS.
* src/diff.c (major, minor): New macros or functions.
Include <sys/mkdev.h> or <sys/sysmacros.h> for them.
(compare_files): Output major and minor device numbers
for special files that differ.
2023-08-11 Paul Eggert <eggert@cs.ucla.edu>
diff,cmp: tighten up same-file checks
* src/cmp.c (main):
* src/diff.c (compare_files):
* src/dir.c (dir_loop):
same_file returns bool, not int, so remove "0 <"s that date back
to when it returned an int. Remove uses of same_file_attributes.
* src/system.h (same_file): Now an inline function not a macro.
Tighten up comparison rules a bit, by ignoring attributes of
special files whose st_rdev are the same, and by considering
any birthtime differences to be definitive. Do all the work
that same_file_attributes used to do. Update commentary.
(same_file_attributes): Remove. All uses removed.
maint: tighten stat_size arg type
* src/system.h (stat_size): Arg is now pointer to const.
2023-08-08 Paul Eggert <eggert@cs.ucla.edu>
cmp,diff,diff3,sdiff: quote more consistently
* lib/diagnose.c, lib/diagnose.h: New files.
* lib/Makefile.am (noinst_HEADERS, libdiffutils_a_SOURCES):
Add them.
* po/POTFILES.in: Add lib/diagnose.c.
* src/analyze.c, src/cmp.c, src/diff3.c, src/dir.c:
* src/sdiff.c, src/util.c:
Include diagnose.h.
* src/analyze.c (briefly_report, diff_2_files):
* src/cmp.c (usage, main, cmp):
* src/diff.c (add_regexp, summarize_regexp_list, main, compare_files):
* src/diff3.c (usage, process_diff, scan_diff_line):
* src/dir.c (diff_dirs):
* src/sdiff.c (usage, ck_fopen, main, edit):
* src/util.c (perror_with_name, begin_output):
Quote file names or regexps with squote.
* src/cmp.c, src/diff.c, src/diff3.c, src/dir.c, src/sdiff.c:
Include quote.h.
* src/cmp.c, src/diff.c, src/diff3.c, src/sdiff.c (try_help):
Remove; now in diagnose.c.
* src/cmp.c (specify_ignore_initial, main, cmp):
* src/diff.c (main, specify_value, specify_colors_style):
* src/diff3.c (main, read_diff):
* src/dir.c (compare_collated):
* src/sdiff.c (check_child_status, main):
* src/util.c (finish_output):
Quote strings with ‘quote’ or ‘quote_n’.
* src/system.h (EXIT_TROUBLE): Remove; now in diagnose.h
and now an enum.
* src/util.c (c_escape_char, c_escape):
Remove, as we now use squote.
* tests/cmp, tests/filename-quoting, tests/invalid-re:
Adjust to match new behavior.
diff: try lseek on special files
* src/diff.c (compare_files): It is OK to try lseek on special
files, as failures are no-ops. Treat failures as an indication
that the file position is irrelevant.
cmp: lseek need not succeed on special files
* src/cmp.c (main): Do not report an error if lseek returns -1,
as it is OK if the file is not seekable and none of the other
lseek errors seem to be relevant. This reverts my June 21 commit.
diff: clarify /proc code
* src/system.h (care_about_symlink_size): New macro.
(stat_size): Use it. Do the simple checks (requiring no syscalls)
first. Although it now makes no difference, remove the S_ISREG (mode)
check from the /proc test; this is clearer as /proc files need not be
regular files.
diff: output symlink contents when they differ
* bootstrap.conf (gnulib_modules): Add quote.
* src/diff.c: Include quote.h.
(compare_files): Print contents of symlinks that differ,
and quote their names and contents.
* src/system.h (symlink_size_ok): Remove.
(stat_size): Don’t worry about symlink sizes.
* tests/no-dereference: Adjust tests to match new behavior.
2023-08-06 Paul Eggert <eggert@cs.ucla.edu>
diff: fix some behavior on unreadable input
This fixes a bug I recently introduced.
* src/diff.c (compare_files): Set and use openerr to avoid
the need for a doomed second attempt at openat.
Don’t insist on openat succeeding before trying fstatat.
Unless openat fails with ENOENT, ENOTDIR, ELOOP, EOVERFLOW, ENAMETOOLONG
it’s possible for it to fail even when fstatat would succeed.
ENOTDIR also means the file does not exist.
However, do not worry about EBADF as that is no longer possible
now that diff uses xstdopen. When checking whether a file should
be considered to be nonexistent, do not require the other file
desc to be UNOPENED or STDIN_FILENO; all that is needed is
for the other file to not have an ENOENT or ENOTDIR failure.
* src/diff.h (struct file_data): New member openerr.
(OPEN_FAILED): New constant.
* tests/new-file: Add a regression test to catch the bug
fixed by the above.
diff: fix recent -N regression
* src/diff.c (compare_files): Fix recent regression, by
looking at cmp.file[1 - f].err rather than cmp.file[1 - f].desc.
Also, do not bother checking for EBADF, as that’s no longer
possible now that diff uses xstdopen.
2023-08-05 Paul Eggert <eggert@cs.ucla.edu>
diff: minor errno performance tweak
* src/diff.c (get_errno): New function.
(compare_files): Use it.
diff: prefer openat+fstat more often
This closes some more races, by using openat+fstat instead
of fstatat+openat which can get confused by some other process
renaming files in the meantime. Not all races are closed of course.
* bootstrap.conf (gnulib_modules): Add d-type.
* src/diff.c (errno_encode, errno_decode): Remove, as file
descriptors are no longer portmanteau variables. All uses removed.
(detype_from_mode): New function.
(dir_p): Use detype, not stat.st_mode.
(compare_files): New args DETYPE0 and DETYPE1. All uses changed.
Update detype and err as new info arrives.
Adjust to desc's new use (no longer encodes errno).
Do not ignore lseek failures on regular files.
Prefer openat+fstat to fstatat+openat when detype shows that it's safe,
and avoid both fstat and fstatat if detype suffices.
Use ‘error’ with errno value rather than setting error
and then calling perror_with_name. Coalesce two of these
error diagnostics into one by moving an error check before
the diagnostic is output. Coalesce two calls to diff_dirs.
Print file type based on detype if available,
in case neither fstat nor fstatat was called.
* src/diff.h (enum detype): New type.
(struct file_data): New slots err, detype.
(NONEXISTENT, UNOPENED): Renumber so that -1 stands for open failed.
* src/dir.c (HAVE_STRUCT_DIRENT_D_TYPE): Default to false.
(dir_read): Return to caller the d_type, if available.
(diff_dirs): Pass detype to compare_files.
maint: use O_CLOEXEC on streams
* bootstrap.conf (gnulib_modules): Add fopen-gnu, for the "e" flag.
* src/diff3.c (main):
* src/sdiff.c (main, edit):
Use the "e" flag.
maint: use O_CLOEXEC
* src/cmp.c (main):
* src/diff.c (compare_files):
* src/dir.c (dir_read):
Use O_CLOEXEC when opening files that need not be shared with
child processes.
diff: tiny tweak to compare_files performance
* src/diff.c (compare_files): Compare ints, not strings.
diff: simplify diff_dirs API
* src/diff.c (compare_files):
Now extern, not static, so that diff_dirs can call it.
* src/dir.c (diff_dirs): Remove arg HANDLE_FILE, since it was
always compare_files. Just call compare_files directly.
All uses changed.
diff: simplify diff_dirs
* src/dir.c (diff_dirs): Simplify and help the compiler a bit.
diff: tune errno handling
* src/diff.c (errno_encode): Add dassert to help debugging,
and help the compiler when not debugging.
diff: avoid a race when opening files
* src/diff.c (O_PATHSEARCH): New constant.
(compare_files): Prefer openat+fstat to fstatat+openat,
as it avoids a race and should be a bit faster.
2023-08-01 Jim Meyering <meyering@meta.com>
maint: avoid new syntax-check failures
* cfg.mk (_gl_TS_extern): Add SYSTEM_EXTERN to the list.
* src/system.h (stat_size): Hoist function name onto the
preceding line, to placate syntax-check rule.
2023-07-30 Paul Eggert <eggert@cs.ucla.edu>
diff: fail faster in odd --ignore-file-name-case usage
* src/diff.c (compare_files):
Fail faster with ‘diff --ignore-file-name case - .’.
maint: be more careful about st_size
* src/cmp.c (main): st_size == -2 now means the rest of
the stat buf is unspecified; st_size == -1 now merely
means st_size itself is unspecified. All uses changed.
* src/analyze.c (diff_2_files):
* src/diff.c (compare_files):
Trust st_size == 0, as this is now reliable.
* src/diff.c (compare_files): Don’t always trust st_size of /proc
files and symlinks.
* src/system.h (SYSTEM_EXTERN): New macro.
(proc_dev, symlink_size_ok): New vars.
(stat_size): New function.
2023-07-28 Paul Eggert <eggert@cs.ucla.edu>
diff: omit no-longer-safe optimization
* src/diff.c (compare_files): Remove optimization for size-zero
files that is no longer valid for unusual combinations like ‘touch
mt; diff /proc/kmsg mt’ where one file is an empty regular file
and the other is an unreadable /proc file with st_size zero but
where the actual size is nonzero.
2023-07-27 Paul Eggert <eggert@cs.ucla.edu>
diff: tweak context timestamp buffer size
* src/context.c (print_context_label): Use a more conservative
upper bound for timestamp length. In practice this change
makes no difference: it’s more for documentation.
2023-07-25 Paul Eggert <eggert@cs.ucla.edu>
diff: stop using sprintf
The calls to sprintf are not needed any more, since the resulting
string is now immediately passed to fprintf.
* src/context.c (print_context_label): Redo to call
maint: translate openat-die.c
* po/POTFILES.in: Re-add lib/openat-die.c.
diff3: simplify by assuming !GCC_LINT
GCC's static checks no longer seem to warn about the code
protected by GCC_LINT, so remove its last uses, which were in diff3.
(Or perhaps it was valgrind or gcc -fsanitize=address leak
checking instead? But in that case there are other false
positives and we don’t worry about them either.) This code was
problematic anyway when introduced (as witness the corresponding
test case) and it slowed diff3 down a bit.
* configure.ac (GCC_LINT): Remove. All uses removed.
* src/diff3.c: Simplify by assuming !GCC_LINT.
diff: simplify SIGSTOP/SIGTSTP porting
* src/util.c (SIGSTOP, SIGTSTP): Default to 0.
(process_signals, is_tstp_index): Simplify by using the default.
(sig): Adjust to default.
2023-07-25 Bruno Haible <bruno@clisp.org>
maint: Fix build failures mingw 10 and MSVC 14.30
* bootstrap.conf (gnulib_modules): Add popen, pclose, readdir,
readlinkat, sigaction.
* configure.ac: Don't enable _FORTIFY_SOURCE on mingw.
* src/util.c (process_signals): If SIGTSTP is not defined,
stop_signal_count is zero, therefore disable the stop signal processing.
(sig): If SIGHUP is not defined, don't list it. If SIGPIPE is not
defined, don't list it.
2023-07-24 Paul Eggert <eggert@cs.ucla.edu>
maint: port better to MS-Windows
Problem reported by Gisle Vanem <https://bugs.gnu.org/64811>.
* bootstrap.conf (gnulib_modules): Add fstatat, openat.
diff: compare symbolic links more efficently
Also, remove dependence on xreadlink.
* bootstrap.conf (gnulib_modules): Add careadlinkat.
Remove xreadlink (which depends on careadlinkat).
* src/diff.c: Include careadlinkat.h, not xreadlink.h.
(compare_files): Don’t bother to read links if their lengths differ.
Use careadlinkat instead of xreadlink so that normally malloc need
not be called.
2023-07-23 Paul Eggert <eggert@cs.ucla.edu>
cmp: fix recent off-by-1 error
* src/cmp.c (cmp): Subtract 1 from byte_number before printing,
fixing an off-by-one error in the previous patch.
build: update gnulib submodule to latest
cmp: remove dependence on inttostr
* bootstrap.conf (gnulib_modules): Remove inttostr.
* src/cmp.c: Do not include inttostr.h.
(cmp): Use C99-style PRIdMAX rather than Gnulib inttostr,
as PRIdMAX is simpler and (thanks to Gnulib) is portable.
diff: omit HAVE_STRUCT_STAT_ST_SPARE1
* src/diff.c (main): Remove reference to macro
HAVE_STRUCT_STAT_ST_SPARE1, which hasn’t been defined since 2007.
diff: get current time lazily, via C11
* bootstrap.conf (gnulib_modules): Remove gettime; add timespec_get.
* src/context.c (print_context_label): Get current time lazily.
Use C11 timespec_get rather than older Gnulib gettime function.
* src/diff.c: Do not include timespec.h.
(set_mtime_to_now): Remove. All uses removed.
2023-07-22 Paul Eggert <eggert@cs.ucla.edu>
diff: check file attributes more carefully
* src/system.h: Include stat-time.h, timespec.h.
* bootstrap.conf (gnulib_modules): Add timespec, for timespec_cmp.
(same_file_attributes): Check birthtime and ns components too.
Check attributes earlier if they are more likely to differ.
2023-07-21 Paul Eggert <eggert@cs.ucla.edu>
diff: don’t think mbcel_strcasecmp preserves errno
* configure.ac: Do not check for strcasecoll (which doesn’t exist)
or stricoll (not worth the porting hassle, as it doesn’t set errno).
* src/dir.c: Always include mbcel.h, since we now always
use mbcel_strcasecmp.
(strcasecoll): Remove
(compare_collated, diff_dirs): Do the setjump business only when
not ignoring file name case, since mbcel_strcasecmp doesn’t fail
and doesn’t set errno. This fixes a bug in recent changes,
which incorrectly assumed mbcel_strcasecmp preserves errno.
* src/dir.c:
Always include mbcel.h, since we now always compile a call
to mbcel_strcasecmp.
(strcasecoll): Remove. It’s not worth bothering to port to
Microsoft stricoll’s idiosyncrasies; mbcel_strcasecmp is good enough.
And nobody ever implemented strcasecoll.
2023-07-21 Paul Eggert <eggert@cs.ucla.edu>
diff: simplify qsort comparison function
* src/dir.c (compare_names_for_qsort): Simplify.
diff: sort multi-byte file names better
* bootstrap.conf (gnulib_modules): Add builtin-expect.
* lib/mbcel-strcasecmp.c: New file.
* lib/Makefile.am (libdiffutils_a_SOURCES): Add it.
* lib/mbcel.h (MBCEL_LEN_MAX, MBCEL_ENCODING_ERROR_SHIFT)
(MBCEL_UCHAR_FITS, MBCEL_UCHAR_EASILY_FITS): New constants.
(_GL_LIKELY): New macro.
(mbcel_scan): Use it. Simplify NetBSD code.
(mbcel_scant, mbcel_scanz, mbcel_cmp, mbcel_casecmp): New functions.
* src/dir.c (strcasecoll): Move defn here from system.h,
since only dir.c needs it. Use mbcel_strcasecmp instead
of strcasecmp.
diff: remove diff_dirs ‘volatile’
* src/dir.c (diff_dirs): Omit ‘volatile’, as it’s no longer
needed with the current use of setjmp.
2023-07-19 Paul Eggert <eggert@cs.ucla.edu>
cmp: remove IF_LINT
* src/cmp.c (cmp): Redo to avoid the need for IF_LINT, while still
pacifying GCC. The machine code is a bit smaller too. The price
is a portmanteau variable, but it’s worth it.
* src/system.h (IF_LINT): Remove.
diff: simplify away an ‘IF_LINT (volatile)’
* src/dir.c (find_dir_file_pathname): Simplify. There is no
longer a need for volatile or setjmp, now that dir_read does all
the tricky sorting and longjmping.
diff: improve -S dir-reading performance
* src/dir.c (dir_read): New args STARTFILE and STARTFILE_ONLY,
to avoid unnecessary allocation and copying. All uses changed.
* tests/starting-file: New test.
* tests/Makefile.am (TESTS): Add it.
diff: fix recently-introduced &noparent bug
* src/dir.c (diff_dirs, dir_loop): The ‘parent’ member is now
&noparent (instead of null) if there is no parent. Patch
a couple of uses that were missed earlier.
2023-07-18 Paul Eggert <eggert@cs.ucla.edu>
diff: fix mbcel bug on NetBSD
* lib/mbcel.h (mbcel_t):
Fix bug on NetBSD as I read its code incorrectly earlier.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2023-07/msg00085.html
Mostly for documentation, use _GL_ATTRIBUTE_MAY_ALIAS to remind
compiler not to rely on strict C semantics for unions.
maint: convert source from non-UTF-8
* po/en.po: Convert from Latin-1 to UTF-8.
This was the only remaining file under Git control
that still used an encoding other than UTF-8.
diff: use openat, fstatat when recursive
This should improve performance when doing recursive comparisons.
Currently there is no attempt to avoid file descriptor exhaustion,
just as previously there is no attempt to avoid file names
that provoke ENAMETOOLONG. Because of this change, ‘diff - A/B’
now works correctly when standard input is a directory.
* .gitignore: Add lib/dirent.h.
* bootstrap.conf (gnulib_modules): Add fdopendir.
* src/diff.c (main): Initialize noparent’s desc to AT_FDCWD.
(compare_files): Use fstatat with parent directory’s file
descriptor and relative name, instead of lstat or stat.
Likewise for openat and open.
* src/diff.h (struct file_data): New member ‘dirstream’.
(struct comparison): The ‘parent’ member is now &noparent (instead
of null) if there is no parent. All uses changed.
(curr): New toplevel variable, replacing ‘files’. All uses changed.
* src/dir.c: Include dirname.h, for last_component.
(dir_read): New arg PARENTDIRFD. Arg DIR is no longer
pointer-to-const since DIR->desc and DIR->dirstream are now
updated. Use PARENTDIRFD to open the directory via
opendat+fdopendir instead of via opendir. Update new dirstream
component instead of closing the directory, since it’s now the
caller’s responsibility to close the directory because callers now
want the file descriptor. All callers changed.
(diff_dirs): First arg CMP is no longer pointer-to-const since
CMP->file is updated by dir_read. All callers changed.
(find_dir_file_pathname): First arg is now struct file_data *,
not merely a file name. All callers changed.
* tests/stdin: Test new behavior when stdin is a directory.
maint: stop exempting lib/mbcel.h
* cfg.mk (exclude_file_name_regexp--sc_GPL_version): Remove.
2023-07-18 Jim Meyering <meyering@meta.com>
maint: avoid syntax-check failure
* po/POTFILES.in: Remove openat-die.c.
It is no longer used. Reported by Bruno Haible in
https://lists.gnu.org/r/diffutils-devel/2023-07/msg00018.html
2023-07-17 Paul Eggert <eggert@cs.ucla.edu>
doc: document tab behavior better
* doc/diffutils.texi (Tabs): Document issues with tabs,
encoding errors, and non-ASCII characters.
diff: remove find_reverse_change
This is a minor refactoring and simplification.
* src/context.c (find_hunk):
* src/util.c (find_change): Rename locals for clarity.
(find_reverse_change): Remove. All uses removed.
diff: assert-related cleanup
Regularize how assertions are done by using ‘unreachable’ or a new
macro ‘dassert’, or by removing unnecessary assertions.
* src/analyze.c (diff_2_files):
* src/util.c (get_funky_string, parse_diff_color)
(set_color_context):
Prefer unreachable to abort for code where it’s easy to
see that it cannot be reached.
* src/context.c (ATTRIBUTE_PURE):
* src/util.c (print_message_queue):
Prefer ‘dassert (X);’ to ‘if (!X) abort ();’.
* src/diff.c: Do not include assert.h; system.h does that if needed.
(usage): Remove the need for an assert by using fputs and fwrite
rather than printf. This is clearer anyway.
(compare_files): Remove ‘assert’ that hardware will check.
Prefer dassert to assert.
* src/ifdef.c (do_printf_spec):
Prefer dassert to comment.
* src/system.h (dassert): New macro. Include assert.h if needed.
maint: prefer puts to printf
* src/cmp.c (usage):
* src/util.c (begin_output):
Simplify by using puts instead of printf.
diff: improve dir comments
* src/dir.c: Improve comments.
diff: improve NONEXISTENT readability
* src/diff.c (NONEXISTENT, UNOPENED): Move from here ...
* src/diff.h: ... to here.
* src/dir.c (dir_read, diff_dirs): Use name for constants.
diff: link to LIB32CONV
* src/Makefile.am (LDADD): Add LIB32CONV; needed for recent
char32_t changes on some platforms.
diff: reindent recent changes
* src/io.c (lines_differ): A bit less indenting.
maint: translate lib/openat-die.c
* po/POTFILES.in: Add lib/openat-die.c.
maint: mbcel.h is LGPL 3 not 2.1
* lib/mbcel.h: Make it LGPL 3, not 2.1, to pass "make syntax-check".
2023-07-12 Jim Meyering <meyering@meta.com>
maint: avoid a new syntax-check failure
* cfg.mk (exclude_file_name_regexp--sc_GPL_version): Exempt mbcel.h,
which is GPL-2.1. Remove this exemption if/when mbcel.h moves to gnulib.
2023-07-11 Paul Eggert <eggert@cs.ucla.edu>
diff: tweak mbstate_t performance
* lib/mbcel.h (mbcel_scan): Improve performance when initializing
an mbstate_t.
2023-07-10 Paul Eggert <eggert@cs.ucla.edu>
diff: add mbcel checks, compiler advice
* lib/mbcel.h: Include limits.h, stddef.h.
Add static assertions that MB_LEN_MAX has a sane value,
as the code relies on this. Help GCC by advising
it that mbrtoc32 never returns a value between
MB_LEN_MAX + 1 and (size_t) -1 / 2 inclusive.
2023-07-09 Paul Eggert <eggert@cs.ucla.edu>
diff: tweak mbcel_scan performance
* lib/mbcel.h (mbcel_scan): Check top bit of size
rather than comparing it to MB_LEN_MAX, as this
typically lets the compiler generate tighter code.
maint: fix mbcel comment
maint: update .gitignore
diff: count newlines for lines_differ lengths
* src/io.c (lines_differ): Line lengths now count trailing
newlines, as this is a bit simpler. Caller changed.
diff: refactor lines_differ location
* src/io.c (lines_differ): Move here ...
* src/util.c: ... from here, since it needs to be kept consistent
with find_and_hash_each line anyway, and there is no reason to
make it an extern function.
diff: simplify recent --side-by-side changes
* src/side.c: Include mbcel.h instead of uchar.h.
(print_half_line): Simplify by using mbcel_scan rather than
mbrtoc32. Although this removes support for hypothetical platforms,
it makes the code easier to follow and a bit more efficient.
diff: support multi-byte comparison
* bootstrap.conf (gnulib_modules): Add c32isspace, c32tolower.
* lib/Makefile.am (noinst_HEADERS): Add mbcel.h.
(libdiffutils_a_SOURCES): Add mbcel.c
* lib/mbcel.c, lib/mbcel.h: New files.
* src/io.c: Include mbcel.h, uchar.h.
(hash): 2nd arg is now hash_value, not merely unsigned char,
since the caller might pass a char32_t now.
(find_and_hash_each_line): Support multi-byte input.
* src/util.c: Include mbcel.h, uchar.h.
(lines_differ): New args S1LEN, S2LEN, needed for mbcel_scan.
Caller changed. Support multi-byte input.
* tests/ignore-case: New file.
* tests/Makefile.am (TESTS): Add it.
* tests/ignore-tab-expansion: Add UTF-8 test.
* tests/init.cfg (require_utf8_locale_): New function.
* tests/side-by-side: Use it. Add a column-counting test.
2023-07-06 Paul Eggert <eggert@cs.ucla.edu>
diff: simplify recent mbrtoc32 improvement
* src/side.c (print_half_line): Simplify. Don't worry about
initializing mbstate until it's needed. Avoid int overflow if the
byte sequence represents more than INT_MAX columns. Avoid need
for separate TP1 local.
2023-07-06 Bruno Haible <bruno@clisp.org>
tests: Add a side-by-side output test
* tests/side-by-side: New file.
* tests/Makefile.am (TESTS): Add it.
diff: Improve handling of mbrtoc32 result
* src/side.c (print_half_line): When mbrtoc32 has left the mbstate not
in the initial state, continue calling mbrtoc32.
2023-07-05 Paul Eggert <eggert@cs.ucla.edu>
diff: ignore tabs consistently with expanding them
* src/io.c (find_and_hash_each_line):
* src/util.c (lines_differ):
Treat '\0', '\a', '\b', '\f', '\r', '\v' consistently with how
side.c treats them when expanding them, e.g., backspacing from
column 1 is a no-op when counting tab columns.
* tests/ignore-tab-expansion: New test.
* tests/Makefile.am (TESTS): Add it.
diff: don’t backspace before first column
* src/util.c (output_1_line): When expanding tabs, treat backspace
before column 1 as no-op, since that’s what most devices do.
* tests/expand-tabs: New test.
* tests/Makefile.am (TESTS): Add it.
diff: tweak -y performance for $ @ ` \a
* src/side.c (print_half_line): Improve performance for '$', '@',
'`', and '\a' since they also are portable in practice nowadays.
2023-07-05 Bruno Haible <bruno@clisp.org>
diff: Fix "diff -y" output
This fixes a regression from 2023-07-04.
* src/side.c (print_half_line): Restore the assignment to out_position.
2023-07-04 Paul Eggert <eggert@cs.ucla.edu>
doc: mention bug#64461 in NEWS
2023-07-04 Bruno Haible <bruno@clisp.org>
diff: Fix output of "diff -l -y" for non-ASCII input files
* src/side.c (print_half_line): Output the multibyte character to out,
not stdout.
2023-07-04 Paul Eggert <eggert@cs.ucla.edu>
diff: fix unspecified mbstate after encoding error
* src/side.c (print_half_line): Clear mbstate after encoding
error, since it’s unspecified.
diff: optimize -y treatment of NUL
* src/side.c (print_half_line): Treat '\0' like other control
characters with print width zero.
diff: fix unlikely intmax_t overflow
* src/side.c (print_half_line): Avoid undefined behavior if the
input column position overflows. Instead, simply stop printing.
2023-06-28 Paul Eggert <eggert@cs.ucla.edu>
maint: prefer ‘static_assert’
Prefer C23-style ‘static_assert’ to traditional Gnulib ‘verify’.
* bootstrap.conf (gnulib_modules): Add assert-h.
* src/context.c, src/io.c, src/system.h: Use ‘static_assert’.
diff: fix xpalloc-related signed integer overflow
Problem reported by Gisle Vanem <https://bugs.gnu.org/64316>.
* src/io.c (find_and_hash_each_line):
Rely on xpalloc to check for integer overflow instead
of trying to do it ourselves incorrectly, with old code
that predated the use of xpalloc.
* src/system.h: Verify that LIN_MAX == IDX_MAX,
since the code now relies on this.
* tests/Makefile.am (TESTS): Add bug-64316.
* tests/bug-64316: New file
diff: tweak mbrtoc32 use
* src/side.c (print_half_line): Use more-intuitive
way to test whether mbrtoc32 found a non-null character.
2023-06-27 Paul Eggert <eggert@cs.ucla.edu>
diff: fix xpalloc typo
Problem reported by Gisle Vanem (Bug#64316).
* src/dir.c (dir_read): Also set local var cache.
2023-06-26 Paul Eggert <eggert@cs.ucla.edu>
maint: pacify "make syntax-check"
cmp: make -bl locale-independent again
* src/cmp.c (sprintc): Use c_isprint, not isprint, fixing a bug I
introduced in 2004.
* tests/cmp: Test for the bug.
diff: omit c-ctype.h double-include
* src/context.c: Don’t include c-ctype.h,
as system.h does that for us.
maint: omit unneeded 0 args to ‘open’
* src/cmp.c (main):
* src/diff.c (compare_files): Omit third arg 0 to ‘open’.
This was never necessary, and I suspect was put in only to pacify
no-longer-relevant compilers.
diff: avoid ‘if (... = ...)’
* src/diff.c (compare_files):
* src/ifdef.c (format_group, print_ifdef_lines):
* src/io.c (find_and_hash_each_line):
Don’t put assignments into ‘if (...)’, of ‘switch (...)’,
as per GNU coding standards.
cmp: tune 'cmp A B >/dev/null'
* src/cmp.c (main): Also optimize 'cmp A B >/dev/null'
when A and B are regular files with different nonzero sizes.
* tests/cmp: Test this.
cmp: support -n N with huge N
* src/cmp.c (bytes): Use INTMAX_MAX, not -1, for “infinity”.
This simplifies the code and is not a value that can be exhausted
these days.
(main, cmp): Treat very large -n values as “infinity”.
* tests/cmp: Test this.
cmp: avoid syscall when !S_ISCHR (stdout)
* src/cmp.c (main): Avoid a 'stat' call in the common case when
standard output is not a character special device. This is valid
because /dev/null is a character special device.
2023-06-25 Paul Eggert <eggert@cs.ucla.edu>
cmp: improve offset width calculation
* src/cmp.c (cmp): When calculating the offset width,
Don’t attempt to squeeze a file position into an int
as that might trap or yield the wrong answer.
Also, treat “negative” file sizes as zero; this can
happen if the initial file offset is past EOF.
cmp: work around lseek bugs
* src/cmp.c (ignore_initial): Now an array of intmax_t not off_t.
This allows cmp -i N to work better on platforms where intmax_t
is wider than off_t, N fits in the former and not the latter,
and the input is not a regular file. All uses changed.
(cmp): Instead of seeking to file end when -i N is huge,
simply pretend that we read zero bytes. This avoids some
kernel lseek bugs.
cmp: do not try to read 2**64 - 1 bytes
* src/cmp.c (cmp): Do not store a negative value into
bytes_to_read, as that causes block_read to be passed
SIZE_MAX as the buffer size.
2023-06-25 Jim Meyering <meyering@meta.com>
cmp: avoid new tests/cmp failure
* src/cmp.c (file_position): Set position to EOF by calling lseek
with an offset of 0 and SEEK_END, rather than a SEEK_CURR-relative
offset of the maximum off_t value. The latter would evoke failure on
fedora 38/glibc-2.37/linux 6.2.15-300.fc38.x86_64:
lseek(3, 9223372036854775807, SEEK_CUR) = -1 EINVAL
The failing test was this (which must now exit 0, but did not):
echo a>a;echo b>b; src/cmp -i 99999999999999999999 a b
2023-06-24 Jim Meyering <meyering@meta.com>
maint: avoid syntax-check failure
* NEWS (Bug fixes): Move the two new items from the section
for already-relesed 3.10 into the section for the next release.
2023-06-24 Bruno Haible <bruno@clisp.org>
build: Ensure that makeinfo ≥ 6.8 checks the @menu structure
See <https://lists.gnu.org/r/bug-texinfo/2023-06/msg00015.html>.
* doc/Makefile.am (MAKEINFO): New variable.
* cfg.mk (_makefile_at_at_check_exceptions): New variable.
2023-06-24 Paul Eggert <eggert@cs.ucla.edu>
cmp: handle huge -i N with regular files
* NEWS: Document this.
* src/cmp.c (specify_ignore_initial):
If the value exceeds TYPE_MAXIMUM (off_t), set the correspnding
ignore_initial value to -1 instead of reporting an error.
(main, cmp, file_position): All uses changed. Hence a huge value
will always do the right thing with regular files, which cannot
contain more than TYPE_MAXIMUM (off_t) bytes. There still may be
EOVERFLOW failures reported for non-regular files, though, as
these can be larger.
* tests/cmp: Test cmp -i N when N cannot fit into 64 bits.
cmp: work around Linux tmpfs bug
* lib/cmpbuf.c: Include inttypes.h, for TYPE_MAXIMUM.
(block_read): Work around Linux 6.3.8 tmpfs bug.
cmp: be more robust if lseek fails
* src/cmp.c (main, cmp): If lseek fails,
don’t assume the file position is -1.
cmp: fix -s bug when comparing /proc files
* NEWS: Mention this.
* src/cmp.c (main, cmp): Do not trust st_size == 0, as it may
be a /proc file.
* tests/brief-vs-stat-zero-kernel-lies: Also test cmp -s.
2023-06-20 Paul Eggert <eggert@cs.ucla.edu>
doc: mention new SI prefixes
* doc/diffutils.texi (cmp Options): Update for new SI prefixes R and Q.
Simplify the intro to be more like coreutils.
maint: prefer c_isdigit to ISDIGIT
c_isdigit is a function supplied by Gnulib, which should
be a bit better than our own macro.
* bootstrap.conf (gnulib_modules): Add c-ctype.
* src/system.h (ISDIGIT): Remove. All calls replaced by c_isdigit.
Include <c-ctype.h>, for c_isdigit.
maint: omit -Wstack-pointer
* configure.ac (WERROR_CFLAGS): Do not use -Wstack-protector.
It is not a correctness warning, and it causes a false
positive on Ubuntu 23.04 x86-64.
2023-06-06 Jim Meyering <meyering@meta.com>
build: update gnulib to latest (for maint.mk syntax-check fix)
maint: avoid new tight-scope syntax-check failure
* src/system.h (floor_log2): Declare with "SYSTEM_INLINE int"
on the same line as the function name, to accommodate the
tight-scope syntax-check rule.
* cfg.mk (_gl_TS_extern): Add SYSTEM_INLINE to the regexp.
2023-06-06 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
maint: update .gitignore
* .gitignore: Add *.rej (for 'patch'), lib/error.c.
maint: sync bootstrap from Gnulib
* bootstrap, tests/init.sh: Copy from Gnulib.
diff: switch from wchar_t to char32_t
Prefer C11-style char32_t to wchar_t, as char32_t works better on
platforms where wchar_t is only 16 bits.
* .gitignore: Add lib/uchar.h.
* bootstrap.conf (gnulib_modules): Add c32width, mbrtoc32.
Remove mbrtowc. Sort.
* src/side.c: Include uchar.h instead of wchar.h.
(print_half_line): Use c32width and mbrtowc instead of
wcwidth and mbrtowc.
maint: tell Gnulib diffutils is single-threaded
* configure.ac (GNULIB_EXCLUDE_SINGLE_THREAD)
(GNULIB_MBRTOWC_SINGLE_THREAD, GNULIB_REGEX_SINGLE_THREAD)
(GNULIB_WCHAR_SINGLE_LOCALE):
Define, to improve performance a bit in Gnulib.
Diffutils is single-threaded and sets locales first.
2023-06-03 Paul Eggert <eggert@cs.ucla.edu>
maint: use similar style for parsing options
This refactors and reindents option-parsing so that the code looks
similar in all three main programs.
* src/cmp.c, src/diff3.c, src/sdiff.c (shortopts): New constant.
(main): Use it.
* src/diff.c (main): Put local inside loop.
maint: go back from ‘die’ to ‘error’
* src/Makefile.am (noinst_HEADERS): Remove die.h.
* src/die.h: Remove. All uses of ‘die’ replaced with ‘error’,
and all includes of die.h removed.
This reverts commit 2016-10-16T15:43:14Z!meyering@fb.com,
which is no longer needed now that the Gnulib ‘error’
module arranges for static checking to work with ‘error’.
diff: bool, not char, for changed vector
* src/diff.h (struct file_data.changed): Now bool instead of char.
This shrinks the size of the code generated on GCC x86-64 by 1.6%.
Formerly this was char because bool’s size is greater than 1
on some platforms, but those platforms are no longer of so
much importance that it’s worth pessimizing on common platforms.
All uses changed.
maint: be more specific about 0 and 1
* src/analyze.c (NOTE_DELETE, NOTE_INSERT)
(discard_confusing_lines, shift_boundaries)
(build_reverse_script, build_script, diff_2_files):
* src/cmp.c (specify_comparison_type, option_help_msgid, main):
* src/diff.c (main, option_help_msgid):
* src/diff3.c (main, option_help_msgid, make_3way_diff)
(using_to_diff3_block, create_diff3_block, process_diff):
* src/dir.c (dir_read):
* src/ifdef.c (format_ifdef, format_group, print_ifdef_lines)
(do_printf_spec, scan_char_literal):
* src/io.c (binary_file_p):
* src/sdiff.c (option_help_msgid, lf_snarf, main, trapsigs)
(untrapsig):
* src/util.c (message, setup_output, begin_output)
(finish_output, lines_differ, print_script, print_1_line_nl)
(change_letter, analyze_hunk):
Prefer more-specific constants like true, false and nullptr
to the less-specific 1 and 0.
maint: switch from propername to propername-lite
* bootstrap.conf (gnulib_modules): Replace propername with
propername-lite.
* src/Makefile.am (LDADD): Remove $(LIBICONV). Sort.
* src/cmp.c, src/diff.c, src/diff3.c, src/sdiff.c (AUTHORS):
Use proper_name_lite and gettext instead of proper_name_utf8 and
proper_name.
maint: modernize GCC warnings, AC_INIT
* configure.ac: Pass new args to AC_INIT.
(gl_GCC_VERSION_IFELSE): New macro, taken from coreutils.
Modernize GCC warnings to agree more with coreutils.
maint: remove AM_PROG_CC_C_O cruft
* bootstrap.conf (buildreq): Require Automake 1.14 instead of 1.12.2,
since AM_PROG_CC_C_O is obsolete as of 1.14.
* configure.ac: Don’t use obsolescent AM_PROG_CC_C_O.
diff: remove CLOSEDIR_VOID cruft
* configure.ac: Don’t use AC_FUNC_CLOSEDIR_VOID; it’s obsolescent.
* src/dir.c (dir_read): Simplify by assuming !CLOSEDIR_VOID.
diff: don’t limit contexts arbitrarily
* src/context.c (find_hunk):
Check for overflow when computing non-ignorable threshold.
* src/diff.c (main): Limit ‘context’ to LIN_MAX since it is a lin.
* src/system.h (CONTEXT_MAX): Remove.
diff: calculate log2 faster in io.c
* src/io.c (find_identical_ends): Use floor_log2 instead
of computing log base 2 by hand.
maint: improve floor_log2 comment
* src/system.h: Document floor_log2 (0).
maint: use same-inode
* bootstrap.conf (gnulib_modules): Add same-inode.
* src/system.h: Include <same-inode.h>.
(same_file): Use SAME_INODE instead of reinventing it.
maint: test that cmpbuf.h is self-contained
* lib/cmpbuf.c: Include cmpbuf.h before all files but config.h.
maint: rely on Gnulib SSIZE_MAX
* lib/cmpbuf.c (SSIZE_MAX): Remove, as Gnulib now supplies it.
maint: coalesce duplicate MIN, MAX
* bootstrap.conf (gnulib_modules): Add minmax.
* lib/cmpbuf.c, src/system.h: Include minmax.h.
(MIN, MAX): Remove.
maint: depend directly on intprops
* bootstrap.conf (gnulib_modules): Add intprops, since
we are including intprops.h.
build: update gnulib submodule to latest
2023-05-30 Paul Eggert <eggert@cs.ucla.edu>
maint: even safer word type
* src/system.h (word): Change from ‘void *’ to ‘struct incomplete *’
since that’s even less likely to be misused.
maint: omit ‘register’
The ‘register’ keyword is no longer needed for optimization.
With GCC 13.1 x86-64 compiled with -O2, omitting ‘register’ did not
change the generated code.
diff: fix unlikely integer overflow
* src/analyze.c (discard_confusing_lines):
Avoid theoretical possibility of integer overflow.
2023-05-30 Paul Eggert <eggert@cs.ucla.edu>
maint: prefer ‘*const’ to ‘* const’
Prefer declarations like ‘char *const *x;’ to ‘char * const *x;’,
for consistency between ‘*const’ and ‘*x’, and to highlight the
fact that the ‘const’ belongs to the preceding ‘*’ not to the
following ‘*’.
Similarly for ‘* volatile’.
2023-05-30 Paul Eggert <eggert@cs.ucla.edu>
scripts: sync git-hooks from coreutils
maint: calculate log base 2 more efficiently
* bootstrap.conf (gnulib_modules): Add count-leading-zeros.
* src/analyze.c (discard_confusing_lines, diff_2_files):
* src/io.c (read_files):
Prefer floor_log2 to doing it by hand.
* src/cmp.c, src/diff.c, src/diff3.c, src/sdiff.c:
Define SYSTEM_INLINE, for system.h.
* src/system.h: Include count-leading-zeros.h.
(SYSTEM_INLINE): New macro.
(LIN_MAX): Verify that it does not exceed IDX_MAX, so that
floor_log2 is safe to use for lin values too.
(floor_log2): New inline function.
maint: use xpalloc
* bootstrap.conf (gnulib_modules): Add ialloc, to document
the now-direct dependency.
* src/diff.c (add_regexp):
* src/diff3.c (read_diff):
* src/dir.c (dir_read):
* src/io.c (slurp, find_and_hash_each_line, find_identical_ends):
* src/sdiff.c (diffarg):
Prefer xpalloc to doing it by hand.
* src/io.c: Include ialloc.h, for irealloc.
(equivs_alloc): Now idx_t, not lin, for xpalloc.
(sip): Don’t bother subtracting 2 * sizeof (word) from the
buffer_lcm upper bound, as later code works anyway now.
(slurp): Simplify buffer allocation so that xpalloc can be used.
Use irealloc for speculative reallocation, since the code could
work anyway if the irealloc fails. Use current->eof to check
for EOF, rather than the less-intuitive buffer size checks.
maint: prefer signed sizes for allocation
* src/analyze.c (discard_confusing_lines, diff_2_files):
* src/cmp.c (main):
* src/diff.c (main, add_regexp):
* src/diff3.c (read_diff):
* src/dir.c (dir_read):
* src/io.c (slurp, find_and_hash_each_line, find_identical_ends):
* src/sdiff.c (lf_init, diffarg): Prefer ximalloc to xmalloc, etc.
Also prefer letting the xmalloc.c functions multiply (with
overflow checking) than doing it by hand (without).
diff: prefer signed types in util.c
* src/util.c (struct msg, message, struct bin_str)
(get_funky_string, c_escape, lines_differ, output_1_line)
(analyze_hunk):
Prefer signed types to size_t.
sdiff: prefer signed types
* src/sdiff.c (ck_fread, ck_fwrite, expand_name, lf_refill)
(lf_snarf, diffarg, edit):
Prefer idx_t to size_t.
diff: prefer signed types in io.c
* src/io.c (struct equivclass, nbuckets)
(find_and_hash_each_line, guess_lines, read_files):
Prefer idx_t to size_t.
diff: prefer signed types in ifdef.c
* src/ifdef.c (do_printf_spec):
Prefer idx_t to size_t.
diff: prefer signed types in dir.c
* src/dir.c (struct dirdata, dir_read):
Prefer idx_t to size_t.
diff: prefer signed types in diff.c
* src/diff.c (struct regexp_list, option_list, main, add_regexp):
Prefer idx_t to size_t.
diff3: prefer signed types
* src/diff3.c (struct diff_block, struct diff3_block)
(copy_stringlist, create_diff3_block, compare_line_list)
(read_diff, scan_diff_line, output_diff3, process_diff):
Prefer idx_t to size_t.
maint: use safer type for ‘word’
* src/system.h (word): Change it from size_t to void *,
so that uses aren’t tempted to treat it as an integer.
diff: prefer signed types in diff.h
* src/diff.h (struct file_data):
Prefer idx_t to size_t. All uses changed.
diff: prefer signed types in context.c
* src/context.c (find_function):
Prefer idx_t to size_t.
cmp: prefer signed types
* src/cmp.c (buf_size, words_per_buffer, cmp, count_newlines):
Prefer idx_t to size_t.
diff: prefer signed types in analyze.c
* src/analyze.c (discard_confusing_lines, diff_2_files):
Prefer signed types to size_t.
diff: use intmax_t for column widths
Don’t represent column widths and tab stops as size_t, since they
are not object sizes. Instead, use intmax_t. This is better than
uintmax_t since gcc -fsanitize=undefined can catch overflows.
* src/diff.c (main):
* src/diff.h (tabsize, sdiff_half_width, sdiff_column2_offset):
* src/io.c (find_and_hash_each_line):
* src/side.c (tab_from_to, print_half_line, print_1sdiff_line):
* src/util.c (lines_differ, output_1_line):
Use intmax_t for column numbers, not size_t.
* src/io.c (find_and_hash_each_line): Count only columns since the
last tab stop, to avoid signed integer overflow. (The old code
had this possibility on odd but valid platforms where SIZE_MAX <=
INT_MAX.)
* src/util.c (lines_differ, output_1_line): Use a separate counter
for tab stops, so that the column count counts only columns since
the last tab stop. This avoids integer overflow when tabsize is
large. (The old code mishandled this situation.)
maint: update cmpbuf.c comment
Update comment to refer to FreeBSD 13, which is current,
instead of to Tru64 which is not.
maint: check for unlikely st_blksize overflow
Prefer idx_t to size_t in lib/cmpbuf.c and related buffer-size code.
Because POSIX says blksize_t can be wider than idx_t,
check for overflow when copying the former to the latter.
* bootstrap.conf (gnulib_modules): Add idx.
* lib/cmpbuf.c (block_read, buffer_lcm):
Prefer idx_t to size_t. All uses changed.
* lib/cmpbuf.c (block_read): Return ptrdiff_t instead of size_t.
All uses changed.
(buffer_lcm): Help the compiler by checking for negative args,
even though they are not allowed.
* lib/cmpbuf.h: Include idx.h and stddef.h, for idx_t and ptrdiff_t,
so that this include file is self-contained.
* src/analyze.c (diff_2_files):
* src/cmp.c (main):
* src/diff.c, src/io.c: Do not include stdckdint.h here,
since system.h now does that.
* src/diff3.c (read_diff):
* src/io.c (sip):
Protect against negative STAT_BLOCKSIZE, or STAT_BLOCKSIZE
outside idx_t range.
* src/system.h: Include stdckdint.h, idx.h.
2023-05-24 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
2023-05-22 Paul Eggert <eggert@cs.ucla.edu>
maint: C99 for cmpbuf.c
* lib/cmpbuf.c (buffer_lcm):
Put decls closer to uses.
diff: C99 style for util.c
* src/util.c (get_funky_string, parse_diff_color, begin_output)
(finish_output, lines_differ, print_script, output_1_line)
(analyze_hunk):
Put decls closer to uses.
diff: C99 style for side.c
* src/side.c (tab_from_to, print_sdiff_hunk):
Put decls closer to uses.
diff: C99 style for sdiff.c
* src/sdiff.c (usage, main, trapsigs, untrapsig, flush_line)
(edit, interact):
Put decls closer to uses.
diff: C99 style for normal.c
* src/normal.c (print_normal_hunk):
Put decls closer to uses.
diff: C99 style for io.c
* src/io.c (sip, slurp, find_and_hash_each_line)
(find_identical_ends, read_files):
Put decls closer to uses.
diff: C99 decl style in ifdef.c
* src/ifdef.c (format_ifdef, format_group, print_ifdef_lines)
(do_printf_spec, scan_char_literal):
Put decls closer to uses.
diff: C99 decl style in ed.c
* src/ed.c (print_ed_hunk, pr_forward_ed_hunk, print_rcs_hunk):
Put decls closer to uses.
diff: C99 decl style in dir.c
* src/dir.c (dir_read, diff_dirs, find_dir_file_pathname):
Put decls closer to uses.
diff: C99 decl style in diff.c
* src/diff.c (option_list, main, usage, compare_files):
Put decls closer to uses.
diff3: C99 decl style
* src/diff3.c (main, usage, make_3way_diff)
(using_to_diff3_block, create_diff3_block, process_diff)
(process_diff_control, read_diff, output_diff3, dotlines)
(output_diff3_edscript, output_diff3_merge)
(reverse_diff3_blocklist):
Put decls closer to uses.
diff: C99 decl style in context.c
* src/context.c (print_context_script, pr_context_hunk)
(pr_unidiff_hunk, mark_ignorable):
Put decls closer to uses.
cmp: C99 decl style in cmp.c
* src/cmp.c (usage, main, cmp, count_newlines):
Put decls closer to uses.
diff: C99 decl style in analyze.c
* src/analyze.c (discard_confusing_lines, shift_boundaries)
(diff_2_files): Assume C99 decls after statements.
sdiff: remove an IF_LINT
* src/sdiff.c (edit): Remove an IF_LINT, which no longer seems
to be needed with current GCC.
sdiff: prefer functions to macros
* src/sdiff.c (sighandler): New type.
(signal_handler) [!HAVE_SIGACTION]:
(initial_handler): Now static functions, not macros.
diff: prefer functions in io.c
* src/io.c (HASH_VALUE_WIDTH): New constant.
(rol, hash): New static functions, replacing ...
(ROL, HASH): ... these macros. All uses changed.
diff: prefer function to DIR_P macro
* src/diff.c (dir_p): New static function, replacing ...
(DIR_P): ... this macro. All uses changed.
2023-05-21 Jim Meyering <meyering@fb.com>
maint: prefer ckd_add, ckd_mul to INT_ADD_WRAPV, INT_MULTIPLY_WRAPV
* bootstrap.conf (gnulib_modules): Add stdckdint.
* lib/cmpbuf.c: Use ckd_mul rather than INT_MULTIPLY_WRAPV.
Include stdckdint.h, not "intprops.h".
* src/diff.c: Similar, but for both ckd_add and ckd_mul.
* src/io.c: Likewise for ckd_add.
2023-05-21 Jim Meyering <meyering@meta.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.10
* NEWS: Record release date.
2023-05-21 Jim Meyering <meyering@fb.com>
build: skip the sole perl-requiring test when there is no usable perl
* tests/init.cfg (require_perl_): New function, from coreutils.
* tests/large-subopt: Use it.
Reported by Bruno Haible in
https://lists.gnu.org/r/diffutils-devel/2023-05/msg00003.html
2023-05-20 Jim Meyering <meyering@fb.com>
build: fix a new syntax-check failure
* src/diff.h (robust_output_style): Put DIFF_INLINE and
the function name on the same line, so that syntax-check's
naive parsing can spot this function.
* cfg.mk (_gl_TS_extern): Add DIFF_INLINE.
build: modernize bootstrap prerequsite tools
Following Pádraig Brady's example from coreutils, ...
* bootstrap.conf: Add an explicit requirement on m4.
Add an explicit requirement on texi2pdf which is often packaged
separately to makeinfo and induces a failure far down the
distribution phase if not present.
Replace the rsync dependency with wget,
which gnulib changed to in 2018.
Also, add an xz requirement and a version for autopoint.
2023-05-19 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
* src/analyze.c (OFFSET_MAX): New macro, needed for
latest gnulib.
diff: avoid a macro in diff.h
* src/diff.h (FILE_BUFFER): Remove.
* src/io.c (file_buffer): New static function. All uses of
FILE_BUFFER replaced.
sdiff: avoid some macros in sdiff.c
* src/sdiff.c (PROGRAM_NAME, SDIFF_BUFSIZE):
Now constants, not macros.
diff3: avoid macros in diff3.c
* src/diff3.c (PROGRAM_NAME, FILE0, FILE1, FILE2, FILE3, FO, FC)
(RANGE_START, RANGE_END): Now constants, not macros.
cmp: avoid macros in cmp.c
* src/cmp.c (PROGRAM_NAME): Now a constant, not a macro.
(hard_locale_LC_MESSAGES): Now a function, not a macro.
All uses changed.
diff: avoid macros in diff.c
* src/diff.c (PROGRAM_NAME, NONEXISTENT, UNOPENED):
Now constants, not macros.
(errno_encode, errno_decode): Now functions, rather than
macros ERRNO_ENCODE and ERRNO_DECODE. All uses changed.
diff: use function for robust_output_style
* bootstrap.conf (gnulib_modules): Add extern-inline.
* src/diff.h: Use _GL_INLINE_HEADER_BEGIN and _GL_INLINE_HEADER_END.
(DIFF_INLINE): New macro.
(robust_output_style): Now an inline function, not a macro
ROBUST_OUTPUT_STYLE. All uses changed.
cmp: don’t give up if fstat fails
* src/cmp.c (main, cmp): If fstat fails, simply record the failure
and move on, instead of exiting. Modify other uses of the struct
stat to do something reasonable if the status is missing.
diff3: don’t give up if fstat fails
* src/diff3.c (read_diff): Work even if fstat fails,
e.g., due to EOVERFLOW.
diff3: fix race condition involving directories
This fixes a TOC-TOU race with "diff3 A B C" when one
of its arguments is a directory.
* src/diff.c (no_directory): New static var.
(NO_DIRECTORY_OPTION): New constant.
(longopts): Add ---no-directory.
(main): Support it.
(compare_files): If ---no-directory is given, do not treat
directories specially.
* src/diff3.c (main): Do not check whether an argument is
a directory.
(read_diff): Pass ---no-directory to diff, so that it checks.
2023-05-13 Jim Meyering <meyering@fb.com>
maint: suppress new test's doubled-word syntax-check failure
* cfg.mk (exclude_file_name_regexp--sc_prohibit_doubled_word):
Exempt the new test's use of "in in".
2023-05-13 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
2023-05-13 Carlo Marcelo Arenas Belón <carenas@gmail.com> (tiny change)
gnulib: fix Y2038 bug (again)
AC_SYS_LARGEFILE meaning has changed, need AC_SYS_YEAR2038 as well
* NEWS: mention this
* tests: add test
* bootstrap.conf: add year2038
2023-02-24 Paul Eggert <eggert@cs.ucla.edu>
maint: add 'diff --git' TODO
* TODO: Suggest better compatibility with 'git diff -p'.
From a suggestion by Linus Torvalds
<https://lkml.org/lkml/2023/2/24/797>.
2023-02-10 Paul Eggert <eggert@cs.ucla.edu>
maint: update .gitignore
.gitignore: Update for some recent changes, and simplify.
diff: fix bug where -D does not work
Problem reported by Robert Webb (bug#61193).
* NEWS: Mention this.
* src/diff.c (main): Omit stray ‘sizeof’.
* tests/ifdef: New test.
* tests/Makefile.am (TESTS): Add it.
2023-02-07 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
2023-02-05 Paul Eggert <eggert@cs.ucla.edu>
diff: use C23 bool
* bootstrap.conf (gnulib_modules): Add stdbool.
* src/die.h, src/system.h: Do not include <stdbool.h>.
diff: prefer nullptr to NULL
* bootstrap.conf (gnulib_modules): Add c-nullptr.
* src/cmp.c (main):
* src/context.c (pr_context_hunk, pr_unidiff_hunk)
(mark_ignorable, find_function):
* src/diff.c (longopts, main, specify_value, specify_style)
(specify_colors_style, compare_files):
* src/diff3.c (main, process_diff):
* src/dir.c (find_dir_file_pathname):
* src/ifdef.c (scan_char_literal):
* src/sdiff.c (main):
* src/util.c (process_signals, install_signal_handlers)
(color_ext_list, color_indicator, indicator_name)
(parse_diff_color):
Prefer C23-style nullptr to NULL, as nullptr is a bit better.
doc: update README-hacking
* README-hacking: Update for current bootstrap.
maint: sync bootstrap from Gnulib
bootstrap: sync from Gnulib
build: update gnulib submodule to latest
* lib/sh-quote.c.diff: Remove, as Gnulib now has this.
build: add libraries
* src/Makefile.am (LDADD, sdiff_LDADD): Add Gnulib libraries that
in theory would be needed on unusual platforms. In practice,
these are typicall empty or are duplicates of other library
arguments and so are redundant.
2023-02-04 Jim Meyering <meyering@fb.com>
doc: update HACKING
* HACKING: Update from grep's HACKING.
2023-02-04 Jim Meyering <meyering@meta.com>
maint: prefer https: to git:
The idea is to defend against some adversary-in-the-middle attacks.
Also prefer git.savannah.gnu.org over its shorter alias, git.sv.gnu.org
to avoid a warning e.g., from git clone.
Also, drop any final ".git" suffix on the resulting URIs.
Inspired by Paul Eggert's nearly identical changes to coreutils.
2023-01-16 Jim Meyering <meyering@fb.com>
tests: accommodate newer GNU make's SIGPIPE-ignore
* tests/colors: Allow an exit code of not just 141 (SIGPIPE),
but also "error": 2.
Reported by Tomasz Kłoczko in http://bugs.gnu.org/59905.
2023-01-15 Jim Meyering <meyering@meta.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.9
* NEWS: Record release date.
build: update gnulib to latest
2023-01-05 Jim Meyering <meyering@fb.com>
tests: avoid large-subopt XPASS on systems without perl
* tests/large-subopt: Use $PERL, rather than hard-coding "perl".
* bootstrap.conf (gnulib_modules): Add "perl" to the list.
Reported by Bruno Haible in
https://lists.gnu.org/r/diffutils-devel/2023-01/msg00000.html
2023-01-05 Bruno Haible <bruno@clisp.org>
tests: avoid a test failure when using Solaris 11.4's old grep
* tests/colors (nanosecond_zeros): Use a dumbed-down grep '\.'
in place of "grep -F ." to accommodate Solaris 11.4's old versions
of grep in the default PATH. Reported here:
https://lists.gnu.org/r/diffutils-devel/2023-01/msg00001.html
2023-01-01 Jim Meyering <meyering@fb.com>
build: update gnulib to latest
maint: update copyright dates
2022-12-31 Paul Eggert <eggert@cs.ucla.edu>
build: simplify GCC 12 false alarm workaround
* src/util.c (print_message_queue): Pacify GCC in a
more-straightforward way.
maint: fix assumption typo
Fix a typo I introduced in my August 2021 signal handling fixes.
Problem reported by Sam James (Bug#60457).
* src/util.c (xsigismember): Don’t assume sigismember cannot return 0.
2022-12-30 Jim Meyering <meyering@fb.com>
build: update gnulib to latest
build: temp?-disable -Wanalyzer-use-of-uninitialized-value
* src/util.c (print_message_queue): This function triggers false
positive warnings from GCC12, so add pragmas to ignore that new warning
in this one function. Required when using either of these:
- gcc version 12.2.1 20221121
- gcc version 13.0.0 20221229 (experimental)
2022-12-11 Jim Meyering <meyering@fb.com>
build: update gnulib to latest
2022-11-12 Jim Meyering <meyering@fb.com>
build: update gnulib to latest
2022-02-14 Paul Eggert <eggert@cs.ucla.edu>
doc: mark up SEE ALSO (Bug#53976)
2022-01-24 Jim Meyering <meyering@fb.com>
tests: fix false-failure on systems without valgrind
* tests/init.cfg (require_valgrind_): Use exit status of subshell,
not that of the "local" declaration.
2022-01-14 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
2022-01-03 Jim Meyering <meyering@fb.com>
maint: avoid new syntax-check failure
* cfg.mk (local-checks-to-skip): Add sc_indent, to skip it.
Otherwise, "make syntax-check" would fail.
maint: make update-copyright
build: update gnulib to latest; also bootstrap and init.sh
2021-10-30 Paul Eggert <eggert@cs.ucla.edu>
maint: modernize README-{hacking,prereq}
2021-10-16 Paul Eggert <eggert@cs.ucla.edu>
doc: copy fdl.texi into git
This pacifies this notice from ./bootstrap: “Notice from module
fdl: Don't use this module! Instead, copy the referenced license
file into your version control repository.”
* bootstrap.conf (gnulib_modules): Remove fdl.
* doc/fdl.texi: New file, taken from Gnulib.
maint: direct dependency on time_rz now
Now that diff calls tzalloc, it depends directly on time_rz.
* bootstrap.conf (gnulib_modules): Add time_rz.
build: update gnulib submodule to latest
2021-10-15 Paul Eggert <eggert@cs.ucla.edu>
diff: fix timezone bug on Solaris
Problem reported by Vladimir Marek (bug#51228).
* NEWS: Mention this.
* src/context.c (print_context_label): Pass localtz to nstrftime,
instead of always passing 0.
* src/diff.c (main) [!HAVE_TM_GMTOFF]:
Initialize localtz if time_format uses %z.
* src/diff.h (localtz): New decl.
* tests/Makefile.am (TESTS): Add timezone.
* tests/timezone: New test.
2021-08-31 Paul Eggert <eggert@cs.ucla.edu>
diff3: port better to MS-Windows
* src/diff3.c (enum diff_type): Prefix constants like ADD with
"DIFF_" to avoid collisions with unwise system headers.
2021-08-30 Paul Eggert <eggert@cs.ucla.edu>
maint: port better to non-POSIX
Problem privately reported by Gisle Vanem for MS-Windows.
* src/util.c (sig, install_signal_handlers):
Don’t assume SIGTSTP, SIGALRM, SIGQUIT.
(is_tstp_index): New function, for use in SIGTSTP avoidance.
maint: prefer attribute.h attributes
Prefer the macros used in attribute.h, and _Noreturn,
to the by-hand use of __attribute__, as this is more portable.
* bootstrap.conf (gnulib_modules): Add attribute.
* src/system.h: Include attribute.h. All uses of
attributes changed to use the attribute.h macros.
Plus, use _Noreturn.
(FALLTHROUGH): Remove; attribute.h now defines this.
build: update gnulib submodule to latest
diff: avoid double translation
* src/analyze.c (briefly_report): Do not translate here,
as ‘message’ translates its format.
diff: use variable arg list for messages
This simplifies the code by using varargs.
* bootstrap.conf (gnulib_modules): Add flexmember.
(XGETTEXT_OPTIONS): Do not flag message5.
* src/util.c: Include flexmember.h, stdarg.h.
(struct msg): New members msgid, argbytes. args is now
FLEXIBLE_ARRAY_MEMBER, and does not contain msgid.
All uses changed.
(message): Now varargs. Detect number of args by counting '%'s.
Use FLEXSIZEOF, to avoid problems on systems with buggy
allocators. Avoid redundant ‘*p = 0’ when *p is already zero
after stpcpy.
(message5): Remove; all callers changed to use ‘message’.
(print_message_queue): Abort if too many args were passed;
this cannot happen with current diffutils.
2021-08-29 Paul Eggert <eggert@cs.ucla.edu>
diff: port better to MS-Windows
Problem reported by Gisle Vanem (Bug#36488#30).
* src/util.c (xsigaction) [SA_NOCLDSTOP]: Remove; no longer needed.
(install_signal_handlers): If the first call to sigaction or
signal fails, do not exit; just skip the signal and continue,
in case the runtime does not support the signal even though the
corresponding SIG* macro is defined.
2021-08-28 Paul Eggert <eggert@cs.ucla.edu>
diff: cleanup signal handling just before exit
This should fix an unlikely signal handling bug with colored
output, and should also fix a Debian FTBFS (Fails To Build From
Source) on powerpc64le-linux. See Bug#34519 and Frédéric
Bonnard’s report in:
https://bugs.debian.org/922552#19
* bootstrap.conf (gnulib_modules): Add raise, sigprocmask.
* src/diff.c (main): Call cleanup_signal_handlers before exiting.
Don’t bother calling ‘exit’; no longer needed nowadays.
* src/util.c (sigprocmask, siginterrupt) [!SA_NOCLDSTOP]:
Define to 0 instead of empty, since the results are now used.
(sigset_t) [!SA_NOCLDSTOP]: Remove; we now rely on Gnulib.
(xsigaction) [SA_NOCLDSTOP]: New function.
(xsigaddset, xsigismember, xsignal, xsigprocmask): New functions.
(some_signals_caught): New static var.
(process_signals): Omit a conditional branch.
Don’t bother loading interrupt_signal if stop_signal_count is nonzero.
(process_signals, install_signal_handlers):
Check for failures from sigprocmask etc.
(sig, nsig): Now at top level, since multiple functions need them.
(install_signal_handlers): No need for caught_sig array;
just use caught_signals. However, set some_signals_caught.
(cleanup_signal_handlers): New function.
2021-08-22 Paul Eggert <eggert@cs.ucla.edu>
diff: add integer overflow checking
* src/diff.c (option_list, main): Check for integer overflow
in some unlikely and hard-to-test cases.
maint: refactor integer overflow checking
Rely on more-modern Gnulib capabilities instead of doing
integer overflow checking by hand, in some cases.
* lib/cmpbuf.c (buffer_lcm):
* src/io.c (slurp, find_identical_ends):
Use INT_ADD_WRAPV and INT_MULTIPLY_WRAPV rather than checking
overflow by hand.
* src/diff3.c (process_diff):
* src/dir.c (dir_read):
* src/io.c (find_identical_ends, read_files):
Use xnmalloc rather than checking overflow by hand.
(read_files): Rely on xcalloc to do overflow checking.
diff: avoid sprintf %s
sprintf fails if the result contains more than INT_MAX bytes,
so rework the code to avoid usage of sprintf %s where the
string might be longer than that.
* bootstrap.conf (gnulib_modules): Remove xvasprintf.
* src/diff.c (specify_style):
* src/util.c (begin_output):
Rewrite to avoid sprintf %s.
* src/util.c: Do not include xvasprintf.h.
(concat): Remove, as it uses sprintf %s. All uses rewritten.
diff: use mempcpy
* bootstrap.conf (gnulib_modules): Add mempcpy, stpcpy.
* src/ifdef.c (do_printf_spec):
* src/sdiff.c (expand_name, lf_snarf, temporary_file):
* src/util.c (message5):
Prefer mempcpy to memcpy plus manual size-updating.
Prefer stpcpy to mempcpy plus manual size-spec.
sdiff: fix unlikely memory leak
* src/sdiff.c (temporary_file): Fix memory leak when mkstemp fails.
Don’t assume temporary file name length fits in ‘int’.
diff3: simplify process_diff
* src/diff3.c (process_diff): Remove LAST_BLOCK arg, since callers
no longer needed it. All callers changed. This removes an
unnecessary initialization of bptr to NULL.
maint: modernize IF_LINT for GCC 11.2.1
* src/cmp.c (cmp):
* src/dir.c (find_dir_file_pathname):
* src/sdiff.c (edit):
Mention which GCC bug this IF_LINT works around.
* src/diff3.c (process_diff):
Always initialize to NULL, to avoid problems on mostly-theoretical
hosts where accessing uninitialized variables traps. The next
patch will have a better fix for this.
* src/ifdef.c (do_printf_spec):
No need for IF_LINT in GCC 11.2.1.
maint: lint → GCC_LINT
‘lint’ is for traditional lint and perhaps some other tools;
‘GCC_LINT’ is targeted more for what we do.
Gnulib accepts either, but we might as well be more accurate.
* configure.ac (GCC_LINT): Define this instead of ‘lint’.
All uses changed.
diff: remove printint
* src/system.h (printint): Remove. All uses removed. This type
was only for porting to pre-C89 hosts, and is no longer needed.
diff: remove INT_MAX limit on -F/-p searches
* src/context.c (find_function): Don’t limit function-line
searches to INT_MAX bytes, removing a FIXME.
maint: .gitignore updates
* .gitignore: Remove lib/unused-parameter.h. Add all of m4, since
no files there need to be committed; this lets us remove
m4/.gitignore and m4/gnulib-cache.m4. Add *.orig, *.patch, .Tpo,
/*.diff, lib/*/ (which lets us remove /lib/sys/), lib/ctype.h,
lib/errno.h, lib/float.h, lib/fnmatch.h, lib/getopt-cdefs.h,
lib/getopt.h, lib/limits.h, lib/sigsegv.h, lib/stdalign.h,
lib/stdarg.h, lib/stdbool.h, lib/stddef.h, lib/stdint.h,
lib/stdopen.[ch], vc-dwim-log-*. Add slashes to autom4te.cache,
build-aux. Remove redundant initial slashes from patterns that
also have internal slashes. Remove plain ABOUT-NLS, since
/ABOUT-NLS suffices. Sort using LC_ALL=C.
maint: omit unused function if not debugging
* src/util.c (debug_script): Compile only if DEBUG.
maint: remove prepargs
* lib/Makefile.am (noinst_HEADERS): Remove prepargs.h.
(libdiffutils_a_SOURCES): Remove prepargs.c.
* lib/prepargs.c, lib/prepargs.h: Remove. Hasn’t been
needed for many years.
* src/diff.c: Do not include prepargs.h.
maint: zalloc → xzalloc
* src/util.c (zalloc): Remove. All uses replaced
by xzalloc, which means the same thing.
2021-08-22 Paul Eggert <eggert@cs.ucla.edu>
diff3: suppress -fanalyzer alarms
* src/diff3.c: Add pragma to suppress -Wanalyzer-null-dereference
alarms.
* src/diff.h (find_dir_file_pathname): Add malloc-related
attributes, to pacify gcc -Wsuggest-attribute=malloc.
2021-08-22 Paul Eggert <eggert@cs.ucla.edu>
maint: remove January workaround for Gnulib issue
* configure.ac: Don’t add -Wno-analyzer-null-argument, since
the issue is now fixed in Gnulib.
build: update gnulib submodule to latest
2021-08-01 Paul Eggert <eggert@cs.ucla.edu>
maint: remove stray init.cfg
* init.cfg: Remove. I guess this file was a stray, since it was a
copy of tests/init.cfg when it was checked in, and it hasn’t been
maintained since.
tests: port to valgrind 3.16.0 + GCC 11.2
* tests/init.cfg (stderr_fileno_): Reject valgrind if it reports a
"Serious error" on a trival use of ‘diff’. Without this patch, on
RHEL 8.4 when I compile diffutils with a GCC 11.2.0 that I built
myself, ‘valgrind diff’ spits out messages like WARNING: Serious
error when reading debug info / When reading debug info from diff:
Ignoring non-Dwarf2/3/4 block in .debug_info’ and this causes the
strip-trailing-cr test to fail. I guess valgrind complains
because the valgrind version 3.16.0 that came with RHEL 8.4 cannot
grok the debug entries generated by GCC 11.2.0.
2021-08-01 Jim Meyering <meyering@fb.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.8
* NEWS: Record release date.
build: update gnulib to latest
2021-07-31 Jim Meyering <meyering@fb.com>
cmp: avoid reading uninitialized memory
[This *is* useful, so reapply. ]
When comparing buffers a word at a time, cmp could read up to
sizeof (word) - 1 uninitialized bytes.
* src/cmp.c (cmp): Set not just a single guaranteed-differing
sentinel byte just beyond any final read byte, but also ensure
that any following bytes are defined, if those may be read via
block_compare's word-at-a-time comparison. Reported by Bruno Haible
in https://lists.gnu.org/r/diffutils-devel/2021-07/msg00003.html
2021-07-28 Bruno Haible <bruno@clisp.org>
cmp: avoid reading uninitialized memory
One or both of the sentinel bytes were copies of uninitialized values.
* src/cmp.c (cmp): Use arbitrary initialized values for the
sentinel bytes.
2021-07-28 Jim Meyering <meyering@fb.com>
cmp: revert preceding change
It did not solve the problem. The next patch does.
2021-07-27 Jim Meyering <meyering@fb.com>
cmp: avoid reading uninitialized memory
When comparing buffers a word at a time, cmp could read up to
sizeof (word) - 1 uninitialized bytes.
* src/cmp.c (cmp): Set not just a single guaranteed-differing
sentinel byte just beyond any final read byte, but also ensure
that any following bytes are defined, if those may be read via
block_compare's word-at-a-time comparison. Reported by Bruno Haible
in https://lists.gnu.org/r/diffutils-devel/2021-07/msg00003.html
2021-07-19 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
2021-05-21 Paul Eggert <eggert@cs.ucla.edu>
diff: better --color help
* src/diff.c (option_help_msgid): Reword --color help without
using the confusing word “default”. Problem reported
by Peter Oliver (Bug#48532).
2021-05-20 Paul Eggert <eggert@cs.ucla.edu>
doc: fix URL in HACKING
2021-03-24 Paul Eggert <eggert@cs.ucla.edu>
diff: pacify compiler re style
* src/diff.c (usage): Prefer &"string"[N] to "string" + N.
Some compilers complain about the latter, as they worry C++
refugees will think it’s string concatnation.
diff3: avoid signed int overflow
* src/diff3.c (main): Avoid signed integer overflow in the very
unlikely case of more than INT_MAX incompatible options. Instead,
use one bit to record the presence of each type of incompatible
option, and report an error if more than one bit is set.
maint: don’t bother with -Wno-return-local-addr
* configure.ac (WERROR_CFLAGS): Don’t bother with
-Wno-return-local-addr as it doesn’t seem to work.
Anyway, it’s no longer needed on Ubuntu 20.10.
maint: disable -Wstack-protector
* configure.ac (WERROR_CFLAGS): Disable -Wstack-protector, as it
has a false alarm with lib/vasnprintf.c on Ubuntu 20.10 and it’s
not worth working around. Coreutils already disables it.
diff: plug memory leak in ifdef.c
Problem reported by Than (Bug#47362).
Fix the bug by using xmalloca instead of vararrays.
* bootstrap.conf (gnulib_modules): Add xmalloca; remove vararrays.
* configure.ac: Remove AC_C_VARARRAYS.
* src/ifdef.c: Include xmalloca.h instead of xalloc.h.
(do_printf_spec): Use xmalloca instead of an xmalloc
that lacks a corresponding ‘free’ if HAVE_C_VARARRAYS
due to a typo in 2017-05-18T05:51:31Z!meyering@fb.com.
build: update gnulib submodule to latest
2021-01-02 Paul Eggert <eggert@cs.ucla.edu>
maint: work around GCC -Wreturn-local-addr bug
* configure.ac: Do not use -Wreturn-local-addr in Gnulib,
to suppress a false alarm in vasnprintf.c.
2021-01-01 Jim Meyering <meyering@fb.com>
maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
2020-12-05 Jim Meyering <meyering@fb.com>
build: require autoconf-2.64
* configure.ac: Require 2.64, up from 2.63, to align with gnulib.
2020-03-15 Jim Meyering <meyering@fb.com>
build: update gnulib to latest
doc: adjust formatting to make apropos (man -k) work better
* man/Makefile.am $(dist_man1_MANS): Adjust sed substitution
to also remove the space after "GNU". This avoids the single
leading space on each man page title line. I'm guessing that
interfered with indexing/searching, causing "man -k diff3" to
print this: diff3 (1) - (unknown subject).
Reported by Dan Jacobon in http://bugs.gnu.org/39769.
2020-01-19 Jim Meyering <meyering@fb.com>
doc: correct an ancient "At present"
* doc/diffutils.texi (Unified Format): Correct the now
seriously outdated "At present" (referring to early 1990s)
statement to be more of a historical note.
Reported by Roland Illig in http://bugs.gnu.org/39184.
2020-01-05 Jim Meyering <meyering@fb.com>
doc: use program name, not "GNU", in the nroff/man header
* man/Makefile.am (dist_man1_MANS): Elide "GNU " prefix
from the generated prog+one-line-summary, so that help2man
uses the program name rather than "GNU" as the nroff "name".
Reported by Dan Jacobson in http://bugs.gnu.org/38574.
2020-01-01 Jim Meyering <meyering@fb.com>
maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
2019-12-29 Jim Meyering <meyering@fb.com>
maint: avoid gnulib-tool deprecation warnings, and build failure
* bootstrap.conf (gnulib_modules): Use getopt-gnu, rather than
obsolete "getopt" module. Use nstrftime in place of strftime.
(avoided_gnulib_modules): Do not avoid the "lock" module. That
would lead to a build failure due to "glthread/lock.h not found".
maint: avoid syntax-check failure
* po/POTFILES.in: Add argmatch.h; remove xstrtol-error.c
maint: disable two and reenable many warning options
* configure.ac (GNULIB_WARN_CFLAGS): Disable -Wduplicated-branches
and -Wreturn-local-addr, due to a couple of false-positive warnings.
(WARN_CFLAGS): Reenable many warnings that now (with recent gcc)
provoke no false positive.
maint: avoid gnulib's lock-tests module
* bootstrap.conf (avoided_gnulib_modules): Also --avoid=lock-tests
to avoid gnulib-related build failure.
2019-12-23 Jim Meyering <meyering@fb.com>
build: update gnulib to latest
* gnulib: Update submodule to latest.
* bootstrap: Copy from gnulib.
* tests/init.sh: Likewise.
2019-12-20 Jim Meyering <meyering@fb.com>
maint: tweak bootstrap.conf
* bootstrap.conf (buildreq): Require at least autoconf 2.62,
up from 2.61, just as grep and coreutils do.
(bootstrap_post_import_hook): "Copy pkg-config's pkg.m4 ...",
copied from grep's bootstrap.conf.
(avoided_gnulib_modules): Pull this definition to the top.
Formatting.
2019-10-01 Dave Odell <dmo2118@gmail.com> (tiny change)
cmp: add test case for Bug#37558
* tests/cmp: New test case (Bug#37558).
2019-10-01 Paul Eggert <eggert@cs.ucla.edu>
cmp: fix -l width bug
Problem reported by Dave Odell (Bug#37558).
* src/cmp.c (cmp): Treat negative ‘bytes’ as infinite, fixing a
bug introduced in the 2019-08-27 patch that fixed Bug#35256.
2019-08-27 Paul Eggert <eggert@cs.ucla.edu>
diff: don’t mistreat -N in arg as a large number
Problem reported by alec (Bug#35256).
* NEWS: Mention the fix.
* bootstrap.conf (gnulib_modules): Use strtoimax and xstrtoimax,
not strtoumax and strtoumax.
* src/cmp.c (bytes): Now signed, with -1 representing no limit.
All uses changed.
* src/cmp.c (specify_ignore_initial, main):
* src/diff.c (main):
* src/ifdef.c (format_group):
* src/sdiff.c (interact):
Use strtoimax, not strtoumax.
build: update gnulib submodule to latest
2019-07-19 Paul Eggert <eggert@cs.ucla.edu>
maint: ignore ‘configure’ temporaries
* .gitignore: Ignore confdefs*, conftest*.
maint: avoid Gnulib setlocale module
Problem reported for MS-Windows by Richard Gering (Bug#34376).
Diffutils doesn’t need any of the Gnulib fixes for setlocale.
* bootstrap.conf (gnulib_tool_option_extras):
Avoid the setlocale module.
2019-05-24 KO Myung-Hun <komh@chollian.net>
tests: init.cfg: use $PATH_SEPARATOR not ':'
On OS/2, a path separator is semi-colon ';' not colon ':'.
* tests/init.cfg: Replace ':' with $PATH_SEPARATOR.
2019-01-20 Jim Meyering <meyering@fb.com>
build: ensure no VLA is used
Cause developer builds to fail for any use of a VLA.
VLAs (variable length arrays) limit portability.
* configure.ac (nw): Remove -Wvla from the list of disabled warnings,
thus enabling the warning when configured with --enable-gcc-warnings.
(GNULIB_NO_VLA) Define, disabling use of VLAs in gnulib. This commit
is functionally equivalent to coreutils' v8.30-44-gd26dece5d.
build: update gnulib to latest
* gnulib: Update to latest.
* po/POTFILES.in: Add lib/xstdopen.c.
2019-01-06 Paul Eggert <eggert@cs.ucla.edu>
diff: use xstdopen, not stdopen
* bootstrap.conf (gnulib_modules):
* src/cmp.c, src/diff.c, src/diff3.c, src/sdiff.c (main):
Use xstdopen, not stdopen.
build: update gnulib submodule to latest
2019-01-05 Jim Meyering <meyering@fb.com>
maint: convert all TABs to equivalent spaces in indentation
Using this file,
cat > leading-blank.exempt <<\EOF
(\.gitmodules|help2man|pre-commit)$
(?:^|\/)ChangeLog[^/]*$
(?:^|\/)(?:GNU)?[Mm]akefile[^/]*$
\.(?:am|mk)$
EOF
run the following command to convert all non-conforming leading white
space to be all spaces:
git ls-files \
| pcregrep -vf leading-blank.exempt \
| xargs pcregrep -l '^ *\t' \
| xargs perl -MText::Tabs -ni -le \
'$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
Since that changed old NEWS, I also ran "make update-NEWS-hash"
to update the old_NEWS_hash value in cfg.mk.
2019-01-05 Paul Eggert <eggert@cs.ucla.edu>
diff: fix cmp, diff3, sdiff with stdin closed
* NEWS: Mention this.
* src/cmp.c, src/diff3.c, src/sdiff.c: Include stdopen.h.
(main): Call stdopen early.
* src/cmp.c (main): Simplify now that we need not worry about
stdin being closed.
* src/diff.c (main): Translate stdopen diagnostic.
diff: remove unportable ‘diff -N - f <&-’ feature
* NEWS: Mention this.
* bootstrap.conf (gnulib_modules): Add stdopen.
* doc/diffutils.texi (Comparing Directories):
Do not document behavior if stdin is closed.
* src/diff.c: Include stdopen.h.
(main): Call stdopen early.
(compare_files) [__hpux]: Remove recently-introduced
special case for HP-UX exec with stdin closed.
* tests/new-file: Remove tests of the removed feature.
build: update gnulib submodule to latest
2019-01-03 Bruno Haible <bruno@clisp.org>
diff: recognize file descriptors closed by the parent process on HP-UX
* src/diff.c (compare_files): Use fcntl to distinguish a file
descriptor closed by the parent process from a file descriptor
that references /dev/null.
2019-01-01 Jim Meyering <meyering@fb.com>
maint: update all copyright dates via "make update-copyright"
* gnulib: Also update submodule for its copyright updates.
2018-12-31 Jim Meyering <meyering@fb.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.7
* NEWS: Record release date.
maint: distribute new file, init.cfg
Otherwise, strip-trailing-cr would fail on a system without valgrind.
* tests/Makefile.am (EXTRA_DIST): Include init.cfg.
2018-12-30 Dennis Lambe Jr <malsyned@malsyned.net>
diff: adjust ANSI escapes for compatibility with less -R
GNU less can display ANSI-colored text with the -R flag, but this
support has some limitations. One of them is that if an escape
sequence starts on one line and ends on a different line, only the
first line will be colored in less.
As a result, when diff creates colored output with multi-line deletes
or adds, less will only color the first line.
This change resets ANSI color to the default at the end of
each line and restarts it at the beginning of the next. It patches
normal and context mode. Side-by-side already worked in my testing.
* src/context.c (print_context_label, pr_context_hunk): As above.
(pr_unidiff_hunk, print_context_header): Likewise.
* src/normal.c (print_normal_hunk): Likewise.
* tests/colors: Adjust existing tests to accommodate this.
* NEWS (Improvements): Mention it.
Proposed in http://bugs.gnu.org/31105
2018-12-29 Jim Meyering <meyering@fb.com>
tests: fix colors test on systems lacking fractional timestamp support
* tests/colors: The .NNNNNNNNN suffix is not printed on some systems.
Adapt the test to accommodate those systems.
tests: strip-trailing-cr: avoid failure with ASAN
Valgrind cannot operate on an ASAN-compiled binary.
* tests/strip-trailing-cr (valgrind): Define as no-op when diff
was compiled with sanitizer support.
2018-12-28 Jim Meyering <meyering@fb.com>
tests: add test for --strip-trailing-cr UMR bug
* tests/strip-trailing-cr: New file. Test for today's bug fix.
* tests/Makefile.am (TESTS): Add it.
tests: import test infrastructure from coreutils
* tests/init.cfg: New file, for require_valgrind_ definition (from coreutils).
* tests/Makefile.am (PATH): Don't set stderr_fileno_ here, since it is
now initialized in init.cfg.
2018-12-28 Paul Eggert <eggert@cs.ucla.edu>
Jim Meyering <jim@meyering.net>
diff: fix UMR with --strip-trailing-cr
Problem reported by Hongxu Chen (Bug#31935).
* src/io.c (prepare_text): Strip trailing CR before
doing the rest of the analysis.
* NEWS: Mention the fix.
2018-12-28 Bruno Haible <bruno@clisp.org>
tests: colors: avoid test failure on AIX 7
* tests/colors: Splice the argument into the printf format string.
2018-12-27 Bruno Haible <address@hidden>
maint: don't use an undocumented Autoconf macro
* configure.ac: Use AC_CONFIG_HEADERS instead of AC_CONFIG_HEADER.
2018-12-23 Jim Meyering <meyering@fb.com>
build: avoid build failure with --enable-gcc-warnings and latest gcc
* src/diff.c (usage): Assert that each line length is no longer than
the minimum required size of 4095. This lets newer gcc (currently
9.0.0 20181219) infer that it need not issue this warning:
diff.c:1012:19: error: '%.*s' directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095
[-Werror=format-overflow=]
1012 | printf (" %.*s", msglen, msg);
build: update gnulib to latest; and bootstrap and init.sh
build: make the autoconf-2.63 requirement explicit
* configure.ac: AC_PREREQ: Require 2.63, not 2.59. And quote properly.
Autoconf-2.63 has been required for some time via gnulib.
This merely makes it explicit.
2018-12-20 Jim Meyering <meyering@fb.com>
maint: use https: in gnu mirror URL prefix, not http
This appears in the generated release announcement message.
* cfg.mk (url_dir_list): Use https: prefix, not http:.
2018-07-24 Paul Eggert <eggert@cs.ucla.edu>
cmp: fix bug in -b diagnostic
Problem reported by mancha (Bug#32249).
* src/cmp.c (count_newlines): Restore old value of sentinel.
* tests/cmp: Test for the bug.
build: update gnulib submodule to latest
2018-05-14 Paul Eggert <eggert@cs.ucla.edu>
doc: prepend "GNU" to NAME in man pages
Requested by RMS.
* src/cmp.c, src/diff.c, src/diff3.c, src/sdiff.c:
Prepend "GNU" to first comment, so that the man page says "GNU".
2018-04-20 Paul Eggert <eggert@cs.ucla.edu>
sdiff: port to mingw
Problem reported by Ross Burton (Bug#31218).
* src/sdiff.c (checksigs): Use ‘raise’, not ‘kill’.
2018-03-23 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
2018-01-14 Jim Meyering <meyering@fb.com>
tests: fix quoting error in previous change
* tests/colors: Double-quote $PATH.
2018-01-06 Jim Meyering <meyering@fb.com>
tests: port tests/colors to some env-munging shell
* tests/colors: Also set PATH="$PATH" in env invocation.
maint: update gnulib and copyright dates for 2018
* gnulib: Update to latest.
* all files: Run "make update-copyright".
* bootstrap: Update from gnulib.
maint: suppress gcc's new -Wcast-function-type in gnulib
* configure.ac (WERROR_CFLAGS): Suppress gcc's new -Wcast-function-type
warning in gnulib, because it would trigger on this:
sig-handler.h:47:12: error: cast between incompatible function types\
from 'void (* const)(int, siginfo_t *, void *)' \
{aka 'void (* const)(int, struct <anonymous> *, void *)'} \
to 'void (*)(int)' [-Werror=cast-function-type]
return (sa_handler_t) a->sa_sigaction;
2017-10-22 Jim Meyering <meyering@fb.com>
tests: add expected-failing test for minor subopimality
In some unusual cases, diff -u prints suboptimal output.
* tests/large-subopt: New test script.
* tests/Makefile.am (TESTS): Add it.
(XFAIL_TESTS): Add it here, too, to record that this test is
currently expected to fail.
* tests/large-subopt.in1, tests/large-subopt.in2: Inputs derived from
those in http://bugs.gnu.org/28796
2017-09-23 Jim Meyering <meyering@fb.com>
gnulib: update to latest
2017-05-21 Jim Meyering <meyering@fb.com>
maint: make the announcement template Cc the devel- list
* cfg.mk (announcement_Cc_): Define.
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.6
* NEWS: Record release date.
2017-05-19 Jim Meyering <meyering@fb.com>
gnulib: update to latest
2017-05-18 Jim Meyering <meyering@fb.com>
maint: update to work with GCC7's -Werror=implicit-fallthrough=
* src/system.h (FALLTHROUGH): Define.
Use new FALLTHROUGH macro in place of comments
* src/cmp.c: FIXME
* src/diff3.c: FIXME
* src/ifdef.c: FIXME
* src/sdiff.c: FIXME
* src/side.c: FIXME
* src/util.c: FIXME
gnulib: update to latest
2017-05-09 Jim Meyering <meyering@fb.com>
tests: new-file: closed-stdin: also ensure stdout was empty
* tests/new-file: Also require that "out" be empty.
2017-05-06 Jim Meyering <meyering@fb.com>
maint: stop using @acronym{...} in texinfo sources
* doc/diffutils.texi: Remove all uses of @acronym{...},
per recommendation by Karl Berry.
* cfg.mk (local-checks-to-skip): Remove exemption, enabling
the @acronym{-prohibiting syntax-check rule.
2017-05-05 Paul Eggert <eggert@cs.ucla.edu>
cmp: improve EOF diagnostic
This improves on yesterday's change, following up on a
remark by Jim Meyering (Bug#22816#21).
* doc/diffutils.texi (Invoking cmp, cmp Options): Follow POSIX more
closely in the documentation of the information appended to the EOF
diagnostic.
* src/cmp.c (cmp): Be more specific about the shorter file's length
and fix some off-by-1 issues in reporting line counts.
* tests/cmp: Adjust to match new behavior.
Don't assume internal details about stdio buffering.
2017-05-04 Benno Schulenberg <bensberg@justemail.net>
diff: describe each --help option with a single string
* src/diff.c: To ease translating, fuse four description pieces
into two whole ones. Also reword and rewrap one of them to fit
within eighty characters.
2017-05-04 Paul Eggert <eggert@cs.ucla.edu>
cmp: report prefix length when one file is shorter
Requested by Dan Jacobson (Bug#22816).
* NEWS:
* doc/diffutils.texi (Invoking cmp, cmp Options): Document this.
* src/cmp.c (cmp): Implement it.
* tests/Makefile.am (TESTS): Add cmp.
* tests/cmp: New file.
2017-05-02 Jim Meyering <meyering@fb.com>
tests: add test for latest fix
* NEWS (Bug fixes): Describe it.
* tests/invalid-re: New test for just-fixed bug.
* tests/Makefile.am (TESTS): Add it.
gnulib: update to latest
2017-04-27 Paul Eggert <eggert@cs.ucla.edu>
diff: don't crash if regexp is invalid
Problem reported by Marcel Böhme in:
http://lists.gnu.org/archive/html/bug-diffutils/2017-04/msg00002.html
* src/diff.c (add_regexp): Exit if re_compile_pattern fails.
2017-03-24 julama <julama@fake-box.com>
tests: avoid false failure for unreadable /proc/cmdline
* tests/brief-vs-stat-zero-kernel-lies: Use "test -r" rather than
just "test -f". This avoids a false test failure on a linux system
with grsecurity and its GRKERNSEC_PROC_USER option enabled, for which
/proc/cmdline is unreadable. Reported in https://bugs.gnu.org/26155
2017-02-01 Jim Meyering <meyering@fb.com>
tests: avoid false failure with some shells on debian, freebsd
* tests/colors: Move the TERM=dumb setting into the code run by
"returns_", since some shells do not propagate envvar setting through
to a use of a function like this. That would cause this test to fail
because results were colorized when they should not have been.
Reported by Nelson Beebe.
2017-01-31 Jim Meyering <meyering@fb.com>
maint: add "introduced in 3.4" in latest NEWS entry
* NEWS: Update. Also, thanks to Nelson Beebe for reporting this.
diff: avoid UMR with ---presume-output-tty
* src/diff.c (main): Always define presume_output_tty.
Otherwise, it would be read uninitialized.
Introduced in v3.3-45-g17e2698
* NEWS (Bug fixes): Mention it.
gnulib: update to latest; and update bootstrap and init.sh
maint: change "time stamp" to "timestamp" globally
This avoids a new syntax-check failure.
* ChangeLog-2008: Perform that change.
* doc/diffutils.texi: Likewise.
* NEWS: Likewise.
* cfg.mk: Update the old news hash accordingly.
2017-01-01 Jim Meyering <meyering@fb.com>
maint: update gnulib and copyright dates for 2017
* gnulib: Update to latest.
* all files: Run "make update-copyright".
2016-11-08 Jim Meyering <meyering@fb.com>
tests: use "returns_" rather than explicit comparison with "$?"
* tests/colors: Use "returns_ 1" rather than testing $? = 1
* tests/basic: Likewise.
* tests/binary: Likewise.
* tests/filename-quoting: Likewise.
* tests/function-line-vs-leading-space: Likewise.
* tests/ignore-matching-lines: Likewise.
* tests/label-vs-func: Likewise.
* tests/new-file: Likewise.
* tests/no-dereference: Likewise.
* tests/no-newline-at-eof: Likewise.
* tests/stdin: Likewise.
2016-10-25 Paul Eggert <eggert@cs.ucla.edu>
diff: fix big performance degradation in 3.4
* NEWS, doc/diffutils.texi (Overview): Document this.
* src/analyze.c (diff_2_files): Restore too_expensive heuristic,
but this time with a floor that is 16 times the old floor. This
should fix Bug#16848, by generating good-quality output for its
test case, while not introducing Bug#24715, by running nearly as
fast as diff-3.3 for that test case.
build: update gnulib submodule to latest
2016-10-16 Jim Meyering <meyering@fb.com>
maint: use die rather than error
Use "die (N, ..." rather than "error (N, ..." whenever N is a nonzero
constant. That lets the compiler know that control never goes beyond
that point, and thus makes unnecessary the occasional following
"abort ();" or "break;" statement we have historically added to inform
static analysis tools of this aspect of "error" semantics.
* src/die.h: New file.
* src/Makefile.am (noinst_HEADERS): Add it.
* src/cmp.c: Use die in place of error whenever the first
argument is a nonzero constant. Also remove any immediately-
following call to abort, and include "die.h".
* src/diff.c: Likewise.
* src/diff3.c: Likewise.
* src/sdiff.c: Likewise.
* src/util.c: Likewise.
2016-10-02 Jim Meyering <meyering@fb.com>
gnulib: update to latest
build: avoid GCC 7's new warnings
* src/util.c (get_funky_string): Adjust comment so that GCC 7's
-Wimplicit-fallthrough recognizes it.
* src/diff3.c (main): Cast boolean MERGE to "int" to avoid this:
diff3.c:341:25: error: '~' on a boolean expression \
[-Werror=bool-operation]
2016-08-30 Jim Meyering <meyering@fb.com>
gnulib: update to latest
2016-08-29 Jim Meyering <meyering@fb.com>
gnulib: update to latest, to port to upcoming GCC 7
This fixes compilation errors when using gcc-7-to-be that were
due to missing backslashes in gnulib's intprops.h and an API
change in functions like __builtin_add_overflow. This ports
to GCC 7's newer built-in overflow-checking functions.
2016-08-28 Paul Eggert <eggert@cs.ucla.edu>
diff: don't assume ptrdiff_t <= long long int
* src/system.h (printint, pI): Port to (theoretical) platforms
where ptrdiff_t is wider than long long int (Bug#24311).
2016-08-27 Paul Eggert <eggert@cs.ucla.edu>
diff: port line numbers to mingw64
Problem reported by Peter Rosin (Bug#24311).
* src/system.h (printint, pI): New typedef and macro.
All uses of 'long int' and "%l" in printf format replaced by
'printint' and "%"pI respectively.
* src/ifdef.c (do_printf_spec): Don't assume pI is length 1.
2016-08-20 Jim Meyering <meyering@fb.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.5
* NEWS: Record release date.
2016-08-16 Jim Meyering <meyering@fb.com>
build: arrange to build with -fno-common, when possible
* configure.ac (WERROR_CFLAGS): Add -fno-common, when possible.
This would have prevented the duplicate definition of
presume_output_tty that was fixed in v3.4-10-gc2dc91f.
2016-08-16 Hanno Böck <hanno@hboeck.de>
diff: avoid duplicate definition of presume_output_tty
* src/util.c (presume_output_tty): Remove this definition.
The other is in diff.h. Reported in https://bugs.gnu.org/24248
2016-08-14 Jim Meyering <meyering@fb.com>
gnulib: update to latest
tests: diff3: work around missing seq on some systems
* tests/diff3 (seq): Provide a seq replacement function,
since at least AIX, SunOS 5.10, OpenBSD-5.8 lack it.
Reported by Assaf Gordon in https://bugs.gnu.org/24227#8
2016-08-13 Jim Meyering <meyering@fb.com>
diff3: fix leaks, for real
* src/diff3.c (struct diff_block)[lint]: Add member, n2.
(free_diff_block, next_to_n2): New functions.
* tests/diff3: Add more test coverage.
maint: require that commit messages be of a certain form
* bootstrap.conf (bootstrap_epilogue): Merge from coreutils, so that
a local commit hook will now help enforce consistent commit messages.
* Makefile.am (check-git-hook-script-sync): New rule, largely copied
from coreutils.
* scripts/git-hooks/commit-msg: New file, from coreutils, but
with adapted list of program names.
* scripts/git-hooks/applypatch-msg: New file, from git.
* scripts/git-hooks/pre-applypatch: Likewise.
* scripts/git-hooks/pre-commit: Likewise.
2016-08-13 Bastian Beischer <bastian.beischer@rwth-aachen.de>
diff3: fix heap use-after-free; add minimal diff3 test coverage
Commit v3.3-42-g3b74a90, "FIXME: src/diff3: plug a leak" added an
invalid use of free, leading to use-after-free in nearly any invocation
of diff3. Revert that commit.
* NEWS (Bug fixes): Mention it.
* tests/diff3: New file, to add minimal test coverage.
* tests/Makefile.am (TESTS): Add it.
Reported by Bastian Beischer in http://bugs.gnu.org/24210
2016-08-13 Jim Meyering <meyering@fb.com>
build: ignore texinfo build artifacts
* .gitignore: Ignore texinfo artifacts in doc/.
maint: diff3: remove an unreachable statement
* src/diff3.c (main): Remove unreachable "return" after exit from main.
2016-08-08 Jim Meyering <meyering@fb.com>
diff: disable colorization for TERM=dumb
* src/diff.c (main): With --color or --color=auto, when TERM is
"dumb", disable colorization. Suggested by Daniel Colascione.
* NEWS (Bug fixes): Mention it.
* tests/colors: Add a test that would fail without this change,
yet passes with it.
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.4
* NEWS: Record release date.
2016-08-06 Jim Meyering <meyering@fb.com>
gnulib: update to latest
tests: tweak built_programs definition
* tests/Makefile.am (built_programs): Adjust to work around what
may be a problem due to interaction between Solaris 10's /bin/sh
and an old version of GNU make. Reported by Dagobert Michelsen
in https https://bugs.gnu.org/24137.
2016-08-02 Jim Meyering <meyering@fb.com>
gnulib: update to latest
tests: skip a /proc/self-dependent test on the Hurd
* tests/brief-vs-stat-zero-kernel-lies: The Hurd's /proc/self
is not useful, so detect that and skip the test that requires it.
Reported by Assaf Gordon in https://debbugs.gnu.org/24121#29
2016-08-01 Jim Meyering <meyering@fb.com>
tests/colors: fix portability problem with touch --date
* tests/colors (epoch): Don't use GNU touch's --date=$epoch option.
Use the portable -t 197001010000.00.
Reported by Assaf Gordon in https://debbugs.gnu.org/24121#8
build: Solaris 9: avoid link failure due to isblank use
* bootstrap.conf (gnulib_modules): Add isblank, to avoid a link
error on Solaris 9 Sparc. Reported by Dagobert Michelsen.
test: improve test infrastructure
* tests/envvar-check: New file, copied from grep, with the addition
of the EDITOR and GREP_OPTIONS envvar names.
* tests/Makefile.am (EXTRA_DIST): Add it.
(TESTS_ENVIRONMENT): Revamp, to be more like that of grep.
2016-07-31 Jim Meyering <meyering@fb.com>
maint: remove gl/lib/reg*.c.diff; no longer needed
* gl/lib/regcomp.c.diff: Remove file, now that gnulib's
regcomp.c compiles regex.c with -Wno-unused-parameter.
* gl/lib/regex_internal.c.diff: This file induced a change to ensure
that the "Idx" type was unsigned and to remove a few "VAR < 0"
comparisons. These days, it is probably fine to stay in sync with
gnulib/glibc's copies
of these files, so remove these patches, too.
* gl/lib/regexec.c.diff: Likewise.
Prompted by a report by Assaf Gordon and a suggestion from Paul Eggert.
tests: colors: fix a portability problem and work around a shell bug
* tests/colors (e): Fix a portability bug: use printf '\033'
rather than '\e' to generate the required byte sequence, since
for some shells (at least dash 0.5.8), the latter doesn't work.
Work around a shell bug whereby "local tab=$(printf '\t')"
would result in an empty value for "$tab": hoist each "tab"
definition up/out of its function to global scope.
Reported by Assaf Gordon in http://debbugs.gnu.org/24116#8
2016-07-23 Jim Meyering <meyering@fb.com>
gnulib: update to latest; and tests/init.sh
* gnulib: Update to latest.
* init.sh: Update from gnulib.
2016-05-30 Jim Meyering <meyering@fb.com>
maint: arrange for "make distcheck" to work with unreleased automake
* dist-check.mk (my-distcheck): Remove all .deps directories
before performing the recursive comparison.
2016-05-24 Glenn Morris <rgm@gnu.org>
doc: fix a reference to emacs' emerge node
* doc/diffutils.texi (Interactive Merging): Correct a reference to
emacs' emerge node: s/emerge/Emerge/.
This addresses http://debbugs.gnu.org/23613
2016-04-30 Jim Meyering <meyering@fb.com>
maint: arrange for better URLs in generated announcement message
* cfg.mk (url_dir_list): Define. I had been correcting the generated
URLs by hand, just before the announcement. This is better.
2016-03-15 Jim Meyering <meyering@fb.com>
maint: don't ignore gitlog-to-changelog failure
* Makefile.am (gen-ChangeLog): Don't ignore failure of
gitlog-to-changelog. This syncs to coreutils' copy of this rule.
2016-03-06 Giuseppe Scrivano <gscrivano@gnu.org>
diff: --color: fix an infinite recursion bug
* src/diff.h (presume_output_tty): New extern variable.
* src/diff.c (PRESUME_OUTPUT_TTY_OPTION): New enum.
(group_format_option): Add '-presume-output-tty'.
(main): Handle PRESUME_OUTPUT_TTY_OPTION.
* src/util.c: New variable `presume_output_tty'.
(check_color_output): Handle presume_output_tty.
(set_color_context): Call process_signals only when color_context is
not RESET_CONTEXT.
* tests/colors: Check that diff doesn't crash when interrupted
in the middle of a color sequence.
Reported by Gisle Vanem in http://debbugs.gnu.org/22067
2016-01-31 Jim Meyering <meyering@fb.com>
maint: update prereq version of gettext
* configure.ac: Increase designated gettext version to 0.19.2
* bootstrap.conf (buildreq): Likewise.
Remove now-unnecessary code to remove gettext-provided files.
gnulib: update to latest
2016-01-01 Jim Meyering <meyering@fb.com>
FIXME: src/diff3: plug a leak
2016-01-01 Jim Meyering <meyering@fb.com>
maint: update copyright year, bootstrap, init.sh
Run "make update-copyright" and then...
* gnulib: Update to latest.
* tests/init.sh: Update from gnulib.
* bootstrap: Likewise.
2015-12-06 Jim Meyering <meyering@fb.com>
diff --brief no longer mistakenly reports diff. with 0-sized /proc/ files
Normally, it is safe to assume two regular files are different when
their st_size values are different. However, that assumption may
be invalid if either value is zero, as happens with files on Linux
/proc and /sys file systems. Since skipping this optimization will
usually cost very little (one read syscall, to read zero bytes),
it is fine to accommodate those unusual files.
* src/analyze.c (diff_2_files): Do not assume regular files differ
just because their st_size values differ when one or more is 0.
* src/diff.c (compare_files): Likewise.
* tests/brief-vs-proc-stat-zero: New test.
* tests/Makefile.am: Add it.
* NEWS (Bug fixes): Describe it.
Reported by Stephan Müller in http://debbugs.gnu.org/21942
tests: arrange to print any skipped-test explanation to tty, too
I noticed that when a test was skipped, the reason was not printed.
This fixes it. In coreutils, this variable is set in init.cfg,
but there is no point in putting the definition so far from the
code that chooses the file descriptor number in tests/Makefile.am.
* tests/Makefile.am (TESTS_ENVIRONMENT) [stderr_fileno_]: Define
here (to 9), right next to the companion "9>&2".
2015-11-29 Jim Meyering <meyering@fb.com>
build: add gperf to the list of required programs
* bootstrap.conf (buildreq): Add gperf to the list.
Reported by Stephan Müller in http://debbugs.gnu.org/21945
2015-11-29 Giuseppe Scrivano <gscrivano@gnu.org>
tests: Add tests for --color and --palette
* tests/colors: New file.
* tests/Makefile.am (TESTS): Add colors.
doc: mention --color and --palette in NEWS
diff: add --palette
* bootstrap (gnulib_modules): Add 'argmatch'.
* doc/diffutils.texi: Add documentation for --palette
* src/diff.h (set_color_palette): New prototype.
* src/diff.c (set_color_palette): New function.
(color_palette): New variable.
* src/utils.c: Include "argmatch.h".
(struct bin_str): New struct.
(struct color_ext_type): New struct.
(color_indicator): New array.
(indicator_name): New array.
(indicator_no): New enum.
(parse_state): New enum.
(put_indicator): New function.
(get_funky_string): New function. Copied from coreutils ls.
(parse_diff_color): New function. Copied from coreutils ls
"parse_ls_color" function.
(set_color_context): Use put_indicator instead of directly
outputting the sequence.
* po/POTFILES.in: Add 'lib/argmatch.c'
diff: add support for --color
* doc/diffutils.texi (diff Options): Add documentation for --color.
Copied from coreutils ls --color.
* src/context.c (pr_unidiff_hunk): Set the color context.
(print_context_header): Likewise.
(pr_context_hunk): Likewise.
* src/diff.h (enum colors_style): New enum to record when to use colors.
(colors_style): New variable to memorize the argument value.
(set_color_context): Add function definition.
* src/diff.c: : Define COLOR_OPTION.
(specify_colors_style): New function.
(longopts): Add --color.
(main): Handle --color argument.
(option_help_msgid): Add usage string for --color.
* src/normal.c (print_normal_hunk): Set the color context.
* src/side.c (print_1sdiff_line): Likewise.
* src/util.c (print_1_line_nl): New function.
(print_1_line): Make it a wrapper of 'print_1_line_nl'.
(colors_enabled): New boolean variable.
(begin_output): Call check_color_output once the output file is
configured.
(output_1_line): Periodically call `process_signals'.
(caught_signals): New sigset_t.
(colors_enabled): New boolean variable.
(interrupt_signal): New sig_atomic_t.
(stop_signal_count): New sig_atomic_t.
(check_color_output): New function.
(install_signal_handlers): Likewise. Copied from coreutils ls.
(process_signals): Likewise. Copied from coreutils ls.
(set_color_context): New function.
(sighandler): Likewise. Copied from coreutils ls.
(stophandler): Likewise. Copied from coreutils ls.
2015-09-24 Andreas Grünbacher <agruen@gnu.org>
diff: Improve help text of option --label
* src/diff.c (option_help_msgid): Improve help text of option --label.
2015-09-01 Jim Meyering <meyering@fb.com>
build: correct man-page generation rule
The PATH was set incorrectly, so that the diff used by
help2man was the one from $PATH, rather than the just-built
one.
* man/Makefile.am (bin_dir): New variable, to...
(dist_man1_MANS): ...prepend ../src to PATH, not just "..".
Also, add a test to ensure that each $(bin_dir)/$$base is
executable, so this doesn't happen again.
In http://debbugs.gnu.org/21023, Rodrigo Valiña
Gutiérrez reported that diff.1 from the diffutils-3.3 tarball
contained no description of the then-new --no-dereference option.
2015-07-10 Jim Meyering <meyering@fb.com>
doc: --no-dereference: improve wording/description
* doc/diffutils.texi (Comparing Directories): Correct grammar.
(diff Options) [--no-dereference]: Say a little more.
2015-01-01 Jim Meyering <meyering@fb.com>
maint: update copyright year ranges to include 2015; update gnulib
2014-12-12 KO Myung-Hun <komh@chollian.net>
diff: skip test if seek is not possible on OS/2 kLIBC
This fixes the problem that 'diff - file' and 'cat file | diff - file'
fail due to a seek failure with a message 'diff.exe: -: Invalid seek',
because seek does not work on stdin and a pipe on OS/2 kLIBC.
* src/io.c (sip): Set skip_test to true if seek is not possible on
OS/2 kLIBC.
2014-12-09 Jim Meyering <meyering@fb.com>
gnulib: update to latest
2014-12-09 KO Myung-Hun <komh78@gmail.com>
build: double-quote use of $PATH
* man/Makefile.am (dist_man1_MANS): On OS/2, PATH_SEPARATOR is ';',
but unquoted, that is interpreted as the shell's statement
terminator. Quote it.
2014-10-27 Paul Eggert <eggert@cs.ucla.edu>
diff: fix integer overflow problem with --tabsize
Reported by Tobias Stoeckmann in: http://bugs.gnu.org/18857
* src/diff.c (main): Don't overflow if INTMAX_MAX / 2 < tabsize.
* tests/bignum: New file, to test for this bug.
* tests/Makefile.am (TESTS): Add it.
2014-09-03 Paul Eggert <eggert@cs.ucla.edu>
doc: mention diff -B fix in NEWS
diff: fix bug with diff -B and incomplete lines
Reported by Navin Kabra via Eric Blake in:
http://bugs.gnu.org/18402
* src/util.c (analyze_hunk): Don't mishandle incomplete
lines at end of file.
* tests/no-newline-at-eof: Test for the bug.
diff: fix performance bug with prefix computation
* src/io.c (find_identical_ends): Fix performance bug:
the test for when the prefix was needed messed up by
the 2002-02-28 integer-overflow fixes, causing performance to be
worse than it needed to be.
2014-08-23 Jim Meyering <meyering@fb.com>
gnulib: update to latest, as well as bootstrap
maint: update copyright year range in texinfo documentation
* doc/diffutils.texi: Update copyright.
2014-04-15 Jim Meyering <meyering@fb.com>
maint: update bug-reporting address
* README: Change bug-gnu-utils@... to bug-diffutils@gnu.org.
* doc/diffutils.texi: Likewise.
Reported by Jamie Landeg Jones.
2014-03-26 Paul Eggert <eggert@penguin.cs.ucla.edu>
diff: fix two "..." typos in --help output
* src/diff.c (option_help_msgid): Remove two "..." typos (Bug#17102).
2014-03-25 Paul Eggert <eggert@cs.ucla.edu>
doc: improve documentation about reading and stdin
See Bug#17075.
* doc/diffutils.texi (Comparison): Say that files need not be read.
(Invoking diff): Remove confusing remark about 'diff - -'.
It's not that useful, and it's not portable anyway.
2014-02-24 Paul Eggert <eggert@cs.ucla.edu>
diff, sdiff: minor integer overflow fixes
* src/context.c (find_hunk):
Simplify, now that 2 * context + 1 cannot overflow.
* src/diff.c (main):
* src/sdiff.c (interact):
Don't rely on undefined behavior on signed integer overflow.
* src/diff.c (main): Don't let contexts exceed CONTEXT_MAX.
* src/system.h (CONTEXT_MAX): New macro.
diff: fix bug with -I and overlapping hunks
Problem reported by Vincent Lefevre in <http://bugs.gnu.org/16864>.
* src/context.c (find_hunk): Threshold is CONTEXT only if
the second change is ignorable.
* tests/ignore-matching-lines: New test.
* tests/Makefile.am (TESTS): Add it.
2014-02-23 Paul Eggert <eggert@cs.ucla.edu>
diff: remove TOO_EXPENSIVE heuristic
Problem reported by Vincent Lefevre in <http://bugs.gnu.org/16848>.
The simplest solution is to remove the TOO_EXPENSIVE heuristic
that I added to GNU diff in 1993. Although appropriate for
circa-1993 hardware, these days the heuristic seems to be more
trouble than it's worth.
* NEWS: Document this.
* doc/diffutils.texi (Overview): Modernize citations.
Remove mention of TOO_EXPENSIVE heuristic.
* src/analyze.c (diff_2_files): Adjust to TOO_EXPENSIVE-related
API changes in gnulib's diffseq module.
build: update gnulib submodule to latest
2014-01-31 Paul Eggert <eggert@cs.ucla.edu>
diff: exit with status 1, not 2, when binary files differ
Problem reported by Vincent Lefevre in <http://bugs.gnu.org/16608>.
* NEWS:
* doc/diffutils.texi (Binary, Invoking diff): Document this.
* src/analyze.c (briefly_report): Return void, not int.
All uses changed. Do not futz with exit status. Simplify.
* tests/binary: Adjust to match new behavior.
2013-09-26 Paul Eggert <eggert@cs.ucla.edu>
build: omit -Wsuggest-attribute=pure for lib
* configure.ac (WARN_CFLAGS): Omit -Wsuggest-attribute=pure
when compiling the lib subdirectory. Reported for Fedora 19
by Eric Blake in <http://bugs.gnu.org/15463>.
2013-08-22 Paul Eggert <eggert@cs.ucla.edu>
cmp, diff, sdiff: tune by using rawmemchr
On my platform (AMD Phenom II X4 910e, Fedora 17 x86-64), this sped up
'cmp -n 8GiB /dev/full /dev/zero' by a factor of 3.8, and
'cmp -sn 8GiB /dev/full /dev/zero' by a factor of 1.8.
* bootstrap.conf (gnulib_modules): Add rawmemchr.
* src/cmp.c (cmp): Optimize the common case where buffers are the same,
by using count_newlines rather than block_compare_and_count.
(block_compare_and_count): Remove.
(count_newlines): New function.
* src/cmp.c (count_newlines):
* src/io.c (prepare_text):
* src/sdiff.c (lf_copy, lf_skip, lf_snarf):
Use rawmemchr instead of memchr, for speed.
2013-08-12 Paul Eggert <eggert@cs.ucla.edu>
cmp: tune 'cmp a b' for GCC x86
Performance problem reported by David Balažic in:
http://lists.gnu.org/archive/html/bug-diffutils/2013-08/msg00013.html
* src/system.h (word): Make it size_t, not uintmax_t.
This sped up plain cmp 90% on my tests (GCC 4.8.1, x86).
2013-07-06 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
2013-05-06 Stefano Lattarini <stefano.lattarini@gmail.com>
build: enable 'subdir-objects' automake option
The future major Automake version (2.0, ETA at least one year from now)
might enable that option unconditionally, so better get prepared in due
time.
* configure.ac (AM_INIT_AUTOMAKE): Adjust.
(AM_PROG_CC_C_O): New, required by Automake up to 1.13.x when the
'subdir-objects' is in use.
2013-04-28 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
2013-04-03 Paul Eggert <eggert@cs.ucla.edu>
diff: fix bug with Asian file names
Problem reported by Errembault Philippe in:
http://lists.gnu.org/archive/html/bug-diffutils/2013-03/msg00012.html
* NEWS: Document this.
* src/dir.c (compare_names): Fall back on file_name_cmp if
compare_collated returns 0, unless ignoring file name case.
(diff_dirs): Don't bother with the O(N**2) stuff unless ignoring
file name case.
* tests/Makefile.am (TESTS): Add strcoll-0-names.
* tests/strcoll-0-names: New file.
diff: remove unnecessary decl
* src/dir.c (compare_names_for_qsort): Remove declaration.
Not needed now that we assume C89.
diff: tune compare_names_for_qsort
* src/dir.c (compare_collated): New function.
(compare_names): Use it.
(compare_names_for_qsort): Use it. This is a bit more efficient
as it can avoid a double invocation of file_name_cmp when
file_name_cmp returns zero.
2013-03-30 Jim Meyering <meyering@fb.com>
doc: mention new option, --no-dereference in 3.3's NEWS
* NEWS (New feeatures): Update 3.3's news to mention --no-dereference.
Reported by Denis Excoffier.
* Makefile.am (old_NEWS_hash): Update, since this modifies old, and
normally-immutable NEWS.
2013-03-26 Paul Eggert <eggert@cs.ucla.edu>
tests: port to Solaris 10 /bin/sh
* tests/Makefile.am (TESTS_ENVIRONMENT):
Use "FOO=val; export FOO" rather than "export FOO=val",
as the latter form doesn't work with Solaris /bin/sh.
Problem found when trying to run "make check" on Solaris 10.
2013-03-24 Jim Meyering <meyering@fb.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.3
* NEWS: Record release date.
2013-03-23 Paul Eggert <eggert@cs.ucla.edu>
doc: fix menu typo
* doc/diffutils.texi (Comparing Three Files): Fix out-of-order menu.
Bug caught by Texinfo 5.0.
maint: update build procedure to recent gettext etc.
* bootstrap.conf (gnulib_modules): Add vararrays.
(needed_gnulib_files, unnecessary_gettext_files): New vars.
(bootstrap_post_import_hook): New function, to implement these vars.
(excluded_files): Remove; 'bootstrap' no longer supports this.
Its function is now performed by unnecessary_gettext_files.
(buildreq): Update automake to 1.12.2, to avoid CVE-2012-3386.
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump from 0.17 to 0.18.2,
to lessen the probability that we'll have outlandishly old files
during a build.
* m4/vararrays.m4: Remove from repository, as we now use the
gnulib version.
2013-03-21 Jim Meyering <jim@meyering.net>
build: update gnulib to latest and adapt; update bootstrap, too
Blindly updating to the latest from gnulib, bootstrap would
fail due to failure of our local patches to apply. Hence,
these first two updates.
* gl/lib/regex_internal.c.diff: Update offsets, so this patch
applies to the latest from gnulib.
* gl/lib/regex_internal.h.diff: Remove file. No longer needed.
* bootstrap: Update from gnulib.
2013-01-06 Paul Eggert <eggert@cs.ucla.edu>
tests: port to hosts lacking fmt, make -C
* tests/Makefile.am (built_programs): Don't assume fmt works.
Don't rely on 'make -C', either.
maint: update .gitignore for recent gnulib
* .gitignore: Add tests/*.trs and several *.h and *.sed files in lib,
2013-01-04 Jim Meyering <jim@meyering.net>
build: update gnulib submodule to latest
maint: update all copyright year number ranges
Run "make update-copyright".
2012-10-23 Eric Blake <eblake@redhat.com>
build: default to --enable-gcc-warnings in a git tree
Anyone building from cloned sources can be assumed to have a new
enough environment, such that enabling gcc warnings by default will
be useful. Tarballs still default to no warnings, and the default
can still be overridden with --disable-gcc-warnings.
* configure.ac (gl_gcc_warnings): Set default based on environment.
2012-10-03 Paul Eggert <eggert@cs.ucla.edu>
* doc/diffutils.texi (cmp Options): Document -l format better.
2012-09-10 Jim Meyering <meyering@redhat.com>
maint: use xasprintf in place of xmalloc+sprintf
* bootstrap.conf (gnulib_modules): Add gnulib's xvasprintf module.
* src/util.c: Include "xvasprintf.h".
(begin_output): Use xasprintf in place of xmalloc+sprintf.
2012-09-10 Andreas Gruenbacher <agruen@gnu.org>
diff: encode file names with special characters
* src/util.c (c_escape_char): New function.
(c_escape): New function.
(begin_output): Escape file names when needed.
* src/context.c (print_context_header): New names parameter.
(print_context_label): New name parameter.
* src/diff.h (print_context_header): Change prototype.
* tests/filename-quoting: New file.
* NEWS: Document this change.
2012-08-30 Paul Eggert <eggert@cs.ucla.edu>
diff: silence GCC warning instead of slowing down
* src/dir.c (find_dir_file_pathname): Use 'IF_LINT (volatile)' to
silence the gcc warning, rather than using 'volatile', as the
warning appears to be bogus.
2012-08-28 Jim Meyering <meyering@redhat.com>
diff: avoid possible longjmp-triggered misbehavior
* src/dir.c (find_dir_file_pathname): gcc 4.8.0 20120825 reported
that a local variable's value might be clobbered. Declare "match"
to be volatile.
build: update gnulib, bootstrap and init.sh to latest
maint: avoid new syntax-check failure due to @xref use
* doc/diffutils.texi: Change several "; @xref{..." to ". @xref{...",
since @xref should start a sentence.
2012-05-15 Paul Eggert <eggert@cs.ucla.edu>
maint: remove ms subdirectory
diffutils is now designed to build with Cygwin or MinGW.
The old DJGPP stuff probably doesn't work anyway.
* Makefile.am (SUBDIRS): Remove ms.
* NEWS: Document this.
* configure.ac (AC_CONFIG_FILES): Remove ms/Makefile.
* ms/Makefile.am, ms/README, ms/config.bat, ms/config.sed:
* ms/config.site: Remove.
2012-05-14 Paul Eggert <eggert@cs.ucla.edu>
maint: update bootstrap from gnulib
* bootstrap: Update from gnulib.
main: port subcommands to mingw
Problem reported by Eli Zaretskii in
<http://lists.gnu.org/archive/html/bug-gnu-utils/2012-05/msg00013.html>.
Approach suggested by Bruno Haible as option (4) in
<http://lists.gnu.org/archive/html/bug-gnu-utils/2012-05/msg00036.html>.
* bootstrap.conf (gnulib_modules): Add system-quote.
* src/diff3.c, src/sdiff.c, src/util.c:
Include <system-quote.h>, not <sh-quote.h>.
* src/diff3.c (read_diff):
* src/sdiff.c (main, edit):
* src/util.c (begin_output):
Use system_quote_argv, for portability to Mingw.
* src/sdiff.c (NUM_SIGS, handler_index_of_SIGINT): Now enum
values, not macros; this is cleaner and avoids a GCC warning if
!HAVE_WORKING_VFORK.
* src/util.c (begin_output) [! HAVE_WORKING_FORK]: Do not use -f,
for consistency with the HAVE_WORKING_FORK code.
maint: update bootstrap from gnulib
* bootstrap: Update from gnulib.
maint: m4/gnulib-cache.m4 is not under version control
This is like what coreutils does, and suppresses 'git status' chatter.
* .gitignore: Add /m4/gnulib-cache.m4.
Use binary mode when testing for binary files.
This reverts the 2006-01-05 change and modernizes to the current API.
Idea suggested by Eli Zaretskii in:
http://lists.gnu.org/archive/html/bug-gnu-utils/2012-05/msg00066.html
* src/cmp.c (main):
* src/diff.c (main, compare_files):
Use set_binary_mode rather than SET_BINARY.
* src/diff.c (compare_files): Omit unnecessary use of O_BINARY.
* src/io.c (sip): Sample unknown files in binary mode, to see
whether they are binary.
(read_files): Read binary files in binary mode.
build: update gnulib submodule to latest
2012-05-13 Stefano Lattarini <stefano.lattarini@gmail.com>
build: omit obsolete AM_PROG_CC_STDC macro
The Automake-provided macro 'AM_PROG_CC_STDC' has been superseded by
the Autoconf-provided one 'AC_PROG_CC' since October 2002, and will
be removed in the next major automake version.
* configure.ac (AM_PROG_CC_STDC): Drop it.
2012-05-05 Jim Meyering <meyering@redhat.com>
diff: fix a typo that was always disabling the same_special_file macro
* src/system.h (same_special_file): Correct cpp guard expression:
s/HAVE_ST_RDEV/HAVE_STRUCT_STAT_ST_RDEV/. Reported by Eli Zaretskii.
2012-04-17 Jim Meyering <meyering@redhat.com>
maint: update bootstrap from gnulib
* bootstrap: Update from gnulib.
2012-03-07 Eric Blake <eblake@redhat.com>
usage: improve wording of --ignore-matching-lines
* src/diff.c (option_help_msgid): Tweak wording.
2012-03-04 Paul Eggert <eggert@cs.ucla.edu>
doc: explain -I RE better in --help output
* src/diff.c, src/sdiff.c (option_help_msgid): For -I RE,
change "whose lines all match" to "all whose lines match" to avoid
unintended interpretation. Reported by Danijel Tasov in
<http://bugs.debian.org/648411>.
2012-02-12 Paul Eggert <eggert@cs.ucla.edu>
sdiff: remove dependency on sigprocmask
* bootstrap.conf (gnulib_modules): Remove sigprocmask.
* src/sdiff.c (temporary_file): No need to invoke sigprocmask
here, since the signal handler merely sets a flag.
2012-02-04 Paul Eggert <eggert@cs.ucla.edu>
diff: -N, --unidirectional-new-file now compare to "-" too
* NEWS: Document this.
* doc/diffutils.texi (Comparing Directories): Likewise.
Also, document that these options work at the top level.
* src/diff.c (compare_files): Treat EBADF like ENOENT, to handle
the case where "-" is closed. Allow the other file to be
STDIN_FILENO, in case it's "-".
* tests/Makefile.am (TESTS): Add new-file.
* tests/new-file: New file.
2012-01-25 Paul Eggert <eggert@cs.ucla.edu>
maint: quote 'like this' or "like this", not `like this'
This is in response to a recent change in the GNU coding standards,
which now suggest quoting 'like this' or "like this", instead of
`like this' or ``like this''.
* HACKING, NEWS, README, README-hacking, TODO, doc/diagmeet.note:
* doc/diffutils.texi, ms/config.bat, ms/config.site:
* src/analyze.c, src/cmp.c, src/context.c, src/diff.c:
* src/diff.h, src/diff3.c, src/dir.c, src/ifdef.c, src/io.c:
* src/sdiff.c, src/side.c, src/system.h, src/util.c:
* tests/help-version:
Quote 'like this' or "like this" in commentary.
* cfg.mk (old_NEWS_hash): Adjust to reflect new NEWS quoting.
* man/help2man: Update to 1.40.4 version, with quoting fixed as above.
* po/en.po: Remove translation involving `, as it's no longer needed.
* src/cmp.c (try_help, specify_ignore_initial, usage, main):
* src/diff.c (main, try_help, option_help_msgid, specify_value)
(compare_files):
* src/diff3.c (main, try_help, option_help_msgid, usage)
(read_diff):
* src/dir.c (compare_names):
* src/sdiff.c (try_help, usage, check_child_status, main):
* src/util.c (finish_output):
* tests/help-version:
Quote 'like this' in output.
build: update gnulib submodule to latest
2012-01-12 Jim Meyering <meyering@redhat.com>
build: accommodate newer bootstrap from gnulib
* bootstrap.conf (gnulib_tool_option_extras): Add both --symlink
and --makefile-name=gnulib.mk. Also remove now-obsolete $bt/ prefix.
* bootstrap: Update from gnulib.
* tests/init.sh: Update from gnulib.
* lib/Makefile.am: Initialize numerous variables, so that
generated code in gnulib.mk may use += to append to them.
maint: avoid new syntax-check failure
* src/diff.c (compare_files): Use STREQ, not strcmp.
2012-01-08 Bruno Haible <bruno@clisp.org>
New option --no-dereference.
* src/diff.h (no_dereference_symlinks): New variable.
* src/diff.c: Include xreadlink.h.
(longopts): Add --no-dereference option.
(main): Accept --no-dereference option.
(option_help_msgid): Mention the --no-dereference option.
(compare_files): If no_dereference_symlinks is true, use lstat()
instead of stat(). Compare symbolic links by comparing their values.
* bootstrap.conf (gnulib_modules): Add lstat, stat, xreadlink.
* doc/diffutils.texi (Comparing Directories, diff Options): Mention the
--no-dereference option.
* tests/no-dereference: New file.
* tests/Makefile.am (TESTS): Add it.
2012-01-01 Jim Meyering <meyering@redhat.com>
maint: update all copyright year number ranges
Run "make update-copyright".
2011-12-14 Jim Meyering <meyering@redhat.com>
build: update to latest gnulib and adapt
* tests/binary: Reverse arguments to compare to avoid failure of
new syntax-check rule.
* configure.ac: Use -Wno-format-nonliteral.
Mark functions as pure of const, per recommendations enabled by
new gcc -W options. Use _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST.
* lib/cmpbuf.h (buffer_lcm, block_compare):
Apply pure and/or const attributes.
* src/cmp.c (block_compare): Likewise.
* src/context.c (find_hunk): Likewise.
* src/diff.h (lines_differ): Likewise.
* src/diff3.c (skipwhite): Likewise.
* src/dir.c (dir_loop): Likewise.
* src/util.c (find_change, find_reverse_change): Likewise.
(translate_line_number): Likewise.
build: stop distributing gzip'd releases; xz is enough
* configure.ac (AM_INIT_AUTOMAKE): Add no-dist-gzip.
2011-11-29 Jim Meyering <meyering@redhat.com>
tests: use "compare exp out", not "compare out exp"
Likewise, when an empty file is expected, use "compare /dev/null out",
not "compare out /dev/null". I.e., specify the expected/desired contents
via the first file name. Prompted by a suggestion from Bruno Haible
in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154
Run these commands:
git grep -l -E 'compare [^ ]+ exp' \
|xargs perl -pi -e 's/\b(compare) (\S+) (exp\S*)/$1 $3 $2/'
git grep -l -E 'compare [^ ]+ /dev/null' \
|xargs perl -pi -e 's,\b(compare) (\S+) (/dev/null),$1 $3 $2,'
But manually convert this one:
-compare out exp-$(echo $opt|tr ' ' _)
+compare exp-$(echo $opt|tr ' ' _) out
and avoid an inappropriate change to cfg.mk.
2011-10-12 Stefano Lattarini <stefano.lattarini@gmail.com>
tests: use more portable fd redirection in TESTS_ENVIRONMENT
* tests/Makefile.am (TESTS_ENVIRONMENT): Redirection with `exec 9>&2'
is not portable to various Korn shells, and to (at least) HP-UX 11
/bin/sh. Use a more portable idiom.
See http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22488 for
lots of discussion.
2011-10-11 Stefano Lattarini <stefano.lattarini@gmail.com>
tests: make test runner a script, not a shell function
All the test scripts in the diffutils testsuite are shell scripts,
so the current definition of TESTS_ENVIRONMENT, which adaptively
run tests using either perl or the shell depending on their kind,
is an overkill.
Moreover, this change is required in order for the testsuite to
continue to work with the new testsuite harness that is planned
to be introduced in Automake 1.12 (which, as of the writing date,
is still under development and in late alpha state).
See also related discussion on bug-coreutils:
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8887>
* tests/Makefile.am (TESTS_ENVIRONMENT): Remove definition of the
`shell_or_perl_' shell function, which is not required anymore.
(LOG_COMPILER): New, define to `$(SHELL)'.
* tests/binary: Make executable.
* tests/colliding-file-names: Likewise.
* tests/excess-slash: Likewise.
* tests/no-newline-at-eof: Likewise.
2011-10-04 Claudio Bley <claudio.bley@gmail.com>
portability: use SET_BINARY rather than xfreopen (NULL, ...
* src/diff.c: Include binary-io.h, not xfreopen.h.
(main): Use SET_BINARY (...) rather than xfreopen (NULL, X, ...),
because the latter doesn't work on MinGW and crashes using MSVC.
* src/cmp.c (main): Likewise.
2011-10-04 Jim Meyering <meyering@redhat.com>
build: update gnulib submodule to latest
2011-09-02 Jim Meyering <meyering@redhat.com>
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.2
* NEWS: Record release date.
build: update bootstrap and tests/init.sh from gnulib
* bootstrap: Update from gnulib.
* tests/init.sh: Likewise.
build: update gnulib submodule to latest
2011-09-01 Jim Meyering <meyering@redhat.com>
doc: diffutils' texi-derived doc may now be in debian's "main" section
* NEWS (Packaging): Mention the "no front/back-cover" change.
2011-08-14 Jim Meyering <meyering@redhat.com>
maint: avoid new "make sytnax-check" failure.
* src/diff.h (find_dir_file_pathname): Mark declaration with "extern"
keyword, in order to placate the tight-scope syntax check.
2011-08-14 Paul Eggert <eggert@cs.ucla.edu>
* src/io.c (find_and_hash_each_line): Refactor for brevity.
2011-08-14 Roland McGrath <roland@hack.frob.com>
diff, sdiff: new option --ignore-trailing-space (-Z)
Derived from Roland McGrath's patch (dated June 2004!) in:
http://lists.gnu.org/archive/html/bug-gnu-utils/2004-07/msg00000.html
* NEWS:
* doc/diffutils.texi (White Space, Blank Lines)
(sdiff Option Summary, diff Options, sdiff Options): Document -Z.
* src/diff.h (IGNORE_TRAILING_SPACE)
(IGNORE_TAB_EXPANSION_AND_TRAILING_SPACE): New constants, for -Z.
* src/diff.c (shortopts, longopts, main, option_help_msgid):
* src/sdiff.c (longopts, option_help_msgid, main):
* src/io.c (find_and_hash_each_line):
* src/util.c (lines_differ, analyze_hunk): Support -Z.
2011-08-13 Paul Eggert <eggert@cs.ucla.edu>
* bootstrap.conf (gnulib_modules): Remove timegm.
This fixes a problem noted by Andreas Schwab in:
http://lists.gnu.org/archive/html/bug-diffutils/2011-08/msg00035.html
2011-08-13 Tim Waugh <twaugh@redhat.com>
diff: --ignore-file-name-case now applies at top level too
Derived from Tim Waugh's patch in:
http://lists.gnu.org/archive/html/bug-diffutils/2011-08/msg00034.html
* NEWS, doc/diffutils.texi (diff Options): Document this.
* src/diff.c (compare_files): Implement this, by using
find_dir_file_pathname.
* src/diff.h (find_dir_file_pathname): New decl.
* src/dir.c: Include filenamecat.h.
(find_dir_file_pathname): New function.
2011-08-13 Paul Eggert <eggert@cs.ucla.edu>
* .gitignore: Add lib/unistr, lib/unused-parameter.h.
2011-08-10 Jim Meyering <meyering@redhat.com>
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.1
* NEWS: Record release date.
build: use largefile module and update to latest gnulib
* configure.ac: Remove AC_SYS_LARGEFILE, subsumed by ...
* bootstrap.conf (gnulib_modules): ...this. Use largefile module.
* gnulib: Update to latest.
2011-08-08 Santiago Vila <sanvila@unex.es>
doc: insert comma in --help line for --ignore-space-change (-b)
* src/diff.c (option_help_msgid): Insert omitted comma between
"-b" and "--ignore-space-change". (tiny change)
2011-08-04 Jim Meyering <meyering@redhat.com>
doc: relax restriction on front-cover and back-cover texts
* doc/diffutils.texi (copying): Relax restriction on front-cover
and back-cover texts (just as m4 did here:
http://git.savannah.gnu.org/cgit/m4.git/commit?id=ee1e92ec).
Reported by Santiago Vila. Fix suggested by Eric Blake.
2011-08-03 Jim Meyering <meyering@redhat.com>
tests: update init.sh from gnulib
* tests/init.sh: Update from gnulib.
build: update gnulib submodule to latest
2011-07-03 Jim Meyering <meyering@redhat.com>
maint: remove inclusion of unused header, for "make syntax-check"
* src/diff3.c: Don't include <inttostr.h>. Not used.
* src/context.c: Likewise.
2011-06-19 Jim Meyering <meyering@redhat.com>
build: don't require perl when building from a tarball
But do ensure -- in all other circumstances -- that the man/*.1
files are rebuilt whenever the version number changes.
* configure.ac (SRC_VERSION_C): Define.
* man/Makefile.am (dist_man1_MANS): Rename from $(man1_MANS),
so that we distribute those pesky man/*.1 files.
(EXTRA_DIST): Reflect name change.
(MAINTAINERCLEANFILES): Define this, not DISTCLEANFILES,
now that these generated files are distributed.
($(dist_man1_MANS)): Depend on $(SRC_VERSION_C), so we get the
full dependency when not building from a tarball.
2011-06-13 Jim Meyering <meyering@redhat.com>
doc: do not distribute generated man/*.1 man files
* man/help2man: New file.
* man/Makefile.am: Use $(srcdir)/help2man.
Convert $(dist_man1_MANS) to $(man1_MANS), to tell automake
not to distribute the generated man/*.1 files. Now they're
generated at build-from-tarball time.
($(man1_MANS)): Depend on version.c, so that man pages are
regenerated whenever the version string changes.
build: ccache works better without embedded version strings
* src/Makefile.am: Generate version.c and version.h and put the
new symbol in a tiny library to be used by each program.
(LDADD): Add the new library.
* src/cmp.c (main): Use Version, not PACKAGE_VERSION, so the .o
file does not change with each commit-derived version increment.
* src/diff.c (main): Likewise.
* src/diff3.c (main): Likewise.
* src/sdiff.c (main): Likewise.
* src/system.h: Include "version.h".
* .gitignore: Add version.[ch]
2011-06-12 Jim Meyering <meyering@redhat.com>
doc: ensure each program has a man/*.x file: add "SEE ALSO" references
* man/cmp.x: New file.
* man/diff3.x: New file.
* man/sdiff.x: New file.
* man/diff.x: Add xrefs to the other three programs, and to patch.
* man/Makefile.am (EXTRA_DIST): List new files.
(cmp.1, diff3.1, sdiff.1): Depend on each .x file.
doc: rename diff.texi to diffutils.texi
This makes the .texi basename the same as the package name,
which is consistent with most other GNU packages.
* doc/diffutils.texi: Rename from...
* doc/diff.texi: ...removed.
* doc/Makefile.am (info_TEXINFOS): Reflect name change.
(diffutils_TEXINFOS): Likewise.
* cfg.mk (gendocs_options_): Remove this customization. It is no
longer needed, now that the .texi name matches that of the package.
* man/Makefile.am ($(dist_man1_MANS)): Remove now-unnecessary sed
filter.
* README: Update references to diffutils.texi etc. here, too.
* .gitignore: Update here, too.
Suggested by Karl Berry.
2011-06-08 Karl Berry <karl@freefriends.org>
cmp, diff, diff3, sdiff: edit and align --help text.
* cmp.c (option_help_msgid, usage),
* diff.c (option_help_msgid, usage),
* diff3.c (option_help_msgid, usage),
* sdiff.c (option_help_msgid, usage): align descriptions in the --help
output and slightly edit content.
2011-05-27 Paul Eggert <eggert@cs.ucla.edu>
diff: don't use locales after local-specific sorting fails
* src/dir.c (compare_names): Don't invoke strcasecmp if
locale-specific sorting fails, because POSIX.1-2008 says strcasecmp
has unspecified behavior outside the POSIX locale. See:
http://lists.gnu.org/archive/html/bug-diffutils/2011-05/msg00008.html
bootstrap: Avoid multithreading.
* bootstrap.conf (gnulib_tool_option_extras):
Add "--avoid=localename --avoid=lock", because we don't want to
bring in the multithreading code that recent gnulib changes would
otherwise bring in.
(excluded_files): Remove m4/lock.m4; no longer needed, now that
we use --avoid=lock.
build: update gnulib submodule to latest
2011-05-23 Karl Berry <karl@gnu.org>
maint: update README-hacking
* README-hacking: Update a la coreutils for git, etc.
2011-05-23 Jim Meyering <meyering@redhat.com>
maint: update gnulib to latest with accompanying tight-scope tweaks
* cfg.mk: Include $(srcdir)/dist-check.mk using "-include",
to accommodate the new sc_tight_scope rule.
(_gl_TS_extern): Define, to tell gnulib's tight_scope rule that
headers here mark externs with "XTERN".
* gnulib: Update to latest.
2011-05-18 Jim Meyering <meyering@redhat.com>
maint: use gnulib's new readme-release module
* bootstrap.conf (gnulib_modules): Add readme-release.
(bootstrap_epilogue): Add the recommended perl one-liner.
* README-release: Remove file; it is now generated from gnulib.
* .gitignore: Add it.
build: update gnulib submodule to latest
maint: prepare for the tight-scope check
* src/diff.h: Mark function declarations with "extern" in
preparation for the tight-scope check.
(ignore_white_space): Separate enum decl from declaration
of this variable.
* src/Makefile.am (diff_SOURCES): Move diff.h from here to ...
(noinst_HEADERS): ...here.
For convenience, since the tight-scope rule uses $(noinst_HEADERS).
maint: don't use now-removed gnulib "exit" module
* bootstrap.conf (gnulib_modules): Remove "exit" module.
It no longer exists.
2011-03-26 Jim Meyering <meyering@redhat.com>
build: update gnulib submodule to latest
* .x-sc_space_tab: Remove file. Instead, ...
* cfg.mk (exclude_file_name_regexp--sc_space_tab): ...define this.
maint: fix typo in unused rule
* cfg.mk (config-save): Fix typo: add leading "_" in variable name.
2011-03-18 Jim Meyering <meyering@redhat.com>
doc: add a reference to wdiff(1) from diff.1
* man/diff.x: New file, to add "SEE ALSO" reference to wdiff(1).
* man/Makefile.am (diff.1): Depend on diff.x.
($(dist_man1_MANS)): Tell help2man to include diff.x.
(EXTRA_DIST): Add diff.x.
Suggestion from Dan Jacobson in http://bugs.debian.org/613319
2011-03-18 Eric Blake <eblake@redhat.com>
docs: info should mention -L
* doc/diff.texi (diff Options): Document -L.
docs: diff --help should mention -L
* src/diff.c (option_help_msgid): Document -L.
2011-02-15 Jim Meyering <meyering@redhat.com>
doc: speak of the --test (-a) option, not "the -a or --test option"
Convert using this command:
perl -pi -e \
's/(\@option{-.}) or (\@option{--.*?}) option/$2 ($1) option/' \
doc/diff.texi
Then convert some more with this:
perl -pi -e \
's/the (\@option{-.}) or (\@option{--.*?})$/the $2 ($1)/' \
doc/diff.texi
Then convert more manually.
Suggested by Dan Jacobson
2011-01-24 Jim Meyering <meyering@redhat.com>
maint: remove all uses of vfork: use fork instead
Our use of vfork now provokes warnings from gcc-4.6.0.
Also, vfork is no longer even specified by POSIX.1-2008.
* src/diff3.c (read_diff): Change each use of vfork to "fork".
Remove #ifdef'd code.
* src/util.c (begin_output, finish_output): Likewise.
* src/sdiff.c (cleanup, main, edit): Likewise.
(handler_index_of_SIGPIPE): Remove now-unused definition.
* src/system.h: Don't include <vfork.h>.
(vfork): Remove definition.
* ms/config.site: Remove reference to vfork cache variable.
tests: avoid newer but less-portable tail option syntax
* tests/function-line-vs-leading-space: Use sed -n '3,$p' rather than
tail -n+3. Older versions of tail do not accept that newer syntax.
Reported by Sudhakara Peram.
tests: fix an erroneous test
On most systems, like-named files were compared, by luck.
However, on others, different-named files would be compared
since their names were being treated as equal -- but they had
different content, so the test would fail.
* tests/colliding-file-names: Use different sets of file names
in d1 and d2 so that they cannot accidentally match.
Put the same line in each test file. This is required
when files named e.g., abc and ABC are compared.
This test was failing on a NixOS 86_64-darwin system.
build: update gnulib submodule to latest
tests: fix typo that silently disabled all tests
* tests/Makefile.am (TESTS): Fix typo: s/jESTS/TESTS/
2011-01-23 Jim Meyering <meyering@redhat.com>
build: update gnulib submodule to latest
maint: avoid new syntax-check failure
* src/diff.c (specify_value): Use !STREQ(...), not strcmp(...) != 0.
* src/diff3.c (main): Likewise.
2011-01-03 Jim Meyering <meyering@redhat.com>
maint: update copyright year ranges to include 2011
Run "make update-copyright", so "make syntax-check" works in 2011.
build: update gnulib submodule to latest
2010-12-16 Paul Eggert <eggert@cs.ucla.edu>
bootstrap: adjust to recent gnulib changes
* bootstrap.conf (excluded_files): Do not exclude m4/size_max.m4
and m4/xsize.m4 when using an external gettext, since they are
now needed by other gnulib modules.
2010-12-16 Jim Meyering <meyering@redhat.com>
doc: add contributor guidelines: HACKING
* HACKING: New file, copied 99% from the one in grep's repository.
2010-10-09 Jim Meyering <meyering@redhat.com>
maint: describe policy on copyright year number ranges
* README: Mention coreutils' long-standing policy on use of M-N
ranges in copyright year lists. Requested by Richard Stallman.
2010-09-04 Jim Meyering <meyering@redhat.com>
maint: adjust init.sh use to conform
* tests/help-version: Use one line: "${srcdir=.}/init.sh"; ...
* tests/basic: Likewise.
* tests/binary: Likewise.
* tests/colliding-file-names: Likewise.
* tests/excess-slash: Likewise.
* tests/function-line-vs-leading-space: Likewise.
* tests/help-version: Likewise.
* tests/label-vs-func: Likewise.
* tests/no-newline-at-eof: Likewise.
* tests/stdin: Likewise.
maint: avoid shadowing warning
* src/dir.c (diff_dirs): Rename shadowed local cmp to "c".
2010-09-03 Jim Meyering <meyering@redhat.com>
build: use gettext-h, not gettext
* bootstrap.conf (gnulib_modules): Use gettext-h, not gettext.
The latter is overkill for a package that uses
AM_GNU_GETTEXT([external]...
build: update build/test tools from gnulib
* bootstrap: Update from gnulib.
* tests/init.sh: Likewise.
build: update gnulib submodule to latest
2010-08-14 Jim Meyering <meyering@redhat.com>
diff -r: avoid printing excess slashes in concatenated file names
* bootstrap.conf (gnulib_modules): Add filenamecat.
* src/diff.c: Include "filenamecat.h".
(compare_files): Use file_name_concat, rather than dir_file_pathname.
* src/util.c (dir_file_pathname): Remove now-unused function.
* src/diff.h: Remove its declaration.
* tests/excess-slash: New script to test for this.
* tests/Makefile.am (TESTS): Add it.
Forwarded by Santiago Vila from <bugs.debian.org/586301a>,
reported by Jari Aalto.
2010-08-12 Paul Eggert <eggert@cs.ucla.edu>
diff: avoid spurious diffs when two distinct dir entries compare equal
Problem reported by Christoph Anton Mitterer in:
http://lists.gnu.org/archive/html/bug-diffutils/2010-08/msg00000.html
* NEWS: Mention this bug fix.
* src/dir.c (compare_names_for_qsort): Fall back on file_name_cmp
if two distinct entries in the same directory compare equal.
(diff_dirs): Prefer a file_name_cmp match when available.
* tests/Makefile.am (TESTS): New test colliding-file-names.
* tests/colliding-file-names: New file.
2010-05-09 Jim Meyering <meyering@redhat.com>
build: update gnulib submodule to latest
build: don't define macros that gnulib provides
* bootstrap.conf (gnulib_modules): Add signal, stdint.
* lib/cmpbuf.c (SA_RESTART, SA_INTERRUPT): Remove definitions.
(SIZE_MAX, PTRDIFF_MAX): Likewise.
Include <stdint.h>.
* src/system.h (WEXITSTATUS, WIFEXITED): Remove definitions.
(SA_RESTART, SA_INTERRUPT): Likewise.
build: rely on gnulib's sigprocmask module
* src/sdiff.c: Remove #if-!HAVE_SIGPROCMASK-guarded code.
* bootstrap.conf (gnulib_modules): Add sigprocmask.
2010-05-04 Jim Meyering <meyering@redhat.com>
doc: README-release: don't mention To:, Cc:, etc announcement headers,
now that those are supplied automatically via gnulib's maint.mk.
* README-release: sync with coreutils.
maint: teach web-doc-generating code how to do its job
* cfg.mk (gendocs_options): Define, so that gendocs.sh knows
the name of our texinfo source file.
* gnulib: Update to latest, for new gnu-web-doc-update and maint.mk.
2010-05-03 Jim Meyering <meyering@redhat.com>
doc: update release procedure
* README-release: Rearrange slightly: post the announcement to
Savannah first, so you can include a link to that post in the email.
Sync a few details from coreutils' README-release.
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 3.0
* NEWS: Record release date.
build: update gnulib submodule to latest
2010-04-30 Jim Meyering <meyering@redhat.com>
build: use gnulib's sys_wait module
* bootstrap.conf (gnulib_modules): Use gnulib's sys_wait module,
now that we assume its presence.
build: update gnulib submodule to latest
* bootstrap: Also update from gnulib.
* tests/init.sh: Likewise
maint: remove now-useless #if HAVE_HEADER_H guards
* src/system.h: Include <sys/wait.h> unconditionally,
now that gnulib guarantees its presence.
* lib/cmpbuf.c: Likewise for <unistd.h> and <inttypes.h>.
2010-04-16 Jim Meyering <meyering@redhat.com>
tests: use original no-newline-at-eof test, but with -U1, not -U2
* tests/no-newline-at-eof: Revert to the smaller test, but with
-U1 rather than -U2, since that actually triggers the bug.
2010-04-16 Paul Eggert <eggert@cs.ucla.edu>
Followon improvements for the fix for Debian bug 577832.
* src/io.c (find_and_hash_each_line): Omit the inserted newline in
a simpler way.
* tests/no-newline-at-eof: Fix the test case so that it rejects
the old, buggy behavior.
2010-04-16 Jim Meyering <meyering@redhat.com>
build: update gnulib submodule to latest
tests: test for the no-newline-at-EOF bug
* tests/no-newline-at-eof: New file.
* tests/Makefile.am (TESTS): Add it.
2010-04-16 Jim Meyering <meyering@redhat.com>
diff: fix a regression when at least one input lacks a newline-at-EOF,
and the final hunk plus context-length aligns exactly with the end
of the newline-lacking file. Diff would fail to output the required
"\ No newline at end of file" line, thus rendering the output invalid.
This bug appears to have been introduced by 2006-05-07
commit 58d0483b, "(find_identical_ends): Fix huge performance bug...",
at least to the extent that reverting that change fixes the bug.
Considering the stated effect of that change and lack of metrics,
reverting it is not an option, so here we take a more direct approach.
Given these inputs,
printf '\n1'>a; printf '\n0\n\n1'>b
and running diff like this:
./diff -U1 a b
for input file "b", the pointer, files[1].linbuf[4][-1], to
the last byte on the final line was mistakenly pointing at the
sentinel newline at EOF, rather than at the preceding byte.
(gdb) p files[1].linbuf[4][-1]
$3 = 10 '\n'
Thus, this test in the final print_1_line call:
if ((!line_flag || line_flag[0]) && limit[-1] != '\n')
fprintf (out, "\n\\ %s\n", _("No newline at end of file"));
would fail, because limit[-1] (which is files[1].linbuf[4][-1])
was mistakenly '\n', rather than the desired '1'.
My first thought was simply to adjust the final linbuf[line] setting,
at the end of io.c's find_and_hash_each_line function function:
if (p == bufend)
- break;
+ {
+ if (current->missing_newline)
+ --linbuf[line];
+ break;
+ }
But that would make diff misbehave with this input
(same as above, but with a newline appended to "a"),
printf '\n1\n'>a; printf '\n0\n\n1'>b
./diff -U1 a b
due to the block (100 lines above) that is triggered in that case
(but not in the both-files-missing-newline case):
if (p == bufend
&& current->missing_newline
&& ROBUST_OUTPUT_STYLE (output_style))
{
/* This line is incomplete. If this is significant,
put the line into buckets[-1]. */
if (ignore_white_space < IGNORE_SPACE_CHANGE)
bucket = &buckets[-1];
/* Omit the inserted newline when computing linbuf later. */
p--;
bufend = suffix_begin = p;
}
Note how "p" is decremented and "bufend" adjusted.
When that happens, we certainly don't want to decrement
"bufend" yet again.
Since there is no other way to determine at the end whether "bufend"
was already decremented, add a new variable to serve as witness.
* NEWS (Bug fixes): Mention it.
Reported by Timo Juhani Lindfors in http://bugs.debian.org/577832.
Forwarded by Santiago Vila.
2010-04-16 Jim Meyering <meyering@redhat.com>
tests: update init.sh from gnulib
* tests/init.sh: Update from gnulib.
2010-04-08 Jim Meyering <meyering@redhat.com>
build: include cfg.mk and dist-check.mk in the distribution tarball
* Makefile.am (EXTRA_DIST): Add cfg.mk and dist-check.mk.
maint: update to latest gnulib
* cfg.mk (sc_cross_check_PATH_usage_in_tests): Remove rule,
now that it's in gnulib's maint.mk.
* gnulib: Update to latest.
2010-04-07 Jim Meyering <meyering@redhat.com>
tests: make new PATH-crosschecking syntax-check tighter
* cfg.mk (sc_cross_check_PATH_usage_in_tests): Use grep's -x (match
entire line) option with -F.
tests: pull latest help-version from gzip
* tests/help-version: Update from gzip.
* Makefile.am (TESTS_ENVIRONMENT): Export VERSION,
as required for this new help-version script.
tests: add syntax-check rule to verify that tests use proper PATH
* cfg.mk (sc_cross_check_PATH_usage_in_tests): New rule, that is
useful only in conjunction with the help-version script.
tests: use path_prepend_ consistently; remove unnecessary VERBOSE check
* tests/basic: Likewise.
* tests/binary: Likewise.
* tests/function-line-vs-leading-space: Likewise.
* tests/label-vs-func: Likewise.
* tests/stdin: Likewise.
2010-04-06 Eric Blake <eblake@redhat.com>
maint: ignore generated files
* .gitignore: Ignore recent gnulib additions.
maint: update to latest bootstrap
* bootstrap: Copy from gnulib/build-aux.
2010-04-05 Jim Meyering <meyering@redhat.com>
tests: get latest init.sh from gnulib
* tests/init.sh: Update from gnulib.
build: update gnulib submodule to latest; adapt
* cfg.mk (local-checks-to-skip): Add new sc_texinfo_acronym, to skip it.
diff -F/-p: don't depend on locale-specific white-space definition
* src/context.c: Include "c-ctype.h".
Use c_isspace, not isspace.
2010-03-18 Jim Meyering <meyering@redhat.com>
tests: exercise new behavior of -F RE
* tests/function-line-vs-leading-space: New file.
* tests/Makefile.am (TESTS): Add it.
2010-03-18 Yannick Moy <yannick.moy@adacore.com>
with -F or -p, emit better function lines: no leading white space
* src/diff.c (print_context_function): For languages like Ada
that allow local functions and procedures, the plain context
function line may start with enough blank characters that the
function name does not get completely printed in the 40
characters limit. This patch solves this problem by removing
these useless initial blank characters.
* NEWS (Changes in behavior): Mention this change.
2010-03-17 Jim Meyering <meyering@redhat.com>
build: don't require a specific version of help2man
* bootstrap.conf (buildreq): Bootstrap can't deal with it,
perhaps because the command name contains a digit.
build: make bootstrap ensure that help2man is available
* bootstrap.conf (buildreq): Add help2man.
2010-02-23 Jim Meyering <meyering@redhat.com>
tests: test for the "Binary files A and B differ" diagnostic
* tests/binary: New script.
* tests/Makefile.am (TESTS): Add it.
revert 2002 change that removed "Binary " from "files A and B differ"
With this change, "printf '\0'|diff - /dev/null" now prints
"Binary files - and /dev/null differ" once again.
This reverts 2002-06-28 commit a352f0980,
"(briefly_report): Don't say "Binary files differ", ...".
* src/analyze.c (briefly_report): Do include the "Binary " prefix
in the diagnostic, when !brief.
* NEWS (Changes in behavior): Mention the diagnostic change.
Reported by Andreas Hoenen in http://bugs.debian.org/570064.
2010-02-14 Juan Manuel Guerrero <juan.guerrero@gmx.de>
avoid compilation failure on systems lacking both fork and vfork
* src/sdiff.c [!HAVE_WORKING_FORK && !HAVE_WORKING_VFORK] (main):
Pass the right number of arguments to shell_quote_copy.
* src/util.c [!HAVE_WORKING_FORK && !HAVE_WORKING_VFORK] (begin_output):
Likewise.
2010-02-11 Jim Meyering <meyering@redhat.com>
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 2.9
* NEWS: Record release date.
doc: document the release procedure
* README-release: New file.
2010-02-10 Jim Meyering <meyering@redhat.com>
maint: change use of "|" to more maintainable "||" (no semantic change)
* src/analyze.c (diff_2_files): Using the "||" operator happens to
be equivalent to using "|" in this case. It is also clearer and
less prone to inadvertent bug introduction, in case the variable,
"changes" were ever to take on a value not in {0,1}.
Patch by Tim Waugh, via Mike Frysinger.
portability: avoid "diff - ..." failure at least on *BSD and Solaris
The new "stdin" test was failing on many types of systems.
* src/diff.c (compare_files): Guard use of xfreopen (NULL, "rb", ...
also with O_BINARY, so as to avoid this unnecessary call on
systems where it's not needed (on some it fails with "Bad address".
2010-02-09 Jim Meyering <meyering@redhat.com>
tests: honor VERBOSE
* tests/basic: Enable "set -x" if $VERBOSE.
* tests/help-version: Likewise.
* tests/label-vs-func: Likewise.
* tests/stdin: Likewise.
2010-02-04 Jim Meyering <meyering@redhat.com>
build: update gnulib submodule to latest
sync with gnulib
* gl/lib/regcomp.c.diff: Adjust to apply to the latest in gnulib.
* gnulib: Update submodule to latest.
2010-02-04 Jim Meyering <meyering@redhat.com>
build: do not override gnulib-provided AM_CFLAGS options
Avoid a warning from automake:
lib/Makefile.am:23: AM_CFLAGS multiply defined in condition TRUE ...
lib/gnulib.mk:30: ... `AM_CFLAGS' previously defined here
lib/Makefile.am:18: `lib/gnulib.mk' included from here
* lib/Makefile.am (AM_CFLAGS): Append $(WARN_CFLAGS) and
$(WERROR_CFLAGS), i.e., use "+=", not "=".
This was introduced via 2009-12-17 commit e58efa5b
"build: enable warnings and -Werror.",
but fortunately is not a bug, because the definition
it would have overridden was always empty.
2010-01-17 Jim Meyering <meyering@redhat.com>
maint: add to .gitignore
* .gitignore: Ignore more.
2010-01-15 Jim Meyering <meyering@redhat.com>
doc: add to TODO
* TODO: Add an item, suggested by Dan Jacobson.
2010-01-13 Jim Meyering <meyering@redhat.com>
tests: ensure that an argument of "-" is treated as standard input
* tests/stdin: New test.
* tests/Makefile.am (TESTS): Add it.
2010-01-10 Jim Meyering <meyering@redhat.com>
tests: now "make distcheck" runs more tests, incl. syntax-check
* cfg.mk: Include dist-check.mk, from coreutils.
* Makefile.am (distcheck-hook): Define rule, to hook to...
* dist-check.mk: New file.
2010-01-09 Jim Meyering <meyering@redhat.com>
build: update gnulib to latest, for fixed syntax-check rule
maint: record updated NEWS hash
* cfg.mk (old_NEWS_hash): Update to account for GFDL change.
build: update gnulib submodule to latest
tests: add a test of basic functionality
* tests/basic: Start adding tests.
* tests/Makefile.am (TESTS): Add it.
maint: udpate GFDL license to 1.3
* doc/diff.texi: Update to use GFDL version 1.3.
2010-01-04 Eric Blake <ebb9@byu.net>
build: allow compilation on cygwin
* src/Makefile.am (cmp_LDADD): Move LIBICONV...
(LDADD): ...into global flags, since all programs need it.
2010-01-03 Jim Meyering <meyering@redhat.com>
maint: record update-copyright options for this package
* cfg.mk: Next time, just run "make update-copyright".
tests: prepend ../src, not "." to PATH
* tests/help-version: Correct PATH.
2010-01-01 Jim Meyering <meyering@redhat.com>
maint: update all FSF copyright year lists to include 2010
Use this command:
git ls-files |grep -vE '^(\..*|COPYING|gnulib)$' |xargs \
env UPDATE_COPYRIGHT_USE_INTERVALS=1 build-aux/update-copyright
2009-12-31 Jim Meyering <meyering@redhat.com>
maint: newer gnulib; don't hard-code my GPG key ID
* cfg.mk (gpg_key_ID): Remove definition, now that maint.mk automates it.
* gnulib: Update to latest.
tests: exercise diff -p's function-name matching
* tests/label-vs-func: New file.
* tests/Makefile.am (TESTS): Add label-vs-func.
Reported by Simon Arlott <simon@fire.lp0.eu>
http://article.gmane.org/gmane.linux.kernel.janitors/14260
tests: use gnulib's init.sh
* tests/Makefile.am (EXTRA_DIST): Add init.sh.
Remove test-lib.sh.
* tests/init.sh: New file.
* tests/test-lib.sh: Remove file.
* tests/help-version: Use init.sh, not test-lib.sh.
2009-11-28 Jim Meyering <meyering@redhat.com>
maint: don't let trailing spaces in diffs perturb make syntax-check
* .x-sc_space_tab: New file.
2009-11-22 Jim Meyering <meyering@redhat.com>
build: enable warnings and -Werror.
* src/Makefile.am (AM_CFLAGS): Enable warnings and -Werror.
Set to this: $(WARN_CFLAGS) $(WERROR_CFLAGS)
* lib/Makefile.am (AM_CFLAGS): Similarly, but use this:
$(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
* configure.ac (GNULIB_WARN_CFLAGS): Don't turn off -Wuninitialized.
build: avoid a warning from gnulib's sh-quote.c
* gl/lib/sh-quote.c.diff: New file, to avoid a warning.
maint: avoid warnings via patched versions of gnulib's regex functions
* gl/lib/regcomp.c.diff: New file.
* gl/lib/regex_internal.c.diff: Likewise.
* gl/lib/regex_internal.h.diff: Likewise.
* gl/lib/regexec.c.diff: Likewise.
build: update gnulib submodule to latest
2009-11-20 Eric Blake <ebb9@byu.net>
build: ignore more files
* .gitignore: Add config.cache, *.exe.
2009-11-20 Eric Blake <ebb9@byu.net>
build: fix test run on cygwin
This, plus a gnulib update for xalloc-die-tests, are necessary
for make check to pass on cygwin.
* tests/Makefile.am (built_programs): Ignore $(EXEEXT).
* src/Makefile.am (paths.h): Add missing dependency.
2009-11-20 Jim Meyering <meyering@redhat.com>
maint: remove vestiges of nanosleep
* src/Makefile.am (LDADD): Remove $(LIB_NANOSLEEP), now
that we no longer use the nanosleep module.
Spotted by Eric Blake.
maint: don't pull in gnulib's nanosleep unnecessarily
* bootstrap.conf (gnulib_modules): Remove nanosleep. Not needed.
Spotted by Eric Blake.
maint: cfg.mk: remove factored-out ftp host/dir definitions
* cfg.mk (gnu_ftp_host-alpha, gnu_ftp_host-beta gnu_ftp_host-stable):
(gnu_rel_host, url_dir_list): Remove definitions. The defaults,
now provided by maint.mk, are the same.
* gnulib: Update for latest, including those maint.mk additions.
build: link with now-required libraries
* src/Makefile.am (LDADD): Add gnulib-required libraries.
(cmp_LDADD): Add $(LIBICONV), for cmp's use of proper_name_utf8.
maint: lib/xfreopen.c contains translatable strings
* po/POTFILES.in: Add lib/xfreopen.c.
maint: remove hard-coded macro definitions provided by intprops.h
* lib/cmpbuf.c: Include "intprops.h" rather than open-coding macros
like TYPE_SIGNED and TYPE_MINIMUM.
maint: add gnulib's announce-gen module
* bootstrap.conf (gnulib_modules): Add announce-gen
build: suppress warnings about bindtextdomain and textdomain
* src/system.h (bindtextdomain, textdomain) [!ENABLE_NLS]: Define away.
build: use more gnulib modules
* bootstrap.conf (gnulib_modules): Add mktime, nanosleep, strptime
and timegm.
use xfreopen rather than freopen
* src/cmp.c: Include "xfreopen.h".
Use xfreopen in place of freopen.
* src/diff.c Likewise, and...
(main): Set exit_failure to EXIT_TROUBLE, rather than to 2.
* src/diff3.c: Likewise.
* bootstrap.conf (gnulib_modules): Add xfreopen.
build: enable many warnings
* configure.ac: Add support for --enable-gcc-warnings.
* bootstrap.conf (gnulib_modules): Add manywarnings.
* Makefile.am (AM_CFLAGS): Add $(WARN_CFLAGS) $(WERROR_CFLAGS)
build: update gnulib submodule to latest
maint: add an assertion to suppress clang-detected warning
The clang static analyzer reported that a NULL parent could be
dereferenced. However, that cannot happen, because for all callers,
the parameter, parent, is always non-NULL at that point.
* src/diff.c: Include <assert.h>.
Assert that parent is not NULL.
maint: remove dead assignment from diff3.c
* src/diff3.c (make_3way_diff): Remove dead assignment.
2009-11-17 Jim Meyering <meyering@redhat.com>
build: update gnulib submodule to latest
maint: hide build commands behind $(AM_V_GEN)
* src/Makefile.am (paths.h): Use $(AM_V_GEN), and split a long line.
* man/Makefile.am ($(dist_man1_MANS)): Use $(AM_V_GEN) here, too.
2009-11-16 Jim Meyering <meyering@redhat.com>
build: let automake generate better man-installation rules
* man/Makefile.am (dist_man1_MANS): Rename from dist_man_MANS,
to enable better automake-generated installation rules.
admin: ignore all of gnulib-tests
* .gitignore: Add gnulib-tests
2009-11-16 Eric Blake <ebb9@byu.net>
build: avoid link failure when libsigsegv is used
* src/Makefile.am (LDADD): Link against LIBSIGSEGV.
2009-11-16 Jim Meyering <meyering@redhat.com>
maint: define/use PROGRAM_NAME and AUTHORS; use propername module
* bootstrap.conf (gnulib_modules): Add propername.
* src/cmp.c (PROGRAM_NAME, AUTHORS): Define.
(main): Use them in use of version_etc.
* src/diff.c (PROGRAM_NAME, AUTHORS, main): Likewise.
* src/diff3.c (PROGRAM_NAME, AUTHORS, main): Likewise.
* src/sdiff.c (PROGRAM_NAME, AUTHORS, main): Likewise.
* src/system.h: Include "propername.h".
maint: no longer define *_FILENO constants
* src/system.h (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO):
Remove definitions. Now guaranteed by gnulib.
maint: bug-diffutils@gnu.org is the new bug-reporting address
* configure.ac (AC_INIT): Use bug-diffutils@..., not bug-gnu-utils
as the bug-reporting address.
* NEWS (Administrivia): Mention this.
* src/cmp.c (usage): Remove hard-coded address.
Instead, use gnulib's emit_bug_reporting_address function.
* src/diff.c (usage, option_help_msgid): Likewise.
* src/diff3.c (usage): Likewise.
* src/sdiff.c (usage): Likewise.
sdiff, diff3: exec diff, not $(bindir)/diff
* src/Makefile.am (paths.h): Emit a definition of DEFAULT_DIFF_PROGRAM
that is simply "diff" (or whatever $(transform) would convert that to,
e.g., "gdiff"). This makes it so that tests can work without first
installing diff, and so that the binaries do not hard-code $(prefix).
* NEWS (Changes in behavior): Mention this.
2009-11-14 Jim Meyering <meyering@redhat.com>
tests: add the first script; hook up gnulib-tests
* configure.ac (AC_CONFIG_FILES): Add tests/Makefile and
gnulib-tests/Makefile.
* tests/help-version: New file, from coreutils.
* tests/test-lib.sh: Likewise.
* tests/Makefile.am: New file, from gzip.
* Makefile.am (SUBDIRS): Add tests and gnulib-tests.
* tests/t-local.sh: New, empty(for now) file.
2009-11-13 Jim Meyering <meyering@redhat.com>
build: require gettext-0.17
* configure.ac: Require gettext-0.17; it was released two years ago.
build: correct gettext configure-time support
* configure.ac: Use AM_GNU_GETTEXT([external], [need-ngettext]),
rather than AM_GNU_GETTEXT([external], [need-formatstring-macros]).
Reported by Martin Jacobs in
http://thread.gmane.org/gmane.comp.parsers.bison.bugs/3181
2009-11-12 Jim Meyering <meyering@redhat.com>
build: generalize autoheader check
* bootstrap: Look for AC_CONFIG_HEADER as well as AC_CONFIG_HEADERS.
2009-11-11 Jim Meyering <meyering@redhat.com>
maint: use a git submodule for gnulib
* .gitmodules: New file, to track gnulib.
* gnulib: New file, created by running this:
git submodule add git://git.sv.gnu.org/gnulib.git gnulib
maint: tell git what it can ignore
* .gitignore: Ignore generated files.
|