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
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
|
2005-12-27 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_obsolete_symbols): Prohibit use of O_NDELAY.
(sc_prohibit_assert_without_use): New rule.
(syntax-check-rules): Add it to the list.
* .x-sc_prohibit_assert_without_use: New empty file.
* Makefile.am (EXTRA_DIST): Add it.
* Makefile.maint (CVS_LIST): Define in terms of $(srcdir).
* cp.c, df.c, link.c, mknod.c, nice.c, sleep.c, unlink.c:
Don't include <assert.h>; it wasn't used.
2005-12-26 Paul Eggert <eggert@cs.ucla.edu>
* src/chown-core.c (restricted_chown):
Don't try O_WRONLY unless O_RDONLY failed wth EACCES.
* src/remove.c (fd_to_subdirp): Open with O_DIRECTORY | O_NOCTTY
| O_NOFOLLOW too, for consistency with other dir-openers.
Use POSIX-preferred O_NONBLOCK rather than O_NDELAY.
(is_empty_dir): Likewise.
* src/shred.c (wipename): Likewise. Don't bother trying to open
dir for writing, since POSIX prohibits it.
2005-12-22 Jim Meyering <jim@meyering.net>
* tests/help-version: Redirect stderr to /dev/full, to suppress
write error diagnostic.
2005-12-19 Jim Meyering <jim@meyering.net>
* src/mkdir.c, src/mknod.c, src/mkfifo.c (main)
Avoid a minor race condition when `-m MODE' is specified, by using
open, fchown, and close rather than just chown. To do that reliably --
even with an overly restrictive umask -- ensure that each mkdir,
mknod and mkfifo call uses a mode including at least owner-read access.
* src/mknod.c (main): When `-m MODE' is specified, exit nonzero if
the subsequent chown (or equivalent open,fchown,close) fails.
* tests/misc/mknod: New tests.
* tests/misc/Makefile.am (TESTS): Add mknod.
2005-12-17 Jim Meyering <jim@meyering.net>
* src/remove.c (is_empty_dir): Open with O_NDELAY, so we don't hang,
e.g., on a named pipe.
(OPEN_NO_FOLLOW_SYMLINK): Remove definition. Use O_NOFOLLOW in
place of all uses, since it is guaranteed (system.h) to be defined.
2005-12-05 Andreas Gruenbacher <agruen@suse.de>
Add POSIX ACL support
* src/ls.c: Switch back from HAVE_ACL to USE_ACL: The acl() syscall
is no requirement for ACL support; particularly, it does not exist
on systems that have POSIX ACLs.
* src/copy.h (cp_option_init) [umask_kill]: Remove member.
* src/cp.c (umask_kill): With default acls, the umask is not to be
applied. Remove umask_kill, don't change the process umask, and let
the kernel apply the umask where appropriate.
* src/cp.c (make_dir_parents_private): Fix logic for POSIX ACLs.
* src/copy.c (get_dest_mode): Remove; it is obsolete after removing
umask_kill.
(copy_reg, copy_internal): Use copy_acl and set_acl
instead of fchown/chown. Fix the logic for POSIX ACLs.
(chown_succeded): Remove; we now always copy acls and
preserve S_ISUID, S_ISGID, and S_ISVTX when needed, no matter if we
did a chown before or not.
* src/mv.c, src/install.c (cp_option_init): Don't set umask_kill member.
* src/Makefile.am (dir_LDADD, ls_LDADD, vdir_LDADD, cp_LDADD,
mv_LDADD, ginstall_LDADD): On systems with an ACL library, arrange
to link with it via $(LIB_ACL), for the utilities that need it.
2005-12-16 Paul Eggert <eggert@cs.ucla.edu>
* src/remove.c (OPENAT_CWD_RESTORE__REQUIRE): Remove.
(OPENAT_CWD_RESTORE__ALLOW_FAILURE): Likewise.
(fd_to_subdirp): Remove openat_cwd_restore_allow_failure arg; its
value is now signified by whether cwd_errno is null.
(fd_to_subdirp, remove_dir, rm_1); Change cwd failure indicator from
pointer-to-bool to pointer-to-errno-value. All callers changed.
(rm_1): Don't bother setting a local cwd failure flag and then
ORing it into the caller's. Just set the caller's.
(rm): Use cwd failure errno value to print a slightly-better
diagnostic.
2005-12-15 Jim Meyering <jim@meyering.net>
* src/stat.c (print_it): Properly handle a backslash at the
end of a --printf format string. Reported by Paul Eggert.
* tests/misc/stat-printf (end-bs): Add a test for the above.
2005-12-15 Paul Eggert <eggert@cs.ucla.edu>
* tests/acl: Port to pre-POSIX shells like Solaris 8 /bin/sh.
Don't assume /etc/passwd contains user names; use 'id' instead.
2005-12-15 Jim Meyering <jim@meyering.net>
stat: revert behavior of --format=FMT (-c)
stat: add new option: --printf=FMT
* NEWS: Mention this.
* src/stat.c (isodigit, octtobin, hextobin): Define.
(PRINTF_OPTION): Define.
(interpret_backslash_escapes, trailing_delim): New globals.
(usage): Document them. Alphabetize on long option names.
(print_esc_char): New function.
(print_it): Rewrite, in order to handle backslash escapes.
(main): Handle new option. Set globals for --format, too.
* tests/misc/stat-printf: Test --printf and --format.
* tests/misc/Makefile.am (TESTS): Add stat-printf.
2005-12-14 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: sort now reports incompatible options.
* src/sort.c (incompatible_options, check_ordering_compatibility):
New functions.
(main): Use them. Don't bother with a usage message for
"sort -c a b", for consistency with other error diagnostics.
* tests/sort/Test.pm (incompat1, incompat2, incompat3, incompat4):
New tests.
* src/cat.c (main): Undo previous change. close_stdout already
does the check, so the previous change wasn't necessary.
2005-12-13 Paul Eggert <eggert@cs.ucla.edu>
* src/cat.c (main): Check for close (STDOUT_FILENO) failure.
2005-12-12 Paul Eggert <eggert@cs.ucla.edu>
Install a more-conservative approach for sort -R. It's the
same basic idea as the existing code, except it uses the full ISAAC
approach (called the "more kosher" approach in the existing comments).
This makes "sort -R" quite a bit slower (about a factor of 2 on my
little tests involving 10000 lines on a 2.4 GHz P4), but I think it's
better to be conservative here at first, and review any performance
improvements carefully.
* .x-sc_require_config_h: Add src/rand-isaac.c.
* src/rand-isaac.h: Remove. All uses now simply include rand-isaac.c.
* src/Makefile.am (noinst_HEADERS): Remove rand-isaac.h.
(shred_SOURCES, sort_SOURCES): Remove.
(EXTRA_DIST): Add rand-isaac.c.
* src/rand-isaac.c: Revert to what used to be in shred.c, without
changing it to allow for varying numbers of words in the state.
Alter so that we include rand-isaac.c directly rather than
compiling it and linking to it. Don't include config.h or
system.h; that's the includer's responsibility.
Omit functions that are specific to shred.
(ISAAC_LOG, ISAAC_WORDS, ISAAC_BYTES, struct isaac_state, ind):
(isaac_step, struct irand_state):
Resurrect these, with the same defns that used to be in shred.c.
(ISAAC_SIZE, isaac_new, isaac_copy): Remove.
(isaac_refill, isaac_seed_start, isaac_seed_data, irand_init, irand32):
static again.
(struct isaac_state, isaac_refill, isaac_mix, isaac_init):
(isaac_seed_start, isaac_seed_data, isaac_seed_finish, isaac_seed):
(irand_init, irand32, irand_mod):
Number of words is constant again.
(struct irand_state, irand_init, irand32, irand_mod): Move to shred.c.
* src/shred.c: Include rand-isaac.c rather than rand-isaac.h.
* src/sort.c: Likewise.
* src/shred.c (fillrand, dopass, main): Undo previous change.
(struct irand_state, irand_init, irand32, irand_mod): Moved back here,
from rand-isaac.c.
* src/sort.c: Don't include md5.h; it wasn't needed.
(struct keyfield): Rename random_hash to random, for consistency
with the other member names. All uses changed.
(usage): Tweak wording to mention STRING for --seed option.
(short_options): Rorder for consistency with other programs.
(rand_state): Now a struct, not a pointer to one. All uses changed.
(HASH_WORDS, HASH_SIZE): Remove.
(get_hash): Remove comments around resbuf size, since we can assume C89.
Use a "more-kosher" (but slower) approach of invoking isaac_refill.
(keycompare): Adjust to the new get_hash.
Add a FIXME.
(badfieldspec): Omit recently-introduced comment; it isn't needed.
(main): Don't set need_random simply because gkey has it set; that
doesn't necessarily mean we'll need random numbers.
Redo seeding to match new get_hash approach.
2005-12-10 Jim Meyering <jim@meyering.net>
* src/Makefile.am (noinst_HEADERS): Add rand-isaac.h.
Avoid shred segfault on 64-bit systems.
* src/rand-isaac.c (isaac_refill): Don't try to negate a
local of type uint32_t. Make the local an `int' instead.
* NEWS: Mention sort's new options.
* src/rand-isaac.c (isaac_mix): Declare to be static.
Mark all other functions as `extern' so the tight-scope
part of `make distcheck' passes once again.
* src/rand-isaac.h (isaac_mix): Remove declaration.
* src/sort.c (get_hash): Change position of `*' in parameter
type to conform with convention.
(main): Split a long line so it fits in 80 columns.
(keycompare): Remove stray SPACE before TAB that was
causing `make distcheck' to fail.
* src/shred.c: Don't include gethrxtime.h. No longer needed.
* tests/misc/sort-rand: New file: basic tests for the new options.
* tests/misc/Makefile.am (TESTS): Add sort-rand.
2005-12-10 Frederik Eaton <frederik@ofb.net>
* src/Makefile.am (sort_LDADD): Add $(LIB_GETHRXTIME).
(shred_SOURCES, sort_SOURCES): New macros, so we compile rand-isaac.c.
* src/rand-isaac.c: New file, containing ISAAC code that was in shred.c.
Make state size runtime-configurable.
(isaac_new, isaac_copy): New functions.
* src/rand-isaac.h: New file.
* src/shred.c: Include rand-isaac.h. Move ISAAC code to rand-isaac.c.
(fillrand, main): Adjust to the fact that the state size is now
runtime-configurable.
* src/sort.c (short_options, long_options, WORDS, keycompare, main):
(usage): Add options --random-sort and --seed to implement a random
shuffle.
Include md5.h and rand-isaac.h.
(get_hash): New function.
(rand_state): New var.
(HASH_WORDS, HASH_SIZE): New macros.
2005-12-09 Paul Eggert <eggert@cs.ucla.edu>
* tests/dd/misc: Add test for dd iflags=noatime.
2005-12-09 Jim Meyering <jim@meyering.net>
* src/sort.c (usage): Mention white space vs -b and -t options.
From The Wanderer.
2005-12-09 Eric Blake <ebb9@byu.net>
* src/test.c (main): Fix misleading comment.
2005-12-07 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Mention dd's new noatime flag.
* src/system.h (O_NOATIME): Define to 0 if not already defined.
* src/dd.c (flags, usage): Add support for noatime flag.
2005-12-07 Jim Meyering <jim@meyering.net>
Distribute the cvsu script, used only by `make syntax-check'.
* Makefile.am (EXTRA_DIST): Add build-aux/cvsu.
* Makefile.maint (CVS_LIST): Use build-aux/cvsu, now that we
distribute a copy of this script.
* .x-sc_unmarked_diagnostics: Add build-aux/cvsu.
* tests/mv/acl: exit-77 before the trap, not after, if we fail
to create a temporary directory on another partition.
From Andreas Gruenbacher.
2005-12-06 Tomas Pospisek <tpo@sourcepole.ch> (tiny change)
* man/basename.x: Cross-reference to dirname and readlink.
* man/dirname.x: Cross-reference to basename and readlink.
2005-12-05 Andreas Gruenbacher
* src/copy.c [!HAVE_FCHOWN]: Define fchown(...) to -1.
(set_owner, preserve_author): New functions, factored out of copy_reg.
(copy_reg): Use them.
(copy_internal): Use them here, too.
2005-12-04 Jim Meyering <jim@meyering.net>
* src/sleep.c (usage): Say what happens with two or more arguments.
Suggested by Justin Pryzby.
* src/uptime.c (print_uptime): Move decl of `upsecs' into scope
where it's used.
2005-12-03 Jim Meyering <jim@meyering.net>
* src/rm.c (long_opts): Change the name of each undocumented, for-
testing-only option to start with `-', so that it cannot render
ambiguous any prefix it happens to share with some other option name.
Problem reported by Eric Blake.
* src/head.c (long_options): Likewise.
* src/tail.c (long_options): Likewise.
* tests/misc/head-elide-tail: Update uses of undocumented, for-
testing-only --presume* options to start with `---'.
* tests/rm/dangling-symlink: Likewise.
* tests/rm/dir-no-w: Likewise.
* tests/rm/isatty: Likewise.
2005-11-30 Jim Meyering <jim@meyering.net>
* Makefile.maint: Add a comment about cvsu.
2005-11-25 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: df updates for "none", "proc", inaccessible file systems.
* src/df.c (show_point): Ignore inaccessible file systems.
(usage): -a includes dummy file systems, not size-0 file systems.
* src/od.c (unsigned_long_long_int): Renamed from ulonglong_t,
to avoid collision with POSIX name space. All uses changed.
2005-11-24 Jim Meyering <jim@meyering.net>
* tests/Makefile.am (EXTRA_DIST): Add acl to the list.
* tests/acl: Add `$0: ' prefix to diagnostics.
* .x-sc_require_config_h: Add lib/buffer-lcm.c to the list.
2005-11-23 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.c: Improve performance a bit by optimizing away
unnecessary system calls and going to a block size of at least
8192 (on normal hosts, anyway). This improved performance 5% on my
Debian stable host (2.4.27 kernel, x86, copying from root
ext3 file system to itself).
Include "buffer-lcm.h".
(copy_reg): Omit last argument. All callers changed.
Use xmalloc to allocate rather than trusting alloca
(which is unwise with large block sizes).
Declare locals more locally, if possible.
Use uintptr_t words instead of int words, for a bit more speed
when looking for null blocks on 64-bit hosts.
Optimize away reads of zero bytes on regular files.
In the typical case, insist on 8 KiB buffers, at least.
Avoid unnecessary extra call to fstat when checking for sparse files.
Avoid now-unnecessary cast to off_t, and "0L".
Avoid unnecessary test of *new_dst when checking for same owner
and group.
2005-11-22 Paul Eggert <eggert@cs.ucla.edu>
* src/remove.c (rm): Don't assume C99 for-loop syntax.
2005-11-22 Jim Meyering <jim@meyering.net>
* src/remove.c (AD_push): Remove debugging cruft.
* tests/rm/unread2 (rm): Change expected diagnostic,
`cannot open directory' to `cannot remove', to align with
new version of rm.
* tests/rm/rm2: Ensure that rm now continues removing entries
even after certain types of failure.
* src/remove.c: Rewrite. Now, this module is reentrant on systems
that provide openat (Solaris), and on systems like Linux+procfs
where our openat emulation code is reentrant. This also fixes a
few low-probability leaks and eliminates some code that could,
in very unusual circumstances, cause rm() (via a callee) to exit.
* NEWS: Mention this.
* configure.ac: Put copyright dates all on one line so the
emacs function that updates them works properly.
2005-11-18 Paul Eggert <eggert@cs.ucla.edu>
* configure.ac (AM_PROG_CC_C_O): Add. Needed for CVS Automake.
Problem reported by Eric Blake.
(AC_PROG_CC_STDC): Use this instead of AC_PROG_CC, so that
we get a standard-conforming compiler. This relies on the new
m4/c.m4 file. Note that it's a bit tricky, since c.m4 doesn't
define AC_PROG_CC_STDC; we are relying on Autoconf 2.59 internals.
m4/c.m4 can go away with Autoconf 2.60 comes out.
2005-11-17 Jim Meyering <jim@meyering.net>
* src/remove.c (AD_mark_helper): Make a `char *' parameter `const'.
(AD_mark_current_as_unremovable): Likewise, but for a local.
(rm_1): Likewise.
* tests/mv/acl: Let traps handle removing temporary directories.
Expect acl-related tests to fail, until the corresponding
patches are committed.
* tests/mv/Makefile.am (XFAIL_TESTS): Add acl.
* tests/cp/Makefile.am (XFAIL_TESTS): Likewise.
ACL tests, from Andreas Gruenbacher.
* tests/acl, tests/mv/acl, tests/cp/acl: New files.
* tests/mv/Makefile.am (TESTS): Add acl.
* tests/cp/Makefile.am (TESTS): Add acl.
* src/ls.c (basename_is_dot_or_dotdot): Correct wording in comment.
2005-11-16 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Improve quality of ln's diagnostics.
* src/ln.c (do_link, usage): Likewise.
(do_link): Don't use alloca on a buffer of unbounded size.
2005-11-16 Jim Meyering <jim@meyering.net>
* tests/cp/fail-perm: Accommodate HPUX. It appears to fail
with EACCES rather than EPERM. Reported by Peter O'Gorman here:
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/5766
This also affects AIX 4.3.3, according to Ralf Wildenhues, in
http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00192.html
2005-11-14 Jim Meyering <jim@meyering.net>
* NEWS (sort): Mention consequences of today's mkstemp-safer.c fix.
2005-11-13 Jim Meyering <jim@meyering.net>
* announce-gen: Accept new option, --gpg-key-id=ID and
emit a blurb telling how to use the .sig files.
* Makefile.cfg (gpg_key_ID): Define.
* Makefile.maint (announcement): Use new option and key.
Require that most .c files include <config.h>.
* Makefile.maint (sc_require_config_h): New rule.
(syntax-check-rules): Add it.
* .x-sc_require_config_h: New file listing exceptions to the
above rule. Some are legit, others are simply grandfathered in.
* Makefile.am (EXTRA_DIST): Add .x-sc_require_config_h here, too.
2005-11-12 Jim Meyering <jim@meyering.net>
* src/checksum.h, src/md5.c, src/sha1sum.c: Remove now-unused files.
2005-11-11 Jim Meyering <jim@meyering.net>
* NEWS: Mention `readlink -f' bug fix in 5.3.0 news.
Mention new readlink options in 5.3.0's `New features' section.
Spotted by Thomas Hood.
2005-11-08 Jim Meyering <jim@meyering.net>
* NEWS: Merge in changes from b5_9x branch.
2005-11-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: ls now defaults to --time-style='locale', which in turn acts
like --time-style='posix-long-iso' if the locale settings are messed up.
* src/ls.c (decode_switches): Implement this.
2005-11-08 Jim Meyering <jim@meyering.net>
* tests/du/2g: s/expensive/very expensive/ in a comment.
From Paul Townsend.
2005-10-17 Eric Blake <ebb9@byu.net>
* src/ls.c (usage): Fix descriptions of --sort, --time.
Reported by Vitaly A. Ostanin.
2005-11-04 Paul Eggert <eggert@cs.ucla.edu>
* src/ln.c: Include filenamecat.c.
(FILE_BASENAME_CONCAT): Remove.
(do_link): Remove last arg DEST_IS_DIR. All callers changed.
(main): Use file_name_concat, base_name, and strip_trailing_slashes
instead of FILE_BASENAME_CONCAT. This simplifies the code, and avoids
the use of alloca.
2005-11-04 Jim Meyering <jim@meyering.net>
* src/du.c (process_file): Don't overflow for files of size >= 2^31
on systems with stat.st_blocks of a signed 32-bit type.
This bug causes trouble on some AIX 5.1 systems.
Report and trivial patch from Paul Townsend:
<http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00033.html>
* NEWS: Mention this.
* tests/du/2g: New (very-expensive) test for the above-fixed bug.
* tests/du/Makefile.am (TESTS): Add it here.
* tests/very-expensive: New file.
* tests/Makefile.am (EXTRA_DIST): Add it here.
* tests/cp/perm: Mark this test as `very-expensive', too.
2005-11-02 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Mention that rm -d and maybe ln -d are scheduled for
removal in 2006.
* src/remove.h (struct rm_options): Remove unlink_dirs. All uses
removed.
* src/rm.c (usage): Don't mention rm -d.
2005-11-02 Jim Meyering <jim@meyering.net>
* tests/dd/skip-seek: Fix typo in comment: s/fileutils/coreutils.
From Andreas Schwab.
* tests/dd/unblock-sync: Redirect stderr to /dev/null so the
`M+N records in/out' lines don't pollute `make check' output.
* tests/dd/skip-seek (sk-seek4): New test, to exercise the bug
fixed on 2005-10-31. This test uses the new, IN_PIPE specifier.
* tests/Coreutils.pm: Accept a new type of input specifier: IN_PIPE,
to indicate that the input file should be piped into the command
under test (via `cat FILE | $prog ...').
* src/remove.c (remove_entry): Emit a better diagnostic when rm
(without -r) fails to remove a directory on a non-Linux system.
This change affects only newer Solaris systems (with priv_*
functions like priv_allocset). Reported by Keith Thompson.
* tests/rm/dir-nonrecur: New file/test for the above fix.
* tests/rm/Makefile.am (TESTS): Add dir-nonrecur.
2005-11-01 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "tail -c 2 FILE" and "touch 0101000000" now operate as
POSIX 1002.1-2001 requires.
* src/tail.c (parse_obsolete_option): Implement this.
Problem reported by Vincent Lefevre.
* src/touch.c (main): Pass PDS_PRE_2000 to posixtime.
* tests/tail/Test.pm (c-2, c-2-minus, c2, c2-minus): New tests.
(test_vector): Add special cases for _POSIX2_VERSION, and
regularize the old ones a bit.
* tests/touch/obsolescent: Add y2000 test.
2005-10-31 Paul Eggert <eggert@cs.ucla.edu>
* src/dd.c (skip): Fix off-by-one error reported by
Theodoros V. Kalamatianos.
2005-10-30 Paul Eggert <eggert@cs.ucla.edu>
* tests/mkdir/p-3: Require that the test be run as non-root.
Problem and trivial fix reported by Theodoros V. Kalamatianos.
2005-10-28 Paul Eggert <eggert@cs.ucla.edu>
* src/ln.c (FILE_BASENAME_CONCAT): Omit unnecessary slashes in the
boundary between DEST and SOURCE in the result.
2005-10-26 Dmitry V. Levin <ldv@altlinux.org>
* src/md5sum.c (main) [!O_BINARY]: Changed default read mode
back to text, to sync with documentation and for backwards
compatibility.
2005-10-25 Jim Meyering <jim@meyering.net>
* tests/dircolors/simple (other-wr): Add an explicit test for
the dircolors bug (NULL-dereference) fixed yesterday.
2005-10-24 Jim Meyering <jim@meyering.net>
* src/tac.c (tac_file): When determining whether a file is seekable,
also test whether it is a tty. Using only the lseek-based test would
give a false positive on Solaris. Reported by Peter Fales.
2005-10-24 Dmitry V. Levin <ldv@altlinux.org>
* tests/install/d-slashdot: New test, for "install -d" failure.
* tests/install/Makefile.am (TESTS): Add d-slashdot.
* tests/mkdir/p-slashdot: New test, for "mkdir -p" failure.
* tests/mkdir/Makefile.am (TESTS): Add p-slashdot.
2005-10-24 Jim Meyering <jim@meyering.net>
* src/dircolors.c (ls_codes): Add missing comma.
Anonymous report and patch from
http://savannah.gnu.org/bugs/?func=detailitem&item_id=14849
* src/dircolors.c: Add compile-time assertion that the slack_codes
and ls_codes arrays have the same number of elements. This would
have prevented the above-fixed bug.
* src/expand.c (parse_tab_stops): Add a comment to make this function
identical to the one in unexpand.c.
* src/unexpand.c (parse_tab_stops): Adjust syntax to make this function
identical to the one in expand.c.
* src/expand.c (next_file): Don't assume fopen cannot return stdin.
2005-10-23 Jim Meyering <jim@meyering.net>
* src/md5sum.c (digest_check, main): Use ptr_align rather than
a dangerous pointer-value-to-`unsigned' cast.
* NEWS: mention the new sha* programs.
* AUTHORS: Add new sha* programs.
2005-08-28 David Madore <david.madore@ens.fr>
Add new programs: sha224sum, sha256sum, sha384sum, sha512sum.
* README: Add their names to the list.
* src/md5sum.c: Provide framework for computing sha-2 hashes.
* src/Makefile.am (sha224sum, sha256sum, sha384sum, sha512sum):
Rules for compiling sha-2 utilities
(noinst_HEADERS): Remove checksum.h.
* man/sha512sum.x, man/sha384sum.x, man/sha256sum.x, man/sha224sum.x:
New files.
* man/Makefile.am (dist_man_MANS): Add the corresponding .1 names.
(sha224sum.1, sha256sum.1, sha384sum.1, sha512sum.1): New dependencies.
* tests/misc/sha224sum, tests/misc/sha256sum: New files.
* tests/misc/sha384sum, tests/misc/sha512sum: New files.
* tests/misc/Makefile.am (TESTS): Add new sha224sum, sha256sum,
sha384sum, sha512sum test scripts here rather that each in its
own directory.
2005-08-28 David Madore <david.madore@ens.fr>
* tests/sha1sum/basic-1 (million-a): Add the "million a's" test (one
of the FIPS test vectors).
2005-10-23 Jim Meyering <jim@meyering.net>
* configure.ac: Use 6.0-cvs as the version string.
* NEWS: Adjust accordingly.
2005-10-22 Jim Meyering <jim@meyering.net>
* Version 5.92.
* configure.ac: Remove -cvs suffix from version string.
* NEWS: Add today's date.
* tests/mkdir/writable-under-readonly: New test, neither run
nor distributed via tarballs.
2005-10-20 Jim Meyering <jim@meyering.net>
* tests/chmod/octal: New file/test, to exercise today's
lib/modechange.c fix.
* tests/chmod/Makefile.am (TESTS): Add octal.
* NEWS: Mention this chmod fix as well as the dircolors one.
2005-10-18 Paul Eggert <eggert@cs.ucla.edu>
* src/dircolors.c (append_quoted): Quote ' correctly.
Problem reported by Eric Blake.
2005-10-19 Jim Meyering <jim@meyering.net>
* tests/dircolors/simple (quote): Add test for the above fix.
2005-10-18 Jim Meyering <jim@meyering.net>
* tests/chgrp/basic: Add a comment explaining (probably) why this
test fails on OpenBSD 3.2 when run in an NFS-mounted directory.
2005-10-17 Jim Meyering <jim@meyering.net>
* configure.ac: Use 5.92-cvs as the version string.
* NEWS: Adjust accordingly.
* Makefile.maint (my-distcheck): Depend on
$(release_archive_dir)/$(prev-tgz) here, so that if it's missing
we fail earlier.
2005-10-16 Jim Meyering <jim@meyering.net>
* Version 5.91.
* Makefile.maint (VERSION_REGEXP): New variable.
(news-date-check, changelog-check): Use tighter regular expressions.
* configure.ac: Remove -cvs suffix from version string.
* NEWS: Add today's date.
* NEWS: Mention the `mkdir -p' bug fix.
2005-10-15 Jim Meyering <jim@meyering.net>
* src/who.c (usage): Undocument deprecated --idle (-i) option.
* src/df.c (main): Warn about the deprecated --kilobytes option.
* src/ls.c (decode_switches): Likewise.
* src/du.c (usage): Document -m, once again.
(main): Warn about use of deprecated long options:
--kilobytes and --megabytes.
* src/tail.c (parse_options): Remove --allow-missing option.
You can use --retry instead.
* src/stat.c (main): Remove --link -l options.
You can use --dereference (-L) instead.
2005-09-30 Eric Blake <ebb9@byu.net> (tiny change)
* man/Makefile.am (.x.1): Remove temp directory first.
* NEWS: Document dircolors change of 2005-09-05.
2005-10-07 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (sortlines_temp): Redo previous change, since I'm
no longer confident that the m4/stdbool.m4 patch suffices.
2005-10-06 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (sortlines_temp): Undo previous change, since
today's change to m4/stdbool.m4 should catch it.
2005-10-06 Jim Meyering <jim@meyering.net>
* TODO: rm: add support for a -I option, like that from FreeBSD's.
2005-10-05 Jim Meyering <jim@meyering.net>
* src/sort.c (sortlines_temp): Declare temporary as `int' rather
than `bool' to work around AIX 5.3 compiler bug in 64-bit mode.
From James Lemley.
2005-10-03 Jim Meyering <jim@meyering.net>
* src/factor.c (MAX_N_FACTORS): Define in terms of sizeof (uintmax_t)
rather than hard-coding to 128. From Thomas M.Ott.
2005-10-02 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_unmarked_diagnostics):
Search only cvs-controlled files.
* .x-sc_unmarked_diagnostics: New file.
* Makefile.am (EXTRA_DIST): Add it.
2005-10-01 Jim Meyering <jim@meyering.net>
* src/factor.c (main): Don't stop processing arguments upon
the first invalid one. Suggestion from Eric Blake
* tests/factor/basic: Add a test for this.
2005-09-30 Jim Meyering <jim@meyering.net>
* configure.ac: Use 5.91-cvs as the version string.
* NEWS: Adjust accordingly.
2005-09-29 Paul Eggert <eggert@cs.ucla.edu>
* src/dd.c (main): Don't assume size_t has the same width
as unsigned long. Problem reported by Eric Blake.
* NEWS: Clarify "tail - f" example.
2005-09-29 Jim Meyering <jim@meyering.net>
* Version 5.90.
* configure.ac: Remove -cvs suffix from version string.
* NEWS: Add today's date.
* NEWS: Mention this bug fix:
stat now exits nonzero if a file operand does not exist
2005-09-28 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (LONGEST_MODIFIER): Use ULONG_MAX_LT_ULLONG_MAX
instead of ULLONG_MAX, as the latter doesn't work with GCC 2.7.2.1.
2005-09-28 Jim Meyering <jim@meyering.net>
* configure.ac: Use 5.90-cvs as the version string, not 5.3.1-cvs.
* NEWS: Adjust accordingly.
* README: Remove note about FreeBSD make test failure.
2005-09-28 Paul Eggert <eggert@cs.ucla.edu>
* tests/install/trap: Work around a bug in FreeBSD 5.0.
2005-09-28 Jim Meyering <jim@meyering.net>
* README: Warn about a (now-)known problem on FreeBSD 5.0:
2005-09-26 Paul Eggert <eggert@cs.ucla.edu>
* src/touch.c (touch): Handle "touch -c - >&-" by checking for EBADF
and ENOSYS.
Do not pass "-" to futimens; pass NULL instead.
If close (STDIN_FILENO) fails, report the error separately instead
of letting the 'close' pollute errno.
* tests/touch/empty-file: Test "touch -" too.
* tests/touch/no-create-missing: Likewise.
* tests/touch/read-only: Likewise.
2005-09-26 Jim Meyering <jim@meyering.net>
* tests/touch/read-only: New test, for root of chmod/usage failure.
* tests/touch/Makefile.am (TESTS): Add read-only.
Work around the root cause of alpha-linux-1.sf.net test failure.
* tests/chmod/usage: Remove *all* files before each inner loop
iteration. Otherwise, with a touch program that fails on unwritable
files, (this happens at least on linux-2.2.20) a -w file left behind
from a previous iteration could cause a spurious test failure.
2005-09-25 Paul Eggert <eggert@cs.ucla.edu>
* tests/chmod/usage: Undo the s/files/file/ change, but add
comments about why the old version was desired.
2005-09-25 Jim Meyering <jim@meyering.net>
* tests/ls-2/tests (setuid-etc): Work around output mismatch when
a just-created test file cannot be made set-group-ID.
Avoid test failures on alpha-linux-1.sf.net.
* tests/chmod/usage: Use newer trap and tmpdir-creation framework.
Fix apparent typos (s/files/file/) in inner loop.
2005-09-24 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "touch -" now touches standard output.
* src/touch.c (touch): Implement this.
(usage): Document this.
* src/copy.c (HAVE_FCHMOD, HAVE_FCHOWN): Define to 0 if not defined.
(copy_reg): New args CHOWN_SUCCEDED and DST_SB. All callers changed.
Add a "goto close_src_and_dst_desc;" that was missing in the
previous patch.
(copy_reg) [HAVE_FCHOWN]: Prefer fchown to chown.
(copy_reg) [HAVE_FCHMOD]: Prefer fchmod to chmod.
(copy_internal): Don't invoke chown if fchown worked,
and likewise for chmod and fchmod.
2005-09-24 Jim Meyering <jim@meyering.net>
* src/shred.c: Use `#ifdef HAVE_CONFIG_H', not `#if HAVE_CONFIG_H',
for consistency with gnulib.
* src/dircolors.c: Likewise.
* Makefile.maint (sc_no_if_have_config_h): New rule.
(syntax-check-rules): Add it.
.x-sc_no_if_have_config_h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* tests/seq/basic (eq-wid-1, eq-wid-2): Disable these tests for now.
They fail with non-gcc compilers and some combinations
of options and libraries on Solaris systems.
* tests/misc/date (uninit-64): Restore this test.
Add start-up code to detect, and work around, the cases in
which the test might fail.
2005-09-24 Paul Eggert <eggert@cs.ucla.edu>
* tests/misc/date (uninit-64): Remove this test. It wasn't
portable in theory (it doesn't work on hosts where 'int' is 64
bits, example) or in practice (Solaris 8 localtime returns garbage
in tm_year for the specified date, but that's not coreutils's
fault).
2005-09-23 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.c (copy_reg): Preserve time stamps if
x->preserve_timestamps is set, using futimens so that
we needn't resolve the path again.
(copy_internal): Don't preserve time stamps if copy_reg did it
already.
* src/install.c (change_timestamps): First arg is source
struct stat, not file name. All uses changed.
(install_file_in_file): Stat the source file.
Don't try to change time stamps if copy_file did it.
* src/system.h: Don't include utime.h; not needed.
(struct utimbuf) [!defined HAVE_STRUCT_UTIMBUF]: Remove; not needed.
2005-09-23 Jim Meyering <jim@meyering.net>
* src/od.c: Use `verify' to ensure that our hard-coded
bytes_to_*_digits arrays are long enough. Of course, 17+-byte
integral types aren't on the near horizon, but just in case...
(MAX_INTEGRAL_TYPE_SIZE): Move definition to precede new first use.
(bytes_to_oct_digits, bytes_to_signed_dec_digits):
(bytes_to_unsigned_dec_digits, bytes_to_hex_digits): Change base
type from `char' to the clearer `unsigned int'.
2005-09-21 Paul Eggert <eggert@cs.ucla.edu>
* src/rmdir.c (EEXIST, ENOTEMPTY): Remove unused macros.
Sync from gnulib.
* src/dircolors.c: Include strcase.h.
* src/pinky.c: Include canon-host.h rather than declaring
canon_host ourselves.
* src/who.c: Likewise.
* src/system.h (X2NREALLOC, X2REALLOC): Moved here from
../lib/xalloc.h, with args properly parenthesized, and using
verify_expr rather than the old VERIFY_EXPR.
2005-09-21 Jim Meyering <jim@meyering.net>
* tests/install/basic-1: Require that this test be run as non-root.
Otherwise, it fails due to the fact that the chmod 0 . doesn't
affect root.
2005-09-20 Jim Meyering <jim@meyering.net>
* src/remove.c (write_protected_non_symlink): Change comment to
agree with the code.
2005-09-19 Jim Meyering <jim@meyering.net>
* src/remove.c (remove_dir): Return RM_ERROR, not `1',
when attempting to remove `/' with --preserve-root.
* src/remove.c (remove_cwd_entries): Syntactic tweak: move an
assignment out of an if-expression.
2005-09-17 Jim Meyering <jim@meyering.net>
* src/extract-magic (usage): Request that additions be sent to
bug-coreutils@gnu.org, too.
2005-09-16 Jim Meyering <jim@meyering.net>
* tests/misc/date (rfc822-1): Compensate for Solaris 5.9's /bin/sh,
which emits a diagnostic to stderr when this test's LC_ALL=de_DE
setting cannot be honored.
* tests/misc/date (subfmt-up1): Put quotes around format string
to protect `^' from interpretation by some shells.
Add a use of OUT_SUBST to compensate for Solaris strftime's slightly
different formatting of %c.
* src/dd.c (main): When failing to truncate, mention both the seek
block count and the block size, in case the block size is very large.
Now `make distcheck' should pass, once again.
2005-09-16 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.c: Include stat-time.h.
(copy_internal): Use its functions instead of the obsolete
TIMESPEC_NS macro.
* src/cp.c (re_protect): Likewise.
* src/date.c (main): Likewise.
* src/du.c (struct duinfo, duinfo_init, duinfo_set, duinfo_add):
(show_date, print_size, process_file): Likewise.
* src/install.c (change_timestamps): Likewise.
* src/ls.c (cmp_ctime, cmp_mtime, cmp_atime, print_long_format):
Likewise.
* src/pr.c (init_header): Likewise.
* src/stat.c (human_time, print_stat): Likewise.
* src/tail.c (record_open_fd, tail_forever): Likewise.
* src/test.c (get_mtime, binary_operator): Likewise.
* src/touch.c (touch, main): Likewise.
* src/test.c (get_mtime): Renamed from age_of. All uses changed.
2005-09-16 Jim Meyering <jim@meyering.net>
Date no longer needs to allocate virtual memory to do its job,
so it can no longer fail due to an out-of-memory condition.
* src/date.c: Include fprintftime.h.
Don't include strftime.h or xanstrftime.h -- no longer needed.
(show_date): Use new fprintftime function rather than xanstrftime.
Correct comment: this function no longer handles a NULL format string.
* src/du.c: Likewise.
* NEWS: Mention this.
* tests/misc/date (subfmt-up1): Test the combination of the
to-upper-case modifier (^) and a conversion specifier that
expands to a string containing lower case characters.
2005-09-15 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: uname -a no longer generates the -p and -i outputs if they
are unknown.
* src/uname.c (usage): Document this.
(main): Implement this.
2005-09-14 Jim Meyering <jim@meyering.net>
* tests/misc/date (tz-5w, tz-5wf): Test new %:z format with
a field width.
2005-09-13 Paul Eggert <eggert@cs.ucla.edu>
* src/dd.c: Detect some very unlikely buffer overflows.
(INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP): New macros.
(MAX_BLOCKSIZE): Now accepts an arg. All uses changed.
(page_size): New var.
(scanargs, skip, main): Use more-straightforward way to detect overflow.
(dd_copy): Use page_size rather than invoking getpagesize.
Use INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP.
(main): Set page_size.
Avoid a call to stat in the usual case where ftruncate succeeds.
* src/expr.c (docolon): Add IF_LINT check to avoid GCC warning.
* configure.ac: Don't invoke AC_CONFIGURE_HOST directly; AB_INIT
does it for us, and our invocation evokes a diagnostic from
Autoconf 2.59.
* NEWS: date has a new --rfc-3339 option, and the old --iso-8601
option is deprecated. date, du, ls, and pr also have new time format
specifiers %:z, %::z, %:::z.
* src/date.c (TIME_SPEC_DATE): No longer needs to be nonzero, so
remove the "=1".
(TIME_SPEC_HOURS, TIME_SPEC_MINUTES): Must be at end now, so put
them there.
(time_spec_string, time_spec): Hours and minutes must be at
start now, so put them there.
(rfc_2822_format): Now a string constant, not a boolean. All uses
changed.
(iso_8601_format, rfc_format): Remove.
(RFC_3339_OPTION): New constant.
(long_options): Add --rfc-3339.
(usage): Add --rfc-3339. Don't mention --iso-8601.
Mention %:z, %::z, %:::z.
(main): Simplify calculation of 'format'; it was getting too hairy
to follow. Add --rfc-3339.
(show_date): Assume format arg is not NULL, which is the case
now. The default code is moved to 'main'. This simplifies things
and allows the default to be calculated just once.
* tests/misc/date: Add tests for --rfc-3339, %:z, %::z, %:::z.
2005-09-13 Jim Meyering <jim@meyering.net>
* Makefile.maint (GZIP_ENV): Add --rsyncable option.
(makefile-check): Escape a `$' in a diagnostic.
* configure.ac: Use AB_INIT (from autobuild).
2005-09-11 Jim Meyering <jim@meyering.net>
* src/factor.c (usage): Remove leading spaces in 2-line
description, so that help2man doesn't mangle it.
Reported by Justin Pryzby.
2005-09-10 Jim Meyering <jim@meyering.net>
csplit could produce corrupt output, given input lines longer than 8KB
* src/csplit.c (load_buffer): Don't read from free'd memory
when handling lines longer than the initial buffer length.
(save_to_hold_area): Don't leak the previous hold_area buffer.
Reported by Tristan Miller and Luke Kendall.
* NEWS: Mention this.
* tests/misc/csplit: New test for this.
* src/csplit.c (load_buffer): Avoid integer overflow in buffer
size calculations for very long lines.
2005-09-09 Paul Eggert <eggert@cs.ucla.edu>
Support regular expressions in 64-bit code correctly, by
importing the latest gnulib regexp code, and not assuming
that sizes fit in 32 bits.
* src/csplit.c (process_regexp): Store match length in regoff_t,
not int. Assume that negative return values less than -2
represent regoff_t overflow.
* src/expr.c (docolon): Likewise.
* src/nl.c (proc_text): Likewise.
* src/ptx.c (SKIP_SOMETHING, find_occurs_in_text): Likewise.
* src/tac.c (tac_seekable): Likewise.
* src/expr.c (docolon) Check for size calculation overflow.
* src/nl.c (build_type_arg): Likewise.
* src/ptx.c (matcher_error): New function.
(SKIP_SOMETHING): Use it to report matcher errors.
(alloc_and_compile_regex): No longer any need to worry about
int versus size_t mismatch.
* NEWS: Document "niceness" vs "nice value".
* configure.ac (utils_cv_func_setpriority): Simplify the tests.
Define HAVE_NICE rather than NICE_PRIORITY (since a niceness is
not a priority); all uses changed.
* src/nice.c (main): Hoist errno=0 outside the ifdef.
2005-09-09 Jim Meyering <jim@meyering.net>
* tests/misc/date (neg-secs2, fill-1, fill-2): Add new tests.
2005-09-07 Paul Eggert <eggert@cs.ucla.edu>
Use the phrase "niceness" instead of "nice value" to describe
the biased nice value that can go negative. This corrects
a discrepancy with POSIX, which states that nice values are
nonnegative.
* src/nice.c (GET_NICENESS): Renamed from GET_NICE_VALUE.
All uses changed.
(usage): Say "niceness" rather than "nice value".
(main): Say "niceness" rather than "priority" (which is something else
entirely nowadays).
2005-09-07 Jim Meyering <jim@meyering.net>
* src/du.c (time_args): Use NULL in place of 0.
2005-09-05 Jim Meyering <jim@meyering.net>
* src/dcgen: Don't omit comments until there is better documentation.
Colorize set-user-ID and set-group-ID files and sticky,
other-writable, and sticky-and-other-writable directories.
* src/dircolors.c (slack_codes): Add new dircolors mode names.
(ls_codes): Add corresponding two-letter ls mode strings.
* src/ls.c (indicator_no[]): Add new symbols.
(indicator_name[]): Add corresponding mode strings.
(color_indicator[]): Add an entry for each new mode string.
(print_color_indicator): Honor new types.
* src/dircolors.hin: Document the default colors for the new strings.
From Mike Frysinger, based on a patch from Fedora.
* tests/ls-2/tests (setuid-etc): New test, for the above.
2005-08-29 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "rm -FOO" now suggests "rm ./-FOO" if the file "-FOO"
exists and "-FOO" is not a valid option.
* src/rm.c: Include lstat.h, quotearg.h.
(diagnose_leading_hyphen): New function.
(main): Use it.
2005-08-27 Jim Meyering <jim@meyering.net>
* src/du.c: Go ahead and leave the patch in (i.e., revert
today's change). It doesn't cause a problem after all, since
--exclude-from=- is always handled before --files0-from=F.
* src/du.c: Revert the du.c part of the change from 2005-07-02:
That change (to reopen stdin on F for --files0-from=F) made it so
--exclude-from=- and --files0-from=F would not work together.
2005-08-23 Jim Meyering <jim@meyering.net>
* configure.ac: Use `5.3.1-cvs' as the version string.
* NEWS: Adjust accordingly.
* Makefile.maint (sc_useless_cpp_parens): New rule.
(syntax-check-rules): Add it.
* .x-sc_useless_cpp_parens: New file.
* Makefile.am (EXTRA_DIST): Add it.
* src/od.c: Include <float.h> unconditionally.
* src/uptime.c (print_uptime): Remove unnecessary parens in
`#if defined (SYMBOL)' expressions.
* src/system.h: Likewise.
* src/hostname.c: Likewise.
* src/su.c: Likewise.
* src/test.c: Likewise.
2005-08-22 Jim Meyering <jim@meyering.net>
* src/tail.c (xwrite_stdout): Rename from xwrite. Remove always-
equal-to-STDOUT_FILENO parameter and associated assertion.
Adjust all callers.
2005-08-21 Jim Meyering <jim@meyering.net>
* src/ln.c (do_link): If ln is invoked with --interactive (-i),
encounters an existing destination file, and gets an affirmative
response, then first try to unlink the destination file rather
than simply failing. Suggestion from Karl Berry.
FIXME: add test for this
* src/ln.c (main): Declare `target_directory' with const attribute.
* src/du.c (time_style): Add `const' attribute.
(tot_dui): Remove unnecessary (and too-short) initializer list.
2005-08-19 Jim Meyering <jim@meyering.net>
* src/sort.c (usage) [-b,-t]: Ensure that there are at least two
spaces between each option and the corresponding description -- this
lets help2man format entries properly. Reported by Edward Welbourne.
2005-08-17 Jim Meyering <jim@meyering.net>
* src/sort.c (usage): Fix typo s/POS 2/POS2/.
Reported by Edward Welbourne.
* tests/misc/date [neg-secs]: New test for today's strftime.c bug fix.
* tests/misc/date: Remove terminating "\n"s once again.
Automatically add them whenever EXIT != 0.
2005-08-16 Paul Eggert <eggert@cs.ucla.edu>
* src/df.c (show_dev): New arg STAT_FILE. All uses changed.
This sometimes gives better results on networked file systems
that do not respect POSIX semantics. Problem reported by
Bruno Haible.
2005-08-15 Jim Meyering <jim@meyering.net>
Don't print uninitialized data (or anything else) to stdout
upon localtime failure.
* src/date.c (show_date): Remove stray `puts (buf);' (debugging?)
from the 2004-02-02 change.
* tests/misc/date (uninit-64): New test for the above.
Rewrite all other OUT strings to include the terminating "\n".
2005-08-14 Jim Meyering <jim@meyering.net>
* src/md5sum.c (usage): Fix typo s/formated/formatted/ reported
by Norbert Kiesel.
Use one fewer file descriptor in a common case.
* src/touch.c: Include "fd-reopen.h", rather than "fcntl--.h".
Use fd_reopen rather than open.
2005-08-14 James Youngman <jay@gnu.org>
* src/test.c (age_of): Return the nanoseconds part of the timestamp,
if available.
(binary_operator) [-nt, -ot]: Use nanosecond values to break ties.
2005-08-14 Jim Meyering <jim@meyering.net>
* src/ls.c (long_time_expected_width): Revert last change, just to
be paranoid, and add a comment explaining why. Paul Eggert mentioned
the possibility.
* src/wc.c: Don't define mbrtowc at all.
If mbstate_t is not defined, then AC_TYPE_MBSTATE_T will define
it to `int' for us. Now wc.c really does compile on HP-UX 11.23.
2005-08-13 Jim Meyering <jim@meyering.net>
* tests/date: Remove directory
* tests/Makefile.am (SUBDIRS): Remove date.
* configure.ac (AC_CONFIG_FILES): Remove tests/date/Makefile.
* tests/Coreutils.pm: New keywords, ENV and ENV_DEL, to support
tests/misc/date.
With today's additions, the generated shell script,
tests/date/date-tests had becoming far too large (over 350KB),
so use the superior-but-perl-requiring framework instead.
* tests/date/Test.pm: Move all tests from here...
* tests/misc/date: ...to this new file.
* tests/misc/Makefile.am (TESTS): Add date.
* tests/date/Test.pm (test_vector) [cross-dst]: New test for
just-fixed getdate.y bug.
* tests/date/Test.pm (test_vector): Add 364 more tests like the above.
Remove unused $sunos4 variable.
2005-08-12 Jim Meyering <jim@meyering.net>
* src/nohup.c (main): Explain why we reopen stdin for write-only access.
* src/ls.c (long_time_expected_width): Don't test for failed localtime.
That cannot happen when the result date's year is in range.
Add an assertion instead.
* src/ls.c (sort_files): Use cleaner `sizeof *VAR_NAME'
rather than `sizeof (TYPE_NAME)'.
* src/ptx.c (sort_found_occurs, digest_word_file): Likewise.
(alloc_and_compile_regex): Likewise.
* src/wc.c: Test `!defined HAVE_MBSTATE_T' rather than
`defined mbstate_t' to detect missing support for mbstate_t.
The latter didn't work for HP-UX 11.23.
Add bulletproofing in case stdin is closed.
* src/dircolors.c (have_read_stdin): Remove global variable.
(dc_parse_stream): Always use stdin (freopen, if needed) rather
than sometimes using fopen to get a new file descriptor.
Call fclose unconditionally.
(main): Don't close stdin here. If needed, now it's already done
by dc_parse_stream.
* src/dircolors.c (dc_parse_file): Remove comment about
now-removed OPENOPTS.
* src/fold.c (fold_file): Cosmetic: use X2REALLOC rather than x2realloc.
* src/pr.c (main): Likewise.
* src/csplit.c (new_control_record): Cosmetic: use X2NREALLOC (only
two arguments) rather than x2nrealloc (with three).
* src/cut.c (ADD_RANGE_PAIR): Likewise.
* src/expand.c (add_tab_stop): Likewise.
* src/join.c (extract_field, getseq): Likewise.
* src/od.c (decode_format_string): Likewise.
* src/sort.c (add_temp_dir): Likewise.
* src/unexpand.c (add_tab_stop): Likewise.
* src/pr.c (main): Cosmetic: use '\0' in place of 0.
2005-08-02 Jim Meyering <jim@meyering.net>
* src/date.c: Include "xanstrftime.h".
(show_date): Use xanstrftime instead of open-coding it.
* src/du.c: Likewise.
2005-07-29 Jim Meyering <jim@meyering.net>
* src/date.c (show_date): Remove now-unnecessary code that
treated an empty format string as a special case.
* tests/date/Test.pm (empty-format): New test, for this case.
2005-07-19 Jim Meyering <jim@meyering.net>
* src/md5sum.c (usage): Adjust printf argument list to match
new format string.
2005-07-19 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: md5sum --check now accepts multiple input files, and
similarly for sha1sum. Extension suggested by Chris Girling.
* src/md5sum.c (usage, main): Support this new usage.
2005-07-18 Paul Eggert <eggert@cs.ucla.edu>
Fix a problem noted by James Youngman: VPATH-style builds don't
work because of po file problems.
* src/Makefile.am (BUILT_SOURCES): Remove false.c.
(false.c): Remove; it's now a source file.
* src/false.c: New file.
* src/true.c (EXIT_STATUS): New macro.
(PROGRAM_NAME, usage): Behave like "false" if EXIT_STATUS indicates.
(usage): Remove "These option names may not be abbreviated."
2005-07-15 Paul Eggert <eggert@cs.ucla.edu>
* src/nohup.c (main): Don't worry about POSIXLY_CORRECT. Today's
Austin Group Minutes says that the GNU behavior will be put
forward as proposed text for a future revision.
2005-07-13 Paul Eggert <eggert@cs.ucla.edu>
* src/Makefile.am (nanosec_libs): Remove $(FESETROUND_LIBM); no longer
needed. Problem reported by Jeff Bailey.
2005-07-12 Jim Meyering <jim@meyering.net>
* Makefile.maint (copyright-check): Reflect rearrangement in
version-etc files.
2005-07-11 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Binary input and output are now implemented more consistently.
These changes affect only platforms like MS-DOS that distinguish
between binary and text files.
* src/cat.c (usage, main, long_options) [O_BINARY]:
Remove support for -B. Use same rules as other programs to decide
whether to use binary I/O, except that the -bensAE options always
select text mode.
* src/cat.c (main): Avoid setmode; use POSIX-specified routines instead.
* src/cksum.c (cksum): Likewise.
* src/head.c (head_lines, head_file): Likewise.
* src/od.c (open_next_file): Likewise.
* src/split.c (main): Likewise.
* src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
* src/tac.c (copy_to_temp, tac_file, main): Likewise.
* src/tail.c (tail_bytes, tail_lines, tail_file, main): Likewise.
* src/tee.c (tee): Likewise.
* src/tr.c (main): Likewise.
* src/wc.c (wc): Likewise.
* src/copy.c (copy_reg): Always copy in binary mode.
* src/expand.c (expand): Always copy in text mode. POSIX says
the input and output must be text.
* src/unexpand.c (unexpand): Likewise.
* src/head.c (elide_tail_bytes_file, elide_tail_lines_file, head_bytes):
(head_lines, head_file): Always use binary mode except for std tty.
* src/md5sum.c (usage): Clarify whether text or binary is the default.
(split_3, main): BINARY is now a 3-way value. All uses changed.
(digest_file): Likewise. Clear *BINARY if we determine the file
to be text. All uses changed.
(main): Don't report a file to be binary if we actually read it
as text in MS-DOS, because it was a terminal.
* src/shred.c (wipefile): Always use binary mode. Clearly this
never worked right on DOS!
* src/system.h (setmode, fileno): Remove; no longer needed, we think.
(SET_MODE, SET_BINARY, SET_BINARY2): Remove.
[defined __DJGPP__]: Don't include <io.h> or <sys/exceptn.h>.
* src/wc.c (wc_file): FILE might be null now.
(main): Simplify code a bit, so that fewer places need the
setmode fixes.
2005-07-09 Paul Eggert <eggert@cs.ucla.edu>
* src/comm.c, src/csplit.c, src/dd.c, src/join.c, src/md5sum.c:
* src/pr.c, src/sort.c, src/tee.c:
Don't include stdio.h; no longer needed.
2005-07-08 Paul Eggert <eggert@cs.ucla.edu>
Fix porting problems reported by Eric Blake.
* configure.ac: Remove check for AC_HEADER_TIOCGWINSZ.
* src/cat.c, src/ls.c, src/stty.c: Include stropts.h if available,
because POSIX says that's where ioctl is declared.
* src/cat.c: Use HAVE_SYS_IOCTL_H instead of _POSIX_SOURCE
to decide whether to include <sys/ioctl.h>.
* src/stty.c: Use only HAVE_SYS_IOCTL_H to decide whether
to include <sys/ioctl.h>.
* src/id.c (print_user): Don't assume uid fits in unsigned int.
(print_group): Likewise, for gid.
2005-07-05 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (DECIMAL_DIGIT_ACCUMULATE): Generate a hard error
(not just a warning) if GCC is used and the types don't match.
2005-07-04 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (VERIFY_W_TYPEOF): Remove; no longer needed.
(DECIMAL_DIGIT_ACCUMULATE): Change last arg from T's maximum value
to T itself. All callers changed. Check that T is unsigned, and
that Accum is of type T. This fixes a bug in the unlikely case
where SIZE_MAX <= INT_MAX, and it no longer requires typeof to do
the proper validity checks.
* src/od.c: Adjust to verify.h change.
* src/system.h (VERIFY_W_TYPEOF): Likewise.
2005-07-04 Jim Meyering <jim@meyering.net>
* src/system.h: Include "verify.h".
* src/system.h (verify): Rename from VERIFY_EXPR, to be lower case,
like assert. Use sizeof, rather than equivalent ((...)0), for
it's slightly simpler syntax. Suggestions from Paul Eggert.
(verify_decl): Rename from VERIFY.
* src/od.c: Reflect name change.
2005-07-03 Jim Meyering <jim@meyering.net>
* NEWS: cp and mv: the --reply=X option is deprecated
Suggested by Bob Proulx, after numerous user complaints
about how --reply=no appeared not to work.
* src/mv.c (main): Using --reply now evokes a warning.
(usage): Remove description of --reply.
* src/cp.c (main): Using --reply now evokes a warning.
(usage): Remove description of --reply.
* tests/mv/i-link-no: Adjust for new diagnostic.
* tests/mv/reply-no: Likewise.
* src/printf.c (verify_numeric): Rename from verify.
Update caller.
2005-07-03 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.h: Include "lstat.h" rather than rolling our own.
* src/ls.c: Likewise.
* src/remove.c: Likewise.
2005-07-02 Paul Eggert <eggert@cs.ucla.edu>
Cleanup to isolate "safer" functions to a small part of the code.
* src/comm.c: Include stdio--.h, not stdio-safer.h.
(compare_files): Use fopen, not fopen_safer.
* src/copy.c: Include fcntl--.h, not unistd-safer.h.
(copy_reg): Don't call fd_safer; no longer needed
now that we include fcntl--.h.
* src/csplit.c: Include fd-reopen.h.
Include stdio--.h, not stdio-safer.h.
(input_desc): Remove. All uses changed to STDIN_FILENO.
(set_input_file): Reopen stdin, to simplify code.
(create_output_file): Use fopen, not fopen_safer.
* src/dd.c: Include fd-reopen.h.
(open_fd): Remove. All callers changed to use fd_reopen instead.
* src/join.c: Include stdio--.h, not stdio-safer.h.
(main): Use fopen, not fopen_safer.
* src/md5sum.c: Include stdio--.h.
(digest_check): Don't try to read both checksums and data from stdin.
* src/nohup.c: Include fd-reopen.h.
Include unistd--.h, not unistd-safer.h.
(main): Use fd_reopen to simplify code. When replacing stdin,
use "/dev/null" not "/", as that's less likely to go wrong these days.
(main): Use dup, not dup_safer.
* src/pr.c: Include stdio--.h, not stdio-safer.h.
(open_file): Invoke fopen, not fopen_safer.
* src/shred.c: Include fcntl--.h, not unistd-safer.h.
(wipename, wipe_file): Don't use fd_safer; no longer needed
now that we include fcntl--.h.
* src/sort.c: Include stdio--.h rather than stdio-safer.h.
Include stdlib--.h. Do not include unistd-safer.h.
(create_temp_file): Don't call fd_safer; no longer needed
now that we include *--.h files.
(xfopen): Don't call fopen_safer, for similar reasons.
* src/split.c: Include fcntl--.h rather than unistd-safer.h.
Include fd-reopen.h.
(input_desc): Remove. All uses replaced by STDIN_FILENO.
(cwrite): Don't call fd_safer; no longer needed now that
we include fcntl--.h.
(main): Reuse stdin rather than opening a new one. This
saves a file descriptor.
* src/stty.c: Include fd-reopen.h.
(display_all, display_settings, display_window_size, set_window_size):
Remove fd arg, since we now assume stdin. All callers changed.
(main): Reuse stdin rather than opening a new one. This
saves a file descriptor.
* src/tac.c: Include stdlib--.h rather than unistd-safer.h.
(copy_to_temp): Don't call fd_safer; no longer needed now
that we include stdlib--.h.
* src/tail.c: Include fcntl--.h, not unistd-safer.h.
(recheck, tail_file): Don't call fd_safer; no longer needed
now that we include fcntl--.h.
* src/tee.c: Include stdio--.h, not stdio-safer.h.
(tee): Don't call fopen_safer; no longer needed now that we
include stdio--.h.
* src/touch.c: Include fcntl--.h, not unistd-safer.h.
(touch): Don't call fd_safer; no longer needed now that
we include fcntl--.h.
* src/du.c (main): Reuse stdin rather than opening a new stream.
This saves a file descriptor.
* src/uniq.c: Don't include stdio-safer.h; no longer needed.
(writeline): Remove stream arg; we now always output to stdout.
All callers changed.
(check_file): Reuse stdout rather than opening a new stream.
This saves a file descriptor.
2005-07-02 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_obsolete_symbols): New rule.
(syntax-check-rules): Add it to the list.
* Makefile.am (EXTRA_DIST): Add .x-sc_obsolete_symbols.
* .x-sc_obsolete_symbols: New file.
2005-07-01 Jim Meyering <jim@meyering.net>
* src/system.h: Assume HAVE_FCNTL_H (i.e., include <fcntl.h>
unconditionally, and don't include <sys/file.h>).
* src/system.h: Likewise for HAVE_UNISTD_H.
2005-06-30 Jim Meyering <jim@meyering.net>
* src/cp.c: Add uses of ARGMATCH_VERIFY to ensure that
corresponding option string and value arrays are consistent.
* src/date.c: Likewise.
* src/du.c: Likewise.
* src/ls.c: Likewise.
cp.c and date.c each had a harmless trailing `, 0' (now-removed)
in a value list.
* src/system.h (VERIFY): Guard definition with #ifndef.
(VERIFY_EXPR): Undef before defining.
2005-06-29 Jim Meyering <jim@meyering.net>
* src/pr.c (main, store_char): Use X2REALLOC rather than x2realloc.
* src/du.c (show_date): Likewise.
* src/date.c (show_date): Likewise.
* src/od.c (dump_strings): Likewise.
* src/sort.c (fillbuf): Likewise.
* src/chmod.c (main): Likewise.
* src/system.h (VERIFY): Rewrite to use string-concatenation
and __LINE__ so as not to require a struct name parameter.
(GL_CONCAT, GL_CONCAT2): Define helper macros.
* src/od.c: Update sole use.
* src/ls.c (gobble_file): Use stat.st_author, not stat.st_uid
when computing the --author column width. This bug might have
resulted in misaligned columns when using the --author option
on the Hurd. Spotted by Arnold Robbins.
2005-06-28 Jim Meyering <jim@meyering.net>
* src/pr.c (main, store_char): Use x2realloc on 1-byte base types,
not x2nrealloc. The former is a little more concise and readable.
N.B. this sort of transformation is ok only when the base type is
unlikely ever to change to a multibyte type.
* src/du.c (show_date): Likewise.
* src/date.c (show_date): Likewise.
* src/od.c (dump_strings): Likewise.
* src/sort.c (fillbuf): Likewise.
2005-06-24 Jim Meyering <jim@meyering.net>
* src/mv.c (usage): Clarify how --reply=no works.
2005-06-23 Paul Eggert <eggert@cs.ucla.edu>
Address the following "du" issues:
- The option name "--last-time=TYPE" is different from the ls's option
"--time=TYPE" with a similar meaning. I assume this wasn't intended.
- --time-style implies --time, but this is not true for "ls". It's
better to be consistent.
- Since we don't have POSIX compatibility concerns, there's no need
for the "posix-" styles, or for support of styles with newlines, or
for the "locale" style, except for parsing the TIME_STYLE
environment variable.
- It's cleaner (and these days, no less efficient) to use functions
rather than macros when possible.
- struct duinfo doesn't need a 'valid' flag; you can simply use a time
stamp that is less than all valid time stamps.
- The code needs a bit of reformatting to fit the usual GNU style.
* NEWS: du's --last-time option is now --time.
* doc/coreutils.texi (ls invocation): Fix typo: --time=use is
equivalent to --time=atime, not --time=ctime.
(ls invocation, du invocation): Fix typo: --time-style=long-iso
is equivalent to a time style with a leading "+".
(du invocation): --last-time is now --time.
--time-style no longer implies --time.
The locale and posix- stuff now works only for TIME_STYLE, not
for --time-style. Give equivalent format for --time-style=iso.
* src/du.c: Do not include hard-locale.h.
(struct duinfo): Remove 'valid' member. All uses changed to use
negative nsec instead.
(DUIINFO_INI, DUINFO_SET, DUINFO_ADD): Remove.
(duinfo_init, duinfo_set, duinfo_add): New functions, taking the
role of the removed macros.
(opt_time): Renamed from opt_last_time. All uses changed.
(TIME_OPTION): Renamed from LAST_TIME_OPTION. All uses changed.
(long_options, usage): Rename --last-time to --time.
(locale_time_style): Remove.
(time_style_args, time_style_types, usage): Remove support for
--time-style=locale.
(show_date): Now returns void, since nobody looked at the result.
Assume FORMAT is not null. An empty FORMAT now outputs an empty time.
Simplify nstrftime invocation.
(main): Put in ls compatibility workarounds only for TIME_STYLE,
not for --time-style. Omit unnecessary space in iso time style.
2005-06-23 Jim Meyering <jim@meyering.net>
* src/du.c (time_format): Add `const' attribute.
* src/date.c (show_date): Use puts rather than printf ("%s\n",.
* src/du.c (show_date): Rename local `time_format' so as not to
shadow the file-scoped global by that name.
(show_date): Add a FIXME comment.
* src/du.c: Include hard-locale.h and strftime.h.
(DUINFO_INI, DUINFO_SET, DUINFO_ADD):
Enclose body in `do {...} while (0)', not just `{...}'.
Adjust uses (add semicolons).
Adjust formatting, indentation.
(usage): Tweak formatting to maintain more or less constant indentation.
2005-06-14 William Brendling <wbrendling@gmail.com>
* src/du.c: Add --last-time and --time-style options.
2005-06-22 Paul Eggert <eggert@cs.ucla.edu>
* tests/umask-check: New file.
* tests/Makefile.am (EXTRA_DIST): Add umask-check.
* tests/mkdir/perm: Use umask-check.
* tests/cp/cp-parents: Likewise, instead of using chmod
as described below. Problem reported by Kevin Mudrick.
2005-06-22 Jim Meyering <jim@meyering.net>
Make rmdir produce diagnostics like this:
rmdir: /tmp: Permission denied
not like this:
rmdir: `/tmp': Permission denied
* src/rmdir.c: Include "quotearg.h", not "quote.h".
(remove_parents, main): Use quotearg_colon, not quote.
2005-06-22 Paul Eggert <eggert@cs.ucla.edu>
* tests/cp/cp-parents: Use chmod to work around some hosts with
ACL problems. Problem reported by Kevin Mudrick.
2005-06-21 Jim Meyering <jim@meyering.net>
* tests/du/deref-args: Use --apparent-size to avoid the vagaries
of counting blocks. Kevin Mudrick reported that this test would
fail on an nfs-mounted directory where attribute-caching is
turned on.
2005-06-19 Jim Meyering <jim@meyering.net>
* src/tac.c (tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
* src/shred.c (usage): Use `file system', not `filesystem'.
2005-06-18 Jim Meyering <jim@meyering.net>
* src/tr.c (unquote): Remove unnecessary `' quotes from a diagnostic.
2005-06-17 Jim Meyering <jim@meyering.net>
* src/shred.c (usage): Clarify that shred works on an ext3 file
system as long as it's not in data=journal mode.
Tiny change by Mark Melahn.
2005-06-16 Paul Eggert <eggert@cs.ucla.edu>
* src/hostid.c (main): Don't print fewer than 8 digits, or spurious
leading "f"s. "f" problem reported by Tim Waugh.
* NEWS: Document this.
2005-06-16 Jim Meyering <jim@meyering.net>
Don't embed `this'-style quotes in format strings.
* src/tr.c: Rather than this: error (..., "...`%s'...", arg);
do this: error (..., "...%s...", quote (arg));
* src/od.c, src/tr.c, src/csplit.c, src/date.c, src/hostname.c:
* src/join.c, src/ptx.c, src/seq.c, src/sort.c, src/split.c:
* src/split.c, src/tail.c: Likewise.
* src/sleep.c: Include "quote.h". Remove hard-coded quotes, as above.
* src/nice.c, src/printf.c, src/fold.c, src/pr.c: Likewise.
* src/factor.c, src/cat.c, src/expr.c, src/stty.c: Likewise.
* src/mv.c: Finally remove support for --version-control=S (-V).
It was deprecated nearly 6 years ago and has been warning
users to switch to --backup=S since fileutils-4.0j.
* src/cp.c, src/install.c, src/ln.c: Likewise.
2005-06-15 Jim Meyering <jim@meyering.net>
* src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
* tests/install/basic-1: Ensure that each `-d'-specified directory
is created. Ensure that rel-named dirs are not created when
chdir($PWD) fails.
* tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
2005-06-14 Paul Eggert <eggert@cs.ucla.edu>
Improve diagnostics for restore_cwd failure.
* src/install.c (main): Standardize on a diagnostic for
restore_cwd failure, and report errno.
(install_file_in_file_parents): Fail if restore_cwd fails and
one of the files is relative. This fixes a bug (albeit unlikely).
* src/mkdir.c (create_parents): Remove static var (now local to 'main').
(main): Standardize on a diagnostic for restore_cwd failure,
and report errno.
Don't bother to check cwd_errno unless create_parents.
Use mkdir rather than make_dir; it's simpler.
* src/install.c (main): Adjust to new make_dir_parents convention.
* src/mkdir.c (main): Likewise.
2005-06-14 Jim Meyering <jim@meyering.net>
* tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
is an absolute directory name.
* Makefile.maint (my-distcheck): Add -Wall to the list of options that
are used with -Werror. This target is not intended for general use.
2005-06-13 Jim Meyering <jim@meyering.net>
* src/mkdir.c (main): Give a diagnostic for -- and skip -- each
relative directory name after make_dir_parents fails to restore
the working directory. Before, `mkdir -p' could create directories
in the wrong place in unusual circumstances.
* src/install.c (main): Likewise.
(install_file_in_file_parents): Update make_dir_parents caller.
* tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
* tests/mkdir/Makefile.am (TESTS): Add p-3.
2005-06-10 Paul Eggert <eggert@cs.ucla.edu>
Act on the Austin Group's response yesterday to XCU ERN 63; see
<http://www.opengroup.org/austin/docs/austin_260.txt>.
* NEWS: ls no longer outputs an extra space between mode and link count.
* doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
* src/ls.c (any_has_acl): New var.
(clear_files): Clear it.
(gobble_file): Set it if a file has an ACL.
(print_long_format): Omit needless space unless some file has an ACL.
2005-06-10 Jim Meyering <jim@meyering.net>
* src/system.h (VERIFY_W_TYPEOF): Add parentheses.
2005-06-02 Jim Meyering <jim@meyering.net>
* src/sort.c (usage): Put `Ordering options:' line where it belongs.
2005-06-01 Paul Eggert <eggert@cs.ucla.edu>
Use "file name" when talking about file names, instead of "filename"
or "path", as per the GNU coding standards.
* src/basename.c: Don't use "path" or "filename".
* src/copy.c: Likewise.
* src/copy.h: Likewise.
* src/cp-hash.c: Likewise.
* src/cp.c: Likewise.
* src/df.c: Likewise.
* src/install.c: Likewise.
* src/ls.c: Likewise.
* src/pinky.c: Likewise.
* src/pr.c: Likewise.
* src/pwd.c: Likewise.
* src/remove.c: Likewise.
* src/rmdir.c: Likewise.
* src/sort.c: Likewise.
* src/system.h: Likewise.
* src/tty.c: Likewise.
* src/who.c: Likewise.
* src/cp.c (parents_option): Renamed from flag_path. All uses changed.
(make_dir_parents_private): Renamed from make_path_private.
All uses changed.
* src/cp.c (usage): Don't use "path" to describe a file name.
* src/readlink.c (usage): Likewise.
* src/rmdir.c (usage): Likewise.
* src/df.c: Don't include "path-concat.h"; not needed.
* src/install.c (install_file_in_file_parents): Renamed from
install_file_to_path. All uses changed.
* src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
All uses changed.
* src/ls.c (make_link_name): Renamed from make_link_path.
All uses changed.
* src/pwd.c (struct file_name): Renamed from struct Path.
All uses changed.
(file_name_free): Renamed from path_free. All uses changed.
(file_name_init): Renamed from path_init. All uses changed.
(file_name_prepend): Renamed from path_prepend. All uses changed.
* src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
All uses changed.
(longopts): Add comment that --path is deprecated.
2005-05-31 Jim Meyering <jim@meyering.net>
* src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
This is a crutch so that `make distcheck's sc_tight_scope rule
knows that they really are deliberately declared that way.
2005-05-30 Paul Eggert <eggert@cs.ucla.edu>
Port to Solaris 10's rules for whether programs can chown files.
* src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
(DO_CHOWN): Remove. Replaced by chown_failure_ok. All callers
changed.
(copy_internal): If chown failed, don't worry about what happened
to the mode bits; they can't have changed.
(chown_privileges, chown_failure_ok): New functions.
* src/copy.h: Add copyright notice.
(struct cp_options): Remove myeuid member. Add chown_privileges
member.
(chown_privileges, chown_failure_ok): New function decls.
* src/cp.c (re_protect): Remove unnecessary call to geteuid.
Use chown_failure_ok rather than our own code.
* src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
* src/install.c (cp_option_init): Likewise.
* src/mv.c (cp_option_init): Likewise.
2005-05-29 Paul Eggert <eggert@cs.ucla.edu>
* src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
* src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
Remove decls.
* src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
* src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
[!defined _POSIX_VERSION]: Remove decls.
* src/install.c (getpwnam, getgrnam): Remove decl.
(getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
* src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
(digest_file): Use O_BINARY-using expr instead of OPENOPTS.
* src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
* src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
isn't defined.
Don't include <sys/file.h>; no longer needed.
(getegid, geteuid): Remove no-longer-necessary decls.
* src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
Define to 256, not 255, as per modern POSIX.
2005-05-27 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
* src/dd.c (skip): Return the number of records that were not
skipped due to encountering EOF.
(dd_copy): If the file wasn't seekable and EOF was encountered,
write zeros past EOF until the desired offset is reached.
* NEWS: expr and test now correctly compare integers of unlimited size.
(Also, correct a comment that claimed that expr detects integer
overflow; it does so only when converting from strings.)
* src/expr.c: Include strnumcmp.h, xstrtol.h.
(looks_like_integer): New function.
(toarith): Use it. Also, use xstrtoimax rather than rolling our
own diagnostics.
(eval2): Don't look for trouble if !evaluate; this simplifies things.
Compare numbers using string comparison, so that overflow is
not possible.
* src/sort.c: Refactor so that others can use large-integer
comparison functions.
Include "strnumcmp.h".
(NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
Remove; moved to strnumcmp.
(decimal_point): Now int, to simplify converison overhead with
new API. All uses changed.
(thousands_sep): Now -1 if there isn't one, as per new API.
All uses changed.
(numcompare): Move contents to strnumcmp module, except for
skipping blanks.
* src/test.c: Include inttostr.h, strnumcmp.h.
(whitespace, digit, digit_value, integer_expected_error): Remove.
(is_int): Remove; replaced by...
(find_int): New function.
(binary_operator): Don't let integers overflow in comparisons;
return the correct answer instead. Simplify the code.
(unary_operator): Convert the integer ourself, since find_int
no longer does so.
* tests/expr/basic (bigcmp): New test.
* tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
2005-05-26 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: nohup now redirects a tty stdin to an unreadable fd
instead of closing it.
* doc/coreutils.texi (nohup invocation): Document this.
* src/nohup.c (main): Implement this.
2005-05-26 Jim Meyering <jim@meyering.net>
* src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
Reported by David Alan Gilbert.
* tests/expr/basic: Add tests using arithmetic on negative integers.
2005-05-19 Jim Meyering <jim@meyering.net>
* src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
Remove inaccurate-but-harmless `const' attributes.
* src/join.c (decode_field_spec): Add an abort after
`error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
about variables being used uninitialized.
2005-05-18 Paul Eggert <eggert@cs.ucla.edu>
* configure.ac: Add copyright notice. gl_LIB_CHECK -> cu_LIB_CHECK.
* src/Makefile.am: Add copyright notice.
(factor_LDADD): Remove, as factor no longer needs sqrt.
* src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
it's always true now.
2005-05-16 Paul Eggert <eggert@cs.ucla.edu>
Fix Cygwin porting problem reported by Eric Blake.
* src/remove.c (DT_IS_DIR): Remove.
(DT_IS_KNOWN, DT_MUST_BE): New macros.
(remove_entry): Use them.
2005-05-14 Paul Eggert <eggert@cs.ucla.edu>
* src/remove.c: Include unlinkdir.h.
(UNLINK_CAN_UNLINK_DIRS): Remove.
(remove_entry): Use cannot_unlink_dirs () rather than
UNLINK_CAN_UNLINK_DIRS.
2005-05-14 Jim Meyering <jim@meyering.net>
Update FSF postal mail address.
* Makefile.maint, Makefile.cfg, gnupload
* src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
* src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
* src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
* src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
* src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
* src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
* src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
* src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
* src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
* src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
* src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
* src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
* src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
* src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
* src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
* src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
* src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
* src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
* src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
* src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
* src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
* src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
2005-05-13 Jim Meyering <jim@meyering.net>
* NEWS: `rm -r' now removes all of the files it should, even on
systems with a buggy readdir affecting file systems inaccessible
at configure time.
In some unusual circumstances `rm -r' would fail to remove --
or even consider -- all entries in a directory with more than 254
(SunOS) or 338 (Darwin) entries. This could cause trouble even on
other types of systems when using an affected file system via e.g.,
NFS. The underlying cause was a bug in readdir on those systems.
Coreutils-5.2.1 and earlier used a configure-time test designed
to detect precisely those problem systems, but it would detect
the problem and enable remove.c's work-around code only when its
configure-time test was run on a losing file system. Obviously,
it couldn't detect a problem if the offending file system wasn't
tested or even mounted at coreutils configure time. Now, rm itself
performs a minimal-cost run-time test to detect the problem.
* src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
(remove_cwd_entries): When readdir returns NULL for a directory from
which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
entries, call rewinddir and then resume the readdir/unlink loop.
(UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
2005-05-12 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: nohup now closes stdin if it is a terminal, unless
POSIXLY_CORRECT is set. This fixes a glitch noted by Wayne Pollock in
<https://www.opengroup.org/sophocles/show_mail.tpl?
source=L&listname=austin-group-l&id=8341>.
* doc/coreutils.texi (nohup invocation): Document this.
* src/nohup.c (main): Implement this.
2005-05-12 Jim Meyering <jim@meyering.net>
* src/date.c: Assume `free (NULL)' works.
* src/dd.c: Likewise.
* src/df.c:Likewise.
* src/dircolors.c:Likewise.
* src/head.c: Likewise.
* src/ls.c: Likewise.
* src/md5sum.c: Likewise.
* src/pr.c: Likewise.
* src/sort.c: Likewise.
2005-05-10 Jim Meyering <jim@meyering.net>
* tests/touch/not-owner: Skip this test if the user running it
owns `/' or has write access to it.
* src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
This makes `mv -i --reply=no f1 f2' work as expected (in not
performing the move operation). But note that specifying `-i'
after `--reply=no' does *not* work.
Tiny patch from Vlada Macek.
Correct a comment.
* tests/mv/reply-no: New file. Test for the above fix.
* tests/mv/Makefile.am (TESTS): Add reply-no.
* tests/ls-2/tests: Don't print PATH to stderr.
2005-05-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: cp, ln, mv, rm no longer discard white space when intepreting
responses.
2005-05-06 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: dd has new iflag= and oflag= flags "binary" and "text".
* src/dd.c (flags, usage): Add support for "binary" and "text".
2005-05-04 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: chmod -w now complains if it differs from chmod a-w.
* src/chmod.c: Include quotearg.h.
(diagnose_surprises): New var.
(process_file): Diagnose surprises. Simplify the logic a bit,
while we're at it.
(main): Prepare to diagnose surprises. Remove useless code for
'-' option.
* tests/chmod/Makefile.am (TESTS): Add umask-x.
* tests/chmod/umask-x: New file.
2005-05-02 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: ls --indicator-style=directory renamed to ls
--indicator-style=slash, to avoid confusion with ls --directory.
* src/ls.c (usage): Likewise.
(slash): Renamed from directory_only. All uses changed.
2005-05-01 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "chmod +1 foo" is now diagnosed.
2005-04-29 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: ls -p now marks only directories. New option
--indicator-style=directory equivalent to -p.
* doc/coreutils.texi (ls invocation): Document this.
Also, mention ">" is for doors.
* src/ls.c (enum indicator_style): New constant directory_only,
for -p.
(indicator_style_args, indicator_style_types): Set it appropriately.
(decode_switches, gobble_file, print_type_indicator):
(length_of_file_name_and_frills):
Implement the change described in NEWS.
(decode_switches): Quote ">", too.
(usage): Update to match the new behavior. Describe ">".
* tests/ls/file-type: Test for new behavior. Omit -1 option.
The "ls --color" test wasn't being checked; add a check for
"ls --color=auto" instead.
* tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
* tests/misc/split-fail: Likewise.
* tests/pr/Test.pm: Likewise.
* tests/sort/Test.pm: Fix comment to match new behavior of "sort".
* tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
if they use file names starting with +.
(test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
* tests/uniq/Test.pm (tv, test_vector): Likewise.
The following was partly derived from a tiny change by Eric Blake:
* tests/misc/nice: Don't use 'set -'. It's not portable to strict
POSIX 1003.1-2001 hosts. Also, don't set _POSIX2_VERSION.
* tests/mkdir/perm: Don't use 'set -'. Simplify test construction.
Work even if the underyling system attaches ACLs to new dirs.
* tests/mv/part-hardlink: Don't use 'set -'.
* tests/stty/row-col-1: Don't use 'set -'.
2005-04-28 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document fixes described below.
* src/chmod.c (change, umask_value): New static vars.
(reference_file): Move this static var to inside "main".
(process_file, process_files): Remove CHANGES arg; now taken from
static var. All uses changed.
(usage): Fix incorrect description of MODE operand.
(main): For invalid mode usages, output a brief usage message.
Adjust to new modechange API.
* install.c (main): Adjust to new modechange API.
Also, free the mode_change object when done.
* mkdir.c (main): Likewise.
* mkfifo.c (main): Likewise.
* mknod.c (main): Likewise.
* tests/chmod/equal-X: Check for =xX bug.
* tests/chmod/equals: Check for =u bug.
* tests/chmod/usage: Check for u+gr and ug,+x bugs.
2005-04-26 Paul Eggert <eggert@cs.ucla.edu>
Restore support for usages like "head -1" and "tail -1",
even when conforming to POSIX 1003.1-2001.
Fix bug with "POSIXLY_CORRECT=1 fold file -3".
join now supports a NUL field separator, e.g., "join -t '\0'".
join now detects and reports incompatible options, e.g.,
"join -t x -t y",
* NEWS: Document this.
* src/date.c: Remove posixver.h and its uses.
(COMMON_SHORT_OPTIONS): Remove.
(short_options): New constant.
(short_options, usage): -I now always takes an optional arg.
* src/expand.c: Remove posixver.h and its uses.
(shortopts): New constant. -DIGIT now always takes an optional arg.
(main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
Don't complain about -DIGIT.
* src/fold.c: Remove posixver.h and its uses.
(shortopts): New constant. -DIGIT now always takes an optional arg.
(main): Don't preprocess arg list; that was buggy. Use method
similar to expand.
* src/head.c: Remove posixver.h and its uses.
(header_mode_option): Remove.
(main): Don't complain about obsolete -NUM args.
* src/join.c: Remove posixver.h and its uses.
(obsolete_usage): Remove.
(join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
they haven't been set yet.
(tab): Now int, not char. Initialize to -1 to indicate white space
separates columns, so that we can use NUL as a separator.
All uses changed.
(OBSOLETE_LONG_OPTIONS, get_option): Remove.
(string_to_join_field): Remove ERR_MSG_FMT arg; a single format
suffices. Use xstrtoul for sizes; it suffices.
(decode_field_spec): Report an error and exit on failure. Return void,
not bool.
(add_field_list): Likewise.
(set_join_field): New function.
(enum operand_status): New enum.
(add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
possibilities with obsolete option parsing.
(main): Use it. Do not depend on POSIX version.
Check for conflicting options. Parse obsolete options -j1 and -j2
so that it is a pure extension to POSIX 1003.1-2001.
Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
* src/nice.c: Remove posixver.h and its uses.
(main): Always support -NUM option.
* src/od.c: Remove posixver.h and its uses.
(short_options): New constant, which always supports -w[num].
(COMMON_SHORT_OPTIONS): Remove.
* src/pr.c: Remove posixver.h and its uses.
(short_options): New constant, which always supports -S[string].
(COMMON_SHORT_OPTIONS): Remove.
* src/sort.c: Remove posixver.h and its uses.
(short_options): New constant, which always supports -y arg.
(COMMON_SHORT_OPTIONS): Remove.
(main): Redo workaround for Solaris compatibility with -y.
This change isn't visible to the user; it just cleans up the
code so that we don't need posixver.h.
* src/split.c: Remove posixver.h and its uses.
(main): Don't complain about -NUM option.
* src/tail.c (parse_obsolete_option): Don't complain about -NUM.
* src/unexpand.c: Remove posixver.h and its uses.
(main): Don't complain about -TAB.
* src/uniq.c (main): Don't complain about -NUM.
2005-04-22 Paul Eggert <eggert@cs.ucla.edu>
* src/nohup.c (main): If getopt fails, exit with status 127,
not status 1. POSIX requires this.
* NEWS: Document this.
* src/nice.c (main): Report proper program name when getopt finds
trouble. Problem reported by Behdad Esfahbod.
* NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
when the "+x" was being evaluated.
* mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
* mkfifo.c (main): Likewise.
* mknod.c (main): Likewise.
* tests/mkdir/perm: Test for the above bug.
2005-04-20 Paul Eggert <eggert@cs.ucla.edu>
Port test cases to Microsoft-Windows-related environments,
following suggestions from Eric Blake.
* tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
* tests/install/basic-1: Undo previous change.
(dd, dd2): New vars, which use $EXEEXT. All uses of dd and dd2 changed.
* tests/install/trap: Undo previous change.
(sig): New var. Use it insted of "trap '' CHLD".
Append $EXEEXT to executable name.
"fetish" -> "coreutils" in more places.
* tests/Coreutils.pm: Renamed from tests/Fetish.pm.
(package Coreutils): Renamed from package Fetish. All uses changed.
* tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
remove Fetish.pm.
2005-04-19 Paul Eggert <eggert@cs.ucla.edu>
* tests/mv/setup (dot_mount_point): Use stat -L, in case the
directory is actually a symbolic link. Problem reported by
Eric Blake.
* tests/mv/mv-special-1: Use test -p to test for fifos, rather
than the (incorrect) test -f and the (inadequate) ls. ls is
inadequate because on some hosts a buggy mv will create a file of
the wrong type (problem reported by Eric Blake). Skip this test
if test -p doesn't work.
* tests/chmod/setgid: Use numeric group ids, not symbolic group names,
since the latter can have shell metacharacters in them (e.g., spaces).
This follows up to the 2005-01-17 patch, which missed this occurrence.
2005-04-18 Paul Eggert <eggert@cs.ucla.edu>
"fetish" -> "coreutils" in several places.
* Makefile.cfg (ftp): Remove fetish.sf.net.
* Makefile.maint (emit_upload_commands): Likewise.
* src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
* tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
* tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
* tests/install/basic-1: Use "cat", not "test", to test for
../../src/dd. Problem reported by Eric Blake.
2005-04-18 Jim Meyering <jim@meyering.net>
* src/dd.c: Don't include stat-macros.h directly. system.h does that.
2005-04-17 Paul Eggert <eggert@cs.ucla.edu>
Work around a couple of "make check" failures reported for Cygwin
and ash by Eric Blake.
* tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
* tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
2005-04-16 Jim Meyering <jim@meyering.net>
* src/dd.c (S_TYPEISSHM): Remove definition.
Get the definition by including "stat-macros.h", instead.
2005-04-14 Paul Eggert <eggert@cs.ucla.edu>
Fix test suite problems reported by Eric Blake on Cygwin.
* tests/mv/mv-special-1: Ignore chatter about when files are removed,
since POSIX doesn't require rename to fail across file systems.
* tests/mv/setup (dot_mount_point): Use stat rather than df, as
it's more reliable.
(other_partition_tmpdir): Remove df from name as that would be
misleading now.
2005-04-14 Jim Meyering <jim@meyering.net>
* src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
2005-04-12 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (usage): "uid" -> "user ID".
2005-04-12 Jim Meyering <jim@meyering.net>
* src/tsort.c (tsort): Use "%s" as the format string,
rather than a diagnostic or a file name.
* src/comm.c (compare_files): Remove declaration of unused local.
* src/chown-core.c (chopt_free): Mark parameter as unused.
2005-04-11 Paul Eggert <eggert@cs.ucla.edu>
* man/chown.x: Reword to match user manual.
* man/id.x: Likewise.
* src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
for "group ID".
* src/whoami.c (usage, main): Likewise.
Add bulletproofing for cases where stdin, stdout, or stderr are closed.
* src/comm.c: Include stdio-safer.h.
(compare_files): Exit right away on I/O error rather than continuing
and producing confusing output and error messages.
Return void, not int; all callers changed.
Use fopen_safer to avoid confusion with file descriptors.
* src/copy.c: Include unistd-safer.h.
(copy_reg): Use fd_safer.
* src/csplit.c: Include stdio-safer.h.
(input_desc): Remove unnecessary static initialization.
(set_input_file): Use STDIN_FILENO, not 0.
(create_output_file): Use fopen_safer.
* src/dircolors.c (dc_parse_file): Don't assume fopen does not
return stdin.
* src/head.c (head_file): Don't assume open does not return 0.
* src/join.c: Include stdio-safer.h.
(main): Use fopen_safer. Simplify the resulting code.
* src/md5sum.c (digest_file, digest_check):
Don't assume that fopen does not return stdin.
* src/nohup.c: Include unistd-safer.h.
(main): Don't dup stderr to stdin or stdout by mistake.
* src/od.c (check_and_close): Don't assume fopen does not return stdin.
* src/paste.c (paste_serial): Likewise.
* src/pr.c: Include stdio-safer.h.
(open_file): Use fopen_safer.
(close_file): Don't assume fopen does not return stdin.
* src/ptx.c (main): Don't assume fopen returns stdout after closing
stdout. Use freopen instead.
* src/shred.c: Include unistd-safer.h.
(wipename): Use fd_safer on directory file descriptor.
(wipefile): Remove special case for /dev/fd/* on older hosts.
It didn't work in general, and wasn't documented.
Use fd_safer.
* src/sort.c: Include unistd-safer.h.
(create_temp_file): Use fd_safer.
(xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
* src/split.c: Include unistd-safer.h.
(cwrite): Use fd_safer. Replace mystery constant 0666 with symbolic
version, as POSIX requires.
* src/sum.c (bsd_sum_file, sysv_sym_file):
Use same pattern as elsewhere for checking for stdin.
* src/tac.c: Include unistd-safer.h.
(copy_to_temp): Use fd_safer.
(tac_file): Don't assume fopen cannot return stdin.
* src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
(recheck, tail_file): Use fd_safer rather than open_safer.
* src/tee.c: Include stdio-safer.h.
(tee): Use fopen_safer.
* src/touch.c: Include unistd-safer.h.
(touch): Use fd_safer.
* src/tsort.c (have_read_stdin): Remove; no longer needed. All uses
removed.
(tsort): Do not assume fopen can't return stdin.
Close stdin before returning. All uses changed.
* src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
* src/uniq.c: Include stdio_safer.h.
(check_file): Don't assume fopen cannot return stdin or stdout.
2005-04-09 Jim Meyering <jim@meyering.net>
* src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
Now that close_stdout closes standard output unconditionally,
these workarounds for dd and cat are no longer necessary.
* src/dd.c (close_stdout_wrapper): Remove function.
(main): Call atexit with close_stdout, instead.
* src/cat.c (close_stdout_wrapper): Likewise.
Don't close STDOUT_FILENO explicitly; close_stdout does it.
* src/system.h (__attribute__): Readability nit:
Change this:
# define __attribute__(x)
to this:
# define __attribute__(x) /* empty */
2005-04-09 Jim Meyering <jim@meyering.net>
* src/rm.c (usage): Mention that --recursive removes listed
directories too, not just their contents.
Say that by default, rm does not remove directories.
* src/pr.c: Don't include "timespec.h". system.h does that.
* Makefile.maint (sc_system_h_headers): Propagate exit status
through trap.
2005-04-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document that dd no longer treats QUIT or PIPE specially,
and when conforming to POSIX no longer treats USR1 specially.
Document that dd no longer dumps core when handling signals.
* src/system.h (RETSIGTYPE): Remove; no longer needed. All uses
replaced with void.
* src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
All uses changed.
(siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
(delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
behavior when called from a signal handler. All uses changed.
(main) [!defined SA_NOCLDSTOP]:
Use siginterrupt to specify that system calls should be interrupted.
* src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
(process_signals): Add forward decl.
(SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
New macros.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(SA_NODEFER) [!defined SA_NODEFER]: New macro.
(SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
(caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
New vars.
(usage): Mention -USR1 versus -INFO.
(cleanup): Don't invoke print_stats; the caller must do it now.
All callers changed.
(quit): Process signals just before exiting.
(interrupt_handler): Simply record the signal and return.
(siginfo_handler): Simply increment the signal counter and return.
(install_handler): Remove, replacing with:
(install_signal_handlers, process_signals, iread, iwrite):
New functions. All callers to safe_read and full_write replaced
by iread and iwrite. All callers to install_handler replaced by
install_handlers.
* src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
All uses changed.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(main) [! SA_NOCLDSTOP]: Use it.
* src/shred.c: Remove all uses of signals; modern hosts have
/dev/random and don't need this gorp.
Do not include signal.h.
(env, sigill_handler, isaac_seed_machdep): Remove. All uses removed.
* src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
All uses changed.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(main) [! SA_NOCLDSTOP]: Use it.
* src/dd.c: Do not include inttostr.h, no longer needed.
(print_stats, main): Rewrite and simplify formats to use PRIuMAX
instead of umaxtostr.
(print_stats): Work even in languages that have special
forms for two of things, for r_truncate and w_bytes. We can't
fix delta_s in this way, since ngettext doesn't support floating-point.
(main): Rewrite to avoid casts.
2005-04-07 Jim Meyering <jim@meyering.net>
Placate gcc-4's -Wuninitialized.
* src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
* src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
* src/test.c (is_int, age_of, binop): Declare `char *' parameters to
be `const'.
(binop): Move function definition to precede first use so we can...
(binop): ...remove prototype.
2005-04-05 Paul Eggert <eggert@cs.ucla.edu>
* man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
* src/basename.c (usage): Add examples.
* src/cat.c (usage): Likewise.
* src/chgrp.c (usage): Likewise.
* src/chown.c (usage): Likewise.
* src/dirname.c (usage): Likewise.
2005-04-05 Jim Meyering <jim@meyering.net>
* src/nice.c (usage): Mention that some shells provide a
built-in function by the same name.
* src/nohup.c (usage): Likewise.
* src/printenv.c (usage):Likewise.
2005-04-04 Dmitry V. Levin <ldv@altlinux.org>
* src/tee.c (tee): When closing files, do not close stdout,
leave this job to close_stdout() instead.
* configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
* tests/Makefile.am (SUBDIRS): Add tee.
* tests/tee/Makefile.am: New file.
* tests/tee/.cvsignore: Likewise.
* tests/tee/{basic,dash}: New tee tests.
2005-04-04 Jim Meyering <jim@meyering.net>
* src/echo.c (usage): Mention that some shells provide a
built-in function by the same name.
* src/kill.c (usage): Likewise
* src/printf.c (usage): Likewise.
* src/pwd.c (usage): Likewise.
* src/stat.c (usage): Likewise.
* src/test.c (usage): Likewise.
* src/true.c (usage):
* src/system.h (USAGE_BUILTIN_WARNING): New macro.
* man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
* man/printf.x: Likewise.
* man/pwd.x: Likewise.
2005-04-03 Jim Meyering <jim@meyering.net>
* src/pr.c (main): Fix off-by-one error.
pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
end of a malloc'd buffer.
2005-04-01 Jim Meyering <jim@meyering.net>
* src/pr.c (main): Free column_count_string when done with it.
Don't let pr treat +1:-1 like +1:18446744073709551615.
* src/pr.c (strtoumax): Remove declaration.
(first_last_page): Use xstrtoumax in place of strtoumax,
so we don't interpret a negative page number (e.g., in an option
like --pages=1:-1) as valid.
* tests/pr/Test.pm (neg-page): Add a test for this.
2005-03-30 Paul Eggert <eggert@cs.ucla.edu>
* src/pinky.c (short_pinky): Adjust to read_utmp signature change.
* src/uptime.c (uptime): New arg OPTIONS. All uses changed.
* src/users.c (users): Likewise.
* src/who.c (who): Likewise.
* src/uptime.c (main): Check PIDs when invoked with zero arguments.
* src/users.c (main): Likewise.
* src/who.c (main): Likewise. Also with two arguments.
Omit duplicate code in 2-arg case.
(UT_PID): Moved to ../lib/readutmp.h.
2005-03-29 Jim Meyering <jim@meyering.net>
* src/system.h (ptr_align): Declare `ptr' parameter to be a
`const' pointer, since this function never writes through it.
* src/uname.c: Indent cpp directives to reflect nesting.
2005-03-28 Jim Meyering <jim@meyering.net>
* src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
Add `void' to make this an ANSI-style function declaration.
* src/remove.c (ds_init): Likewise.
* src/pr.c (print_sep_string): Likewise.
* src/stty.c (speeds): Declare this array to be static.
* src/Makefile.am (sc_tight_scope): Adjust to catch any
new declarations like that of stty.c's `speeds'.
* src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
(GETOPT_VERSION_OPTION_DECL): Likewise.
* src/chown.c (long_options): Likewise.
* src/chgrp.c (long_options): Likewise.
* src/chmod.c (long_options): Likewise.
* src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
Likewise.
* src/chown-core.c (chopt_init): Likewise.
* src/comm.c (long_options): Likewise.
* src/copy.c (copy_reg): Likewise.
* src/csplit.c (extract_regexp): Likewise.
* src/cut.c (longopts): Likewise.
* src/date.c (time_spec_string): Likewise.
* src/df.c (find_mount_point, show_point): Likewise.
* src/expr.c (docolon): Likewise.
* src/fmt.c (long_options): Likewise.
* src/ls.c (time_style_args, indicator_style_args, long_options)
(format_args, sort_args, time_args, decode_switches)
(gobble_file): Likewise.
* src/md5sum.c (long_options): Likewise.
* src/mv.c (reply_args): Likewise.
* src/paste.c (longopts): Likewise.
* src/pinky.c (print_entry): Likewise.
* src/pr.c (long_options): Likewise.
* src/ptx.c (long_options, format_args): Likewise.
* src/readlink.c (longopts): Likewise.
* src/sort.c (long_options, mergefps): Likewise.
* src/stat.c (long_options): Likewise.
* src/tac.c (main): Likewise.
* src/tail.c (follow_mode_string): Likewise.
* src/touch.c (longopts, time_args): Likewise.
* src/uniq.c (delimit_method_string): Likewise.
* src/uptime.c (print_uptime): Likewise.
* src/who.c (print_user): Likewise.
2005-03-27 Jim Meyering <jim@meyering.net>
* src/dcgen: Simplify further, clean up.
Add a standard-output-closing global destructor.
Require perl-5.002.
* src/wheel-gen.pl: Use the same global destructor as dcgen.
2005-03-26 Paul Eggert <eggert@cs.ucla.edu>
* src/dcgen: Squeeze multiple blanks into one. Output a simple
array of adjacent strings rather than a more complicated data
structure; this saves space in the dircolors executable.
* src/dircolors.c (parse_line): Use char *, not unsigned char *.
This avoids casts.
(dc_parse_stream, main): Avoid casts.
Adjust to simpler data structure generated by new dcgen.
2005-03-25 Eric Blake <ebb9@byu.net> (tiny change)
* src/ls.c (usage): Document usage of LS_COLORS.
2005-03-25 Paul Eggert <eggert@cs.ucla.edu>
* src/dircolors.hin: Add "TERM cygwin".
2005-03-25 Jim Meyering <jim@meyering.net>
* src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
the return value, and update callers:
* src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
* src/expand.c (parse_tab_stops, main): Likewise.
* src/split.c (main): Likewise.
* src/unexpand.c (parse_tab_stops, main): Likewise.
* src/uniq.c (main): Likewise.
2005-03-22 Jim Meyering <jim@meyering.net>
* build-aux: New directory. Renamed from config.
* configure.ac: Reflect renaming: config -> build-aux.
* Makefile.am (dist-hook): Likewise.
* Makefile.maint: Likewise.
* Makefile.cfg (cvs_files): Likewise.
* .x-sc_sun_os_names: Likewise.
* .x-sc_trailing_blank: Likewise.
* src/ls.c (get_funky_string): Use '\a', rather than 7, for
portability to EBCDIC hosts.
2005-03-20 Jim Meyering <jim@meyering.net>
* src/pr.c (init_header): Add missing `%' in new format string.
(init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
2005-03-19 Jim Meyering <jim@meyering.net>
* src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
$(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
2005-03-18 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: pr -D "FORMAT" now accepts the same formats that
date +"FORMAT" does.
* src/pr.c: Include strftime.h, timespec.h.
(init_header): Obtain and format nanosecond part of time stamp.
* NEWS: nohup now ignores the umask when creating nohup.out.
nohup now closes stderr if it is a terminal and stdout is closed.
* src/nohup.c (main): Likewise. Be a little more paranoid about
return values; e.g., check for any negative return from open.
Assume free (NULL) works.
Close file descriptor leak when redirecting standard output to a file.
2005-03-17 Jim Meyering <jim@meyering.net>
* src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
in place of functionally-equivalent code.
* src/expand.c (parse_tab_stops, main): Likewise.
* src/split.c (main): Likewise.
* src/unexpand.c (parse_tab_stops, main): Likewise.
* src/uniq.c (main): Likewise.
* src/od.c: Use VERIFY macro in place of an equivalent open-coded
declaration.
* src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
New macros.
Before, this command would make uniq skip 11 fields and print
only the first line:
$ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
1 1
1 2
* src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
not like `uniq -f11'.
2005-03-15 Jim Meyering <jim@meyering.net>
Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
`pr -0' should give a better diagnostic and `pr -03' should be
equivalent to `pr -3'.
* src/pr.c (parse_column_count): Change return type to void.
Call error (EXIT_FAILURE, ... for an invalid string.
(main): Allocate space for column_count_string using malloc.
Accumulate all old-style column-count digits before converting.
When the number of columns is specified via both old-style,
(e.g., -3), and a long option (--columns=5), ensure that only
the last one specified takes effect.
* tests/pr/Test.pm: Add tests for the above.
2005-03-15 Corinna Vinschen <corinna@vinschen.de> (tiny change)
* src/copy.c (copy_reg): Copy regular files in binary mode.
2005-03-14 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Restate why ls limits time stamp lengths.
2005-03-12 Jim Meyering <jim@meyering.net>
Add a little infrastructure to help prevent future bugs like the
one fixed below.
* src/stat.c (xstrcat): New function.
(print_statfs, print_stat): Add buf_len parameter and convert all
uses of strcat to xstrcat. Update callers.
(print_it): Call print_func with buf_len parameter.
Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
could cause a buffer overrun error.
* src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
conversion of the stat %s format string to the longer printf %llu one.
Patch from Guochun Shi.
2005-03-11 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
(long_time_expected_width, print_long_format): Use it, to avoid
some possible denial-of-service attacks.
* NEWS: Document this.
2005-03-11 Jim Meyering <jim@meyering.net>
Prompt once again for `mv -i A B' when A and B are hard links
to the same file. This fixes a bug introduced by my 2003-04-04
(coreutils-5.0.1) change. Reported by Thomas Wolff via Eric Blake.
* src/copy.c (abandon_move): New function, factored out of
copy_internal, now that this code is being used from two places.
(copy_internal): Perform the same interactive-related test for
whether it's alright to proceed and (usually) overwrite the
destination file.
* tests/mv/i-4: Add tests for the above.
Don't segfault for a very long date format string, e.g.,
ls -ld --time-style=+%99999999H .
* src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
so format string abuse cannot provoke stack overflow.
(print_long_format): Likewise.
Don't segfault for a long header date string, e.g.,
echo a|pr -D +%9999999A
* src/pr.c (init_header): Use x2nrealloc, rather than alloca.
Don't bother with fixed-sized initial buffer; always use x*alloc.
* src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
in place of equivalent INT_STRLEN_BOUND + 1.
* src/expr.c (tostring, printv): Likewise.
2005-03-09 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h: Include intprops.h.
(TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
they are now defined in intprops.h.
2005-03-09 Jim Meyering <jim@meyering.net>
* TODO: Remove entry about named pipes. It was fixed in 5.3.0.
2005-03-08 Paul Eggert <eggert@cs.ucla.edu>
* src/date.c (usage): Redo to match recent documentation changes.
Don't bother documenting which usages are GNU extensions; the list
wasn't correct, and is better left to the printed manual anyway.
2005-03-06 Jim Meyering <jim@meyering.net>
Factor out column-count processing.
* src/pr.c: Include "inttostr.h".
(parse_column_count): New function.
(main): Use the new function for both old-style, -9, and long,
--columns=-9, options.
* src/cksum.c: Remove `register' keyword.
* src/cut.c: Likewise.
* src/dd.c: Likewise.
* src/env.c: Likewise.
* src/factor.c: Likewise.
* src/fmt.c: Likewise.
* src/fold.c: Likewise.
* src/id.c: Likewise.
* src/logname.c: Likewise.
* src/ls.c: Likewise.
* src/pr.c: Likewise.
* src/printf.c: Likewise.
* src/shred.c: Likewise.
* src/sort.c: Likewise.
* src/sum.c: Likewise.
* src/test.c: Likewise.
* src/tsort.c: Likewise.
* src/uniq.c: Likewise.
* src/wc.c: Likewise.
* src/whoami.c: Likewise.
2005-03-01 Paul Eggert <eggert@cs.ucla.edu>
* src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
longer needed.
2005-03-01 Jim Meyering <jim@meyering.net>
* src/copy.c (copy_internal): Change test of source type from
!S_ISREG to S_ISLNK. Reported by Paul Eggert in
http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
2005-02-28 Jim Meyering <jim@meyering.net>
* NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
2005-02-21 Paul Eggert <eggert@cs.ucla.edu>
* src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
(nanosec_libs): Add $(LIB_XNANOSLEEP). Needed for newer GNU/Linux
hosts with clock_gettime.
2005-02-20 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Describe user-visible change to dd.
* src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
Remove $(LIB_CLOCK_GETTIME). These functions now use
gethrxtime instead.
* src/dd.c: Include gethrxtime.h, xtime.h.
(start_time): Now of type xtime_t, not struct timespec.
(print_stats, main): Use gethrxtime rather than gettime.
* src/ls.c (time): Remove obsolete decl.
(get_current_time): gettimeofday always returns 0, so don't
check its result.
* src/shred.c: Include gethrxtime.h.
(isaac_seed): Use gethrxtime rather than a mishmash.
* src/touch.c (time): Remove obsolete decl.
* tests/misc/split-fail: Don't assume that the current host
supports integers wider than 32 bits. Fix comment typo.
* tests/od/x8: Likewise.
* src/chown-core.c (enum RCH_status): Remove trailing comma,
as it's not valid in standard C89.
2005-02-15 Jim Meyering <jim@meyering.net>
* src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
so that file systems of type `xfs' are recognized as such.
* src/fs.h: Regenerate.
Reported by Bernd Eckenfels.
* src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
* src/fs.h: Regenerate.
Reported by Andreas Schwab.
* src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
to work around the invalid definition from Darwin 7.7.0.
Test failure reported by Sébastien Maret.
2005-02-14 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (mergefps): Use binary search rather than linear one
when comparing new line to lines already in main memory.
Idea suggested by James Lemley.
2005-02-09 Jim Meyering <jim@meyering.net>
* src/copy.c (valid_options): Add an assertion that
not both hard_link and symbolic_link are set.
2005-02-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document stat -f -c %S, plus changes to default formats.
* doc/coreutils.texi (stat invocation): Normalize terminology,
capitalization, and sort order to match --help output. Mention %c
for file systems. Add new -f -c format %S, and document %s versus %S;
problem reported by Jeroen van Wolffelaar.
* src/stat.c (usage): Likewise.
(STATFS_FRSIZE): New macro.
(print_statfs): Use it, for stat -f -c %S.
(do_statfs): Change default formats to output %S.
2005-02-03 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h: Include "memrchr.h".
(memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
2005-02-02 Jim Meyering <jim@meyering.net>
* tests/du/8gb: Also adjust the test (s/64/128/) to detect
systems that don't support sparse files.
Check for $2 -ge 128, rather than $2 = 128, in case
there is a file system type that doesn't support sparse files,
yet for which metadata takes up additional space.
Both reported by Andreas Schwab.
2005-02-01 Eric Blake <ebb9@byu.net> (tiny change)
* tests/du/8gb: Create a larger test file, so we properly
detect that sparse files can be created on NTFS under cygwin.
2005-01-30 Jim Meyering <jim@meyering.net>
* src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
* src/stty.c: Remove unnecessary parentheses in all #if directives.
2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
* .cvsignore: Ignore config.cache and config.status.lineno.
* src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
instead of VSWTCH, for use with CSWTCH.
2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
* tests/Makefile.am (.PHONY): Add check-root and root-hint.
* tests/rwx-to-mode: Ignore ACL designation.
* tests/setgid-check: Likewise.
* tests/chown/separator: Quote user and group names.
2005-01-24 Jim Meyering <jim@meyering.net>
* src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
Suggestion from Johan Boule.
2005-01-17 Eric Blake <ebb9@byu.net> (tiny change)
* src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
duplicates.
* man/Makefile.am (all_programs): Revert previous patch; updated
all_programs.list fixes this.
(.x.1): No need to add $(EXEEXT).
2005-01-03 Corinna Vinschen <corinna@vinschen.de> (tiny change)
* src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
available.
2005-01-22 Jim Meyering <jim@meyering.net>
* Makefile.maint (v_etc_file): The version string has moved to
version-etc-fsf.c, search that new file, not version-etc.c.
2005-01-17 Paul Eggert <eggert@cs.ucla.edu>
* tests/group-names: Use numeric group ids, not symbolic group names,
since the latter can have shell metacharacters in them (e.g., spaces).
Problem reported by Eric Blake.
* tests/chgrp/basic: Assume groups are numeric, not symbolic.
* tests/chgrp/deref: Likewise.
* tests/chgrp/posix-H: Likewise.
* tests/chgrp/recurse: Likewise.
2005-01-15 Jim Meyering <jim@meyering.net>
* src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
because just calling gethrtime evokes an `illegal instruction'
failure when compiled with Sun's c89 on Solaris 8 and 9.
Reported by Nelson Beebe.
* src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
twice with the same value of `t'.
Replace nested #if-#else blocks with #if-#elif-#elif chain.
2005-01-14 Jim Meyering <jim@meyering.net>
The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
* src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
sockets, since that's what you get when reading from a command-line-
supplied pipe on Darwin 7.7.
(IS_PIPE_LIKE_FILE_TYPE): Define.
(main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
Reported by Nelson Beebe.
This same change is also required on NetBSD/sparc-1.5.
Reported by Adrian Bunk.
* src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
rather than suffering silently.
Before, expr would silently overflow and wrap around:
$ expr 9223372036854775808 = 0 # $(echo 2^63|bc)
1
Now it detects the problem and exits nonzero:
$ ./expr $(echo 2^63|bc) = 0
./expr: 9223372036854775808: integer is too large
* tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
failure, so that doesn't cause `make check' to stop. Nelson Beebe
reported that this test would fail with the diagnostic,
`cannot find name for group ID 10', on one of his systems.
2005-01-13 Jim Meyering <jim@meyering.net>
* src/test.c (is_int): Don't overflow when evaluating integer
constants. Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
would print `FAIL'.
* tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
names of temporary files that would clash on 8.3 file systems.
* tests/mk-script (validate): Likewise.
2005-01-12 Jim Meyering <jim@meyering.net>
* tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
* tests/tr/Test.pm (repeat-xC): Change test name from
`repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
Reported by Eric Blake.
(repeat-000): Rename to `repeat-zeros' for the same reason.
2005-01-11 Jim Meyering <jim@meyering.net>
* configure.ac: Update version to 5.3.1.
2005-01-11 Eric Blake <ebb9@byu.net>
* src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
* man/Makefile.am (all_programs): Account for $(EXEEXT).
2005-01-11 Jim Meyering <jim@meyering.net>
* src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
with decreasing values.
* src/expand.c (main): Likewise.
* src/unexpand.c (main): Check for overflow in tabstop values
specified via the obsolete form. E.g., now this command fails:
_POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
* tests/unexpand/basic-1 (obs-ovflo): New test for this.
2005-01-10 Paul Eggert <eggert@cs.ucla.edu>
Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
* NEWS: Document the changes.
* doc/coreutils.texi (pathchk invocation): Likewise.
* src/pathchk.c (PORTABILITY_OPTION): New constant.
(longopts, usage, main, validate_file_name):
Add support for new -P option.
Reject empty file names (unless -p is not specified and the
current system allows empty file names).
Change --portability so that is now equivalent to -p -P.
Don't test whether file name is too long, if it is known to exist.
(no_leading_hyphen): New function.
* tests/misc/pathchk1: Add tests for empty file names and
pathchk -P.
2005-01-08 Jim Meyering <jim@meyering.net>
* Version 5.3.0.
`pr --columns=N' was not equivalent to `pr -N' when also using
either -s or -w.
* src/pr.c (main): Set `explicit_columns' for --columns=N,
not just for -N. This bug has existed since the introduction
of the --columns=N option on 1998-08-15.
* NEWS: Document this.
* tests/pr/Test.pm (test_vector): For each -N test, automatically
create a new test vector using --columns=N.
2005-01-07 Paul Eggert <eggert@twinsun.com>
* src/pr.c (main): Check for column count overflow with
usages like "pr -2147483648".
2005-01-07 Jim Meyering <jim@meyering.net>
* src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
2005-01-06 Jim Meyering <jim@meyering.net>
* README: List the precise HP-UX version numbers that are affected.
Suggestion from Bob Proulx.
* Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
predicate before `-name ChangeLog' to avoid a harmless warning
from find-4.2.10.
2005-01-05 Jim Meyering <jim@meyering.net>
* tests/help-version: Punt on the uptime test, since it fails when
it can't get boot time, and I don't want that to stop `make check'.
* src/du.c (process_file): Evaluate exclusion rules against
the entire file name, not just the last component.
Reported by Robert Lindgren.
* tests/du/exclude: Test for this.
* NEWS: Document this.
Ensure that tests/Makefile.am's check-root actions stay up to date.
* Makefile.maint (sc_root_tests): New rule.
(syntax-check-rules): Add it to the list.
2005-01-04 Jim Meyering <jim@meyering.net>
* man/shred.x: Change one-line summary to reflect that shred does
not remove files by default. Suggestion from Helen Faulkner in
http://bugs.debian.org/288552
* README: Request VERBOSE=yes output when reporting test failures.
Other minor changes.
* tests/Makefile.am (check-root): Update.
2005-01-03 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h: Undo previous change; we now use Autoconf.
2005-01-03 Jim Meyering <jim@meyering.net>
* tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems. Setting
either (or both) to zero would succeed, but subsequent `stty size'
would say `no size information for this device' due to the ioctl
failing with EINVAL.
* src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
then fail at compile-time rather than let tools like od produce
invalid results at run time.
2004-12-21 Jim Meyering <jim@meyering.net>
* src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
not `xx01, xx02, ...'.
Reported by Matt Kraai in http://bugs.debian.org/286605
* tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
when using c89.
2004-12-20 Paul Eggert <eggert@cs.ucla.edu>
* src/split.c (usage): Mention default size. Suggested by Dan Jacobson.
2004-12-19 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Mention that one should eval "`dircolors`" rather than
`dircolors`.
2004-12-17 Jim Meyering <jim@meyering.net>
* tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
so temporary directories aren't left behind upon e.g., interrupt.
2004-12-16 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (print_dir): Use "%s: not listing already-listed
directory", not "not listing already-listed directory: %s", to
format already-listed directories, to be consistent with other
diagnostics involving file names and colons.
2004-12-15 Jim Meyering <jim@meyering.net>
* src/Makefile.am (__LDADD): Define, so that building `[' on
Solaris still uses the -lgen library that it requires in order
to get a definition of eaccess.
2004-12-14 Jim Meyering <jim@meyering.net>
tac would exit immediately upon I/O or temp-file creation failure.
Now it continues on, processing any remaining command line arguments.
* src/tac.c: Include quotearg.h.
Use quotearg_colon in most diagnostics.
(copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
failure. Before, this command (with /full/tmp being a full partition)
TMPDIR=/full/tmp ./tac /proc/modules tac.c
would exit immediately upon the write error while trying to copy
non-seekable /proc/modules to the full partition. Now it still
reports the failure but continues on with the remaining file.
(tac_nonseekable): Return false also if copy_to_temp fails.
[DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
using atexit like this is wrong.
* NEWS: Document this.
* tests/misc/tac-continue: New test for this.
* tests/misc/Makefile.am (TESTS): Add tac-continue.
* tests/chown/basic: Add a few more tests.
2004-12-13 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (gobble_file): Change arg name to be command_line_arg
rather than explicit_arg, for consistency with copy.c.
(extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
it is deducible from dirname arg. All callers changed.
(extract_dirs_from_files, print_dir, queue_directory):
Add command_line_arg arg. All callers changed.
(struct pending): Add command_line_arg member.
(main): Use NULL rather than 0 when appropriate.
(set_exit_status, file_failure): New functions.
(queue_directory): Store command_line_arg into new structure.
(print_dir, gobble_file, get_link_name):
Use file_failure to report problems in accessing files,
so that the exit status is set consistently.
(print_dir): Simplify readdir failure code yet again.
If closedir fails, report "closing directory" rather than "reading
directory" failure.
(xstrcoll): Use set_exit_status to set status on failure.
* tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
not status 1.
2004-12-11 Jim Meyering <jim@meyering.net>
Avoid a race condition vulnerability in chown, when used with
--from=O:G and without the (-h) --no-dereference option.
* src/chown-core.c (restricted_chown): New function.
(change_file_owner): Call it.
Reported by Ulrich Drepper.
* NEWS: Mention this.
2004-12-09 Paul Eggert <eggert@cs.ucla.edu>
* ls now exits with status 1 on minor problems, 2 if serious trouble.
* NEWS: Document this.
* src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
specified below.
(main): Initialize exit failure to LS_FAILURE.
(print_dir, gobble_file, get_link_name, xstrcoll):
Set exit status to LS_MINOR_PROBLEM if the failure is minor.
(print_dir): Do not give up on entire directory merely because readdir
returns EOVERFLOW.
(usage): Explain exit status.
* tests/help-version: ls and variants now exit with status 2
on serious trouble.
2004-12-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document new UTC+HH:MM date syntax, and put date changes
together.
2004-12-07 Paul Eggert <eggert@cs.ucla.edu>
* src/factor.c (factor): Don't list 1 as a factor of 1.
Problem reported by Thomas Folz-Donahue.
2004-12-06 Jim Meyering <jim@meyering.net>
* tests/du/files0-from: Sanitize environment.
Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
setting is the default (exported from /etc/profile) on at least one
NetBSD 1.6 system.
* tests/du/no-deref: Likewise.
* tests/cp/symlink-slash: Likewise.
* tests/ls/symlink-slash: Likewise
2004-12-05 Jim Meyering <jim@meyering.net>
* tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
_POSIX2_VERSION=199209 is in the environment, or when building on
e.g., OpenBSD 3.2.
2004-12-04 Jim Meyering <jim@meyering.net>
* NEWS: Mention cut's new --complement option.
2004-10-01 Paolo Bonzini <bonzini@gnu.org>
* cut.c (complement, COMPLEMENT_OPTION): New.
(longopts): Add --complement.
(usage): Say not that -b, -c, and -f `print' fields,
but rather that they `select' fields for printing.
Describe the new --complement option.
(mark_range_start): Extracted from set_fields.
(print_kth): Support --complement.
(compare_ranges): New function.
(set_fields): Rewrite the part that populates range_start_ht,
merging it with the part that populates printable_field.
(main): Handle --complement.
2004-12-03 Paul Eggert <eggert@cs.ucla.edu>
* src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
failed. This works around an assertion failure reported by
Roberto Nibali in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
2004-12-02 Jim Meyering <jim@meyering.net>
With using --color and with LS_COLORS saying not to color
executables, don't stat every file.
* src/ls.c (is_colored): New function.
(gobble_file): Use it.
(main): Use it here, in place of too-strict tests against NULL:
if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
old test would fail.
2004-12-01 Paul Eggert <eggert@cs.ucla.edu>
* src/comm.c (compare_files): Assume setlocale exists.
* src/join.c (keycmp): Likewise.
* src/seq.c (decimal_point): Treat like sort. Now char.
All uses changed.
(main): Assume localeconv exists. Use same code as sort.
* src/sort.c (C_DECIMAL_POINT): Remove. Use changed to '.'.
Assume setlocale exists.
(thousands_sep): Renamed from th_sep.
(IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons.
(NONZERO): Parenthesize use of arg.
(numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for
consistency. Avoid unnecessary negation by reversing
fraccompare args.
(main): Rewrite localeconv call to match seq.c.
* src/system.h: Assume locale.h exists.
(HAVE_SETLOCALE): Remove.
* src/uniq.c (different): Assume setlocale exists.
* src/ls.c (sort_files): Minor cleanup. Remove an unnecessary
'volatile' on a local variable. Rewrite to avoid unnecessary
double-assignment to 'func' in the usual case where strcoll does
not fail.
2004-11-30 Paul Eggert <eggert@cs.ucla.edu>
* src/pinky.c (gethostname): Remove decl.
(scan_entries): Use IS_USER_PROCESS instead of by-hand code.
* src/uptime.c (print_uptime): Use IS_USER_PROCESS and
UT_TYPE_BOOT_TIME instead of by-hand code.
* src/users.c (list_entries_users): Use IS_USER_PROCESS
instead of by-hand code.
* src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
(IS_USER_PROCESS): Move to ../lib/readutmp.h.
(UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
(gethostname): Remove decl.
(list_entries_who, scan_entries): Use the new macros defined above,
for consistency with pinky, uptime, and users.
2004-11-25 Paul Eggert <eggert@cs.ucla.edu>
Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
HP's ANSI C compiler. Declaring int functions causes warnings on
some modern systems and shouldn't be needed to compile on ancient
ones.
* src/copy.h (stat, lstat, rename): Remove decls.
* src/install.c (stat): Remove decl.
* src/ln.c (link, symlink): Remove decls.
2004-11-25 Jim Meyering <jim@meyering.net>
* man/help2man: Import help2man-1.35.1.
* man/Makefile.am (.x.1): Remove now-unnecessary use of
locally-added --program-name=NAME option. Now, help2man gets
the name from the [NAME] section (i.e. from our .x file).
* man/install.x: Use `install', not `ginstall' in the one-line
description. Reported by Brendan O'Dea.
* man/sha1sum.x: Use `sha1sum', not `shasum'.
2004-11-24 Jim Meyering <jim@meyering.net>
Since the changes of 2004-05-22, the u.saved_cwd member at
the bottom of the active-directory stack was no longer
strictly necessary. This change removes that member and uses
the newer cwd_state parameter for the final restore_cwd.
* src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
[dev_ino]: Rename from `a'.
(AD_pop_and_chdir): Add a parameter to play the role of just-removed
bottom-of-stack cwd-state member.
(AD_pop_and_chdir): No longer return boolean. Adjust caller.
(AD_push_initial): Remove CWD parameter. Adjust caller.
2004-11-23 Paul Eggert <eggert@cs.ucla.edu>
Minor performance improvements and cleanups for "touch".
* src/touch.c (posix_date): Remove; not needed as a static var.
All uses rewritten.
(touch): Use new futimens function to operate more efficiently
in some cases. Don't stat/fstat existing file when
(!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
old time stamps aren't needed in that case.
(main): change_times is int, not bool. Simplify test for
change_times.
2004-11-20 Paul Eggert <eggert@cs.ucla.edu>
* src/install.c (usage): Avoid usage that runs afoul of Docbook
translation. Problem reported by Eric S. Raymond.
Restore dd's noctty flag, reverting the change of 2004-04-08.
POSIX does not allow "dd" to use O_NOCTTY by default.
* NEWS: Add noctty flag to dd.
* doc/coreutils.texi (dd invocation): Likewise.
* src/dd.c (flags, usage, main): Likewise.
2004-11-19 Alfred M. Szmidt <ams@gnu.org>
* src/ls.c (usage): Clarified description of --no-group (-G),
--human-readable (-h), --inode (-i), --size (-s), --time,
and --time-style.
2004-11-19 Jim Meyering <jim@meyering.net>
* src/ls.c (usage): Clarify description of --author.
Tweak indentation so that help2man creates better nroff.
Reported by Dan Jacobson.
* src/uniq.c (check_file): Don't check stdout for errors here.
* src/pwd.c (find_dir_entry): Update comment to match reality.
2004-11-18 Jim Meyering <jim@meyering.net>
* src/pwd.c (robust_getcwd): Correct the comment: this function
constructs the directory name. The caller prints it.
2004-11-16 Paul Eggert <eggert@cs.ucla.edu>
* src/stat.c (STATFS): New macro, for portability to Solaris 9.
(do_statfs): Use it.
* src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
* src/readlink.c (main): argv is not const.
* src/cut.c (usage): Improve documentation along the lines suggested
by Debian 5.2.1-2.
* src/echo.c (usage): Likewise.
* src/expr.c (usage): Likewise.
* src/dircolors.hin: Add putty, screen-bce.
* src/pinky.c (print_entry): Fix memory leak.
* src/who.c (print_user): Likewise.
2004-11-15 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: New dd operand "status=noxfer".
* src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
macros.
(STATUS_NOXFER, statuses): New constants.
(usage, print_stats, scanargs): Add support for status=noxfer.
(usage): Update status output to match new behavior.
(print_stats): Always output complete byte count.
Put space between numbers and units, as SI requires.
Use ngettext so that i18n can use plurals for "byte" and "second".
Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
(iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
the string.
* tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
problems with regression testing.
2004-11-14 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: dd now outputs total bytes, seconds, and bytes per second.
* src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
* src/dd.c: Include "human.h".
(w_bytes, start_time): New vars.
(usage): Document new I/O statistics output
(print_stats): Output new I/O statistics.
(cleanup): Do statistics after closing stdin and stdout, so that
the times are more accurate.
(write_output, dd_copy): Count output bytes.
(main): Get initial value of clock.
2004-11-14 Jim Meyering <jim@meyering.net>
Backslash-escape `-'s in email addresses, so that they are
rendered properly in UTF-locales.
* man/help2man (escape_hyphens): New function.
(main): Call it on email addresses.
* src/sort.c (zaptemp): Mark new diagnostic for translation.
* tests/misc/close-stdout: New file. Test today's closeout.c change.
* tests/misc/Makefile.am (TESTS): Add close-stdout.
2004-11-13 Jim Meyering <jim@meyering.net>
* src/test.c (usage): Put the description of `[-n] STRING'
on two lines, one for `-n STRING' and one for `STRING' so that
help2man properly escapes the `-'. Otherwise, the hyphen is
rendered inappropriately in UTF-8 locales.
Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
2004-11-12 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document the following changes.
* src/sort.c: Avoid O(N**2) behavior when there are many temporary
files.
(temptail): New variable, so that we can easily append to list.
(create_temp_file): Create new files at end of list, so that
searching the list has O(N*NMERGE) behavior instead of O(N**2).
(zaptemp): Update temptail if needed.
(mergefps, merge): Accept new arg that counts temp files, and keep it
up to date as we create and remove temporaries. This is for
efficiency, so that we don't call zaptemp so often.
All callers changed.
(sort): Don't create array in reverse order, since the list of
temporaries is now in the correct order.
(zaptemp): Protect against race condition: if 'sort' is
interrupted in the middle of zaptemp, it might unlink the
temporary file twice, and the second time this happens the file
might already have been created by some other process.
(zaptemp): Warn if a temporary file is not removed.
(create_temp_file): Use offsetof for clarity.
(die): Move it up earlier, to clean up the code a bit.
* src/pr.c (strtoumax): Declare if not declared.
(skip_to_page, first_page_number, last_page_number, page_number,
first_last_page, print_header):
Use uintmax_t for page numbers.
(first_last_page): Remove unnecessary forward declaration.
Do not modify arg (it is now a const pointer).
Return a true if successful, false (without print a diagnostic)
otherwise.
(main): If +XXX does not specify a valid page range, treat it
as a file name. This follows the response to Open Group XCU ERN 41
<http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
which says the behavior is allowed.
(skip_to_page): When starting page number exceeds page count,
print both numbers in the diagnostic.
(print_header): Detect page number overflow.
2004-11-07 Jim Meyering <jim@meyering.net>
* src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
(main) [__APPLE__]: Get the processor type via syscall rather than
hard-coding "powerpc". From Toby Peterson.
* src/sort.c (merge): Remove declarations of now-unused variables.
2004-11-06 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (first_same_file): Remove. Move most of the code to....
(avoid_trashing_input): New function.
(merge): Avoid some silly merges, e.g., copying a single file to
a temporary file when there are exactly 17 input files to merge.
Take a count of temporary files rather than a max_merge arg.
All uses changed.
2004-11-06 Jim Meyering <jim@meyering.net>
* src/sort.c (xfclose): Don't close stdout here (just flush it),
since close_stdout now closes stdout unconditionally.
2004-11-05 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
first_same_file, merge, sort, main): Use size_t for indexes to arrays.
This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
temporary files).
(getmonth, keycompare, compare): Rewrite to avoid need for alloca,
thus avoiding unchecked stack overflow in some cases. As a side
effect this improve the performance of "sort -M" by a factor of 4
on my benchmarks.
2004-11-03 Paul Eggert <eggert@cs.ucla.edu>
* src/stty.c: Include "vasprintf.h" since we use vasprintf now.
* src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
expression; it's not portable. Problem reported by Albert Chin.
Don't invoke a program more than once.
* src/groups.sh (version): New variable, containing author info,
for benefit of AUTHORS check. Use it when acting on --version option.
* AUTHORS: Remove duplicate lines. Remove bogus "chroot:"
in groups line.
* src/system.h: Don't #define and #undef getopt around <stdlib.h>,
as this breaks the new regime that does "#define getopt rpl_getopt".
Problem reported by Albert Chin for Solaris 9 with Sun cc in:
http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
I suppose this may cause problems on ancient hosts with
incompatible getopt declarations, but we'll cross that bridge if
the problem gets reported to us by someone who can test the fix.
2004-11-03 Jim Meyering <jim@meyering.net>
* src/tac.c: quote(...) file names in diagnostics.
2004-10-29 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document getdate changes.
2004-10-29 Jim Meyering <jim@meyering.net>
* src/tac.c (tac_file): Remove temporary prototype and move this
function `down' so that it precedes definition of tac_nonseekable.
`tac /proc/modules' would print nothing
Reported by Harald Dunkel in http://bugs.debian.org/278604.
* src/tac.c (copy_to_temp): Renamed from save_stdin, since
now it copies a general file descriptor, not just stdin.
(tac_nonseekable): Renamed/adapted from tac_stdin.
(tac_file): Get fd via `open' directly rather than via fopen/fileno,
since we never used the stream. Perform "-" to stdin mapping here
rather than in main. Determine whether a file is seekable,
by trying to `lseek' to its end, and dispatch to tac_seekable or
tac_nonseekable accordingly.
(main): Rewrite argument handling now that it uses only tac_file.
* NEWS: Mention it here.
2004-10-21 Jim Meyering <jim@meyering.net>
* tests/mv/leak-fd: New file.
* tests/mv/Makefile.am (TESTS): Add it.
* tests/rm/dot-rel: New file.
* tests/rm/Makefile.am (TESTS): Add it.
Correct my patch of 2004-10-18.
* src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
if necessary, not in remove_dir. Otherwise, removing multiple
`.'-relative nonempty directories no longer worked.
2004-10-20 Paul Eggert <eggert@cs.ucla.edu>
* src/fmt.c (usage): Improve description of --prefix.
Problem reported by Edward Welbourne.
* man/uniq.x: Change summary so that it doesn't imply that
uniq writes to its input file. Problem reported by
Dan Jacobson.
2004-10-18 Jim Meyering <jim@meyering.net>
Plug a leak that would cause a cross-device mv to fail when
operating on too many command-line-specified nonempty directories.
* src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
top of the stack before returning. This usually closes the file
descriptor that was used to return to the original working directory.
Reported by Cyril Bouthors in
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
* NEWS: Mention it here.
* src/pathchk.c (validate_file_name): Give a more descriptive
diagnostic when pathconf fails. This also avoids an unwarranted
warning from gcc-3.3.5 about a format not being a string literal.
* src/sleep.c (main): Remove declaration of unused local, c.
* src/printenv.c (main): Likewise.
* src/logname.c (main): Likewise.
* src/uptime.c (main): Likewise, for optc.
* src/tsort.c (main): Likewise, for opt.
2004-10-17 Paul Eggert <eggert@cs.ucla.edu>
* AUTHORS: Add self to pathchk.
* src/pathchk.c (AUTHORS): Add self.
Change "path" to "file name" whenever possible.
Remove usage comment, as it was a duplication of the code or doc.
Include <wchar.h> if available.
(mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
(NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
pathconf_wrapper, portable_chars, dir_ok): Remove.
(NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
(pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
(portable_chars_only): New arg FILELEN.
Don't assume ASCII; we might be on an EBCDIC host.
Don't assume unibyte locale in diagnostic.
(component_start, component_len): New functions.
(validate_file_name): Renamed from validate_path. All uses changed.
Pretty much a complete rewrite.
Don't make copy of file arg. Always append trailing slash to
pathconf arg, just in case it's a symlink (this is pure paranoia;
we don't know of any hosts where the trailing slash is required).
Use size_t instead of long int when possible.
Avoid need to call pathconf in most practical cases.
Don't use euidaccess several times to test searchability;
just use lstat once. Reword diagnostic to put the (often very long)
file names last.
2004-10-15 Paul Eggert <eggert@cs.ucla.edu>
* src/printf.c (usage): Mention Unicode, and use H for hex digits.
2004-10-13 Jim Meyering <jim@meyering.net>
* NEWS: Mention today's fts.c fix.
2004-10-13 Paul Eggert <eggert@cs.ucla.edu>
* tests/stty/row-col-1: Set LC_ALL=C.
2004-10-12 Jim Meyering <jim@meyering.net>
* src/dircolors.hin: Add .flac and .mpc as audio suffixes.
From Jesus Climent in http://bugs.debian.org/276149.
2004-10-05 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
problems. All uses changed.
2004-10-05 Jim Meyering <jim@meyering.net>
* .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
since Karl says its trailing blanks are there to stay :-)
2004-10-04 Paul Eggert <eggert@cs.ucla.edu>
* src/expr.c (NEW, OLD): Remove, partly to avoid
reference to obsolescent macro XMALLOC.
All uses replaced by xmalloc and free.
2004-09-28 Jim Meyering <jim@meyering.net>
* src/tail.c (usage): Clarify: --retry works only with --follow=name.
Reported by Nik A. Melchior in http://bugs.debian.org/273781.
2004-09-27 Paul Eggert <eggert@cs.ucla.edu>
* src/od.c (format_address_paren): c is optional, so don't output
it if it's '\0'.
2004-09-26 Paul Eggert <eggert@cs.ucla.edu>
Add support for ls --hide. Idea suggested by Bardur Arantsson.
* NEWS: Document this.
* src/ls.c (file_ignored): Renamed from file_interesting, with
inverted return value. Accept the file name, not a struct dirent *.
All uses changed. Avoid the expense of calling fnmatch if the
file is ignorable due to leading '.'.
(all_files, really_all_files): Removed; replaced by:
(ignore): New variable. All uses changed.
(IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
New constants.
(hide_patterns): New variable.
(long_options, decode_switches, file_ignored, usage):
Add support for --hide.
(patterns_match): New function.
(usage): Replace "hide" with "ignore" in explanation, to avoid
confusion.
2004-09-25 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (gobble_file, print_long_format): Don't assume that
human-readable output has a byte count equal to its column width;
this isn't always true in locales where the radix character is not
'.' or ','.
(format_user_or_group): Revamp code to match the above fix;
this avoids the (very faint) possibility of integer overflow.
2004-09-24 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Mention that "chmod -r -w x" now works as expected.
* src/chmod.c (main): Revamp option processing to support this.
* tests/chmod/Makefile.am (TESTS): Add 'usage'.
* tests/chmod/usage: New set of tests for usage like that.
2004-09-24 Jim Meyering <jim@meyering.net>
* Makefile.maint (CVS_LIST): Use --types=AFGM option so that
it lists only cvs-controlled regular files.
* src/csplit.c (xalloc_die): Declare to be `extern', not `static'
to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
2004-09-23 Paul Eggert <eggert@cs.ucla.edu>
* Makefile.maint (CVS_LIST): New macro.
(sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
sc_trailing_blank, po-check): Use it instead of the
nonstandard "cvsu --list".
* src/tail.c (parse_obsolete_option): Bring back support
for obsolete option followed by non-obsolete, or by more
than one file. When obsolete, conform to SUSv2 rather than
original POSIX 1003.2-1992, as SUSv2 corrected the case of
"tail -c". Add support for the SUSv2 "b" modifier.
* NEWS: Mention the above.
* tests/tail/Test.pm: New test case obs-b to check the above.
err-[134] no longer need _POSIX2_VERSION=199209.
Fix comments to match revised behavior.
2004-09-22 Jim Meyering <jim@meyering.net>
* Use automake-1.9.2. Regenerate dependent files.
* src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
Improve the comment.
Clean up scoping etc. so that some make `distcheck' tests pass.
* src/csplit.c (xalloc_die): Declare to be static.
* src/chown-core.c (chown_files): Declare as `extern'.
* src/cp-hash.c (remember_created): Likewise.
* src/copy.c (copy): Likewise.
* src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
* src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
* src/unexpand.c: Likewise.
* src/Makefile.am (check-AUTHORS): New rule.
(check): Depend on it.
* AUTHORS: Update.
* Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
(sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2004-09-22 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (decode_switches): Don't compare a short value
to SIZE_MAX: GCC sometimes complains.
2004-09-21 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: The following commands now reject unknown options:
basename dirname factor hostname link nohup sync unlink yes
Also, pathchk no longer accepts trailing options.
* src/basename.c: Include <getopt.h>.
* src/chroot.c: Likewise.
* src/dirname.c: Likewise.
* src/factor.c: Likewise.
* src/hostid.c: Likewise.
* src/hostname.c: Likewise.
* src/nohup.c: Likewise.
* src/pwd.c: Likewise.
* src/setuidgid.c: Likewise.
* src/sync.c: Likewise.
* src/basename.c (main): Reject unknown options.
* src/dirname.c (main): Likewise.
* src/factor.c (main): Likewise.
* src/hostid.c (main): Likewise.
* src/hostname.c (main): Likewise.
* src/link.c (main): Likewise.
* src/nohup.c (main): Likewise.
* src/pwd.c (main): Likewise.
* src/setuidgid.c (main): Likewise.
* src/sync.c (main): Likewise.
* src/unlink.c (main): Likewise.
* src/yes.c (main): Likewise.
* src/cat.c (main): Remove unused "case 0".
* src/chgrp.c (main): Likewise.
* src/chmod.c (main): Likewise.
* src/chown.c (main): Likewise.
* src/comm.c (main): Likewise.
* src/cp.c (main): Likewise.
* src/csplit.c (main): Likewise.
* src/cut.c (main): Likewise.
* src/date.c (main): Likewise.
* src/df.c (main): Likewise.
* src/du.c (main): Likewise.
* src/env.c (main): Likewise.
* src/expand.c (main): Likewise.
* src/fold.c (main): Likewise.
* src/head.c (main): Likewise.
* src/id.c (main): Likewise.
* src/install.c (main): Likewise.
* src/join.c (main): Likewise.
* src/ln.c (main): Likewise.
* src/ls.c (decode_switches): Likewise.
* src/mkdir.c (main): Likewise.
* src/mkfifo.c (main): Likewise.
* src/mknode.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/nl.c (main): Likewise.
* src/paste.c (main): Likewise.
* src/pinky.c (main): Likewise.
* src/pr.c (main): Likewise.
* src/ptx.c (main): Likewise.
* src/readlink.c (main): Likewise.
* src/rm.c (main): Likewise.
* src/rmdir.c (main): Likewise.
* src/seq.c (main): Likewise.
* src/shred.c (main): Likewise.
* src/split.c (main): Likewise.
* src/sum.c (main): Likewise.
* src/tac.c (main): Likewise.
* src/tail.c (main): Likewise.
* src/tee.c (main): Likewise.
* src/touch.c (main): Likewise.
* src/tr.c (main): Likewise.
* src/tty.c (main): Likewise.
* src/uname.c (main): Likewise.
* src/unexpand.c (main): Likewise.
* src/wc.c (main): Likewise.
* src/who.c (main): Likewise.
* src/chroot.c (main): Use getopt where it suffices, not getopt_long.
* src/cksum.c (main): Likewise.
* src/dd.c (main): Likewise.
* src/logname.c (main): Likewise.
* src/printenv.c (main): Likewise.
* src/sleep.c (main): Likewise.
* src/tsort.c (main): Likewise.
* src/uptime.c (main): Likewise.
* src/users.c (main): Likewise.
* src/whoami.c (main): Likewise.
* src/du.c (long_options): Standardize on NULL vs 0.
* src/rm.c (long_opts): Likewise.
* src/logname.c (long_options): Remove.
* src/printenv.c (long_options): Likewise.
* src/sleep.c (long_options): Likewise.
* src/tsort.c (long_options): Likewise.
* src/uptime.c (longopts): Likewise.
* src/users.c (longopts): Likewise.
* src/whoami.c (long_options): Likewise.
* src/pathchk.c (longopts): Add --help, --version.
(main): Use longopts rather than parse_long_options.
* src/stty.c (longpts, main): Likewise.
* src/pathchk.c (main): Don't reorder arguments, so that
we can check weird file names.
* src/readlink.c: Don't include "long-options.h".
* src/sort.c: Likewise.
* src/stty.c: Likewise.
* src/split.c (verbose): Now bool, not int.
(VERBOSE_OPTION): New enum.
(longopts, main): Use it.
* tests/factor/basic: Adjust to new wording in diagnostic
that results from the above changes.
2004-09-21 Jim Meyering <jim@meyering.net>
* man/rm.x: Say "the response is affirmative" rather than "the
response begins with y or Y", so that the documentation is
accurate in non-English locales. Problem reported by Munzir Taha.
2004-09-19 Paul Eggert <eggert@cs.ucla.edu>
* src/echo.c (main): Don't pass NULL to strcmp when
POSIXLY_CORRECT and given no arguments.
* src/md5sum.c (STRING_OPTION): Remove.
(long_options, main): Remove support for undocumented and
obsolete --string option, as suggested in the 1996-09-26 patch.
* NEWS: Document this.
* tests/rm/fail-eperm: Don't try to remove writeable files in a
sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
you remove such files. Problem reported by Bert Fischer in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2004-09-18 Paul Eggert <eggert@cs.ucla.edu>
* src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
(long_options, main): Use them instead of magic numbers 2 and 1.
For --string, optarg can't possibly be NULL.
* src/dd.c (usage): Distinguish between options and operands.
(scanargs): Don't mess with argc, argv; getopt_long handles this now.
Say "operands" for operands, not "options".
(main): Use getopt_long, so that "dd --" works as POSIX requires.
* tests/dd/misc: Check for "dd --".
* src/chroot.c (main): Reject unknown options instead of
interpreting them as a directory to chroot to.
* src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
The current standard (POSIX 1003.1-2004) is correct.
(crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
collision with builtin function.
(main) [defined CRCTAB]: Output in lowercase hexadecimal, and
output the first 0 as 8 digits, to make it easier to compare to
the text of the standard. Output crctab to be a const array.
(crctab): Use result of above changes.
(long_options): Remove; not needed if empty.
(main): getopt_long can't return 0 here, so simplify the code.
2004-09-13 Jim Meyering <jim@meyering.net>
* src/Makefile.am (localedir.h): Don't redirect directly to target.
2004-09-13 Paul Eggert <eggert@cs.ucla.edu>
* src/id.c (print_full_info): Don't exit with failure status simply
because a user or group number can't be turned into a name.
Problem reported by Felipe Kellermann in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2004-09-12 Jim Meyering <jim@meyering.net>
* Makefile.maint (my-distcheck): When building with -Werror, also
require -Wshadow.
2004-09-10 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
* src/tail.c (parse_obsolete_option): Renamed from
parse_obsolescent_option, since the options are obsolete now.
Remove bool *arg; just exit if there's an error. Revamp to follow
POSIX 1003.2-1992 more precisely, to handle cases like "tail -
file" and "tail -10 -- file" correctly when we are conforming to
the older standard.
(main): Adjust to this change.
* tests/tail/Test.pm (test_vector): minus-* requires
_POSIX2_VERSION=199209 now, to work correctly if there is
an input file. err-1 and err-3 no longer errors if there
is another file.
2004-09-09 Paul Eggert <eggert@cs.ucla.edu>
* src/test.c (usage): Document -r, -w, -x more carefully.
2004-09-08 Paul Eggert <eggert@cs.ucla.edu>
* src/test.c (usage): Document "test" (with no args) and "[ ]".
Document that -h and -L don't dereference.
* NEWS: Document that "tr xy -z" now works as per POSIX.
Sort the descriptions.
* src/tr.c (main): Don't reorder options.
* tests/tr/Test.pm (fowler-1): New test case.
2004-09-06 Paul Eggert <eggert@cs.ucla.edu>
* src/touch.c (main): Fix POSIX-conformance bug: "touch --
MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
conforming to pre-2001 POSIX.
* NEWS: Document this.
* tests/touch/obsolescent: Test for this bug. Also, set
_POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
a better test for obsolescent features.
* src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
"sort -y abc" is like "sort abc" whereas "sort -y 100" is like
plain "sort".
* src/od.c: Several changes for POSIX and FreeBSD compatibility.
(COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
(long_options, main): --strings is now -S, not -s.
(usage): Reflect the usage changes.
(parse_old_offset): Do not issue a diagnostic on failure;
callers now do this as necessary.
(main): Support POSIX syntax. Remove unused case 0 from getopt_long.
Add support for new short options (many undocumented) for
compatibility with FreeBSD. Remove FIXME for -s; it's now
POSIX-compatible. Default format is now oS, not o2.
* NEWS: Describe the above.
2004-09-05 Paul Eggert <eggert@cs.ucla.edu>
* src/stty.c (valid_options): Remove.
(main): Fix some bugs in handling invalid option-combinations
like "stty -F".
(recover_mode): Arg is now char const *, not char *.
(main): Use STDIN_FILENO, not 0.
Simplify option-parsing code a tad.
* tests/stty/basic-1: Check for the fixed bugs.
2004-09-03 Paul Eggert <eggert@cs.ucla.edu>
* src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
it from ever being nonzero. Reported by Pozsar Balazs in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
(human_fstype): Add ramfs, squashfs, sysfs.
Reported by Pozsar Balazs in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
(human_fstype): Return char const *, not char *.
Simplify internals a bit, and avoid casts.
* src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
(bit_count): Remove. All uses changed to....
(multiple_bits_set): New function.
(scanargs): Use it, and check separately for each set of
incompatible options, to improve diagnostics.
(MX): Remove.
(apply_translations): Move checks for incompatible options
to scanargs, so that they're done consistently.
2004-09-02 Paul Eggert <eggert@cs.ucla.edu>
Output correct errno-related diagnostic on "paste" I/O errors.
* src/paste.c (write_error, xputchar): New functions.
(paste_parallel): Use correct errno value after input error.
(paste_parallel, paste_serial): Report errno value after output error.
Port to diet libc. Problem reported by Felix von Leitner in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
* src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
it's not portable C to assume FILE is a complete type.
(paste_parallel): Use index test instead of ENDLIST, and NULL
instead of CLOSED.
2004-08-24 Paul Eggert <eggert@cs.ucla.edu>
POSIX-conformance fixes for "expand" and "unexpand".
Also, consistently use "tab stop" rather than "tabstop".
* NEWS: Document fixes.
* src/expand.c: Revamp to resemble the new unexpand.c better.
(usage): -i does not convert tabs after non-tabs.
(add_tab_stop): Renamed from add_tabstop. All uses changed.
(parse_tab_stop): Renamed from parse_tabstop. All uses changed.
(validate_tab_stop): Renamed from validate_tabstop. All uses changed.
(next_file, main): Check fclose against 0, not EOF.
(expand): Remove unnecessary casts.
Add another loop nesting level, for lines, so that per-line variables
are initialized cleanly.
Revamp tab checking. Check for write error immediately, rather
than just once at the end of the program.
* src/unexpand.c: Lkewise (for the expand.c changes).
(TAB_STOP_SENTINEL): Remove.
(tab_size): Now size_t, not uintmax_t, since we need to store
the sequences of blanks.
(max_column_width): New var.
(usage): Say "blank" where POSIX requires this.
(add_tab_stop): Calculate maximum column width.
(unexpand): Store the pending blanks, instead of merely counting them.
Follow POSIX's rules about -a requiring two blanks before a tab stop.
Get rid of internal label and goto.
* tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
Add blanks-1 through blanks-13.
2004-08-19 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
succeed without changing the uid and gid, like FreeBSD.
* src/chgrp.c (parse_group): Return gid_t rather than storing it
through a pointer. Treat "chgrp '' file" as a no-op change,
as FreeBSD does.
(main): Set chopt.group_name to NULL if the group is the empty
string.
* src/chown-core.c (describe_change): Describe changes to -1:-1
without using "to OWNERSHIP" phrase.
* src/chown.c (usage): "chown '' file" is now allowed.
(main): Do not set user name to the empty string if the group
name is null.
* tests/chgrp/basic: Test "chgrp '' file".
* tests/chown/Makefile.am (TESTS): Add separator.
* tests/chown/separator: New file, partly taken from
Dmitry V. Levin's suggestion in
<http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
* tests/install/basic-1: Test for the -d regression.
2004-08-11 Dmitry V. Levin <ldv@altlinux.org>
* src/install.c (main): Fix -d regression introduced with
--target-directory support at 2004-06-25.
2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.c (copy_internal): When preserving links, unlink
a destination with link count greater than one. This is so
that commands like "cp -a" don't get confused when copying into
a destination that already contains many hard links. Problem
reported by Tim Waugh in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2004-08-10 Paul Eggert <eggert@cs.ucla.edu>
Convert all files to UTF-8.
* tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
* tests/sort/Test.pm (16a): Likewise.
* tests/uniq/Test.pm (8): Likewise.
* tests/misc/printf-hex: Use ASCII, not Latin-1.
* NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
* src/shred.c (usage): "-" is an operand, not an option.
* src/sort.c (die, xfopen, mergefps, first_same_file, merge):
A null file arg means standard output.
(main): "-o -" means to write to a file named "-",
not to standard output.
* src/tee.c (usage, tee): "tee -" writes to standard output, not
to a file named "-".
2004-08-10 Dmitry V. Levin <ldv@altlinux.org>
* src/install.c (change_timestamps): Fix int->bool conversion
bugs introduced on 2004-07-29.
2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
* src/shred.c (wipename): Work even if the directory is writeable
and not readable. Prefer write access, since this should work
better with fdatasync.
* src/csplit.c (xalloc_die): New function.
(main): Remove now-obsolete initialization of xalloc_fail_func.
* src/md5sum.c: Adjust to sha->sha1 renaming.
2004-08-08 Dmitry V. Levin <ldv@altlinux.org>
Minor code cleanup.
* src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
(can_mode): Make variable local.
2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
Do not define, to avoid annoying compiler messages on QNX 6.3.
Problem reported by Johan in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2004-08-04 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
Define to a concatenation of string literals, not to an expression;
needed for concatenation contexts.
(INTMAX_MAX, INTMAX_MIN): New macros.
* src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
unsigned long; this isn't true for st_ino on Solaris 9.
2004-08-03 Paul Eggert <eggert@cs.ucla.edu>
* src/uname.c: Do not depend on HAVE_SYSCTL when deciding
whether to include files. Include <sys/param.h> if
HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
(main) [defined __POWERPC__]: Add a kludge to work around a
Mac OS X bug, so that uname -p defaults to "powerpc" if
sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
fails. Problem reported by Petter Reinholdtsen in:
http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
* src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
main): Use bool for booleans.
(writeline, check_file): Use uintmax_t for line counts.
(check_file): Check for and report line number overflow,
when that matters.
* src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
(print_lines, print_words, print_chars, print_bytes, print_linelength,
have_read_stdin, wc, wc_file, main):
Use bool for booleans.
(exit_status): Remove.
(wc, wc_file): Return bool status. All callers changed.
* src/who.c (scan_entries): 0 -> STDIN_FILENO.
* src/whoami.c (main): Print uids using unsigned long int, not
unsigned int.
* src/unexpand.c: Int cleanup and minor reorganization to be more
like src/expand.c.
Include quote.h, xstrndup.h.
(TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
(convert_entire_line, have_read_stdin, parse_tabstops, next_file,
unexpand, main):
Use bool for booleans.
(tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
Use uintmax_t for column counts.
(first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
(add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
as a tab stop.
(parse_tabstops): Don't use ISBLANK on possibly-signed char.
Detect overflow in tab stop string.
(next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
(unexpand): Concatenate input files the same way expand does.
* src/touch.c (no_create, use_ref, posix_date, amtime_now,
touch, main): Use bool for booleans.
(main): Avoid integer overflow when given more than INT_MAX
options.
* src/tsort.c (struct item, n_strings): Use size_t for sizes.
(have_read_stdin, count_items, scan_zeros, detect_loop,
recurse_tree, walk_tree, tsort, main):
Use bool for booleans.
(exit_status): Remove.
(tsort): Return a success flag instead of storing into a global.
(main): Use it.
* src/tty.c (silent, main): Use bool for booleans.
(main): 0 -> STDIN_FILENO.
* src/uname.c (print_element): Use bool for booleans.
* src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
Remove. All uses replaced by C99 boolean primitives.
(TEST_TRUE, TEST_FALSE): New constants, for readability.
(test_unop, binop, unary_operator, binary_operator, two_arguments,
three_arguments, posixtest, expr, term, and, or, is_int, age_of,
one_argument, main): Use bool for booleans.
(advance, unary_advance): Now inline procedures rather than a macros.
(is_int): Renamed from isint, to avoid namespace clash with ctype.h.
(term, and, or): When it's easy, loop instead of recursing.
(term): Avoid integer overflow if there are INT_MAX-3 args (!).
(binary_operator, unary_operator): Simplify by systematically rewriting
true==FOO to FOO (where FOO is a boolean).
(unary_operator): Don't consider a file to be a regular file
merely because its mode&S_IFMT is zero. Just use S_ISREG.
Remove unnecessary casts. Remove ifdefs for things like
S_ISSOCK that are no longer needed, since stat-macros.h always
defines them now.
* src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
Use bool for booleans.
(buf_init_from_stdin, buf_free, find_bol, print_line):
Use size_t for sizes.
* src/tac.c (separator_ends_record, tac_seekable, tac_file,
tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
(match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
(tac_seekable): Use ptrdiff_t for pointer subtraction.
Report an error if the result is out of range.
(tac_seekable, main): Check for integer overflow in buffer size
calculations.
(main): Remove unnecessary casts.
* src/su.c (run_shell): Pass a new n_additional_args arg, so that
the callee doesn't have to count 'em. All callers changed.
Don't allocate more space for the arg vector than we'll need.
Use memcpy to copy the args rather than rolling our own loop.
Use size_t for sizes.
(fast_startup, simulate_login, change_environment, log_su,
correct_password, restricted_shell, main): Use bool for booleans.
(longopts): Don't assume change_environment is an int.
Use NULL, not 0, for pointers.
(xsetenv): New function, replacing xputenv and concat.
All callers changed.
(elements): Remove; no longer needed.
(log_su, correct_passwd, main): Prefer !x to x==NULL.
(log_su): 2 -> STDERR_FILENO.
(modify_environment, main): Don't assume that getenv's returned value
has an indefinite lifetime.
(modify_environment): Allocate a larger environ.
(main): Remove an impossible 'case 0'; if it happens now, it'll
get diagnosed. Don't assume getpwnam results outlive endpwent.
Check for null or empty pw_name, pw_dir and for null pw_passwd.
* src/stty.c (VA_START): Remove. All callers now use va_start.
(_POSIX_VDISABLE): Remove unnecessary cast.
(struct control_info, visible): Use cc_t for control chars.
(struct control_info): Use size_t for sizes.
(recover_mode, set_mode, display_speed, display_window_size,
valid_options, main, display_changed):
Use bool for booleans.
(integer_arg): Return unsigned long int, not long int.
Accept new max arg; all callers changed, to specify a maximum
value for integer parameters instead of silently overflowing.
(wrap): Do not overrun the stack buffer if the output contains
more than 1024 bytes. Instead, malloc a buffer.
(main): Remove a "what is this?!?" FIXME. Nobody knows what it is.
Remove unnecessary casts.
(set_control_char): Allow int values only up to cc_t range.
(screen_columns): Don't reject INT_MAX.
(display_changed, display_all, display_speed, recover_mode):
Don't assume cc_t fits in int.
* src/remove.h: Add copyright notice.
(struct rm_options): Use bool for booleans.
* src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
errno_rmdir_non_empty, remove_parents, main): Likewise.
* src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
main): Likewise.
(main): Don't dump core if invoked with argv[0]==NULL.
* src/tee.c (tee, append, ignore_interrupts, main, tee):
Use bool for booleans.
(tee): Use ssize_t for read returns.
* src/ptx.c: Add a FIXME mentioning that there are many
unchecked integer overflows in this file.
(gnu_extensions, auto_reference, input_reference, right_reference,
ignore_case, initialize_regex, fix_output_parameters,
output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
Use bool for booleans.
(SKIP_SOMETHING, compare_words, digest_break_file,
find_occurs_in_text, fix_output_parameters):
Use to_uchar instead of a caset.
(print_field): Rewrite to avoid cast.
* src/printf.c (posixly_correct): Use bool for booleans.
(verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
(STRTOX): Rewrite to avoid casts.
(print_esc_char): Arg is char, not int.
* src/readlink.c (canonicalize): Remove. All uses now merely inspect
can_mode.
(no_newline, verbose): Use bool for booleans.
(can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
* src/shred.c (struct Options, main): Use bool for booleans.
(isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
* src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
Use bool for booleans.
* src/stat.c (G_fail): Remove.
(print_statfs): Print various gotta-be-nonnegative values using
unsigned long int, not long int or int.
(do_statfs, do_stat): Return a boolean success flag.
(do_stat, main): Use bool for booleans.
* src/pr.c: Add a FIXME mentioning that there are many
unchecked integer overflows in this file.
(TRUE, FALSE): Remove. All uses replaced by true and false.
(struct COLUMN, read_line, print_page, print_stored, open_file,
skip_to_page, init_fps, parallel_files, align_empty_cols,
empty_line, FF_only, explicit_columns, extremities, keep_FF,
print_a_FF, print_a_header, use_form_feed, have_read_stdin,
print_across_flag, storing_columns, balance_columns,
truncate_lines, join_lines, untabify_input, failed_opens,
numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
double_space, ignore_failed_opens, use_col_separator,
pad_vertically, last_line, main, init_parameters, skip_read,
read_line, print_stored):
Use bool for booleans.
(struct COLUMN, char_to_clump, store_char, print_char):
Use char for chars.
(clump_buff, print_clump): Use char[], not int[], for an array whose
elements are always chars.
(first_last_page, main, getoptarg, balance, add_line_number,
char_to_uclump): Remove unnecessary casts.
(init_parameters): Allocate chars, not ints, for clump_buff.
(print_char): Use to_uchar before invoking ISPRINT.
(char_to_clump): Convert to unsigned char before invoking ISPRINT.
* src/nohup.c (main): Use bool for booleans.
* src/paste.c (paste_parallel, paste_serial, main): Likewise.
* src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
(portable_chars_only): Use to_uchar rather than a cast.
* src/printenv.c (main): Use bool for booleans.
Do not assume that the environ has at most one matching entry
for each option (integer overflow was possible otherwise).
* src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
constant. Do not assume PRIdMAX etc. are strings of length 3 or
less.
(struct tspec): Use it. fmt_string is now an array, not
a pointer, as there's little point to the indirection here.
(struct tspec, flag_dump_strings,
traditional, flag_pseudo_start, limit_bytes_to_format,
abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
decode_one_format, open_next_file, check_and_close,
decode_format_string, skip, write_block, read_char, read_block,
parse_old_offset, dump, dump_strings, main):
Use bool for booleans.
(struct tspec): Use void *, not char *, for generic pointers.
(bytes_to_oct_digits, bytes_to_signed_dec_digits,
bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
Use char, not unsigned int, since char suffices.
(print_s_char, print_char, print_s_short, print_short,
print_int, print_long, print_long_long, print_float,
print_double, print_long_double): Rewrite to avoid casts.
These now take void * arguments, instead of char *.
Use the same body for all functions, except for the choice
of type. Assume C89 to simplify handling of signed char.
(dump_hexl_mode_trailer, print_named_ascii, print_ascii):
Rewrite to avoid casts.
(print_named_ascii, print_ascii): Now takes void *, not char *.
(decode_one_format): Use int for printf field widths, not
unsigned int. Pass void * to subsidiary printers,
not char *. Simplify handling of floating-point formats
by factoring out common code dealing with precision and field width.
(decode_format_string): Avoid need for temporary copy of
each decoded struct tspec.
(get_lcm): Remove unnecessary cast.
(main): Fix bug where more than INT_MAX failed decodes were ignored.
2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
* src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
(enum number_format): Remove.
(FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
not enum values.
(DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
(section_del): Now const.
(print_fmt): Remove.
(starting_line_number, page_incr, blank_join, line_no,
print_lineno, proc_text, main):
Use intmax_t for line numbers.
(reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
Use bool for booleans.
(lineno_format): Now a string, not an enum value.
(build_print_fmt): Remove. All calls removed. This work is
now done within print_lineno.
(build_type_arg): Use size_t for sizes.
(print_lineno): Check for line number overflow.
(proc_text, main): Remove unnecessary cast.
* src/ln.c (symbolic_link, interactive, remove_existing_files,
verbose, hard_dir_link, dereference_dest_dir_symlinks,
do_link, main): Use bool for booleans.
* src/ls.c (struct fileinfo, file_interesting,
extract_dirs_from_files, color_symlink_as_referent,
FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
numeric_ids, print_block_size, dired, print_with_color,
check_symlink_color, print_inode, recursive, immediate_dirs,
all_files, really_all_files, qmark_funny_chars,
print_dir_name, format_needs_stat, format_needs_type, visit_dir,
main, decode_switches, parse_ls_color, print_dir, file_interesting,
gobble_file, make_link_path, basename_is_dot_or_dotdot,
extract_dirs_from_files, print_long_format):
Use bool for booleans.
(dir_defaulted): Remove; no longer needed.
(main): Use int to count files, since it suffices for argv.
Rewrite to avoid need for dir_defaulted.
(main, print_dir, gobble_file, get_link_name,
xstrcoll):
Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
(decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
Remove unnecessary cast to int. Use int instead of unsigned
int to count from 0 to 1.
(get_funky_string, print_type_indicator): Use char for bytes, not int.
(make_link_path): Use NULL for null pointers.
(quote_name): Use to_uchar instead of cast.
* src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
print_full_info): Use bool for booleans.
(problems): Remove, replacing with....
(ok): New var (inverted from old sense).
(print_user, print_group, print_full_info):
Print uids/gids with %lu, not %u.
(xgetgroups): Don't run out of memory if getgroups or getugroups
returns -1.
* src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
* src/factor.c (wheel_tab): Use unsigned char instead of unsigned
int, since it suffices.
(factor, print_factors): Use size_t for sizes.
(print_factors, do_stdin, main): Use bool for booleans.
* src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
(fold_file, main): Use bool for booleans.
(fold_file, main): Use size_t for sizes.
(main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
of prohibiting widths greater than INT_MAX.
* src/head.c (presume_input_pipe, print_headers, have_read_stdin,
write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
elide_tail_lines_pipe, elide_tail_lines_seekable,
elide_tail_lines_file, head_bytes, head_lines, head, head_file,
string_to_integer, main):
Use bool for booleans.
(main): Rewrite to avoid cast.
* src/csplit.c (struct line): Use size_t for sizes.
(main): Remove unnecessary cast.
* src/cut.c (cut_fields): Use to_uchar rather than a cast.
* src/cut.c (cut_file, main): Use bool for booleans.
* src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
* src/env.c (main): Likewise.
* src/expr.c (nextarg): Likewise.
* src/env.c (main): Remove unused and nonstandard envp arg.
* src/fmt.c (COST, MAXWORDS): Add a comment describing some of
fmt's arbitrary limits.
(TRUE, FALSE): Remove; all uses changed to (true, false).
(main): Use bool for booleans.
Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
to parse width.
(copy_rest): Remove unnecessary cast.
(get_prefix): Rewrite to avoid cast.
(check_punctuation): Use char *, not unsigned char *; C89 requires
this. Avoid off-by-one buffer read overrun when line is empty.
(flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
Remove unnecessary casts.
* tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
changes.
* src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
next_file, expand, main):
Use bool for booleans.
(tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
expand, main):
Use uintmax_t for column counts.
(add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
All callers changed.
(parse_tabstops): Don't pass a negative char to isblank.
Avoid memory leak with large tab stops.
(validate_tabstops, expand): Don't assume number of tab stops is
<= INT_MAX.
(next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
storing values into exit_status.
(expand): Use same pattern as unexpand for reading chars.
Report an error when input line is too long, instead of silently
screwing up. Do not mishandle tab stops when backspacing left
over start of line.
* src/dircolors.c (have_read_stdin, append_quoted,
dc_parse_stream, dc_parse_file, main): Use bool for booleans.
(dc_parse_stream): Use enum for state, rather than int.
Use ssize_t to store getline result.
* src/dd.c (translation_needed, parse_integer, scanargs,
apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
Use bool for booleans.
(translate_buffer): Use to_uchar rather than a cast.
(swab_buffer, copy_simple, copy_with_unblock):
Use size_t for sizes.
* src/seq.c (equal_width, valid_format, main): Use bool for booleans.
* src/sleep.c (apply_suffix): Likewise.
* src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
forever, from_start, print_headers, have_read_stdin, valid_file_spec,
write_header, file_lines, pipe_lines, pipe_bytes, recheck,
tail_forever, tail_bytes, tail_lines, tail, tail_file,
parse_obsolescent_option, parse_options, main): Likewise.
* src/sleep.c (apply_suffix): Invert sense of result.
Use int (not unsigned int) for multiplier, as this generates better
code with some compilers. Simplify code a bit.
* src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
parse_options): Use uintmax_t, not unsigned int or unsigned long int,
for state counters.
(tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
make it a bit clearer.
* src/hostname.c: Include "xgethostname.h".
(xgethostname): Remove decl; xgethostname.h has it.
(sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
&& defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
prototypes rather than K&R form. Assume any negative value from
sysinfo denotes failure, not just -1.
(main): Simplify use of sethostname.
* src/pinky.c (include_idle, include_heading, include_fullname,
include_project, include_plan, include_home_and_shell, do_short_format,
include_where, main): Use bool for booleans.
(count_ampersands, create_fullname, scan_entries, short_pinky):
Use size_t for sizes.
(create_fullname): Check for overflow in size calculations.
(idle_string): Don't assume that the number of idle days
is less than 10**8 and/or INT_MAX/(24*60*60).
(main): No need to pass a non-NULL last arg to getopt_long.
* src/uptime.c (print_uptime, uptime): Use size_t for sizes.
(print_uptime): Remove unused local variable.
(main): No need to pass a non-NULL last arg to getopt_long.
* src/users.c (list_entries_users, users): Use size_t for sizes.
(list_entries_users): Use char for bytes.
(main): No need to pass a non-NULL last arg to getopt_long.
* src/who.c (do_lookup, short_list, short_output, include_idle,
include_heading, include_mesg, include_exit, need_boottime,
need_deadprocs, need_login, need_initspawn, need_clockchange,
need_runlevel, need_users, my_line_only, main): Use bool for booleans.
(print_runlevel): Use unsigned char for bytes.
(list_entries_who, scan_entries, who): Use size_t for sizes.
(main): No need to pass a non-NULL last arg to getopt_long.
* src/install.c (isdir): Remove decl.
(install_file_to_path): Rely on make_path to fail if the destination
is not a directory, by passing preserve_existing==true to it.
Hence we no longer need to call isdir.
Free dest_dir immediately when it's no longer needed, rather than
waiting until the end of the function.
(copy_file): Don't bother calling isdir, as copy will do the
right thing if the destination is a directory.
* src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
Use bool for booleans.
(max_depth): Now size_t, not int, to avoid an arbitrary limit
of INT_MAX on depth.
(G_fail): Remove: no longer needed, now that the relevant
functions return bool.
(process_file): Use return value to signal success rather than
setting a global. Remove first_call static var; not needed, since
we can look at n_alloc. Use size_t for depths. Remove FIXME
about size_t casts, as it's now fixed. Use xnrealloc rather
than the obsolescent XREALLOC. Don't bother to check whether
reallocation is needed unless level > prev_level.
(du_files): Invert sense of result, for consistency with
other coreutils code. All callers changed.
(main): Allow --max-depth values up to SIZE_MAX.
* src/df.c (inode_format, show_all_fs, show_local_fs,
show_listed_fs, posix_format, require_sync, print_type,
selected_fstype, excluded_fstype, show_dev, show_point, main):
Use bool for booleans.
(df_readable, show_dev): Use UINTMAX_MAX instead of -1.
(show_dev, show_point, main):
Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
Don't assume disk name lengths are <= INT_MAX.
Rewrite pct calculation to avoid cast.
(show_point): Don't assume resolved length is <= SSIZE_MAX.
* src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
instead of uintptr_t.
* src/shred.c (UINT_MAX_32_BITS): Remove.
(word32): Remove. All uses changed to uint32_t.
(isaac_seed_data): Remove unnecessary cast.
* src/system.h (ptr_align): Use size_t; in practice, this is just as
good as uintptr_t in checking for alignments, and has fewer
configuration hassles.
* src/Makefile.am (localedir.h): Make it readonly; this
undoes part of the 2004-07-27 patch.
2004-07-30 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
(IS_THOUSANDS_SEP): Use bool when appropriate.
(numcompare, main): Use char, not int, when the value is always a char.
(numcompare): Remove "register"; compilers are smart enough these days.
* src/system.h (errno, CHAR_BIT): Remove decls;
no longer needed now we assume C89 or better.
Include <inttypes.h> before <stdint.h>, as it's the
Autoconf-recommended pattern.
(to_uchar): New inline function, moved here from tr.c.
Use full names for int types, e.g. "long int" rather than "long".
* src/tr.c (to_uchar): Remove; now in system.h.
(is_char_class_member): Use bool when appropriate.
* src/mkdir.c (create_parents, main): Use bool when appropriate.
(main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2004-07-29 Paul Eggert <eggert@cs.ucla.edu>
* src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
* src/chmod.c (recurse, force_silent, process_file, process_files,
main): Use bool when appropriate.
* src/cksum.c (cksum, main): Likewise.
* src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
compare_files, main): Likewise.
* src/copy.h (struct cp_options): Likewise.
* src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
* src/cp-hash.h (remember_created): Likewise.
* src/cp-hash.c (remember_created): Likewise.
* src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
re_protect, make_path_private, target_directory_operand, do_copy,
cp_option_init, decode_preserve_arg, main): Likewise.
* src/install.c (isdir, change_timestamps, change_attributes,
copy_file, install_file_to_path, install_file_in_dir,
install_file_in_file, strip_files, dir_arg, cp_option_init, main,
change_attributes, change_timestamps): Likewise.
* src/mv.c (remove_trailing_slashes, rm_option_init,
cp_option_init, do_move, movefile, main): Likewise.
* src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
AD_push, prompt, remove_dir): Likewise.
* src/rm.c (rm_option_init, main): Likewise.
* src/remove.c (top_dir, pop_dir, full_filename_):
Use size_t for sizes.
* src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
succeeds. It's not necessary in that case, as *NEW_DST is always
false already.
(do_copy): Rewrite slightly to avoid need for "unreachable" comment.
(main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
* src/rm.c (main): Likewise.
md5sum, sha1sum integer cleanups.
* src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
not needed.
(ALG_UNSPECIFIED): Remove.
(ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
* src/md5.c: Don't include any files other than checksum.h.
* src/sha1sum.c: Likewise.
* src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
Use bool when appropriate.
(digest_check): Increase limit of number of input lines to
UINTMAX_MAX from INT_MAX. Diagnose any overflows of this counter.
Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
2004-07-28 Paul Eggert <eggert@cs.ucla.edu>
* src/cat.c (exit_status): Remove. Now done by passing a boolean
'ok' flag around.
(simple_cat, cat): Return true if successful. All callers changed.
(simple_cat, cat, main): Use bool for booleans.
(simple_cat): Use size_t for sizes.
(cat, main): Use the same names for parameters that we use for
long options, to avoid confusion. This inverts the sense of the
show_tabs (formerly output_tabs) and number_nonblank
(formerly numbers_at_empty_lines) variables.
(main): Don't mess up (due to integer overflow) if we are given
INT_MAX - INT_MIN + 1 options.
[O_BINARY]: Don't invoke isatty unless the other options require it.
(main): When deciding whether to use simple_cat, don't worry
about binary option; it's irrelevant.
* src/dcgen: Remove comments, trailing white space, and empty
lines from the output strings, to save space.
Use a narrower type like 'unsigned char' for line lengths, if
that will do.
Make the output variables static, not extern.
* src/chgrp.c (parse_group): Require base 10 when parsing
groups as integers.
(main): int -> bool when appropriate.
* src/chown.c (main): Likewise.
* src/chown-core.c: Include inttostr.h.
(UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
(gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
instead of uint_to_string).
(describe_change): Instead of an int flag, use a char *
auxiliary; this avoids the need for casts.
Assume free (NULL) works.
(change_file_owner): Return true/false, not 0/-1, since
we don't set errno. All callers changed.
Use bool when appropriate.
(chown_files): Likewise.
* src/chown-core.h (chown_files): Likewise.
* tests/chown/basic: Test for proper handling of uids like
"010", which must be parsed as decimal.
* tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
pwd when there are multiple names for the working directory
(which can happen with an automounter, sigh).
* src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
this causes Solaris 8 'make' to refuse to build "groups".
(localedir.h): Don't depend on Makefile: this causes Solaris
8 'make' to build localedir.h unnecessarily. The dependence
on Makefile is ineffective anyway, since $(localedir) might
change even if Makefile hasn't.
* src/remove.c (remove_dir): If we can't save the state of the
working directory, pretend we started from "/", not ".".
This avoids a bug on hosts like Solaris that don't let you
remove the working directory.
2004-07-27 Paul Eggert <eggert@cs.ucla.edu>
* src/printf.c (strtiomax, strtoumax): Declare if not already
declared: this fixes a portability bug with Solaris 8 + GCC.
(STRTOX): Parenthesize use of macro arg as expression.
(vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
parentheses.
* configure.ac: Check for declaration of strtoumax, for
src/printf.c.
* src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
* tests/readlink/can-e: Don't assume that we can remove the
working directory: this isn't possible under Solaris 8, say.
* tests/readlink/can-f: Likewise.
* tests/readlink/can-m: Likewise.
* src/copy.c (copy_internal): find_backup_file_name no longer
returns NULL, so don't bother to check for this.
* src/cp.c (do_copy): Likewise.
* src/ln.c (do_link): Likewise.
2004-07-25 Paul Eggert <eggert@cs.ucla.edu>
* src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
All uses changed.
(NZERO): New macro, if system doesn't define it already.
(usage): Distinguish priorities from nice values.
Don't assume NZERO is 20.
(main): Use bool instead of int where appropriate.
If user specifies an adjustment out of range, always truncate it
to an inrange value instead of sometimes giving an error message
and sometimes not.
Do not assume that -1 is an error return from "nice" or
"getpriority", as it might be the current nice value minus NZERO.
If nice/setpriority fails with errno == EPERM, go ahead and run
the command anyway; POSIX requires this.
* src/pathchk.c: Include euidaccess.h.
(dir_ok): Use euidaccess, not access.
* src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
(eaccess): Remove. All users changed to use euidaccess instead.
2004-07-24 Paul Eggert <eggert@cs.ucla.edu>
* src/uptime.c (print_uptime) [defined BOOT_MSG]:
Don't assume ut_line is null-terminated.
* src/who.c (print_line): New arguments USERLEN and LINELEN,
since USER and LINE might not be null terminated. All callers
changed.
2004-07-23 Paul Eggert <eggert@cs.ucla.edu>
Fix bug with "tail -f" reported by Rob Holland in
<http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
Also, remove the undocumented and unsupported-since-2000
--max-consecutive-size-changes options. Fix another related bug:
"tail" got confused if stdin, stdout, or stderr were closed.
Also, use output buffering even with "tail -f".
* NEWS: Document this, plus yesterday's patch.
* doc/coreutils.texi (tail invocation): "size has remained the same"
-> "file has not changed", which is more accurate for fifos.
* src/tail.c: Include fcntl-safer.h.
(COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
(COPY_A_BUFFER): New macro.
(struct File_spec): New members mtime, mode, blocking.
Remove member n_consecutive_size_changes.
(DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
max_n_consecutive_size_changes_between_opens,
MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
(long_options, tail_forever, parse_options):
Remove (non-)support for --max-consecutive-size-changes.
(record_open_fd): New function.
(recheck, tail_file): Use it. Don't assume that stdin is open.
(dump_remainder): Add support for new COPY_A_BUFFER special value.
Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
(recheck): New arg BLOCKING, specifying whether to use blocking reads.
All uses changed.
(n_live_files): Remove, replacing with...
(any_live_files): New function. All uses changed.
(tail_forever): Use nonblocking I/O unless we know that blocking I/O
is safe; this avoids some hangs when reading from a fifo.
Avoid invoking fstat or sleep when using blocking I/O.
Do not check for changes to size if the file is not a regular file,
as the size is undefined in that case.
Check for changes to mtime or mode, too; this works for non-regular
files.
(tail_forever, main): Redo fflush strategy to work even when input
is nonblocking. Don't use unbuffered output; just flush when needed.
2004-07-22 Paul Eggert <eggert@cs.ucla.edu>
* src/tail.c (main): Ignore -f if no file operand is specified
and standard input is a pipe.
* doc/coreutils.texi (tail invocation): Do not ignore -f for
all pipes, just for when standard input is a pipe and no
file operand is specified.
* tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
Add a new commented-out f-2 test, which we still fail.
(test_vector): All f-* tests are special cases, not just f-1.
2004-07-12 Paul Eggert <eggert@cs.ucla.edu>
* src/uptime.c: Include c-strtod.h.
(print_uptime): Use c_strtod instead of setlocale and sscanf.
Use long int rather than int to count days (for 64-bit hosts),
and check for arithmetic overflow when converting double to time_t.
2004-07-11 Paul Eggert <eggert@cs.ucla.edu>
* src/printf.c (vstrtold): Renamed from vstrtod.
Now returns long double. All uses changed.
(print_direc): Use "L" length modifier when printing floating point
numbers, since we're now printing long double.
2004-07-06 Paul Eggert <eggert@cs.ucla.edu>
printf cleanup, to avoid undefined behavior, to add support for
formats that Bash supports, and to support wide integers like
Bash does.
* NEWS: Document this.
* src/printf.c (UNSPECIFIED): Remove. All uses now replaced by
booleans, so that we don't reserve any values for precision or
width (like Bash).
(STRTOX): Use prototype, not K&R-style definition.
(vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
in ../lib), with type change to intmax_t.
All uses changed.
(vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
All uses changed.
(vstrtod): Renamed from xstrtod. All uses changed.
(print_direc): Use boolean arg instead of special value to indicate
a missing precision or width. LENGTH no longer includes
length modifiers or conversion character. New arg CONVERSION
now specifies conversion character.
Use intmax_t-width formatting for integers (like Bash).
Add support for C99 %a, %A, %F (like Bash).
Add support for field width with %c (POSIX requires this).
Add a FIXME for lack of support for field width and precision
for %b.
Add support for '\'', '0' flags.
Check for invalid combinations of flags, field width, precision,
and conversion, to prevent use of undefined behavior.
Allow multiple length modifiers, for formats like "%lld" (like Bash).
Add support for C99 'j', 't', 'z' length modifiers (like Bash).
In error message, output entire invalid conversion specification,
instead of merely outputting % followed by the conversion char.
* tests/misc/printf: Add tests for the above.
2004-04-03 Dmitry V. Levin <ldv@altlinux.org>
Change "readlink -f" to be more compatible with prior implementations.
Add more canonicalize options, -e and -m.
Add comprehensive tests for all readlink modes.
* m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
Do not add canonicalize.c here.
* src/readlink.c (longopts): Add new options.
(usage): Document them.
(canonicalize_fname): New proxy function.
(main): Handle new options.
* doc/coreutils.texi (readlink invocation): Document new
"readlink -f" behaviour and new canonicalize options, -e and -m.
* configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
* tests/Makefile.am (SUBDIRS): Add readlink.
* tests/readlink/Makefile.am: New file.
* tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
* tests/misc/Makefile.am (TESTS): Remove basic readlink test.
* tests/misc/readlink: Remove file.
2004-07-04 Jim Meyering <jim@meyering.net>
* src/copy.c (copy_internal): Add a FIXME comment.
2004-07-02 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.c (copy_dir): Assume path_concat returns non-NULL.
* src/cp.c (do_copy): Likewise.
* src/mv.c (movefile): Likewise.
* src/cp.c (make_path_private): 2nd arg is now size_t, not int,
to avoid problem when path_concat dir name is longer than 2 GiB (!).
* src/nohup.c (main): Don't pass NULL first argument to path_concat.
This cleans up the semantics a bit, as we no longer try to open the
same file twice.
2004-07-01 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Add short names -t and -T for --target-directory
and --no-target-directory options, respectively.
* src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
Remove. All uses changed to 'T' and 't', respectively.
* src/install.c, src/ln.c, src/mv.c: Likewise.
* src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
aliases for --target-directory and --no-target-directory,
respectively.
* src/install.c (long_options, main, usage): Likewise.
* src/ln.c, src/mv.c: Likewise.
2004-07-01 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_file_system): New target.
(syntax-check-rules): Add it.
.x-sc_file_system: New file.
* Makefile.am (EXTRA_DIST): Add it.
* man/sync.x: Use "file system" rather than "filesystem".
* man/stat.x, man/df.x: Likewise.
2004-06-30 Paul Eggert <eggert@cs.ucla.edu>
* src/df.c (usage, main): Output "file system" rather than
"filesystem".
* src/du.c (usage): Likewise.
* src/shred.c (usage): Likewise.
* src/stat.c (usage): Likewise.
* src/stat.c (long_options, usage): Rename "--filesystem" to
"--file-system". But keep the old name around, for compatibility
reasons.
2004-06-29 Paul Eggert <eggert@cs.ucla.edu>
Add support for --no-target-directory option.
* NEWS: Document it.
* doc/coreutils.texi (Common options, Target directory, cp
invocation, install invocation, mv invocation, ln invocation):
Likewise.
(link invocation): Explain how to rewrite link using ln now
that we have --no-target-directory.
(ln invocation): Explain that --no-target-directory subsumes
--no-dereference.
(unlink invocation): Modify wording to match new wording in
link invocation.
* src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
(long_opts, usage, do_copy, main): Add support for
--no-target-directory,
* src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
usage): Likewise.
* src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
main): Likewise.
* src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
main): Likewise.
* src/mv.c (enum): Sort values.
2004-06-29 Jim Meyering <jim@meyering.net>
Don't let verbose-mode output from a subshell obscure actual differences.
* tests/rm/inaccessible: Turn off command-echoing just before
invoking subshell, then turn it back on if VERBOSE=yes afterward.
2004-06-25 Paul Eggert <eggert@cs.ucla.edu>
Add support for 'install --target-directory', an option
that has been documented for years but not implemented (!).
* doc/coreutils.texi (install invocation): Document
--target-directory in synopsis, too.
* src/install.c (TARGET_DIRECTORY_OPTION): New var.
(long_options, main, usage): Add --target-directory.
(target_directory_operand): New function, stolen from mv.c.
(main): Use it. Check for -d and --target-directory.
Alter wording of diagnostics to match other programs.
2004-06-28 Jim Meyering <jim@meyering.net>
* src/cp.c (usage): Fix copy+paste error in description of
--target-directory: s/move/copy/. From Paul Jarc.
2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
Use more-consistent rules among cp, ln, and mv when dealing with
last operands that are (or look like) directories.
* src/cp.c (target_directory_operand): New, nearly-common function,
It reports an error if the destination appears to be a directory
(e.g., because it has a trailing slash) but is not.
* src/ln.c, src/mv.c: Likewise.
* src/cp.c (do_copy): Use it.
* src/ln.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/cp.c (do_copy): Don't assume argc is positive.
Don't bother to lstat dest, since copy() will do that for us.
Use "const" to avoid the need for cast.
* src/cp.c (do_copy): Don't output a usage message because of file
problems (e.g., an operand is not a directory). Use it only for
syntax. Standardize on "target %s is not a directory" for the
diagnostic.
* src/ln.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/cp.c (do_copy): Remove test for trailing slash, since
target_directory_operand now does this.
* src/ln.c (main): Likewise.
* src/mv.c (movefile): Likewise.
* src/cp.c (main): Reject multiple target directories.
Check whether a specified target is a directory when parsing the
options, using stat. This gives more-accurate diagnostics.
* src/ln.c (main): Likewise.
* src/ln.c (isdir): Remove decl; no longer needed.
* src/mv.c (isdir, lstat): Likewise.
* src/ln.c (do_link): New arg dest_is_dir. All uses changed.
Don't check the destination ourself; rely on dest_is_dir.
This way we can avoid lstatting the destination in the
usual case, and in the worst case we lstat 1, not 3 times.
Don't bother to unlink unless link failed; this saves a syscall.
Remove unnecessary backup_succeeded flag;
it was identical to "dest_backup != NULL".
* src/ln.c (main): Use int to count to argc, not unsigned int.
This handles negative operand counts.
* src/mv.c (main): Likewise.
* src/mv.c (do_move): Don't call hash_init; expect the caller to
do it, for consistency with cp.c and ln.c. All callers changed.
(movefile): dest_is_dir parameter is now bool, not int.
(main): Standardize on "missing destination file operand after %s"
for the diagnostic, for consistency with cp.c.
* tests/mv/diag: Don't assume "mv --target=nonexistentdir"
will complain about the arg count.
Adjust to new (briefer) diagnostics.
* tests/cp/fail-perm: Add a test to verify that we get the new
diagnostic when failing to copy through a symlink-to-inaccessible-dir.
2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
Fix a bug: formerly, if d/x was a directory and x a file, "ln x
d/" incorrectly created a link d/x/x. It also saves some system
calls.
* NEWS: Document the fix.
* src/ln.c (main): Don't append basename to dest if this
results in an existing directory name.
* tests/ln/misc: See whether a trailing slash is followed too far.
2004-06-26 Jim Meyering <jim@meyering.net>
* src/printf.c (main): When given no arguments, print the standard
"missing operand\nTry printf --help..." message -- to be consistent.
2004-06-26 Jim Meyering <jim@meyering.net>
* src/mknod.c (main): Add \n at the end of message output via fprintf.
2004-06-25 Jim Meyering <jim@meyering.net>
* tests/ln/misc: Add test for ln subscript error.
2004-06-23 Paul Eggert <eggert@cs.ucla.edu>
* src/ln.c (do_link): Remove unnecessary call to lstat.
(main): Avoid subscript error when the destination is "".
2004-06-23 Jim Meyering <jim@meyering.net>
* tests/*: Replace all occurrences of `(exit N); exit' with
`(exit N); exit N'. Otherwise, those many tests could exit with
improper exit status when exiting via e.g., a trapped interrupt.
Thanks to a report from Bob Proulx.
2004-06-22 Paul Eggert <eggert@cs.ucla.edu>
* src/who.c (idle_string, print_user): New arg boottime,
specifying the most recent boot time. All uses changed.
(idle_string) Consider a line to be "old" if it hasn't been used
since the last boot time. Watch out for overflow when computing
times, and for times in the future.
(idle_string): Record latest boot time.
2004-06-22 Jim Meyering <jim@meyering.net>
* src/test.c (usage): Correct description of `-t FD'. The file
descriptor, FD, is no longer optional. Reported by Ton Nijkes.
2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
The 2004-06-19 fix for who and pinky was incomplete, as ctime
has undefined behavior if the year precedes -999 or follows 9999.
Since we have to stop using ctime anyway, we might as well use
strftime and fix the FIXME, and support internationalized dates.
* NEWS: Document the new behavior.
* src/who.c: Include "hard-locale.h".
(time_format, time_format_width): New vars.
(time_string, print_line): Use them.
(main): Set them.
(time_string): Use localtime + strftime instead of
ctime, to avoid problems with years before -999 or after 9999.
* src/pinky.c: Likewise.
2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
Fix bug: GNU 'ls' didn't count columns correctly if user or group
names contained multibyte characters where the column count
differed from the byte count. This patch also corrects
some comments.
* src/ls.c (format_user_or_group): New function, which counts
columns correctly.
(format_user, format_group): Use it.
(format_user_or_group_width): New function, which counts columns
correctly.
(format_user_width, format_group_width): Use it.
2004-06-21 Jim Meyering <jim@meyering.net>
* tests/priv-check: Quote "$PATH" in PATH=$PATH.
Suggestion from Andreas Schwab.
* tests/priv-check: When running as root, be sure to propagate
PATH through to the process we exec as non-root.
Reported by michael@aplatform.com.
* src/mknod.c (main): Don't segfault when calculating the
expected number of operands for `mknod NAME'.
2004-06-20 Jim Meyering <jim@meyering.net>
* src/dd.c (input_seek_errno): Declare file-scoped variable as static.
2004-06-20 Paul Eggert <eggert@cs.ucla.edu>
* src/basename.c (main):
Standardize on the diagnostics given when someone gives
too few operands ("missing operand after `xxx'") or
too many operands ("extra operand `xxx'").
Include "quote.h" and/or "error.h" if it wasn't already being included.
* src/chgrp.c (main): Likewise.
* src/chmod.c (main): Likewise.
* src/chown.c (main): Likewise.
* src/chroot.c (main): Likewise.
* src/comm.c (main): Likewise.
* src/cp.c (do_copy): Likewise.
* src/csplit.c (main): Likewise.
* src/date.c (main): Likewise.
* src/dircolors.c (main): Likewise.
* src/dirname.c (main): Likewise.
* src/du.c (main): Likewise.
* src/expr.c (main): Likewise.
* src/hostid.c (main): Likewise.
* src/hostname.c (main): Likewise.
* src/id.c (main): Likewise.
* src/install.c (main): Likewise.
* src/join.c (add_file_name, main): Likewise.
* src/link.c (main): Likewise.
* src/ln.c (main): Likewise.
* src/logname.c (main): Likewise.
* src/md5sum.c (main): Likewise.
* src/mkdir.c (main): Likewise.
* src/mkfifo.c (main): Likewise.
* src/mknod.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/nohup.c (main): Likewise.
* src/od.c (main): Likewise.
* src/pathchk.c (main): Likewise.
* src/ptx.c (main): Likewise.
* src/readlink.c (main): Likewise.
* src/rm.c (main): Likewise.
* src/rmdir.c (main): Likewise.
* src/seq.c (main): Likewise.
* src/setuidgid.c (main): Likewise.
* src/shred.c (main): Likewise.
* src/sleep.c (main): Likewise.
* src/sort.c (main): Likewise.
* src/split.c (main): Likewise.
* src/stat.c (main): Likewise.
* src/test.c (beyond, main): Likewise.
* src/touch.c (main): Likewise.
* src/tr.c (main): Likewise.
* src/tsort.c (main): Likewise.
* src/tty.c (main): Likewise.
* src/uname.c (main): Likewise.
* src/uniq.c (main): Likewise.
* src/unlink.c (main): Likewise.
* src/uptime.c (main): Likewise.
* src/users.c (main): Likewise.
* src/who.c (main): Likewise.
* src/whoami.c (main): Likewise.
* tests/basename/basic: Adjust to new diagnostics.
* tests/du/files0-from: Likewise.
* tests/expr/basic: Likewise.
* tests/mv/diag: Likewise.
* tests/tsort/basic-1: Likewise.
2004-06-20 Jim Meyering <jim@meyering.net>
* src/ln.c: Remove declaration of yesno.
Instead, include yesno.h.
* src/copy.c: Likewise.
* src/remove.c: Remove declaration of yesno.
Instead, include yesno.h.
(top_dir): Remove now-unnecessary cast of obstack_base.
(pop_dir): Likewise.
(full_filename_): Likewise.
2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
Don't dump core if ctime returns NULL; this is possible on
hosts with 64-bit time_t and 32-bit int.
* src/who.c: Include "inttostr.h".
(time_string): If ctime fails, print the raw time as an integer
instead of dumping core.
* src/pinky.c: Likewise, as follows:
Include "inttostr.h".
(time_string): New function, copied from who.c.
(print_entry): Use it.
2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
* src/who.c (print_line): Don't truncate user names at 8 bytes.
Problem reported by Guido Leenders in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
* NEWS: document this.
2004-06-19 Jim Meyering <jim@meyering.net>
* src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
using GNU_PACKAGE (from PACKAGE) once again. This restores
`GNU' to the parenthesized package name in --version output.
Before, the first argument from AC_INIT, `GNU coreutils', would
be propagated to the PACKAGE variable. Now, `GNU ' is trimmed.
Reported by Richard Stallman.
2004-06-17 Jim Meyering <jim@meyering.net>
* src/tr.c (to_uchar): Rename function from `uchar'. The latter
would clash with a typedef in Tru64's <sys/types.h>. From Albert Chin.
2004-06-15 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
allows the GNU behavior. "--" is now supported by chroot, hostid,
hosname, pwd, sync, yes.
* doc/coreutils.texi (yes invocation, false invocation,
true invocation): Document this.
* src/chroot.c (main): Handle "--".
* src/hostid.c (main): Likewise.
* src/hostname.c (main): Likewise.
* src/pwd.c (main): Likewise.
* src/sync.c (main): Likewise.
* src/yes.c (main): Likewise.
* src/true.c (main): Recognize --help and --version even if
POSIXLY_CORRECT is set.
* src/yes.c (main): Likewise.
2004-06-09 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
the GNU behavior.
* doc/coreutils.texi (pr invocation, unlink invocation): Document this.
* src/ls.c (decode_switches): Pay attention to TABSIZE even if
POSIXLY_CORRECT is set. POSIX reserves upper-case environment
variables to the implementation, so it's OK for ls to depend on
TABSIZE.
* src/pr.c: Include "hard-locale.h".
(main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
POSIX specifies the behavior only in the POSIX locale.
* src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
since POSIX says the behavior is unspecified here.
* src/tail.c (parse_obsolescent_option): Support multiple file operands
even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
* src/printf.c (main): Recognize --help, --version even if
POSIXLY_CORRECT. POSIX does not specify any options, but it
does not prohibit options either, so "printf" is like "expr" here.
* src/unlink.c (main): Likewise.
* tests/misc/printf: Adjust to the new semantics for \x if
POSIXLY_CORRECT.
2004-06-14 Jim Meyering <jim@meyering.net>
* tests/misc/pwd: New test, for fix of 2004-04-19.
* tests/misc/Makefile.am (TESTS): Add pwd.
(BUILD_SRC_DIR): Define BUILD_SRC_DIR.
* src/copy.c: Remove declaration of euidaccess.
Instead, include "euidaccess.h".
2004-06-13 Paul Eggert <eggert@cs.ucla.edu>
* src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
(UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
as (sizeof "??") reliably returns 3.
(print_line): Guard against idle and pid being too long
(which is possible when printing headers).
(print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN.
Avoid unnecessary cast of sizeof to int.
(make_id_equals_comment): Do not assume that UT_ID returns
a string; it might return a non-null-terminated array.
Use strncat instead. It's not very often where strncat is
exactly what you want, but this is one of those rare cases.
2004-06-11 Paul Eggert <eggert@cs.ucla.edu>
* src/who.c (list_entries_who): Don't output a trailing space.
2004-06-09 Jim Meyering <jim@meyering.net>
* src/touch.c (usage): Improve wording in description of the
--time=WORD option. Reported by Dan Jacobson.
* src/chown-core.c (change_file_owner): Change names of parameters
old_uid and old_gid to required_uid and required_gid respectively.
* src/chmod.c (mode_changed): Return false, not 0, now that the
function returns `bool'.
2004-06-08 Paul Eggert <eggert@cs.ucla.edu>
Adjust chmod and chown to be similar if -c or -v are given. In
particular, a no-op chown is no longer reported as a change; this
reverts to previous behavior. Also, fix both commands so that -v
report failures even if the failure is not due to the chmod or
chown syscalls.
* src/chmod.c (CH_NOT_APPLIED): New constant.
(describe_change): Handle it.
(process_file): Use it, if a symlink wasn't changed.
(mode_changed): Return bool, not int. Accept new argument
NEW_MODE; all callers changed. This lets us avoid statting the
file unless the new mode has unusual bits.
(process_file): Return -1 on error. With -v, report all errors
verbosely, not just some.
* src/chown-core.c (change_file_owner): Return -1 on error, not
1 sometimes and -1 on others. Our caller ORs together our results,
and (-1 | 1) == 0 on ones-complement hosts.
With -v report all errors verbosely, not just some.
Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
file_stats wasn't set properly in that case.
* tests/chgrp/basic: Adjust to above changes.
2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
* tests/chgrp/basic: Test that chgrp -h does not fail on
symlinks, even on hosts where that's not supported.
Test that if -R is specified without -H or L, -h is assumed.
Test that chown() is not optimized away.
2004-05-18 Paul Eggert <eggert@cs.ucla.edu>
Several fixes to chgrp and chown for compatibility with POSIX and BSD:
Check for incompatible options. When -R and --dereference are
both used, then either -H or -L must also be used. When -R and -h
are both used, then -P must be in effect.
-H, -L, and -P have no effect unless -R is also specified.
If -P and -R are both specified, -h is assumed.
Do not optimize away the chown() system call when the file's owner
and group already have the desired value. This optimization was
incorrect, as it failed to updated the last-changed time and reset
special permission bits, as POSIX requires.
Do not report an error if the owner or group of a
recursively-encountered symbolic link cannot be updated because
the file system does not support it.
* NEWS: Document the above.
* src/chgrp.c (main): Check for incompatible options. -R --dereference
requires either -H or -L, and -R -h requires -P. If -H, specify
FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
file as much like chown.c as possible.
* src/chown.c (main): Likewise.
* src/chown-core.c (change_file_owner): Use ent->fts_statp only if
needed. Chown a directory only after chowning its children; this
avoids problems if the new directory ownership doesn't permit
access to the children. Dereference symlinks before doing
ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
Do not optimize away the chown() system call when the file's owner
and group already have the desired value. POSIX does not permit
this optimization. Rely on chown and lchown to do the right
thing with symlinks and/or -1 arguments, now that we have wrappers
to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
errors, not just command-line errors.
(chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
* src/system.h (ENOTSUP): Remove.
* tests/chgrp/basic: Use chown --from to discover whether the
group changed, since chgrp now changes unconditionally. This
complicates the sed script a bit. Do not specify --dereference,
since it's the default (and we want to test this). Adjust output
to match the fact that chgrp no longer optimizes the case of
changing a file's group to the same value as before.
* tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
options are incompatible, and their behavior is undefined with POSIX.
(changed, not_changed): Adjust to match the fact that -h is no longer
specified. Sort names.
* tests/chown/deref: Adjust error-diagnostic spelling to match new
behavior.
2004-06-07 Paul Eggert <eggert@cs.ucla.edu>
* src/uname.c (main): Fix typo introduced on 2003-05-10 that
prevented a diagnostic of any operands.
2004-06-08 Jim Meyering <jim@meyering.net>
* src/shred.c (direct_mode): Turn it on/off with directio, too.
2004-06-07 Jim Meyering <jim@meyering.net>
Enable direct-mode I/O (bypassing the buffer cache), if possible.
Prompted by a suggestion from Kalle Olavi Niemitalo
in http://bugs.debian.org/207035.
* src/shred.c (direct_mode): New function.
(do_wipefd): Turn on direct-mode I/O.
(dopass): If a file's first write fails with EINVAL,
turn off direct-mode I/O and retry the write.
2004-06-05 Paul Eggert <eggert@cs.ucla.edu>
* src/tr.c (main): "tr -d a b" is now a fatal error even if
POSIXLY_CORRECT is set. The POSIX SYNOPSIS does not allow this
option combination.
2004-06-04 Paul Eggert <eggert@cs.ucla.edu>
* src/shred.c (dopass): Don't subtract 1 from the offset after
a write error. Problem reported by Jon Peatfield in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
2004-06-02 Paul Eggert <eggert@cs.ucla.edu>
Fix bug reported by Buciuman Adrian in
<http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
where 'dd' created a file that was too large. The bug was that dd
assumed that the input file offset does not advance after a failed
read; but POSIX says that the input file offset is undefined after
a failed read.
* src/dd.c (MAX_BLOCKSIZE): New macro.
(input_seekable, input_seek_errno, input_offset,
input_offset_overflow): New vars.
(scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
(advance_input_offset): New function.
(skip_via_lseek): Set errno to zero when reporting our failure,
so that we don't report based on garbage errno.
(skip): If fdesc is standard input, advance the input offset.
Do not quit if reading, and if noerror was specified;
POSIX seems to require this.
If read fails on output file, report the earlier lseek failure
instead; this fixes a FIXME in dd_copy.
(advance_input_after_read_error): New function.
(dd_copy): Use it, instead of assuming that failed reads
do not advance the file pointer. Advance input offset
after nonfailed reads. Advance only a partial block if
the previous read (before the failed read) succeeded, and
do not generate an output block of zeros in this case.
(main): Determine initial input offset, seekability of input,
and error if it wasn't seekable.
2004-06-02 Jim Meyering <jim@meyering.net>
rm (without -f) could hang unnecessarily when attempting to
remove a symlink to a file on an off-line NFS-mounted partition.
Reported by David Howells in https://bugzilla.redhat.com/124699.
* src/remove.c (write_protected_non_symlink): New function.
Don't invoke euidaccess on symlinks.
(prompt): Use write_protected_non_symlink rather than using
euidaccess directly, being careful not to call lstat twice for a file.
Fix a bug in how the --output-delimiter=D option works with
abutting byte or character ranges. Reported by David Krider in
http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
* src/cut.c (print_kth): Remove special case for open-ended range.
(set_fields): Record the range start index for an interval even
when it abuts another interval on its low side.
Also record the range start index of the longest right-open-interval.
* tests/cut/Test.pm: Add tests of --output-delimiter=S with
abutting and overlapping byte ranges.
2004-06-01 Paul Eggert <eggert@cs.ucla.edu>
Some POSIX-conformance cleanups for tr.
* src/tr.c (posix_pedantic): Remove; no longer needed since
we need to test this in just one place now.
(usage): Mention -C.
(unquote): Note that \055, \n, etc are escaped.
Do not worry about POSIXLY_CORRECT when warning about ambiguous
escape sequences.
\ at end of string stands for itself.
Do not diagnose invalid backslash escapes: POSIX says the behavior
is unspecified in this case, so we don't need to diagnose it.
(main): Add support for -C (currently an alias for -c).
Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
a diagnostic here.
* tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
Fix comment for range-a-a.
2004-05-25 Paul Eggert <eggert@cs.ucla.edu>
Improve the efficiency (and in one case, correctness) of code
that reads symlinks.
* src/copy.c (copy_internal): Don't use alloca, as it can mess up
royally if the link length is long (e.g., GNU/Hurd). Use
xreadlink instead, it's safer. Don't bother to read the link if
it's the wrong size. Add a FIXME because this area is a bit murky
and undocumented.
* src/ls.c (get_link_name): Update use of xreadlink.
* src/readlink.c (main): Likewise.
* src/stat.c (print_stat): Likewise.
2004-06-01 Jim Meyering <jim@meyering.net>
* src/env.c (main): Prefer the notation `STREQ (a, b)'
over `!strcmp (a, b)'.
* src/sort.c (main, sort_buffer_size): Prefer the notation
`STREQ (a, b)' over `strcmp (a, b) == 0'.
* src/date.c (batch_convert): Likewise.
* src/expr.c (nextarg): Likewise.
* src/su.c (correct_password, restricted_shell, main): Likewise.
* src/ptx.c (swallow_file_in_memory, main): Likewise.
* src/test.c (binary_operator, and, or, main): Likewise.
2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: echo compatibility cleanup.
* doc/coreutils.texi (echo invocation): Document the changes.
* src/echo.c (V9_ECHO): Remove; always enabled.
(DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
we use the same naming convention as bash. Now an enum,
not a macro.
(usage): Reword to mention -e/-E more accurately.
Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
(hextobin): New function.
(main): Use bool rather than int for local vars when appropriate.
Do not allow options if POSIXLY_CORRECT, unless we are using
BSD semantics and the first argument is "-n".
Don't pass unnecessary extra arg to parse_long_options.
do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
Do not look for options if !allow_options.
Use size_t rather than int when appropriate.
Open-code option test rather than using strrchr.
Use faster test for "-".
Avoid redundant argc test.
Add support for \x, for Bash compatibility.
Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
When '\c' is encountered, stop printing immediately, as POSIX
requires.
Add support for \xhh syntax.
Add support for \0ooo syntax; POSIX requires this.
2004-06-01 Jim Meyering <jim@meyering.net>
* Use automake-1.8b. Regenerate dependent files.
2004-05-31 Jim Meyering <jim@meyering.net>
* tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
the build src/ directory -- at the front.
($(srcdir)/$x-tests): Depend on Makefile.am.
Use $x as the program name, except when it would be `test' (test is
the sole program tested via mk-script that is also a shell built-in).
In that case, use the old ../../src/$x.
2004-05-30 Jim Meyering <jim@meyering.net>
Work around HPUX /bin/cc compiler bug that is exposed, now that
sets are arrays of type `bool'. More details here:
http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
FIXME: verify that the above URL points to the right message
* src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
(aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
system, those two expressions are not the same (256 vs. 1024).
The effect of this problem was that `tr -c x y' would fail:
tr: when not truncating set1, string2 must be non-empty
(set_initialize): Remove unnecessary initialization of the `in_set'
buffer; that initialization triggered the same compiler bug as above.
2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
tr cleanup, mostly having to do with integer type ranges.
Remove all casts.
* tests/tr/Test.pm: Add a few tests for the below. Alas, most of
the test cases wouldn't be portable, or would take too much CPU
time, or both.
* src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
This is safe since the code already assumes N_CHARS fits in int.
(Filter): Remove: we want to prototype everything.
(ORD, CHR): Remove. All uses removed. Some replaced with:
(uchar): New function. All places where a char must be converted
to an unsigned char are now done this way, not by ad-hoc methods.
(count): New type. Use it whenever counts or states are needed.
(BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
since we used it in an unsigned int context) to UINTMAX_MAX - 1.
(REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
whenever appropriate.
(NOT_A_CHAR): Remove global macro; now a local enum.
(UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
the rest of the code no longer depends on them.
(class_ok): Remove; all uses changed to use inline comparisons.
(RE_NO_TYPE): Remove; wasn't used or needed.
(struct List_element): normal_char and equiv_code are now unsigned
char, not int.
first_char, last_char, and the_repeated_char are now unsigned char,
not unsigned int. repeat_count is now count, not size_t.
All uses changed.
(struct Spec_list): state is now count, not unsigned int.
lengthis now count, not size_t.
n_indefinite_repeats is now size_t, not int.
has_equiv_class, has_char_class, and has_restricted_char_class
are now bool, not int. All uses changed.
(struct E_string): s is now char *, not unsigned char *.
escaped is now bool *, not int *. All uses changed.
(ES_MATCH): Remove macro, replacing with:
(es_match): New inline function. All uses changed.
(squeeze_repeats, complement, posix_pedantic, truncate_set1,
translating): Now bool, not int.
(io_buf): Now char array, not unsigned char.
(SET_TYPE): Remove. All uses replaced with bool.
(is_equiv_class_member, unquote, append_range, append_char_class,
append_equiv_class, find_closing_delim, star_digits_closebracket,
build_spec_list, parse_str, homogeneous_spec_list):
Now returns bool, not int. All uses changed.
(is_equiv_class_member): Now inline.
(is_equiv_class_member, is_char_class_member, make_printable_str,
append_normal_char, append_range, append_repeated_char,
get_s2_spec_stats):
Args are now of proper integer type.
(unquote, look_up_char_class, make_printable_str,
append_equiv_class, build_spec_list, squeeze_filter):
Avoid unsigned char *p; gently convert *p to unsigned char instead.
(unquote, get_spec_stats): Do not jump past declarations and then
use them; C doesn't allow this in portable programs.
(make_printable_str): Check for overflow in size calculations.
(xmemdup): Remove. All uses rewritten.
(find_bracketed_repeat): Args are now of proper pointer-to-integer
type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
(find_bracketed_repeat, star_digits_closebracket): Check that the
digits are not escaped.
(build_spec_list): Don't bother to copy opnd_str; not needed.
(build_spec_list, get_next): Simplify internal logic a bit.
(card_of_complement): Fix bug due to char overflow.
(get_spec_stats): Don't assume len fits into int.
Check for integer overflow. Use abort() rather than assert(0).
(string2_extend): Fix subscript error: is_char_class_member (..., 255)
was being invoked.
(squeeze_filter): READER is never null now; simplify code.
READER arg now has a simpler type. Remove unnecessary casts.
(squeeze_filter, main): Calls to fwrite improperly checked result
against zero, rather than against requested size.
(plain_read): New function.
(read_and_delete, read_and_xlate):
Remove unused filter arg, and don't worry about hit_eof.
Simplify by using plain_read.
(set_initialize): Args are bool and bool *, not int and SET_TYPE *.
(main): Always pass a non-null procedure to squeeze_filter.
Rewrite so that class_ok isn't needed.
2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
* src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
fdatasync reports EBADF when syncing (unwritable) directories.
Problem reported by Albert Chin-A-Young in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
2004-05-29 Jim Meyering <jim@meyering.net>
* tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
Patch from Albert Chin.
* src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
* src/remove.c (push_dir): Merge declaration and adjacent assignment
into a single statement.
2004-05-28 Jim Meyering <jim@meyering.net>
* src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
2004-05-22 Jim Meyering <jim@meyering.net>
rm -r would get a failed assertion when run from an inaccessible
directory and with two or more command line arguments including an
absolute-named directory followed by a relative-named directory.
* src/remove.h (struct rm_options) [require_restore_cwd]: New member.
* src/remove.c (struct cwd_state): Define.
(AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
can be detected by the caller. Instead of returning a malloc'd
directory name, communicate it to caller via a new parameter, and
return an indication of whether restore_cwd failed. Update caller.
Eliminate an unnecessary call to AC_stack_top.
(remove_dir): Change type of cwd_state parameter to `struct cwd_state'
so we can now communicate to caller whether/how functions like
restore_cwd have failed. Update caller.
(rm_1): Fail if we've failed to restore the working directory
and the name of the next file to remove is `.'-relative.
(rm): Fail if the require_restore_cwd flag is true and we've
failed to restore the working directory.
* src/mv.c (rm_option_init): Initialize new member,
x->require_restore_cwd.
* src/rm.c (rm_option_init): Likewise.
2004-05-21 Jim Meyering <jim@meyering.net>
* tests/rm/inaccessible: New test for the above fix.
* tests/rm/Makefile.am (TESTS): Add inaccessible.
* src/remove.c (rm): Use free rather than XFREE.
(remove_dir): Use xmalloc, not XMALLOC.
(ds_init): Likewise.
2004-05-20 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
diagnostics in shred.c have been fixed, don't exempt shred.c from
this check.
* src/shred.c: Use translatable diagnostics, e.g.
change "%s: remove" to _("%s: failed to remove") and
change "%s: close" to _("%s: failed to close").
2004-05-17 Paul Eggert <eggert@cs.ucla.edu>
* src/shred.c (names): Bring back lower-case letters, "_", and
".". But continue to omit +, =, %, @, #, as they're either
shell metacharacters (for some shells) or are not in some
character sets, or (in the case of '%') must be a
metacharacter somewhere.
2004-05-16 Paul Eggert <eggert@cs.ucla.edu>
* src/cut.c (cut_fields): Adjust to new signature of getndelim2.
2004-05-17 Jim Meyering <jim@meyering.net>
* src/shred.c (incname): Decrement `len' only once per loop iteration.
chgrp and chown now dereference symlinks by default, per POSIX.
Reported by Michal Politowski as http://bugs.debian.org/249177.
* src/chown-core.c (chopt_init): Affect each symlink referent by default.
* src/chown.c (usage): Update to reflect this.
* src/chgrp.c (usage): Likewise.
* NEWS: Describe the change.
Adapt tests accordingly.
* tests/chgrp/basic: Use -h where necessary to retain semantics.
* tests/chgrp/deref: Likewise.
* tests/chgrp/posix-H: Likewise.
2004-05-15 Paul Eggert <eggert@cs.ucla.edu>
In shred, check for errors from fdatasync more carefully. If
fdatasync fails with errno==EINVAL, it means this implementation
does not support synchronized I/O for this file. Do not report
this as an error, as (for example) AIX 5.2 fdatasync reports it
for raw disk devices. Problem reported by Albert Chin in
<http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
Check for write errors, though: the old code ignored them.
Improve error checking in a few other cases, too (e.g., close of a
directory).
Also, change several 'int' values to 'bool', so that the error
checking is a bit clearer. Similarly, change unsigned values
to size_t where appropriate.
* src/shred.c: Include "dirname.h".
(datasync) [!HAVE_FDATASYNC]: Remove.
(dosync): New function.
(dopass): Use it. Return 1 on write error, -1 on other error.
All callers changed. Report write error if dosync does.
(do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
not int (0/-1). All callers changed. Return false if there's a
write error.
(incname): Return bool (true/false), not int (0/1). Accept
size_t length, not unsigned. All callers changed. Do not
bother checking for non-digits; it can't happen. Replace
recursion with iteration.
(wipename): Use dir_name, base_name, etc. instead of assuming
Unix file names. Use size_t for length, not unsigned.
Report error if unlink or close fails.
(wipename, main): Use bool for booleans.
(names): Use only digits and uppercase letters, for greater
portability.
2004-05-16 Jim Meyering <jim@meyering.net>
* tests/chown/deref: New test for the yesterday's change.
* tests/chown/Makefile.am (TESTS): Add deref.
2004-05-15 Jim Meyering <jim@meyering.net>
chown --dereference did nothing when the owner/group of a
symlink matched the desired owner/group. Reported by David Malone.
Also reported in 1999 as http://bugs.debian.org/39642.
* src/chown-core.c (change_file_owner): When --dereference has
been specified, and when processing a symlink, stat it to get the
owner and group of the referent.
2004-05-14 Jim Meyering <jim@meyering.net>
* man/pwd.x, man/echo.x, man/printf.x: Fix typo:
s/supercede/supersede/ reported by Andrew Fabbro.
2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
Improve performance of `sort -m' on large files, at the cost of
making some contrived examples unsafe. POSIX allows this
optimization. Performance problem reported by Jonathan Baker in
<http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
* src/sort.c (first_same_file): Do not treat input pipes
differently from other files.
* doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
might write F before reading all the input.
* NEWS: Likewise.
2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
* src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
'\007', for portability to EBCDIC hosts.
* src/printf.c (print_esc_char): Likewise.
* src/tr.c (unquote, make_printable_str): Likewise.
2004-05-12 Jim Meyering <jim@meyering.net>
* src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
where the result is used. This avoids one unnecessary lstat call
per command line argument.
2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
Don't assume that "make -C" works; Solaris "make" doesn't have -C.
* src/Makefile.am (all_programs.list): New rule, copied from
man/Makefile.am and tests/Makefile.am, except that we use the
system tr rather than ./tr and we don't use tr -s.
* tests/Makefile.am (all_programs): Use it.
* man/Makefile.am (all_programs): Likewise. Renamed from programs,
for consistency. All uses changed.
2004-05-11 Jim Meyering <jim@meyering.net>
* tests/rm/unread3: New test, for the above fix and today's
lib/save-cwd.c improvement.
* tests/rm/Makefile.am (TESTS): Add unread3.
* src/rm.c: Don't include "save-cwd.h". It's no longer used.
2004-05-10 Jim Meyering <jim@meyering.net>
* tests/install/trap: New file. Test for bug fix of 2004-04-18.
* tests/install/Makefile.am (TESTS): Add trap.
* src/remove.c (AD_push): Don't use errno in diagnostic about
`changed dev/ino'.
Remove these generated files from CVS.
* tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
* tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
* tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
* tests/tr/tr-tests, tests/wc/wc-tests:
2004-05-09 Jim Meyering <jim@meyering.net>
* src/tr.c (unquote): Use xcalloc rather than xmalloc and
a loop initializing the just-allocated memory to zero.
2004-05-08 Jim Meyering <jim@meyering.net>
* tests/rm/no-give-up: New file; check for today's fix.
* tests/rm/Makefile.am (TESTS): Add no-give-up.
2004-05-08 Paul Eggert <eggert@cs.ucla.edu>
Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
<http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
* src/remove.c (remove_entry): Check for errno values like ENOENT
that show the file cannot be directory, instead of for errno
values like EPERM that show the file might be a directory. This
is necessary because, when a single unlink() call has multiple
reasons to fail, it can set errno to any of those reasons; it's
only the rare errno value like ENOENT that excludes all the other
possible reasons to fail even when the file is a directory.
(remove_cwd_entries): Don't attempt chdir if the file is known
to not be a directory.
(remove_dir): Use the same method that remove_cwd_entries uses
(for some reason they differed). Don't assert that saved_errno
must be EPERM; it might be just about anything.
2004-05-06 Jim Meyering <jim@meyering.net>
* src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
Don't add `1' to the buffer size (it was to protect against malloc
implementations that fail to allocate a buffer of size zero).
That is no longer necessary, since we use a malloc wrapper
on such systems.
* src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
* src/head.c (elide_tail_bytes_pipe): Likewise.
* src/df.c (main): Likewise.
* src/shred.c (do_wipefd): Likewise.
* src/users.c (list_entries_users): Likewise.
* src/tail.c (main): Likewise.
* src/md5sum.c (main): Likewise.
2004-04-29 Paul Eggert <eggert@cs.ucla.edu>
* src/df.c (show_disk, show_point): If several filesystems are
mounted on the same mount point, prefer the last one, not the first.
Problem reported by Christian Jones in
<http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
(show_disk): Remove unused statp arg. Return bool, not int.
(show_point): Rewrite to avoid gotos. Use the same algorithm
for lofs and dummies for each pass through the mount table,
rather than subtly different algorithms (which are probably
inadvertent).
2004-05-03 Jim Meyering <jim@meyering.net>
* Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
have m4/Makefile*.
2004-05-01 Jim Meyering <jim@meyering.net>
When chown or chgrp is modifying the referent of a symlink,
use the chown(2) function, if possible.
* src/chown-core.c (change_file_owner): Don't hard-code the
open/fchown/close kludge here. Use `chown' instead.
The chown function works just fine on conforming systems.
Other systems now go through the new chown wrapper that
resorts to the old kludge.
* src/chown-core.c (change_file_owner): Add a comment.
2004-04-27 Jim Meyering <jim@meyering.net>
* src/ptx.c: Make over 40 global extern variables `static'.
(syntax_table, re_syntax_table): Remove declarations of two unused
variables (they were exposed by the above change).
* src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
* src/ln.c (backup_type): Likewise.
* src/remove.c (rm): Add `extern' keyword.
* src/cp-hash.c (forget_created, remember_created)
(src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
* src/copy.c (dest_info_init, src_info_init, copy): Likewise.
* src/chown-core.c (chopt_init, chopt_free, gid_to_name)
(uid_to_name, chown_files): Likewise.
* src/Makefile.am (sc_tight_scope): New rule.
* Makefile.maint (sc_tight_scope): New rule.
(syntax-check-rules): Add it.
2004-04-26 Jim Meyering <jim@meyering.net>
* Use automake-1.8.4. Regenerate dependent files.
* src/sort.c (limfield): Make a comment clearer.
2004-04-25 Paul Eggert <eggert@twinsun.com>
Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
leading blanks when computing the location of the field end;
it is not supposed to skip trailing blanks. Solaris 8 "sort"
does conform to POSIX. Also fix the documentation to clarify
this and related issues.
* doc/coreutils.texi (sort invocation): Mention -k earlier, so
that the options are in alphabetical order. Describe how -b works
more-accurately; this involves fixing some examples, too. Mention
what happens if the start field falls after an end field or after
a line end. Warn about using -k without -b, -g, -M, -n, or -t.
Add an example of how to sort IPv4 addresses and Apache Common
Log Format dates. Remove a duplicate example.
(Putting the tools together): Use separate options rather
than agglomerating them.
* src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
decode whether to skip leading blanks.
(trailing_blanks): Remove.
(fillbuf, getmonth, keycompare): Don't trim trailing blanks.
* tests/pr/Test.pm: Fix typo in env_default comment.
* tests/sort/Test.pm: Likewise.
(18c, 18d): Reverse the order of output lines, so that the
test cases conform to POSIX.
2004-04-22 Paul Eggert <eggert@twinsun.com>
More signal-handling cleanup for ls.c. Do not allow signals to
happen between arbitrary output bytes, as the
restore-default-color sequence can bollix up multibyte chars or
color-change sequences in the ordinary output. Instead, process
signals only between printing a file name and changing the color
back to non_filename_text color. That way, if the signal handler
changes the color (to the default), 'ls' will change it back when
'ls' continues (after being suspended).
Also, do not bother with signal-handling unless stdout is a
controlling terminal; this lets stdio buffer better when "ls
--color" is piped or sent to a file.
* src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
Do not include "full-write.h"; no longer needed.
(tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
(put_indicator_direct): Remove. All callers changed to use
put_indicator.
(caught_signals, interrupt_signal, stop_signal_count): New vars.
(restore_default_color): Don't bother checking for put_indicator
failure.
(sighandler): Don't handle SIGTSTP; that's another handler now.
Simply set interrupt_signal to the signal, then exit.
(stophandler, process_signals): New functions.
(main): Don't output any color changes until _after_ the signal
handlers are set up. This fixes a race condition where 'ls'
could be interrupted while initializing colors, and leaving the
terminal in an undesirable state.
Don't mess with signal-handling if standard output is not a
controlling terminal.
When exiting, restore the default color, then restore the
default signal handling, then act on any signals that weren't
acted on yet.
Do not print //DIRED// etc. in colors; this avoids the need
to catch signals when printing them.
(print_name_with_quoting): Process signals just before switching
color back to non_filename_text.
2004-04-23 Jim Meyering <jim@meyering.net>
Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
* src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
of quotearg_buffer. Patch by Mikulas Patocka.
2004-04-18 Paul Eggert <eggert@twinsun.com>
tee ignored SIGPIPE, but POSIX doesn't allow this.
* src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
does not allow this. This undoes the 1996-10-24 patch.
2004-04-18 Paul Eggert <eggert@twinsun.com>
Signal-handling cleanup for coreutils. Here are the highlights:
- csplit sometimes failed to remove files when interrupted.
- csplit didn't clean up if two signals arrived nearly simultaneously.
- install -s would infloop on System V if SIGCHLD was ignored.
- ls could incorrectly restore color if multiple signals
arrived nearly simultaneously.
* src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
Define.
(filename_space, prefix, suffix, digits, files_created, remove_files):
Now volatile.
(caught_signals): New var.
(cleanup): Block signals while deleting all files.
(cleanup_fatal, handle_line_error, regexp_error):
Mark with ATTRIBUTE_NORETURN.
(create_output_file, close_output_file, interrupt_handler):
Block signals while changing the number of output files,
to fix some race conditions.
(delete_all_files): Do nothing if remove_files is zero.
Clear files_created.
(main): Don't mess with signals until after argument processing
is done.
* src/csplit.c (main): Rewrite signal-catching code to make it
similar to other coreutils programs. When processing signals,
block all signals that we catch, but do not block signals that we
don't catch. Avoid problems with unsigned int warnings.
* src/ls.c (main): Likewise.
* src/sort.c (main): Likewise.
* src/csplit.c (interrupt_handler):
Use void, not (obsolete) RETSIGTYPE.
* src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
* src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
* src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
* src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
* src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
for SIG_IGN.
* src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
* src/install.c: Include <signal.h>.
(main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
given, since System V fork+wait does not work if SIGCHLD is ignored.
* src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
handler to self, not to SIG_IGN, since SIGTSTP can be received
more than once.
(main): Use SA_RESTART, as that is simpler than checking for EINTR
failures all over the place.
2004-04-20 Jim Meyering <jim@meyering.net>
* src/remove.c (is_empty_dir): Clarify comment.
* man/help2man: Accept new option: --program-name=NAME, so that we
can override the one in --version output. This is needed solely
so that test.1 doesn't refer to `[' as the program name.
Reported by Benjamin Cutler as http://bugs.debian.org/205251.
* man/Makefile.am (.x.1): Use help2man's new --program-name option.
* src/pwd.c: Don't include pathmax.h; system.h already does it.
* src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
2004-04-19 Jim Meyering <jim@meyering.net>
* src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
Initialize a buffer to avoid warnings from tools like valgrind.
* Makefile.maint (sc_trailing_blank): New rule.
(syntax-check-rules): Add it.
* .x-sc_trailing_blank: New file.
Make pwd work even if the resulting name is so long that getcwd fails.
* src/pwd.c: (path_free, path_init, path_prepend): New functions.
(nth_parent, find_dir_entry, robust_getcwd): New functions.
(main): First try getcwd, then, upon failure, robust_getcwd.
2004-04-18 Jim Meyering <jim@meyering.net>
* src/who.c (print_user): Use xrealloc here, rather than
unchecked realloc. Remove anachronistic casts.
* src/remove.c (full_filename_): Don't leak upon failed realloc.
* src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
from remove.c.
* src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
renaming it. Update uses.
2004-04-17 Jim Meyering <jim@meyering.net>
* configure.ac: Depend on automake-1.8.3.
* src/join.c (add_file_name): Declare function to be `static'.
(string_to_join_field): Likewise.
* src/remove.c (ds_init, ds_free): Likewise.
* Makefile.maint (sc_prohibit_jm_in_m4): New rule.
(syntax-check-rules): Add to the list.
2004-04-13 Paul Eggert <eggert@twinsun.com>
Use page-aligned buffers whenever we bother to do I/O using buffer
sizes that are tailored for the files.
* src/cat.c: Include getpagesize.h.
* src/copy.c: Likewise.
* src/shred.c: Likewise.
* src/split.c: Likewise.
* src/cat.c (main): Align I/O buffers to page boundaries.
* src/copy.c (copy_reg): Likewise.
* src/shred.c (dopass): Likewise.
* src/split.c (main): Likewise.
* src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
All uses replaced by ptr_align.
* src/od.c (gcd, lcm): Remove; now in system.h.
* src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
2004-04-14 Jim Meyering <jim@meyering.net>
Remove m4/Makefile.am: it's no longer needed, with newer automake
* configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
* Makefile.am (SUBDIRS): Remove `m4' from the list.
2004-04-13 Jim Meyering <jim@meyering.net>
* configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
2004-03-27 Paul Eggert <eggert@twinsun.com>
* NEWS: cp -pu and mv -u (when copying) now take the destination
file system time stamp resolution into account.
* doc/coreutils.texi (mv invocation): Document this.
(cp invocation): Document -u (it was missing!) with new behavior.
* src/copy.c: Include "utimecmp.h".
(copy_internal): Compare time stamps using utimecmp rather than
MTIME_CMP.
2004-04-09 Jim Meyering <jim@meyering.net>
* Makefile.maint (.re-list): New rule/file, to replace
hard-coded list of header file names.
(sc_system_h_headers): Use the new file.
Don't look for sys2.h anymore.
* src/system.h: Include new "stat-macros.h" rather than hard-coding
all of its macro definitions -- the list was slightly out of date.
Suggestion from Dmitry V. Levin.
2004-04-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Remove noctty flag from dd. Suggested by Philippe Troin.
* doc/coreutils.texi (dd invocation): Likewise.
* src/shred.c (O_NOCTTY): Remove redundant decl.
* src/dd.c (flags, usage): Remove noctty flag.
(main): Always use O_NOCTTY when opening files.
2004-04-08 Jim Meyering <jim@meyering.net>
* src/dd.c (dd_copy): Mark two diagnostics for translations.
(set_fd_flags): Undo part of today's change: it's a little
cleaner -- and more efficient in the common case -- to go
ahead and OR in the -1 when fcntl fails.
* Makefile.maint (sc_dd_max_sym_length): New target.
(syntax-check-rules): Add it.
* src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
Correct spelling: s/shasum/sha1sum. Reported by Jesse Kornblum.
* src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
Rename parameter, flags, to avoid shadowing global.
(LONGEST_SYMBOL): Tweak comment.
2004-04-07 Paul Eggert <eggert@twinsun.com>
* NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
and new dd options iflag= and oflag=.
* src/dd.c (usage): Likewise.
* src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
* src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
(C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
(input_flags, output_flags): New vars.
(LONGEST_SYMBOL): New macro.
(struct symbol_value): Renamed from struct conversion. Members
symbol and value renamed from convname and conversion. The
symbol value is now an array instead of a pointer; this saves
a bit of space and time in practice. All uses changed.
(conversions): Add nocreat, excl, fdatasync, fsync. Now const.
(flags): New constant array.
(iflag_error_msgid, oflag_error_msgid): New constants.
(parse_symbols): Renamed from parse_conversion and generalized
to handle either conversion or flag symbols.
(scanargs): Adjust uses of parse_symbols accodingly. Add
support for iflag= and oflag=. Reject attempts to use
both excl and nocreat.
(set_fd_flags): New function.
(dd_copy): Just return X rather than calling quit (X), since our
caller invokes quit with the returned value. Add support for
fdatasync and fsync.
(main): Add support for iflag=, oflag=, and new conv= symbols.
* src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
O_RSYNC, O_SYNC): Define to 0 if not already defined.
* NEWS: Remove duplicate mention of BLOCKSIZE.
2004-04-02 Andreas Schwab <schwab@suse.de>
* src/stty.c: Add support for IUTF8 input flag.
2004-04-06 Jim Meyering <jim@meyering.net>
* src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
Interix spells it `mkdev'. Reported by Mark Funkenhauser.
2004-04-04 Jim Meyering <jim@meyering.net>
A specified format is no longer automatically newline terminated.
If you want a newline at the end of your format, use `\n'.
* src/stat.c (print_it): Don't print a newline at the end of
every format.
(do_statfs): Add a newline at end of each default format string.
2004-03-30 Paul Eggert <eggert@twinsun.com>
* src/nohup.c (main): Adjust to new calling convention
for set_cloexec_flag.
2004-03-31 Jim Meyering <jim@meyering.net>
* tests/Fetish.pm (run_tests): Remove `.orig' file.
Remove debugging diagnostic.
Specifying an invalid --width=N (-w) or --gap-size=N (-g)
would not elicit an error.
* src/ptx.c: Include "xstrtol.h" and "quotearg.h".
(main): Don't use atoi. Use xstrtoul instead.
2004-03-30 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_prohibit_atoi_atof): New rule.
(syntax-check-rules): Add it.
* .x-sc_prohibit_atoi_atof: New file.
2004-03-29 Jim Meyering <jim@meyering.net>
* tests/du/files0-from: Use new OUT_SUBST directive, so that this
test is not sensitive to system-dependent block size differences.
Prompted by a report of Solaris 8 differences from Paul Eggert.
* tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
Rename `%tmp' to `%actual'. Reverse order of last two args to
_compare_files (to $actual, $expected) so as to match declaration.
2004-03-28 Paul Eggert <eggert@twinsun.com>
Fix some gotchas encountered when porting to Solaris 8, using
the Forte 6u2 compiler.
* src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
Declare sethostname, since no Solaris header does it.
* src/who.c: Include "vasprintf.h", for asprintf.
2004-03-28 Jim Meyering <jim@meyering.net>
Minor optimization:
* src/du.c (process_file): Don't record dev/inode for directories.
Under some circumstances, without -c, du would mistakenly count the
space of hard-linked files, not just the first one it encountered.
Reported by Anthony Thyssen.
* src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
* src/du.c: Rename global `print_totals' to `print_grand_total'.
* src/du.c (main): Rearrange filtering loop to be a tiny bit
more efficient.
* src/chown-core.c: Don't include savedir.h -- no longer needed.
* src/chmod.c: Likewise.
2004-03-25 Jim Meyering <jim@meyering.net>
* src/du.c (main): Remove now-unused declaration of `i'.
2004-03-24 Paul Eggert <eggert@twinsun.com>
* src/du.c (main): Filter out file names of length zero before
invoking fts, so that they don't cause fatal errors.
2004-03-25 Jim Meyering <jim@meyering.net>
* tests/du/files0-from (zero-len): Add a test for the above.
2004-02-25 Paul Eggert <eggert@twinsun.com>
* NEWS: New environment var BLOCKSIZE.
* lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
* tests/envvar-check: Test for it. Factor the code to simplify it.
2004-03-23 Paul Eggert <eggert@twinsun.com>
* NEWS: Shorten the du --files0-from announcement, and say
"NUL-terminated" rather than "NUL-separated".
* src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
Remove: not used.
(usage): Say "NUL-terminated", not "NUL-separated".
(main): Check for I/O error when istream is closed.
Allow --files0-from=F even if F is empty; this specifies no files.
(du_files): Now that we allow the list of files to be empty,
handle that case.
* tests/du/files0-from: Adjust to above changes to src/du.c.
2004-03-24 Jim Meyering <jim@meyering.net>
* tests/tail-2/assert: Avoid race condition that could cause
spurious failure. Based on a patch from Andreas Schwab.
2004-03-23 Jim Meyering <jim@meyering.net>
* src/du.c (main): Free the hash table, too.
2004-03-22 Jim Meyering <jim@meyering.net>
* man/Makefile.am (.x.1): Remove --info-page= option, reverting
the change of 2004-01-22. I can no longer reproduce the problem
that prompted that change, and `info coreutils pr' would display the
`printing text' section of the manual, not the one on `pr invocation'.
* tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
to match corrected output.
* src/du.c: Include "readtokens0.h" rather than "readtokens.h".
(main): Use readtoken0 functions rather than readtokens.
Don't use errno when diagnosing readtokens0 failure.
Fix off-by-one error in the token number reported in a diagnostic.
(du_files): Return bool, rather than int.
(main): Call readtokens0_free.
2004-03-21 Jim Meyering <jim@meyering.net>
* src/remove.c (ds_free): Plug a small leak.
* tests/Fetish.pm: Fix typo in comment.
2004-03-07 Jim Meyering <jim@meyering.net>
* NEWS: du accepts a new option --files0-from=FILE, where FILE
contains a list of NUL-separated file names.
* src/du.c: Include "readtokens.h".
(usage): Describe the new option, and adjust the `Usage':
with this option, no FILE may be specified on the command line.
(main): Handle the new option.
* tests/du/files0-from: New tests, for the above.
* tests/du/Makefile.am (TESTS): Add files0-from.
* src/factor.c (do_stdin): Reflect changes in use of readtoken.
* src/tsort.c (tsort): Likewise.
2004-02-29 Paul Eggert <eggert@twinsun.com>
* NEWS: Add support for a new notation @N to get_date to represent
the time stamp with numeric value N. Improve support for
fractional time stamps. date's -d and -f options now accept them.
Likewise for touch -t. date has a new option --iso-8601=ns.
* doc/coreutils.texi (touch invocation):
Describe use of fractional seconds.
(date invocation, Options for date): Likewise.
* doc/getdate.texi (General date syntax, Time of day items): Likewise.
* doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
(Options for date): Describe new --iso-8601=ns option.
* doc/getdate.texi: Add copyright notice. Change getdate to
get_date when talking about the function name.
(Seconds since the Epoch): New section, containing the time_t
info moved from Date input formats section, along with new
info about the @ syntax. Mention negative time stamps,
fractional time stamps, and leap seconds.
(General date syntax): Modernize examples a bit to reflect new
features.
(General date syntax, Relative items in date strings):
Use ' rather than " to quote formats.
(Time of day items): Add an example with fractional seconds.
Describe fractional-second syntax.
* src/Makefile.am (touch_LDADD): New macro, since `touch' now
needs clock_gettime.
* src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
(time_spec_string, time_spec, show_date): Support it.
(usage): Remove description of -ITIMESPEC, as it's obsolete and
confusing. Mention --iso-8601=ns.
(batch_convert): getline returns ssize_t, not int.
* src/touch.c (newtime): Now an array of two timespecs, one
for access and one for modification.
(ref_stats): Remove.
(get_reldate): Use get_date's parameter profile.
(touch, main): Adjust to above changes.
(main): Work even if tm_year == INT_MAX (so long as long int is wider).
Use gettime instead of gettimeofday, for new get_date signature.
* tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
ns-relative.
2004-03-15 Jim Meyering <jim@meyering.net>
* Makefile.maint (alpha beta major): `Make' the emit_upload_commands
target before updating $(prev_version_file).
* tests/misc/date-sec: New file, to test for just-fixed bug in date.
See today's change in lib/getdate.y.
* tests/misc/Makefile.am (TESTS): Add date-sec.
2004-03-14 Jim Meyering <jim@meyering.net>
* announce-gen (print_changelog_deltas): Use `.sig' suffix for
signature files, not `.asc'. Reported by angico@yahoo.com.
2004-03-13 Jim Meyering <jim@meyering.net>
* src/cp.c (do_copy): Tweak wording in a diagnostic.
Suggestion from Karl Berry.
Include "quoatearg.h".
(do_copy): Use quotearg_colon (not quote) for diagnostics
that begin with `"%s:'.
* src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
Suggestion from Dan Jacobson.
2004-03-12 Jim Meyering <jim@meyering.net>
* Version 5.2.1.
Sometimes, when source and destination partition are different,
mv mistakenly fails to preserve a hard link. Reported by IIDA Yosiaki.
* src/copy.c: When moving a set of N hard-linked files between
partitions, via two or more command line arguments where the
command line argument containing the Nth link contains no other
link to that same file, mv would mistakenly copy the file, rather
than hard-linking it to the other(s). That happens because when the
final link is processed, its link count has been reduced to 1 since
the other links have been `copied' to the destination partition
and the source links have been removed.
(copy_internal): When in move mode, use the source dev/inode
pair to look up destination name even when st_nlink == 1.
* src/cp-hash.c (src_to_dest_lookup): New function.
* src/cp-hash.h (src_to_dest_lookup): Add prototype.
* tests/mv/part-hardlink: New file. Test for the above fix.
* tests/mv/Makefile.am (TESTS): Add part-hardlink.
* announce-gen: Sync with autoconf.
* tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
This was triggered on a Linux-2.2.19 system using a file system
NFS-mounted from some sort of Sun.
2004-03-11 Jim Meyering <jim@meyering.net>
* Use automake-1.8.3. Regenerate dependent files.
2004-03-10 Jim Meyering <jim@meyering.net>
* tests/du/deref-args: Also convert sizes in the 70-79 kB range,
so that this test works with SELinux-enabled systems.
Based on a patch from Tim Waugh.
`join -1 x' would give a misleading diagnostic
* src/join.c (string_to_join_field): Report that a non-numeric field
number is invalid, rather than `so large that it is not representable'.
* tests/join/Test.pm (invalid-j): New partial test for the above fix.
2004-03-06 Jim Meyering <jim@meyering.net>
cp --sparse=always sparse-image-file.img /dev/hda1 could
produce an invalid copy on the destination device.
* src/copy.c (copy_reg): Even with --sparse=always, try to
make `holes' only if the destination is a regular file.
Reported by Szakacsits Szabolcs.
2004-03-03 Paul Eggert <eggert@twinsun.com>
* src/nohup.c (main): Don't invoke set_cloexec_flag with
a file descriptor of -1.
2004-03-02 Dmitry V. Levin <ldv@altlinux.org>
* src/nohup.c: Include "cloexec.h".
(main): Set the copy of stderr to close on exec.
2004-03-01 Paul Eggert <eggert@twinsun.com>
* configure.ac: Include <signal.h> when checking for strsignal,
sys_siglist, and friends. Problem reported by Tony Leneis in
<http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
2004-02-25 Paul Eggert <eggert@twinsun.com>
* tests/du/deref-args, tests/du/exclude, tests/du/slash:
* tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
etc. are set.
2004-02-23 Paul Eggert <eggert@twinsun.com>
* NEWS: Document how chown's USER.GROUP argument is now parsed.
2004-02-23 Jim Meyering <jim@meyering.net>
* src/seq.c (usage): Remove stray space after \n in --help output.
2004-02-22 Jim Meyering <jim@meyering.net>
* src/du.c (usage): Separate -H and --si. Say that the meaning
of -H will soon change to that of --dereference-args (-D).
2004-02-21 Jim Meyering <jim@meyering.net>
* src/comm.c (usage): Tell what comm does when there are no options.
Reword in terms of FILE1 and FILE2 rather than `left file' and
`right file'. Suggestion from Dan Jacobson.
2004-02-15 Paul Eggert <eggert@twinsun.com>
Fix some POSIX-conformance bugs in expr.
* NEWS: document the following changes to src/expr.c.
* doc/coreutils.texi (expr invocation): Likewise.
Document what forms integers may take, and say "integer"
consistently instead of "number". Warn about operands
that "expr" can misinterpret, and how to work around the
problem.
* src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
Accept a bool argument specifying whether to evaluate the
expression. This is to allow short-circuit evaluation. All
callers changed.
(null): Report that a string is zero even if it has
a form like "-0" or "00".
(eval1, eval): Use short-circuit evaluation for | and &.
(eval): Return 0 if both arguments are null or zero, instead
of returning the first argument.
* tests/expr/basic: Add some tests for the above.
2004-02-17 Jim Meyering <jim@meyering.net>
* Version 5.2.0.
`make check' from a build inside a chroot environment would fail
* tests/help-version: Specify an argument (`/') for df, in the
unusual event that there is no valid entry in /etc/mtab.
Likewise for id: add the -u option, so we don't get spurious
failures when there are no user or group names.
Patch by Tim Waugh.
* src/sort.c (usage) [-u]: Add punctuation so that the description in
the help2man-generated (line-joined) man page is more readable.
Reported by Tim Waugh.
[-T]: Add a semicolon, for the same reason.
2004-02-15 Jim Meyering <jim@meyering.net>
* Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
2004-02-11 Jim Meyering <jim@meyering.net>
* tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
$(srcdir)/../Makefile.am.in, rather than $<.
Suggestion from Michael Elizabeth Chastain.
2004-02-10 Jim Meyering <jim@meyering.net>
* config/install-sh: Make this script executable.
* Makefile.am (dist-hook): New target, to ensure that config/install-sh
is executable. Otherwise, on systems that lack a suitable install
binary, `make install' would fail, because of the way this script
is invoked (without `$SHELL ' prefix).
Reported by Bob Proulx.
2004-02-08 Jim Meyering <jim@meyering.net>
* Version 5.1.3.
* tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
that would cause an unwarranted test failure.
* tests/rm/rm3: Likewise.
2004-02-07 Jim Meyering <jim@meyering.net>
Remove xstat function pointer member. The way it was used was not
portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
inline `stat' and `lstat' functions, thus making the tests of
`xstat == lstat' in copy.c always fail.
* src/copy.h (struct cp_options) [xstat]: Remove member.
(XSTAT): New macro.
* src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
(copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
(valid_options): Remove now-obsolete FIXME comments.
* src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
`*(x->xstat) (...)'.
(do_copy): Declare/use local xstat rather than x->xstat.
(main): Remove code that set x.xstat.
* src/mv.c (cp_option_init): Don't initialize xstat member.
* src/install.c (cp_option_init): Likewise.
* Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
so that emit_upload_commands can use these variables, too.
2004-02-06 Jim Meyering <jim@meyering.net>
* tests/rm/deep-1: Remove `du' stack space test.
Apparently, `ulimit -s N' isn't portable enough.
This test will be restored (with a guard against losing ulimit)
in its own file later.
* tests/rm/deep-1 (deep): Remove progress-style diagnostics,
since this test doesn't take long enough to merit them.
Run du on $tmp (the containing dir), not $deep, the full path to leaf.
* Makefile.maint (signatures): Remove definition.
Now, automake's gnupload handles this.
(%.sig: %): Remove now-unused rule.
(rel-files): Use automake's $(DIST_ARCHIVES), rather than
`$(distdir).tar.bz2 $(distdir).tar.gz'.
(emit-upload-commands): Adjust to use gnupload.
2004-02-05 Jim Meyering <jim@meyering.net>
* src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
(ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
Now, those are all defined in timespec.h.
Include timespec.h.
* src/date.c: Don't include timespec.h, now that system.h does it.
2004-02-02 Paul Eggert <eggert@twinsun.com>
Don't dump core if localtime returns NULL (possible on
hosts with 64-bit time_t and 32-bit int).
* src/date.c: Include "inttostr.h".
(batch_convert, main):
If time conversion fails, exit with nonzero status.
(show_date): Return int to report conversion failure.
Print the time as an int if localtime fails.
* src/uptime.c: Print "??" if the current clock can't
be converted by localtime. This won't happen until the year
2*31 + 1900, but we don't want to dump core even if the current
clock has the wrong value.
* src/stat.c: Include "inttostr.h".
(human_time): Print the date/time as a number of seconds since the
epoch if it can't be converted by localtime. This is better than
just saying "invalid", and is consistent with what "ls" does.
Don't dump core if the year has more than 48 digits; this isn't
possible on any contemporary host, but we might as well do it right.
2004-01-31 Paul Eggert <eggert@twinsun.com>
* src/stat.c (human_time): Accept time rather than
pointer-to-const-time parameter, for clarity. All callers changed.
2004-02-02 Jim Meyering <jim@meyering.net>
* src/stat.c (do_stat): Remove extra trailing newline from
default formats. Reported by Nelson H. F. Beebe.
Print actual fractional seconds in time stamps, not just `.00000000'.
* src/stat.c (human_time): Add and use new parameter, t_ns.
(print_stat): Update callers.
* src/ls.c (TIMESPEC_NS): Remove definition.
* src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
also uses this macro.
Nelson H. F. Beebe noticed that ls --full-time printed nonzero
fractional seconds for files on an XFS file system, but that stat's
fractional seconds were always zero.
2004-01-28 Paul Eggert <eggert@twinsun.com>
* src/seq.c (print_numbers): Use 'double' for loop index, not
'int', to avoid problems with integer overflow. On almost all
machines 'double' works in every case where 'int' works, and
it works on other cases besides.
2004-01-27 Jim Meyering <jim@meyering.net>
* src/seq.c (usage): Mention that if INCREMENT is omitted,
it defaults to 1, even when FIRST is larger than LAST.
Reword so as not to exclude the possibility that INCREMENT be zero.
2004-01-25 Jim Meyering <jim@meyering.net>
* Version 5.1.2.
* Makefile.maint (signatures): Comment out definition.
2004-01-23 Jim Meyering <jim@meyering.net>
* Makefile.maint (header_regexp): Add exitfail.
* man/Makefile.am (EXTRA_DIST): Add help2man.
Reported by Nelson H. F. Beebe.
* man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
so it works on systems with Perl installed somewhere other than in
/usr/bin.
* src/paste.c (paste_parallel): Declare local, chr, to be of type
`int', not `char', since it must hold EOF. This bug would make
paste infloop on some systems. Test failures reported by
Nelson H. F. Beebe and Christian Krackowizer.
2004-01-22 Jim Meyering <jim@meyering.net>
* tests/rmdir/fail-perm: New file. Test for just-fixed rmdir bug.
* tests/rmdir/Makefile.am (TESTS): Add fail-perm.
* man/help2man: Fix it so using --info-page='coreutils PROG' works.
* man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
Use --info-page='coreutils PROG' option.
Now, readlink.1 refers the user to `info coreutils readlink'
rather than to `info readlink'. Reported by Matt Swift.
2004-01-21 Paul Eggert <eggert@twinsun.com>
Exit status cleanup.
* src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
* src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
* src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
* src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
* src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
* src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
* src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
* src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
* src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
* src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
* src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
* src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
* src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
* src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
* src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
* src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
* src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
* src/cat.c (usage): Don't bother normalizing exit status
since the arg is already the correct exit status now.
* src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
* src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
* src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
* src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
* src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
* src/chown.c (main): Removed unused local 'fail'.
* src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
Remove.
* src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
* src/env.c, src/nice.c, src/su.c: Likewise.
* src/nohup.c (main): Likewise, to NOHUP_FAILURE.
* src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
* src/expr.c (main): Use initialize_exit_failure rather than
setting exit_failure directly; this optimizes away redundant
assignments.
* src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
* src/chroot.c (main): Exit with status 1 rather than 127
if chroot itself fails, as per documentation.
* src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
rather than roll-your-own symbols or integers.
* src/env.c (main): Likewise.
* src/nohup.c (main): Likewise.
* src/su.c (run_shell): Likewise.
* src/cp.c (exit_status): Remove static var....
(main): Making it local here instead. Use =, not |=, to set it.
* src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
not 2, on errors.
* src/date.c (batch_convert, main): Likewise.
* src/dd.c (dd_copy): Likewise.
* src/pr.c (first_last_page, main, getoptarg): Likewise.
* src/tr.c (main): Likewise.
* src/date.c (main): Don't assume EXIT_FAILURE == 1, as
POSIX doesn't require it.
* src/dd.c (write_output, skip, dd_copy): Likewise.
* src/df.c (main): Likewise.
* src/id.c (main): Likewise.
* src/install.c (main): Likewise.
* src/ln.c (main): Likewise.
* src/ls.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/shred.c (main): Likewise.
* src/env.c (main): Exit with status 1, not 2, on errors detected
by env proper.
* src/hostname.c (main): Likewise.
* src/nl.c (main): Likewise.
* src/stty.c (main): Likewise.
* src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
consistency with the other programs' naming conventions.
All uses changed.
* src/factor.c (main): Do not report a usage error simply
because stdin has bad numbers.
* src/id.c (problems): Now a boolean int, not a counter,
so that we don't have to worry about int overflow. All uses changed.
* src/touch.c (err): Likewise.
* src/md5sum.c (main): Use int, not size_t, to store boolean int.
* src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
* src/mknod.c: Likewise.
* src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
on error; this is in case EXIT_FAILURE is unusual.
* src/su.c (main): Likewise.
* src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
changed to EXIT_CANNOT_INVOKE.
* src/printenv.c (PRINTENV_FAILURE): New constant.
(main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
command-line syntax problems.
* src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
(main): Avoid integer overflow when seeing whether errors occurred.
* src/seq.c (print_numbers): Now returns void, not (zero) int.
All callers changed.
(main): Remove unused local variable 'errs'. Always exit successfully
if we reach the end.
* src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
for consistency with other programs here. All uses changed.
(main): Use 'error' to exit rather than invoking 'exit' here.
* src/sort.c: Don't include <assert.h>.
(SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
(usage): Don't use 'assert'.
(main): Remove redundant assignment to exit_failure.
* src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
New enum values.
(initialize_exit_failure): New inline function.
Include exitfail.h here, since we refer to exit_failure.
All callers changed to not include exitfail.h.
* src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
substitute them for the corresponding integer constants.
* tests/help-version (expected_failure_status_date): Remove, as
'date' is now normal.
(expected_failure_status_nohup): New var.
2004-01-21 Jim Meyering <jim@meyering.net>
* tests/touch/relative: Remove `command' syntax.
Thanks to Nelson H. F. Beebe and Paul Eggert.
* tests/touch/relative: Test only year/month/day, not hours/min/sec,
so as to avoid problems with systems using TAI clocks.
Although it's no longer necessary, set TZ=UTC0 also for the
initial touch command. Reported by Paul Jarc here:
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
2004-01-20 Diego Biurrun <diego@biurrun.de>
* src/dircolors.hin: Add .mov to the list of media files.
2004-01-19 Paul Eggert <eggert@twinsun.com>
* tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
portable). Problem reported by Christian Krackowizer. Also, use
+0000 rather than +0 to specify a time zone, as the documentation
requires four digits.
2004-01-19 Jim Meyering <jim@meyering.net>
* tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
* tests/mv/backup-is-src: Likewise.
Problem reported by Peter Horst
2004-01-17 Jim Meyering <jim@meyering.net>
* announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
* Version 5.1.1.
2003-12-15 Paul Eggert <eggert@twinsun.com>
* NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
with -r specifying the origin for -d.
* src/touch.c (flexible_date): Remove static var.
(get_reldate): New function.
(main): Use it, to implement this new behavior.
2004-01-16 Jim Meyering <jim@meyering.net>
* tests/touch/relative: New test for the above.
* tests/touch/Makefile.am (TESTS): Add relative.
2004-01-13 Jim Meyering <jim@meyering.net>
* src/system.h: Include contents of sys2.h.
* src/sys2.h: Remove file.
* src/Makefile.am (noinst_HEADERS): Remove sys2.h.
* Use automake-1.8.2. Regenerate dependent files.
* Update to gettext-0.13.1.
* configure.ac: Use gettext-0.13.1.
* .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
2004-01-12 Jim Meyering <jim@meyering.net>
* Makefile.maint (%.sig): Use .sig suffix rather than .asc.
* Makefile.maint (po-check): Ensure that cvsu works before using it.
Reported by Alexandre Duret-Lutz.
* src/tail.c (main): Warn about following stdin only when it's a tty.
* configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
2004-01-10 Jim Meyering <jim@meyering.net>
* tests/misc/stat-fmt: Use backticks, not `$()' notation.
2004-01-09 Jim Meyering <jim@meyering.net>
* configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
2004-01-08 Jim Meyering <jim@meyering.net>
* src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
From Andreas Schwab.
* tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
remnant) from PATH component. That would cause tests in this directory
not to run the just-built binaries, but rather whatever happened
to be in one's PATH. Reported by Christian Krackowizer.
2004-01-04 Jim Meyering <jim@meyering.net>
* src/csplit.c (new_control_record): Use x2nrealloc
rather than xrealloc.
* src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
alloca and strcpy.
(make_path_private): Likewise.
2004-01-03 Jim Meyering <jim@meyering.net>
* src/paste.c: Use `bool' (not int) as the type for a few
global variables.
(collapse_escapes): Rewrite to set globals rather than modifying
its parameter.
Use size_t (not int) for all counters and related index variables.
(paste_parallel): Remove needless complexity of
using xrealloc in the loop; just allocate the buffers up front.
Free the two temporary buffers.
Move declarations of locals `down' into scope where used.
(paste_serial): Remove `register' attributes.
(main): Simplify delim-related code.
Free `delims', now that it's malloc'd.
2004-01-02 Jim Meyering <jim@meyering.net>
* src/chroot.c: Include "quote.h".
(CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
(main): Exit with status of 127, not 1, for too-few-args,
chroot failure, or chdir failure.
Give a better diagnostic upon execvp failure.
* src/du.c (usage): Mention that, with its current meaning,
-H is deprecated.
* src/tail.c (main): Warn about following stdin when it's a tty.
Fail when following by name but no names are specified.
2003-12-30 Jim Meyering <jim@meyering.net>
* src/fold.c (main): Use memcpy, not strcpy.
* src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
alloca and strcpy.
2003-12-28 Jim Meyering <jim@meyering.net>
* src/unexpand.c (n_tabs_allocated): New global.
(add_tabstop): Use x2nrealloc rather than xrealloc.
* src/expand.c: Likewise.
* tests/misc/expand: New file.
* tests/misc/Makefile.am (TESTS): Add expand.
* src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
(fillbuf): Use x2nrealloc rather than xrealloc.
(sort): Use xnmalloc rather than xmalloc.
(main): Likewise.
2003-12-27 Jim Meyering <jim@meyering.net>
* src/tee.c (tee): Use xnmalloc rather than xmalloc.
2003-12-29 Paul Eggert <eggert@twinsun.com>
* NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
* doc/coreutils.texi (join invocation): Remove documentation
accordingly. Document that -t makes all separators significant.
* src/join.c: Include posixver.h.
(obsolete_usage): New var.
(longopts): Put obsolete options first.
(OBSOLETE_LONG_OPTIONS): New constant.
(get_option, add_file_name): New functions.
(main): Use them to support new behavior.
(usage): Remove documentation for -j1 FIELD and -j2 FIELD.
Do not mark -j FIELD as obsolescent; it is longstanding
UNIX tradition and is a valid extension to POSIX.
* tests/join/Test.pm (tv): Avoid obsolete -o usage.
2003-12-28 Paul Eggert <eggert@twinsun.com>
* src/join.c (add_field_list): Don't use alloca with unbounded
size; just modify the argument, which is no longer const *.
Various other minor cleanups, mostly to avoid the need for casts.
(extract_field): Renamed from ADD_FIELD, as it's now a function.
(struct field.beg): Now char *, not unsigned char const *. All
uses changed. It shouldn't be const since xmemcoll writes on its
arguments.
(extract_field): Likewise, for 2nd arg.
(keycmp): Remove now-unnecessary cast of xmemcoll args.
(is_blank): New function, to avoid need to cast arg to unsigned char.
(extract_field): Use it.
(xfields): Rewrite pretty much from scratch.
(hard_LC_COLLATE): Now bool, not int.
(get_line, getseq, add_field_list): Now returns bool, not int.
(decode_field_spec, add_field_list): Return true on success (not
false), for consistency with the rest of the code. All uses changed.
(tab): Now char, not unsigned char. This wasn't 100% necessary
but is slightly cleaner.
(prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
(empty_filler): Now const *.
(make_blank): Remove; wasn't needed. Remove all calls.
(main): Don't set uni_blank.nfields; zero is fine.
2003-12-27 Jim Meyering <jim@meyering.net>
* src/join.c: Include "quote.h".
(min, max): Remove definitions.
Make a few function parameters and corresponding
locals `const'. Use bool for boolean variables.
Use size_t (not int) for all counters and related index variables.
(prjoin): Remove now-useless assertion.
(string_to_join_field): New function.
(main): Accept join fields as large as SIZE_MAX.
(keycmp): Rename `min' to MIN and max to MAX.
2003-12-26 Jim Meyering <jim@meyering.net>
fold -s didn't work on e.g., alpha-based systems.
* src/fold.c (fold_file): Adjust types (int->size_t) so that using
x2nrealloc works properly on systems with differing sizes for int
and size_t. Reported by Nelson Beebe.
* src/fold.c: Use `bool' (not int) as the type for a few
global variables.
2003-12-23 Paul Eggert <eggert@twinsun.com>
* src/ls.c (length_of_file_names_and_frills):
Remove forward decl; not needed.
(print_file_name_and_frills, length_of_file_name_and_frills):
With -m, don't output spaces before inum or size.
(print_with_commas): Don't output space just before newline.
2003-12-24 Jim Meyering <jim@meyering.net>
* tests/ls/Makefile.am (TESTS): Add m-option.
* tests/ls/m-option: New file. Test for above fixes.
2003-12-20 Jim Meyering <jim@meyering.net>
* Version 5.1.0.
* src/pr.c: Change type of global, buff_allocated, to size_t.
* src/join.c [struct seq]: Change types of members count and alloc
from `int' to `size_t'.
* tests/Makefile.am (root-hint): Tweak wording.
* src/du.c: Accept new option (-0, --null) that makes it so each
output line is NUL-terminated rather than newline-terminated.
* src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
Reported by Volker Paul.
* tests/dd/Makefile.am (TESTS): Add unblock-sync.
* tests/dd/unblock-sync: New test for the above.
2003-12-19 Jim Meyering <jim@meyering.net>
* tests/misc/nohup: Double quote back-ticked expression,
in case it ends up having an unexpected value.
* tests/ls/no-arg: Use ls's -1 option in both runs.
* src/du.c (fts_debug): New global.
(FTS_CROSS_CHECK, DEBUG_OPT): Define.
(main): Make fts use FTS_TIGHT_CYCLE_CHECK.
(main) [DU_DEBUG]: Accept -d option.
2003-12-18 Jim Meyering <jim@meyering.net>
* src/ls.c (format_user): Increment dired_pos via two statements,
`dired_pos += width; dired_pos++;' rather than one,
`dired_pos += width + 1;' since the latter could conceivably overflow.
(format_group): Likewise.
From Paul Eggert.
* configure.ac: Require automake-1.8.
2003-12-12 Jim Meyering <jim@meyering.net>
* Use automake-1.8. Regenerate dependent files.
2003-12-08 Jim Meyering <jim@meyering.net>
* Makefile.maint (news-date-check): New rule.
(alpha beta major): Depend on it.
2003-12-03 Paul Eggert <eggert@twinsun.com>
* NEWS: ls -l (and similar options) now adjust all columns to
fit the data. Generalized from a suggestion by Leah Q for file sizes.
* src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
(format_user_width, format_group_width, unsigned_file_size,
format_group): New functions.
(block_size_width): Renamed from block_size_size.
(inode_number_width, nlink_width, owner_width, group_width,
author_width, major_device_number_width, minor_device_number_width,
file_size_width): New vars.
(clear_files): Initialize them.
(gobble_file): Set them. Don't ceiling block_size_width to 7.
(print_long_file): Use them.
(gobble_file): Use a new local variable 'f' to make the code
smaller and more consistent with other functions.
(format_user): Output to stdout, not to a buffer, so that we
don't have to worry about buffer overrun. Update dired_pos.
(print_long_file): Don't put owner, group, author into buffer;
just print them directly. Don't assume link counts and
major and minor numbers fit into unsigned long int.
* tests/cp/same-file, tests/mv/part-symlink: Don't assume that
'ls' output is fixed-width.
2003-12-02 Jim Meyering <jim@meyering.net>
* src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
2003-11-27 Jim Meyering <jim@meyering.net>
* Use automake-1.7f. Regenerate dependent files.
2003-11-24 Paul Eggert <eggert@twinsun.com>
Parse floating-point operands and options in the C locale.
POSIX requires this for printf, and we might as well be
consistent elsewhere (tail, sleep, seq).
* src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
needed now that we assume C89. Include "c-strtod.h".
(xstrtod): Call c_strtod, not strtod.
* src/sleep.c: Include "c-strtod.h".
(main): Update xstrtod call to include new argument, c_strtod.
* src/seq.c (scan_double_arg): Likewise.
* src/tail.c (parse_options): Likewise.
2003-11-24 Jim Meyering <jim@meyering.net>
* tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
Reported by Mark Conty.
2003-11-22 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_xalloc_h_in_src): Remove rule. Subsumed by...
(sc_system_h_headers): Do this test only if sys2.h exists.
2003-11-20 Jim Meyering <jim@meyering.net>
* tests/help-version: Ensure that the bug-reporting address is
included in the --help output for every program.
* tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
* src/ptx.c (usage): Output bug-reporting address.
Reported by Dan Jacobson.
2003-11-19 Jim Meyering <jim@meyering.net>
* src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
on the join fields. Suggestion from Bruce Robertson.
2003-11-18 Jim Meyering <jim@meyering.net>
`od -c -w9999999' could segfault
* src/od.c (dump): Use xnmalloc/free, not alloca.
2003-11-16 Jim Meyering <jim@meyering.net>
* Use autoconf-2.59. Regenerate dependent files.
* tests/du/hard-link: Minor tweak: use mkdir -p.
Fix read-from-free'd-buffer error detected by valgrind.
* src/csplit.c (remove_line): Don't return a pointer to data in
a freed buffer. Instead, arrange to free the buffer on the
subsequent call.
* tests/misc/csplit: New test for above fix.
2003-11-11 Jim Meyering <jim@meyering.net>
* src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
This avoids a warning from valgrind about memcpy with overlapping
source and destination.
* configure.ac: Require automake-1.7.8.
2003-11-09 Jim Meyering <jim@meyering.net>
* Use automake-1.7.9. Regenerate dependent files.
* src/rm.c: Support new options: --preserve-root and --no-preserve-root.
* src/chown.c: Likewise.
* src/chown-core.c: Include "root-dev-ino.h".
(chopt_init): Initialize new member.
(change_file_owner): Support rm's new --preserve-root option.
* src/remove.c: Include "root-dev-ino.h".
(remove_cwd_entries): Remove now-obsolete FIXME comment.
(remove_dir): Support rm's new --preserve-root option.
* src/chown.c: Include "root-dev-ino.h".
Add new options: --preserve-root and --no-preserve-root.
* src/chmod.c: Include "root-dev-ino.h".
(process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
ROOT_DEV_INO_WARN macros.
(get_root_dev_ino): Remove function definition, now that it's
been moved to a separate file.
(usage): Describe new options.
* src/mv.c (rm_option_init): Initialized new member.
* src/remove.h: Include "dev-ino.h".
(struct rm_options): Add new member: root_dev_ino.
* src/chown-core.h: Include "dev-ino.h".
(struct Chown_option): Add new member: root_dev_ino.
2003-11-06 Jim Meyering <jim@meyering.net>
* src/paste.c (paste_parallel): Use `sizeof *var' rather than
hard-coding `sizeof FILE*'.
2003-11-05 Dennis Smit <ds@nerds-incorporated.org>
* src/wc.c (main): Free `fstatus' so there is no confusion about
whether it's leaked or not.
* src/who.c (who): Likewise for `utmp_buf'.
2003-11-05 Paul Eggert <eggert@twinsun.com>
Fix 'cut' problems with size_t overflow and unsigned int.
More generally, resize integer variables to fit use more precisely.
* src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
(struct range_pair): Make members to be of type size_t, not unsigned.
(max_range_endpoint, eol_range_start): Now size_t, not unsigned.
(suppress_non_delimited, output_delimiter_specified,
have_read_stdin, print_kth, set_fields): Now bool, nt int.
(delim): Now unsigned char, not int.
(mark_printable_field, is_printable_field, is_range_start_index,
set_fields, set_fields, cut_bytes, cut_fields):
Use size_t, not unsigned, for field and byte counts.
(hash_int): Use uintptr_t, not unsigned, for pointers converted
to integers. This squeezes more info out of them.
(set_fields, cut_bytes, cut_fields, main):
Use bool, not int, for booleans.
(set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
2003-11-05 Paul Eggert <eggert@twinsun.com>
* man/Makefile.am (check-programs-vs-x):
Work even if $(programs) contains '$'.
Work even if 'missing=1' in environment.
Don't report an error simply because $(programs) outputs nothing.
2003-11-05 Jim Meyering <jim@meyering.net>
* Use autoconf-2.58. Regenerate dependent files.
* src/tr.c (spec_init): Fix typo in last change.
* src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
call to variadic version_etc function, so that it works even on systems
for which sizeof char* != sizeof int.
* src/true.c (main): Likewise.
* basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
* factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
* pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
* sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
Similarly, cast NULL to `(char *)' in call to variadic function,
parse_long_options, so that it works even on systems for which
sizeof char* != sizeof int.
A similar problem was reported by Harti Brandt in
http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
* src/users.c (users): Free `utmp_buf' explicitly so that people
don't mistake this for a real leak.
Patch by Dennis Smit <ds@nerds-incorporated.org.
2003-11-04 Paul Eggert <eggert@twinsun.com>
* README: Document _POSIX2_VERSION.
2003-11-04 Jim Meyering <jim@meyering.net>
* src/tac.c (memrchr): Remove #if-0'd function.
(tac_stdin_to_mem): Clean up #if-0'd code.
* src/od.c (decode_format_string): Remove unnecessary casts.
Use more maintainable `sizeof *var'.
(main): Call decode_format_string rather than decode_one_format,
now that `spec' may be NULL.
* src/chmod.c (AUTHORS): Add my name.
* src/split.c (next_file_name): Use `sizeof *var' rather than
hard-coding `sizeof size_t'.
* src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
* src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
to avoid potential overflow in pointer arithmetic.
(set_fields): Use not `1', but rather `sizeof *printable_field' as
second argument to xcalloc.
* src/od.c (decode_format_string, dump_strings): Use x2nrealloc
rather than xrealloc.
* src/date.c (show_date): Likewise.
* src/join.c (ADD_FIELD, initseq, getseq): Likewise.
* src/pr.c (store_char): Likewise.
* src/fold.c (fold_file): Likewise.
* src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
type changes (unsigned int -> size_t) in hash.c.
* src/cp-hash.c (src_to_dest_hash): Likewise.
* src/du.c (entry_hash): Likewise.
* src/ls.c (dev_ino_hash): Likewise.
* src/cut.c (hash_int): Likewise. Declare function as static.
2003-11-03 Jim Meyering <jim@meyering.net>
* tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
* tests/misc/fold: Fail the test immediately if we're not running
the expected version of fold.
2003-11-02 Jim Meyering <jim@meyering.net>
* src/tr.c (append_normal_char, append_range, append_char_class)
(append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable
and usually shorter.
* src/copy.c (copy_internal): Likewise.
* src/join.c (initseq, add_field, make_blank): Likewise.
* src/od.c (main): Likewise.
* src/cp.c (make_path_private): Likewise.
* src/tsort.c (new_item, record_relation): Likewise.
* src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
(main): Also remove anachronistic cast of xmalloc return value.
* src/ptx.c (alloc_and_compile_regex, main): Likewise.
(main): Also remove anachronistic cast of xmalloc return value.
* src/sort.c (inittables): Likewise.
(sort): Also Split a long line.
2003-10-25 Jim Meyering <jim@meyering.net>
* src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
type changes (unsigned int -> size_t) in hash.c.
* src/cp-hash.c (src_to_dest_hash): Likewise.
* src/du.c (entry_hash): Likewise.
* src/ls.c (dev_ino_hash): Likewise.
* src/cut.c (hash_int): Likewise. Declare function as static.
2003-10-21 Jim Meyering <jim@meyering.net>
Don't fail when run with VERBOSE=yes.
* tests/chgrp/basic: Do `set +x' before starting the subshell
from which we invoke chgrp. Otherwise, the output from the
VERBOSE=yes-induced `set -x' would result in spurious differences.
Reported by Russel Coker via Michael Stone.
2003-10-19 Jim Meyering <jim@meyering.net>
chmod now uses fts to perform a directory traversal when -R is
specified. Before, it operated on full path names, and as such
would encounter the PATH_MAX (often 4096) limit.
* src/chmod.c: Include "xfts.h".
(process_file): Rename from change_file_mode.
Adapt to be used with fts.
(process_files): New function.
2003-10-18 Jim Meyering <jim@meyering.net>
* tests/du/deref-args: Ensure that du -D now dereferences all
symlinks specified on the command line, not just those that
reference directories.
* basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
* dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
* hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
* mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
* printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
* split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
* touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
* who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
Update the call to parse_long_options so that `AUTHORS, NULL' are the
last parameters.
* src/true.c (main): Append NULL to version_etc argument list.
* src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
2003-10-17 Andreas Schwab <schwab@suse.de>
* tests/mk-script: Get $srcdir from first parameter instead of
hardcoding it.
(main): Update usage.
* tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
first argument of mk-script.
($(srcdir)/Makefile.am): Likewise. Prepend $(srcdir) to target.
2003-10-17 Jim Meyering <jim@meyering.net>
* src/mv.c (usage): Tweak descriptions of -i and -f so that the
generated `man' page is more readable. Suggestion from Dan Jacobson.
* src/chown-core.c (change_file_owner): Handle the cases in
which fts_info indicates an error with the given entry.
* src/du.c (main): Simply assign to bit_flags.
Don't bother with bit arithmetic.
* tests/chmod/no-x: New file.
* tests/chgrp/no-x: New file.
* tests/chmod/Makefile.am (TESTS): Add no-x.
* tests/chgrp/Makefile.am (TESTS): Likewise.
* src/du.c: Include "xfts.h".
(du_files): Use xfts_open, rather than fts_open.
* src/chown-core.c (chown_files): Likewise.
2003-10-16 Jim Meyering <jim@meyering.net>
* src/chgrp.c (main): Simply assign to bit_flags.
Don't bother with bit arithmetic.
* src/chown.c (main): Likewise.
Rename a couple of local variables.
Remove unnecessary casts.
* src/tail.c (start_bytes): Rename local, remainder, to avoid
gcc's warning about shadowing a global.
2003-10-15 Jim Meyering <jim@meyering.net>
chown and chgrp now accept POSIX-mandated -H, -L, -P options and
use fts to perform a directory traversal when -R is specified.
Before, they operated on full path names, and as such would
encounter the PATH_MAX (often 4096) limit.
They are more efficient. For example, before, chgrp -R would
take almost 5 seconds to change about 2000 directories and fail
(with `File name too long'), while now it succeeds on a hierarchy
of depth 20,000 in 1/10 the time.
* src/chown.c: Include "userspec.h" and "fts_.h".
(WRITTEN_BY): Add my name.
(getpwnam, getgrnam, getgrgid): Remove declarations.
(endpwent): Remove definition.
(usage): Update.
(main): Handle new options.
Call new function, chown_files rather than change_file_owner.
* src/chgrp.c: Include "fts_.h".
(WRITTEN_BY): Add my name.
(MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
the latter.
(usage): Update.
(main): Handle new options.
Call new function, chown_files rather than change_file_owner.
Rewrite to iterate through hierarchies using fts rather than
via explicit recursion.
* src/chown-core.c: Include "fts_.h"
(change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
on a single file at a time.
(chown_files): New function.
* src/chown-core.h [enum Dereference_symlink]: Remove declaration.
[struct Chown_option] (recurse, force_silent): Change type to `bool'.
[struct Chown_option] (dereference): Remove member with ambiguous name.
[struct Chown_option] (affect_symlink_referent): New member.
(chown_files): New prototype.
* tests/chgrp/recurse: Update tests accordingly.
* tests/chgrp/posix-H: New tests for the above.
* tests/chgrp/Makefile.am (TESTS): Add posix-H.
* src/ln.c (usage): Clarify that --directory, -d, -F probably won't
work even for superuser. Suggestion from Dan Jacobson.
2003-10-14 Paul Eggert <eggert@twinsun.com>
Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
properly diagnosed.
* lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
* src/sort.c (parse_field_count): Handle the case where overflow
and invalid suffix char are both reported.
2003-10-14 Jim Meyering <jim@meyering.net>
* src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
true on Linux.
2003-10-13 Paul Eggert <eggert@twinsun.com>
Fix to avoid a denial-of-service attack if the display width is
enormous. Also, clean up the code a bit by removing duplicate code.
* src/ls.c (init_column_info): Remove forward decl; no longer needed.
(calculate_columns): New function, that contains code that used
to be common to print_many_per_line and print_horizontal.
(print_many_per_line, print_horizontal): Use it.
(decode_switches): Set max_idx here, not in calculate_columns.
(print_current_files): Don't call init_column_info; calculate_columns
now does that.
(init_column_info): Don't allocate a lot more space than is needed
to represent the current set of files. Allocate all the new
size_t cells in one call to xnmalloc, rather than a row at a time.
2003-10-13 Jim Meyering <jim@meyering.net>
* src/ls.c (init_column_info): Add another FIXME comment.
2003-10-13 Paul Eggert <eggert@twinsun.com>
Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
Remove several arbitrary limits on hosts where int cannot represent
all size_t values.
* src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
nfiles, files_index, tabsize, line_length, struct column_info.line_len,
struct column_info.col_arr[0], max_idx):
Now size_t, not int.
(get_funky_string): Return bool indicating success, instead of
a negative count to indicate failure. Store number of columns
through new parameter OUTPUT_COUNT; that way, they can never
go negative. Change equals_end from int to bool. All uses
changed.
(struct column_info.valid_len): Now bool, not int. All uses changed.
(dired_dump_obstack, get_funky_string, clear_files,
extract_dirs_from_files, print_current_files,
print_many_per_line, print_horizontal, init_column_info,
put_indicator, length_of_file_name_and_frills,
print_with_commas): Use size_t, not int, for local variables
that count sizes.
(decode_switches): Decode sizes using xstrtoul, not xstrtol.
Check for TIOCGWINSZ returing negative values (or values greater
than SIZE_MAX!).
(visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
init_column_info):
Use xmalloc and xnmalloc, not XMALLOC.
(gobble_file): Use xnrealloc, not XREALLOC.
(print_color_indicator): Remove now-unnecessary cast to size_t.
2003-10-12 Paul Eggert <eggert@twinsun.com>
* tests/du/no-x: Change wording of diagnostic to match latest du.c.
* tests/sort/sort-tests: Remove from CVS; assume that people
brave enough to check coreutils out from CVS can rebuild it.
2003-10-12 Jim Meyering <jim@meyering.net>
New options: --preserve-root and --no-preserve-root.
* src/chmod.c (change_file_mode): Honor new option.
(change_file_mode): Strip trailing slashes on directory
argument passed to change_dir_mode.
(get_root_dev_ino): New function.
(main): Initialize global, root_dev_ino.
* src/copy.c (copy_internal): Don't #ifdef-out simple uses of
S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined
via system.h.
* src/chmod.c (change_file_mode): Likewise.
2003-10-08 Jim Meyering <jim@meyering.net>
* src/csplit.c (main): Remove obsolete FIXME.
2003-10-07 Jim Meyering <jim@meyering.net>
* Use automake-1.7.8. Regenerate dependent files.
2003-09-29 Paul Eggert <eggert@twinsun.com>
csplit cleanup.
* doc/coreutils.texi (csplit invocation):
The regexp offset need not have a sign; POSIX requires support
for signless offets.
Be more careful about int widths. For example, remove some
arbitrary limits by replacing 'unsigned' with 'size_t',
'uintmax_t', etc. Use standard bool rather than a homegrown type.
* lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
* src/csplit.c (FALSE, TRUE, boolean): Remove. All uses changed
to <stdbool.h> usage.
(struct control): offset is now intmax_t, not int.
repeat_forever is now bool, not int.
(struct cstring): len is now size_t, not unsigned int.
(struct buffer_record): bytes_alloc, bytes_used, num_lines are now
size_t, not unsigned. start_line, first_available are now
uintmax_t, not unsigned.
(hold_count, control_used): Now size_t, not unsigned.
(last_line_number, current_line, bytes_written):
Now uintmax_t, not unsigned.
(save_to_hold_area, red_input, keep_new_line, record_line_starts,
create_new_buffer, get_new_buffer, load_buffer, find_line,
process_regexp, split_file, new_control_record, extract_regexp,
get_format_width, get_format_prec, max_out):
size args, locals, and returned values are now size_t, not unsigned
or int.
(get_first_line_in_buffer, find_line, write_to_file,
handle_line_error, process_line_count, regexp_error, process_regexp,
split_file):
File line, byte, and repetition counts are now uintmax_t, not unsigned.
(check_for_offset): Don't require a sign before the offset.
Use xstrtoimax to do the real work.
(extract_regexp): Remove harmful cast of size to unsigned.
256 -> 1<<CHAR_BIT, for clarity.
(get_format_flags): Return at most 3, to avoid worries about overflow.
(bytes_to_octal_digits): Remove.
(cleanup): Don't check whether output_stream is NULL, since
close_output_file does that for us.
(new_line_control, create_new_buffer): Use "foo *p = xmalloc
(sizeof *p);" instead of the more long-winded alternatives.
(get_new_buffer): Use O(1) algorithm for resizing a buffer
to a much larger size, instead of an O(N) algorithm.
(process_regexp): Use plain NULL rather than casted 0.
(make_filename): Use %u, not %d, to format unsigned file number.
(new_control_record): Use xrealloc exclusively, since it handles
NULL reliably.
(extract_regexp): Change misspelled word in diagnostic.
(get_format_width): Even if a minimum field width is specified,
allow room for enough octal digits to represent the value of
the maximum representible integer. This fixes a potential
buffer overrun. Calculate this room at compile-time, not
at run-time; this removes the need for bytes_to_octal_digits.
Check for overflow; this removes a FIXME.
(get_format_prec): Don't allow precision to be signed; it's
not ANSI. Check for overflow. Remove hardcoded "11" as
default precision; this fixes a potential buffer overrun
on hosts with wider size_t.
(get_format_conv_type): Change local variable to be of type
unsigned char, not int; this removes a potential subscript
violation on hosts where char is signed.
(max_out): Replace "for (;*p;)" with more-standard "while (*p)".
Allow "%%" in format. Don't overflow when
counting lots of percents.
(usage): Default sprintf format is %02u, not %d.
2003-10-05 Jim Meyering <jim@meyering.net>
* src/chown-core.c (change_file_owner): Remove set-but-not-used local.
* src/du.c (du_files): Mark diagnostic for translation.
2003-10-04 Jim Meyering <jim@meyering.net>
* src/du.c (du_files): Ignore any failure of fts_close.
Give better diagnostics for failed fts_open.
* src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
Deprecate existing use of -H (aka --si).
* src/du.c (enum) [HUMAN_SI_OPTION]: New member.
[long_options]: Use HUMAN_SI_OPTION, not 'H'.
(main): Warn that the meaning of -H will soon change to be
POSIX compliant.
2003-10-03 Jim Meyering <jim@meyering.net>
* src/du.c: Accept --no-dereference (-P).
2003-10-02 Jim Meyering <jim@meyering.net>
* tests/du/trailing-slash: Adjust for slightly different output.
Rewrite du.c to use fts.
* src/du.c: Include "fts_.h", not ftw.h.
(opt_dereference_arguments, arg_length, suffix_length): Remove globals.
(IS_FTW_DIR_TYPE): Remove definition.
(IS_DIR_TYPE): Define.
(is_symlink_to_dir): Remove now-unnecessary function.
(process_file, du_files): Rewrite to use fts.
* tests/du/inaccessible-cwd: Ensure that even when run from an
inaccessible directory, du can still operate on accessible
directories elsewhere.
* tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
* tests/rm/deep-1: Ensure that du can process a hierarchy
of depth 400 while using no more than 50KB of stack space.
2003-10-01 Akim Demaille <akim@epita.fr>
* announce-gen (print_news_deltas): New function, extracted from main.
(main): Make `news_file' an array.
Use '...=s' => \@var for --news and --url-directory specs.
Before there were a couple of portability problems.
2003-09-28 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_cast_of_alloca_return_value): New rule.
(syntax-check-rules): Add it.
* src/copy.c: Remove unnecessary cast of alloca, since now it's
guaranteed to be (void *).
* src/cp.c: Likewise.
* src/join.c: Likewise.
* src/ln.c: Likewise.
* src/ls.c: Likewise.
* src/od.c: Likewise.
* src/sys2.h (ASSIGN_STRDUPA): Likewise.
2003-09-27 Jim Meyering <jim@meyering.net>
Don't exhaust virtual memory when processing large inputs.
Fix this by removing csplit's internal free-list management;
instead rely on malloc for that.
* src/csplit.c (free_list): Remove global.
(clear_all_line_control): Remove function.
(get_new_buffer): Always use create_new_buffer to obtain a
new buffer, rather than searching free_list.
(free_buffer): Just call free.
Reported by Nikola Milutinovic.
2003-09-26 Jim Meyering <jim@meyering.net>
* man/rm.x: Also list `chattr' in SEE ALSO section.
Suggestion from Mark Hubbart.
2003-09-25 Jim Meyering <jim@meyering.net>
* configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
* Use autoconf-2.57d. Regenerate dependent files.
2003-09-24 Jim Meyering <jim@meyering.net>
Minor efficiency tweak.
* src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
(do_link): Likewise.
2003-09-23 Jim Meyering <jim@meyering.net>
* src/paste.c (paste_serial): Save errno after input error,
to report proper errno value.
Based on a patch from Paul Eggert.
* src/tee.c (tee): Adjust fwrite arguments so that the return
value is the number of bytes written.
2003-09-16 Paul Eggert <eggert@twinsun.com>
Don't assume ferror sets errno. Bug reported by Bruno Haible.
* src/comm.c (compare_files): Save errno after input error,
to report proper errno value.
* src/fold.c (fold_file): Likewise.
* src/od.c (check_and_close, skip, read_char, read_block): Likewise.
* src/unexpand.c (unexpand): Likewise.
* src/csplit.c (close_output_file): Don't report bogus errno value
after ferror discovers an output error. We don't know the proper
errno value, since it might have been caused by any of a whole
bunch of calls, and it might have been trashed in the meantime.
Fixing this problem will require much more extensive changes;
in the meantime just say "write error".
* src/od.c (check_and_close, dump, dump_strings): Likewise.
* src/uniq.c (check_file): Likewise.
* src/join.c (get_line): Report error right away if I/O fails,
so that the proper errno value is used.
* src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
* src/tee.c (tee): Likewise.
* src/uniq.c (check_file): Likewise.
* src/od.c (skip): If a read fails, don't retry it later, so
that we report the proper errno.
* src/tac.c (tac_mem): Don't return a value; nobody uses it.
* src/tee.c (tee): Once a write failure has occurred, don't bother
writing anything more to that stream.
* src/uniq.c (check_file): Check for ferror (stdout) even if
ostream == stdout.
* src/yes.c (UNROLL): Remove.
(main): Exit immediately when write failure is detected.
Simplify code by assigning to argv when argc == 1.
2003-09-21 Paul Eggert <eggert@twinsun.com>
* src/ptx.c: Switch encoding from Latin-1 to UTF-8.
(WRITTEN_BY): Change "Franc,ois" (actually using
c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
xgettext requires.
2003-09-19 Jim Meyering <jim@meyering.net>
`du -D symlink-to-dir' would mistakenly omit the slash in
lines like this: 24 symlink-to-dir/subdir
* src/du.c (process_file): Fix offset calculation.
Reported by Jeff Sheinberg as Debian bug #211591;
http://bugs.debian.org/205251
* tests/du/deref-args: New file/test for the above.
* tests/du/Makefile.am (TESTS): Add deref-args.
* src/du.c (process_file): Remove useless disjunct.
* src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
to Written_by.
* nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
Mark each WRITTEN_BY string as translatable.
* basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
* dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
* hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
* mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
* printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
* split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
* touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
* who.c, whoami.c, yes.c: Revert yesterday's changes.
Instead, a subsequent change will embed `Written by ' in
each string along with the author names.
* src/true.c: Revert yesterday's changes.
* src/sys2.h: Likewise.
2003-09-18 Jim Meyering <jim@meyering.net>
* basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
* dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
* hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
* mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
* printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
* split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
* touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
* who.c, whoami.c, yes.c: Update AUTHORS definition to be a
comma-separated list of strings and/or update the call to
parse_long_options so that `AUTHORS, NULL' are the last parameters.
* src/true.c (main): Append NULL to version_etc argument list.
* src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
* src/sort.c (numcompare): Rename local, logb, to log_b to avoid
shadowing the math function name. Also rename loga to log_a.
2003-09-14 Jim Meyering <jim@meyering.net>
* src/factor.c (print_factors): Give a separate diagnostic
for numbers that are too large, but otherwise valid.
Reported by Dániel Varga.
2003-09-10 Jim Meyering <jim@meyering.net>
* Use automake-1.7.7. Regenerate dependent files.
* tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
of `fmt -1'. Using the just-built tr is a little cleaner.
Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
* man/Makefile.am (programs, check-x-vs-1): Likewise.
2003-09-09 Jim Meyering <jim@meyering.net>
* src/copy.c: Alphabetize includes.
Remove duplicate inclusion of "same.h".
2003-09-08 Jim Meyering <jim@meyering.net>
* Makefile.maint (GZIP_ENV): Remove --rsyncable.
Didn't give enough of a benefit, mainly because it's not yet
in wide enough use.
* Version 5.0.91.
* man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
(check-programs-vs-x): Fail if $(programs) is empty.
* src/remove.c: Add a comment.
2003-09-07 Jim Meyering <jim@meyering.net>
* src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
Don't define. These symbols are no longer used.
* tests/misc/tty-eof: Write ^D as \cD.
Complete the change of 2003-08-02.
* Makefile.maint (po-check): Use cvsu, so that a temporary source
file in lib/ or src/ doesn't induce an unwarranted failure.
Add a kludge to filter out the sole generated source file that
also has translatable messages: src/false.c.
2003-09-06 Jim Meyering <jim@meyering.net>
* src/tail.c (enum): Add ALLOW_MISSING_OPTION.
(parse_options): Give a diagnostic for (but still accept) the
deprecated --allow-missing option.
2003-09-04 Paul Eggert <eggert@twinsun.com>
Don't ignore -S if input is a pipe. Bug report by Michael McFarland in
<http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
* src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg. Compute the
size_bound ourselves. if an input file is a pipe and the user
specified a size, use that size instead of trying to guess the
pipe size. This has the beneficial side effect of avoiding the
overhead of default_sort_size in that case. All callers changed.
(sort): Remove static var size; now done by sort_buffer_size.
2003-09-05 Jim Meyering <jim@meyering.net>
* Use automake-1.7.6b and autoconf-2.57b. Regenerate dependent files.
* tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
to start, rather than just .1. Upon failure, print unexpected state.
2003-09-04 Paul Eggert <eggert@twinsun.com>
* src/head.c (elide_tail_lines_pipe): Don't assign 0 or
SAFE_READ_ERROR to tmp->nbytes.
* src/tail.c (pipe_lines, pipe_bytes): Likewise.
* src/head.c (struct linebuffer): Change nbytes and nlines
from unsigned int to size_t. unsigned int is safe (after the
2003-09-03 patch) but size_t is cleaner.
* src/tail.c (struct linebuffer, struct charbuffer): Likewise.
(pipe_bytes): Likewise for local variable 'i', which was 'int'.
Standardize on BUFSIZ as opposed to other macro names and values.
* src/head.c (BUFSIZE): Remove. All uses changed to BUFSIZ.
* src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
stdio.h has always defined it,
and other code already assumes it's defined.
* src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
(IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
(io_buf): IO_BUF_SIZE -> BUFSIZ.
2003-09-04 Paul Eggert <eggert@twinsun.com>
* src/seq.c (step): Default to 1.
(print_numbers): Allow the output to be empty.
(main): The default step is 1, even if LAST < FIRST;
as per documentation.
* tests/seq/basic (onearg-2): Output should be empty.
2003-09-05 Jim Meyering <jim@meyering.net>
* Makefile.cfg (wget_files): Temporarily disable, until master
versions are restored to ftp.gnu.org.
* configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
Make seq's --width (-w) option work properly even when the
endpoint requiring the larger width is negative and smaller than
the other endpoint.
* src/seq.c (get_width_format): Include `-' in the set of bytes
allowed in a `simple' number (no decimal point, no exponent).
Reported by Patrick Mauritz.
2003-09-02 Paul Eggert <eggert@twinsun.com>
* NEWS: sort -t '\0' now uses a NUL tab.
sort option order no longer matters, unless POSIX requires it.
* src/sort.c (usage): Say "blanks" instead of "whitespace",
Similar fixes for many comments.
(TAB_DEFAULT): New constant, so that we can support NUL as
the field separator.
(tab): Now int, not char. Initialize to TAB_DEFAULT.
(specify_sort_size): If multiple sizes are specified, use the largest.
(begfield, limfield): Support NUL tab char.
(set_ordering): Do not let -i override -d.
(main): Report an error if incompatible -o or -t options are given.
Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
2003-09-05 Jim Meyering <jim@meyering.net>
* tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
2003-09-03 Andreas Schwab <schwab@suse.de>
Bug report and patch here:
<http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
* src/tail.c (pipe_lines): Don't truncate return value from safe_read.
* src/head.c (elide_tail_lines_pipe): Likewise.
2003-09-03 Jim Meyering <jim@meyering.net>
* src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
small amount of code from him was first moved to lib/human.c, and was
subsequently rewritten entirely.
* src/df.c (AUTHORS): Likewise.
2003-08-22 Lawrence Teo <lcteo@uncc.edu>
* src/md5sum.c (split_3): Accept the BSD format for generic
message digest modes. Currently works with BSD's MD5 and SHA1
formats since these are the two algorithms presently used in
coreutils. Updated comments to reflect this change.
(bsd_split_3): Updated comments.
* tests/md5sum/basic-1: New test to make sure that
`md5sum --check' doesn't accept the BSD SHA1 format (adapted
from `check-bsd' test in tests/sha1sum/basic-1).
* tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
--check exit status and BSD SHA1 format (adapted from tests
in tests/md5sum/basic-1).
2003-08-30 Jim Meyering <jim@meyering.net>
* src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
When source and destination arguments refer to the same file, reside
on a partition (e.g. VFAT) on which distinct names may refer to the
same directory entry (often due to variations in case), and when the
link count for the file is 1, mv no longer unlinks the file. Instead,
it gives the expected diagnostic that the source and destination are
the same. WARNING: this is an incomplete fix. If the file happens
to have a link count of 2 or greater, such an erroneous mv command
will still unlink it.
Although that is not possible on vfat or umsdos, it is possible on
other file system types, e.g., ntfs, and hpfs.
* src/copy.c (same_file_ok): Invoke same_name (which might still
return false for names that refer to the same directory entry)
only if the link count is 2 or more.
* tests/mv/vfat: Show how to demonstrate the above problem.
This test is not run.
* tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
2003-08-27 Jim Meyering <jim@meyering.net>
* src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
who's -l option has been eliciting an unconditional warning about
this impending change since sh-utils-2.0.12 (April 2002).
* src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
This would happen for nonempty files not ending with a newline.
Reported by Dan Jacobson.
* tests/misc/paste-no-nl: New file. Test for above-fixed bug.
* tests/misc/Makefile.am (TESTS): Add paste-no-nl.
* src/stat.c (print_it): Avoid buffer overrun that would
occur when the user-specified format string ends with `%'.
Patch by Tommi Kyntola.
* tests/misc/stat-fmt: New file. Test for above-fixed bug.
* tests/misc/Makefile.am (TESTS): Add stat-fmt.
2003-08-26 Jim Meyering <jim@meyering.net>
Apply changes from bison.
* GNUmakefile (SHELL): Define to `sh', if necessary.
Add copyright.
* Makefile.maint (WGETFLAGS): Define to `-C off'.
Update all uses of $(WGET).
2003-08-22 Akim Demaille <akim@epita.fr>
* Makefile.cfg (local-checks-to-skip): New.
* Makefile.maint (local-check): Rename as...
(local-checks-available): this.
(local-check): New.
2003-08-26 Akim Demaille <akim@epita.fr>
* announce-gen (print_changelog_deltas): Neutralize "<#" as
"<\#" to avoid magic from Gnus when posting parts of this script.
2003-08-25 Jim Meyering <jim@meyering.net>
* src/stat.c (main): Warn about use of deprecated `-l' option.
2003-08-22 Jim Meyering <jim@meyering.net>
* src/stat.c (do_stat): For link count at end of line, use %h format,
instead of %-5h. The latter would make stat emit trailing spaces.
Reported by Dan Jacobson.
2003-08-20 Jim Meyering <jim@meyering.net>
* Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
2003-08-19 Jim Meyering <jim@meyering.net>
* src/system.h: Include stdlib.h unconditionally,
as we're now assuming that part of hosted C89.
2003-08-18 Jim Meyering <jim@meyering.net>
* src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
to avoid warnings from gcc.
2003-08-17 Jim Meyering <jim@meyering.net>
Avoid unnecessary and sometimes time-consuming hostname lookups.
* src/who.c (print_user): Use strchr, not strrchr.
* src/pinky.c (print_entry): Likewise.
Patch by Michael Stone.
This fixes a typo I introduced in who-users.c on 1996-02-23.
* Makefile.maint (makefile-check): Add 0-9 to the range of characters
disallowed between `@...@'.
2003-08-16 Paul Eggert <eggert@twinsun.com>
* configure.ac (fu_cv_sys_truncating_statfs): Remove; now
done by gnulib .m4 files.
(jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
* src/sys2.h (strtoull): Remove unused declaration.
2003-08-16 Jim Meyering <jim@meyering.net>
* man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
are read-only.
* src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
race condition bug. The bug would be triggered when tailing a file
with file pointer not at beginning of file, and where the file was
truncated to have a length of less than the initial offset at just
the right moment (between the two lseek calls in this function).
An invalid initial value for *read_pos would result in
`tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
busy-wait rather than sleeping between iterations. The bug manifests
itself only when tailing regular files that are initially nonempty.
* src/tail.c (tail_bytes): Set *read_pos to new file offset after
each xlseek call.
(tail_lines): Likewise, after lseek calls.
Reported by Nick Estes. See http://bugs.debian.org/205251 for details.
* tests/tail-2/tail-n0f: New file. Test for above fix.
* tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
2003-08-15 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_space_tab): Use exclusion list in separate file.
(sc_sun_os_names): Likewise.
* .x-sc_space_tab, .x-sc_sun_os_names: New files.
* man/help2man: Remove some SPACEs before TAB.
2003-08-14 Paul Eggert <eggert@twinsun.com>
* Makefile.maint (LC_ALL): Set to C.
* man/Makefile.am (ASSORT): New var.
(check-x-vs-1, programs): Use it.
* src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
* tests/Makefile.am (ASSORT, all_programs): Likewise.
2003-08-11 Jim Meyering <jim@meyering.net>
fold -s -wN would infloop for N < 8 with TABs in the input.
E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
* src/fold.c (fold_file): Move contents of `else'-block
out of conditional so it's used also for --spaces (-s).
* tests/misc/fold: Test for the above fix.
* tests/misc/Makefile.am (TESTS): Add fold.
2003-08-10 Jim Meyering <jim@meyering.net>
* src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
system.h so the types from time.h and sys/time.h are available.
It appears that this is necessary for OpenBSD, NetBSD, and
Darwin 6.5 (MacOS 10.2.5). Reported by Nelson Beebe.
2003-08-06 Paul Eggert <eggert@twinsun.com>
* NEWS: Add support for setting file timestamps to microsecond
resolution, on hosts that support this.
* src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
* src/copy.c (copy_internal):
Set file timestamps with utimens, not utime.
* src/cp.c (re_protect): Likewise.
* src/install.c (change_timestamps): Likewise.
* src/touch.c (newtime, touch, main): Likewise.
2003-08-09 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_sun_os_names): New rule based on a regexp
from Paul Eggert.
(syntax-check-rules): Add it.
* src/tail.c (main): Tweak Solaris OS version number in comment.
* src/wc.c (wc): Likewise
* tests/tail-2/fflush: Likewise.
* src/tail.c: Add new undocumented option, --presume-input-pipe.
(pipe_lines): Use memchr to skip lines, rather than an explicit loop.
2003-08-08 Paul Eggert <eggert@twinsun.com>
Use new gnulib 'extensions' module.
* configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
AC_GNU_SOURCE.
2003-08-08 Paul Eggert <eggert@twinsun.com>
* tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
2003-08-09 Jim Meyering <jim@meyering.net>
* tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
For tests of obsolete behavior, don't presume that unsetting
_POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
2003-08-07 Paul Eggert <eggert@twinsun.com>
* doc/coreutils.texi (split invocation):
Add -d or --numeric-suffixes option to 'split'.
From a suggestion by Jesse Kornblum.
* src/split.c (suffix_alphabet): New var.
(longopts, usage, next_file_name, main): Support -d.
(next_file_name, main): Allow -a0, as POSIX requires.
(next_file_name): Don't assume ASCII-like encoding;
'a' through 'z' are not contiguous in EBCDIC.
2003-08-05 Paul Eggert <eggert@twinsun.com>
Merge getline from gnulib.
* lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
* lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
New files, from gnulib.
* lib/getdelim2.c, lib/getdelim2.h: Remove.
* lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
getdelim2.h to getndelim2.c and getndelim2.h.
* m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
checking for getdelim.
(jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
than rolling our own.
* src/cut.c: Include getndelim2.h rather than getdelim2.h.
(cut_fields): Invoke getndelim2 rather than getdelim2.
2003-08-04 Jim Meyering <jim@meyering.net>
* src/sort.c (main): Use unsigned int instead of int for `nsigs'
and for the indices to iterate through nsigs.
2003-08-02 Paul Eggert <eggert@twinsun.com>
* src/sort.c: Minor code cleanups, mostly to use more accurate
types and to remove unnecessary casts.
(min, max): Remove. All uses changed to MIN and MAX.
(hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
keyfield.skipsblanks, struct keyfield.skipeblanks, struct
keyfield.numeric, struct keyfield.general_numeric, struct
keyfield.month, struct keyfield.reverse, reverse, unique,
have_read_stdin): Now bool, not int. All uses changed.
(eolchar): Now char, not int.
(struct keyfield.ignore): Now bool const *, not int *.
(struct keyfield.translate): Now char const *, not char *.
(struct month.name): Likewise.
(blanks, nonprinting, nondictionary): Now bool[], not int[].
(cleanup, inittables, keycompare, check, mergefps, first_same_file,
check, sort, main): Use const * pointers when possible.
(month_cmp): Rewrite to avoid casts.
(inittables): Initialize tables unconditionally, to avoid branches.
(fillbuf): Return bool, not int. All uses changed.
(fillbuf, keycompare, new_key, main):
Use SIZE_MAX rather than (size_t) -1.
(trailing_blanks): Renamed from trim_trailing_blanks.
Return the number of blanks to trim. All uses changed.
(getmonth): Use trailing_blanks rather than open code.
(keycompare): Do not cast char * to unsigned char *; not needed.
CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
ourselves.
(compare, main): Use | rather than || to avoid jumps.
Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
be nonzero there.
(check, first_same_file, sort, main):
Use bool instead of int local vars when possible.
(check): Merge the old 'checkfp' and 'check' into a single function,
that returns a boolean (true if the file was ordered).
All uses changed.
(main): Use int instead of unsigned for iterating through nsigs.
Rename local var "posix_pedantic" to "posixly_correct".
2003-08-02 Jim Meyering <jim@meyering.net>
* src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
* src/cut.c (cut_fields): Don't read again after encountering an
initial EOF. E.g., `cut -f2' would do so.
* tests/misc/tty-eof: Add a test for the above fix.
* src/sort.c (sortlines): Add description and references.
From Paul Eggert.
* tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
the tests in help-version will use the just-built binaries.
Reported by Christian Krackowizer.
2003-07-31 Paul Eggert <eggert@twinsun.com>
* NEWS: Add --rfc-2822 option to GNU date.
* doc/coreutils.texi (Time directives, Options for date, Examples
of date): Likewise.
* src/date.c (long_options, usage, main): Likewise.
* doc/getdate.texi (General date syntax): Likewise.
* doc/coreutils.texi (Options for date): Fix a typo in format:
it's now %d not %_d. Add URLs.
2003-08-01 Jim Meyering <jim@meyering.net>
* tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
Otherwise, with at least the /bin/sh from HPUX 10.20,
the trap code would end up converting that to exit 1 and thus an
unexpected test failure. Reported by Christian Krackowizer.
2003-07-31 Paul Eggert <eggert@twinsun.com>
* src/ptx.c: Do not include bumpalloc.h.
(WORD_TABLE): New member alloc.
(ALLOC_NEW_WORD): Remove.
(occurs_alloc): New var.
(digest_word_file, find_occurs_in_text): Check for arithmetic
overflow when computing table size. Use xrealloc rather than
bumpalloc primitives.
2003-07-29 Jim Meyering <jim@meyering.net>
* Version 5.0.90.
* README: When running tests as root, suggest using
sudo with NON_ROOT_USERNAME=$USER.
* tests/Makefile.am (all_programs): Makefile is in ../src, not
$(srcdir)/../src.
2003-07-28 Jim Meyering <jim@meyering.net>
* Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
2003-07-28 Paul Eggert <eggert@twinsun.com>
* lib/stdbool.hin (_Bool): Make it signed char, instead of
an enum type, so that it's guaranteed to promote to int.
* src/sort.c (sortlines_temp): Undo previous change.
2003-07-28 Jim Meyering <jim@meyering.net>
* src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
`bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
would cause lines[-1 - swap] (with swap = false) to evaluate to
lines[4294967295].
2003-07-27 Jim Meyering <jim@meyering.net>
* tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
* src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
directories, as required by POSIX. Reported by Karl Berry.
* tests/rm/dir-no-w: New file. Test for the above fix.
* tests/rm/Makefile.am (TESTS): Add dir-no-w.
* tests/mk-script: Emit `$xx', not its expansion.
2003-07-27 Paul Eggert <eggert@twinsun.com>
This change was inspired by a similar proposal by Stepan Kasal.
* src/sort.c (mergelines, sortlines_temp): New functions.
(sortlines): Use them, to reduce the number of times that
we need to copy 'struct line' values. This improved CPU
performance by about 30% on one 18 MB test.
(sort): Don't invoke sortlines unless we have 2 or more lines.
2003-07-26 Stepan Kasal <kasal@ucw.cz>
* src/sort.c (sort): Don't require two `struct line's per text line,
the new sort algorithm requires just 1.5.
2003-07-27 Jim Meyering <jim@meyering.net>
* src/pathchk.c (validate_path): Use %lu, not %ld.
From Paul Eggert.
* src/cut.c (is_printable_field): Simplify bit arithmetic.
From Paul Eggert.
* src/ls.c (sort_files): Put `volatile' in the right place.
From Paul Eggert.
2003-07-26 Jim Meyering <jim@meyering.net>
Use only one bit per field/offset in array, not one `int'.
* src/cut.c (printable_field): Change type to `unsigned char'.
(mark_printable_field, is_printable_field): New functions.
Use them in place of all direct accesses of `printable_field'.
* src/expand.c (parse_tabstops): Detect overflow properly.
* src/cut.c (set_fields): Likewise.
* src/rm.c: Include "dirname.h".
(usage): Use base_name (program_name) in body of --help output.
This lets me...
* man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
Idea from Brendan O'Dea, who suggested using
`program_name = basename (argv[0]);' everywhere --
can't do that, but using base_name works just fine here.
* src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
2003-07-24 Paul Eggert <eggert@twinsun.com>
Fix some POSIX-compliance problems with 'test'. This makes
'test' more compatible with Bash.
* NEWS, doc/coreutils.texi: Document the following.
* src/test.c: Include exitfail.h.
(TEST_FAILURE): New constant, used for exit status if 'test' fails.
(test-syntax_error): Use it.
(binary_operator): Now takes bool arg specifying whether left operand
is -l ARG, so that caller determines this rather than us.
All uses changed.
(term): Use posixtest to evaluate parenthesized subexpressions.
(unary_operator, one_argument): Remove support for -t without operand.
(one_argument): Take argument from argv[pos].
(one_argument, two_arguments, three_arguments): Advance pos.
All callers changed.
(three_arguments): Look for binary ops before "!". Then look
for parenthesized one_argument expressions, instead of trusting
expr () to do the right thing.
(posixtest): Now takes number of args. All callers changed.
Treat "( A B )" like "A B".
(main): Set exit_failure to TEST_FAILURE. Don't depend on
POSIXLY_CORRECT, as we now conform to POSIX by default.
(main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
* tests/test/Test.pm (test_vector): Add several tests to check
the above. Syntax errors now exit with status 2, not 1.
* man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
2003-07-26 Jim Meyering <jim@meyering.net>
* tests/help-version: Adjust for above change in test behavior:
`[' exits with 2, not 1, and test doesn't accept --help or --version.
* Makefile.maint (ME): Don't use trick suggested in Make manual.
It doesn't work for make-3.79.1. Reported by Christian Krackowizer.
* Makefile.maint (sc_system_h_headers): Another syntax check.
(syntax-check-rules): Add it to the list.
* src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
so it matches `%ld' format even on 32-bit systems.
* src/fmt.c (flush_paragraph): Cast field width to `int' to
avoid warning on 64-bit systems.
* src/ls.c (sort_files): Make `func' volatile, so it can't be
clobbered by a `longjmp' into this function.
2003-07-25 Jim Meyering <jim@meyering.net>
* src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
value.
* tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
because it'd evoke spurious failure on 64-bit systems.
2003-07-24 Jim Meyering <jim@meyering.net>
* src/dd.c (usage): Document the fact that SIGUSR1 makes dd
output its current record counts. Reported by Jurriaan.
* tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
`wc' with no options. This goes along with the change of 2003-07-20.
2003-07-23 Jim Meyering <jim@meyering.net>
Don't include headers already included by system.h:
* src/tr.c: Don't include errno.h.
* src/true.c: Don't include version-etc.h.
* src/test.c: Don't include limits.h or error.h.
* src/stat.c: Don't include unistd.h or time.h.
* src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
* src/pr.c: Don't include time.h.
* src/pathchk.c: Don't include errno.h.
* src/nice.c: Don't include sys/time.h.
* src/ls.c: Don't include stdlib.h.
* basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
* dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
* fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
* md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
* pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
* sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
* tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
* uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
Don't include closeout.h.
* tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
can access the required version of rm.
* tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
* tests/cut/Test.pm (out-delim3a): New test.
* man/help2man: Update to version 1.33.
* src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
* src/dircolors.c: Include xstrndup.h.
(xstrndup): Remove function, now that it's been factored out into
it's own file.
2003-07-22 Paul Eggert <eggert@twinsun.com>
* src/wc.c (wc): Fix typo in computation of file from file_x,
which caused the former to be used uninitialized if file_x was
nonzero.
2003-07-22 Jim Meyering <jim@meyering.net>
* src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
* man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
help2man, to avoid having `rm.td/rm' appear in rm.1. Reported by
Thomas Luzat. See http://bugs.debian.org/202413 for details.
* src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
* src/hostid.c: Don't include <unistd.h>. system.h already does that.
* src/cut.c (set_fields): Mark all selected indices before trying to
determine range endpoints.
* tests/cut/Test.pm: New test for the above fix.
Begin to address this comment: What if someone wants to
extract the 1,000,000-th field of some huge input file?
The first step is to rearrange things so that the values
in the printable_field array are all 0/1 rather than 0/1/2.
* src/cut.c (RANGE_START_SENTINEL): Remove.
Store range-start indices in a hash table, rather than
overloading the `printable_field' array.
(range_start_ht): New global.
(hash_int, hash_compare_ints, is_range_start_index): New functions.
(print_kth): Use is_range_start_index; don't test printable_field.
(set_fields): Detect overflow.
(set_fields): Insert each range-start index into range_start_ht.
(main): Call set_fields only once, and only after
output_delimiter_specified and (if required) range_start_ht have
been defined.
2003-07-20 Paul Eggert <eggert@twinsun.com>
* src/wc.c (get_input_fstatus): Fix typo: `stat' was being
invoked with a null pointer when there were no file arguments.
2003-07-20 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_changelog): Add another nit-picky check.
* src/wc.c (write_counts): Add a comment.
(wc): Rename `file' parameter.
Set new local, `file', to be the file name, or (when it's NULL)
_("standard output") so that all uses of `file' use the proper value.
Use STREQ, not strcmp.
2003-07-20 Paul Eggert <eggert@twinsun.com>
wc count field widths now are heuristically adjusted depending
on the input size, if known. If only one count is printed, it
is guaranteed to be printed without leading spaces.
Previously, wc did not align the count fields if
POSIXLY_CORRECT was set, but POSIX did not actually require
this undesirable behavior, so it has been removed.
* NEWS: Document this.
* doc/coreutils.texi (wc invocation): Likewise.
* src/wc.c (number_width): New var.
(posixly_correct): Remove.
(struct fstatus): New struct.
(write_counts): Output fields of width number_width.
Do not worry about POSIXLY_CORRECT.
Use null file, not empty-string file, to denote stdin,
since "" is a valid file name on some hosts.
(wc, wc_file): New arg fstatus. Use it to avoid invoking fstat
if possible.
(wc): Avoid problems if end_pos - current_pos overflows.
Do not print odd message if stdin has a read error.
(get_input_fstatus, compute_number_width): New functions.
(main): Use them to implement the new behavior.
Ignore POSIXLY_CORRECT.
* tests/wc/Test.pm: Adjust to the new output widths.
2003-07-19 Jim Meyering <jim@meyering.net>
* tests/rm/fail-eperm: Don't create temporary directory --
we don't use it.
* tests/shred/remove: Don't open-code test for UID != 0.
Use priv-check's require-non-root instead.
Update to use newer framework.
* tests/help-version (expected_failure_status_expr): Record that
expr exits with status of 3 for e.g., a write error.
* tests/priv-check: Use `id -u' to see if we're running as root,
rather than trying go write to an write-protected file.
When running as root, ensure $NON_ROOT_USERNAME is valid.
When running as root with `require-non-root', ensure that `.'
is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
to $NON_ROOT_USERNAME. If `.' is not writable, then skip the test.
* src/printenv.c: Include "exitfail.h".
(main): Set exit_failure rather than calling close_stdout_set_status.
* src/date.c: Likewise.
* src/sort.c: Likewise.
* src/tty.c: Likewise.
2003-07-18 Jim Meyering <jim@meyering.net>
* tests/touch/not-owner: Update to use newer framework.
* tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
directory, and remove Perl-coded `you may not run as root' test.
* tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
hard-coding something not quite equivalent.
Paul Jarc reported the inconsistent diagnostics.
* src/sort.c (main): Use close_stdout via atexit.
Now `sort --version' and `sort --help' fail, as they should
when their output is redirected to /dev/full.
* src/su.c (usage): Don't call close_stdout here.
(main): Use close_stdout via atexit.
Now `su --version > /dev/full' fails, as it should.
Somehow, the change of 2000-05-07 that purports to fix this
was not checked in.
* tests/help-version (--help/--version vs. /dev/full): Special-case
`[' to protect it from expected_failure_status-`eval'.
* src/uniq.c (writeline): Use a SPACE, not a TAB between the
count and the corresponding line, as required by POSIX.
Reported by Clement Wang.
* tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
* tests/expr/basic: Add tests for when exit status is 2.
* src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
Use an anonymous `enum', rather than #define.
2003-07-17 Paul Eggert <eggert@twinsun.com>
* src/expr.c: Include "exitfail.h", "quotearg.h".
(EXPR_INVALID, EXPR_ERROR): New constants.
(nomoreargs, null, toarith, nextarg): Return bool, not int.
(syntax_error): New function, exiting with status 2. Use it
insteading of printing "syntax error" ourselves.
(main): Initialize exit_failure to EXPR_ERROR.
Exit with EXPR_INVALID on syntax error (too few arguments).
(nextarg): Use strcmp, not strcoll; strcoll might return
an undesirable 0, or might fail.
(docolon, eval4, eval3): Exit with status 3 on invalid argument type
or other such error.
(eval2): Report an error if strcoll fails in a string comparison.
* src/sort.c: Include "exitfail.h".
(main): Set exit_failure, not xalloc_exit_failure and
xmemcoll_exit_failure.
* tests/expr/basic: Invalid value exits with status 3, not 2.
2003-07-16 Jim Meyering <jim@meyering.net>
* configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
per GNU maintainer guidelines. The next non-beta release will be 5.1.
This script would have caught at least two recent bugs:
those in [ and kill.
* tests/help-version: Revive this script.
It wasn't doing anything useful, since $all_programs wasn't being
defined by the invoking Makefile.am.
Reflect that nohup is no longer a script, so don't exclude it.
Add framework to handle the programs added since it was last run:
kill, stat, unlink, [, link, readlink.
Fix path-related problems deriving from the move of this script
from src/ to its present location.
* tests/Makefile.am (all_programs): Define.
(TESTS_ENVIRONMENT): Use it.
* src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
whereby kill would always attempt to operate on argv[0] and fail.
* src/test.c (integer_expected_error): Improve diagnostic -- now,
it also matches the one from bash's builtin test.
(binary_operator): Add \n at end of diagnostic.
* tests/rm/fail-2eperm: Remove setuidgid-related code. Move it to ...
* tests/priv-check: Move setuidgid-related and
NON_ROOT_USERNAME-checking code to this file.
* README: Update section on testing as `root'.
Suggestion from Paul Jarc.
* src/test.c (AUTHORS): Replace 3-letter usernames with the actual
names of authors that I just found in bash's builtins/test.def.
Running `[' with no arguments would evoke a segfault.
* src/test.c (main) [LBRACKET]: Move initialization of argv to
precede potential use via test_syntax_error.
* src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
warning from automake -Wall.
2003-07-15 Jim Meyering <jim@meyering.net>
* Version 5.0.1.
* Makefile.maint (%.asc): Remove target first, so gpg doesn't
prompt us about it.
* announce-gen (print_changelog_deltas): Relax tests for matching
version-number line in NEWS.
Change the .sig suffix to .asc here, too.
2003-07-14 Jim Meyering <jim@meyering.net>
* Makefile.maint (%.asc): Renamed from %.sig.
Generate and use ascii-armored signatures.
Use gpg's -o option.
2003-07-13 Jim Meyering <jim@meyering.net>
* src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
(main): Use them.
* Makefile.maint (syntax-check): Move each individual check into
its own target.
(syntax-check-rules): This is the list of syntax-check targets.
(sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
(sc_cast_of_x_alloc_return_value, sc_space_tab):
(sc_error_exit_success, sc_xalloc_h_in_src): New targets.
2003-07-12 Jim Meyering <jim@meyering.net>
* configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
traces of the nohup script.
* src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
$(OPTIONAL_BIN_ZCRIPTS).
* src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
target, not before the `>'.
* src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
now that that function no longer calls `error'.
* src/df.c (find_mount_point): Emit a diagnostic for each
failed syscall, rather than relying on caller to do that.
The caller couldn't do a good job, anyhow -- too many different
ways to fail (each with a different referent).
Give a diagnostic upon failed save_cwd, now that that function
no longer calls `error'.
(show_point): Don't diagnose find_mount_point's errors, now that
it handles them itself.
* src/df.c (find_mount_point): Don't let free clobber errno upon
failed chdir.
* src/sys2.h: Remove alloca-related block.
* src/system.h: Include <alloca.h> here, instead.
It appears that the `#pragma alloca' included via "system.h" is
adequate, since join.c uses alloca, yet lacked an in-file #pragma.
* src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
* src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
* src/chown-core.c (change_file_owner): Do not restore any special
permission bits (e.g., set-user-ID, set-group-ID) that are reset
by chown(2) on some systems. Suggestion and insistence :-) from
Michael Stone.
* tests/input-tty: Also check `test -t 1'.
This is necessary on linux-2.4.21. Otherwise, the stty/basic-1
test would block when run in the background.
2003-07-11 Jim Meyering <jim@meyering.net>
* tests/sample-test: Also fail if cat-to-create-expected-output
fails. Otherwise, if both `exp' and `out' were to end up empty
because of e.g., a full disk, they would mistakenly compare equal.
* src/nohup.c: New file. Rewrite of nohup.sh in C.
This solves a portability problem: on at least Solaris systems,
when nohup.sh used the vendor /bin/sh, it would exit with status
of `1' rather than the required 126 or 127 upon failure to exec
the specified program.
* src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
(bin_PROGRAMS): Add nohup.
(EXTRA_DIST): Remove nohup.sh.
(all_programs): Remove use of $(EXTRA_SCRIPTS).
* src/nohup.sh: Remove file.
* man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
* tests/misc/nohup: Tests for the above.
* tests/misc/Makefile.am (TESTS): Add nohup.
* src/head.c (diagnose_copy_fd_failure): New function, renamed from
the macro, COPY_FD_DIAGNOSE.
(diagnose_copy_fd_failure): Enclose diagnostic in _(...).
(head_file): Likewise.
* src/date.c: Include "quote.h".
(batch_convert): Use the quote function rather than using literal `...'
in a diagnostic.
* src/setuidgid.c (main): Enclose diagnostic in _(...).
* src/fmt.c (main): Likewise.
* src/mknod.c (main): Likewise.
* src/tac.c (tac_seekable): Likewise.
* src/yes.c (main): Likewise.
* src/od.c (main): Likewise.
* src/install.c (change_attributes): Likewise.
2003-07-10 Jim Meyering <jim@meyering.net>
* src/head.c (usage): Use 1024*1024 in place of 1048576.
* src/tail.c (usage): Likewise.
* tests/rm/fail-2eperm: Now that we have setuidgid, use it in
place of the kludge in this test. Suggestion from Paul Jarc.
* src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
* src/setuidgid.c: New program, solely for testing (not installed).
* src/chown-core.c (change_file_owner): Don't leak file descriptors
when dereferencing symlinks.
2003-07-09 Jim Meyering <jim@meyering.net>
* tests/du/slash: New file/test for today's lib/ftw.c fix.
* tests/du/Makefile.am (TESTS): Add slash
* src/tail.c (xlseek): Avoid warning about ``return without value
from function returning non-void''.
2003-07-08 Jim Meyering <jim@meyering.net>
* man/help2man: Update to version 1.29.
* man/help2man: Add END handler to close STDOUT and check for errors.
2003-06-30 Paul Eggert <eggert@twinsun.com>
Add support for a "[" that conforms to the GNU coding standards,
i.e., that does not depend on its name.
* src/lbracket.c: New file.
* README: Add "[".
* man/Makefile.am (programs): Ignore "[", since it doesn't have
a separate man page.
* src/Makefile.am (bin_PROGRAMS): Add "[".
(__SOURCES): New var.
* src/test.c (LBRACKET): Define to 0 if not defined.
(main): Use LBRACKET rather than argv[0].
* src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
Reported by Paul Jarc and Dan Jacobson.
* src/test.c (main): Do not recognize --help or --version if
POSIXLY_CORRECT, when invoked as "test". Handle "[ ]" correctly.
Do not bother testing that margv[margc] is non-null.
2003-07-04 Jim Meyering <jim@meyering.net>
* src/who.c (print_line): Rewrite to use asprintf, in order to be
able to avoid emitting trailing spaces. Reported by Dan Jacobson.
* tests/misc/head-elide-tail: Add tests of head's new --lines=-N
option, and perform the +1600 invocations of head IFF the envvar
RUN_EXPENSIVE_TESTS is set.
2003-07-03 Jim Meyering <jim@meyering.net>
* src/cp.c (do_copy): Give a better diagnostic when failing due
to nonexistent destination directory. Reported by Dmitry Rutsky.
See http://bugs.debian.org/199730 for details.
2003-06-27 Jim Meyering <jim@meyering.net>
split's --verbose option did nothing [broken in 4.5.10 and 5.0]
* src/split.c (longopts): Use `1', not `0' as the value for
&verbose. Reported by Keith Thompson.
Test for the above fix.
* tests/misc/split-a: Also use --verbose and compare stderr
output with what we'd expect.
2003-06-20 Jim Meyering <jim@meyering.net>
* src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
Use `error_t' (rather than int) as type for local `err'.
From Alfred M. Szmidt.
2003-06-19 Marcus Brinkmann <marcus@gnu.org>
* src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
Fix author preservation code.
2003-06-19 Jim Meyering <jim@meyering.net>
* src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
(do_link): Don't warn about hard link to symlink.
2003-06-18 Jim Meyering <jim@meyering.net>
* src/cut.c: Include "getdelim2.h", not "getstr.h".
Reflect renaming: getstr -> getdelim2.
* src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
readline -> readlinebuffer.
2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* src/readlink.c: Include <sys/types.h> before system.h (because
the latter includes <sys/stat.h>). Required on Ultrix 4.3.
2003-06-17 Jim Meyering <jim@meyering.net>
* src/system.h (initialize_main): Define.
Use it in every `main'. Applied via this:
p='initialize_main (&argc, &argv);'
perl -ni -e '/program_name.=.argv.0/ and print " '"$p"'\n"; print' \
$(grep -l program_name.=.argv.0 *.c)
test.c uses margc/margv, so I made the change manually for that file.
Based on a patch from Bernard Giroud.
2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Fix for build failure on Ultrix 4.3.
* src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
Include sys/param.h and sys/mount.h on ultrix.
2003-06-16 Jim Meyering <jim@meyering.net>
* src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
definitions.
* src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
them here instead, but with one change: define EISDIR to -1, not 0.
* src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
guaranteed to be defined.
* src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
* README: Mention the CVS repository.
Encourage addition of test cases.
2003-06-12 Jim Meyering <jim@meyering.net>
* src/touch.c (touch): Call close only if necessary.
From Bruno Haible.
* src/wc.c (usage): Correct wording: wc prints counts in the order
`newline, word, byte'. Reported by Keith M. Briggs.
* man/wc.x: Fix it here, too. And change `lines' to `newlines'.
2003-06-10 Jim Meyering <jim@meyering.net>
* tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
2003-06-07 Jim Meyering <jim@meyering.net>
* Makefile.maint (syntax-check): Add commented-out (over-aggressive)
rule.
2003-06-06 Jim Meyering <jim@meyering.net>
* src/extract-magic (main): Avoid newer 3-arg form of open,
so this script works also with e.g., perl5.005_03.
Patch by John David Anglin.
2003-06-04 Paul Eggert <eggert@twinsun.com>
* src/system.h: Include <stdbool.h> unconditionally.
2003-06-04 Jim Meyering <jim@meyering.net>
* man/Makefile.am (check-programs-vs-x): Rename target
from check-programs-vs-1. Adjust rule to check for the
primary (.x) file, not the generated one (.1).
2003-06-03 Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
* man/kill.x: New file.
* man/Makefile.am (dist_man_MANS): Add kill.1.
(kill.1): New rule.
2003-06-04 Jim Meyering <jim@meyering.net>
Ensure that the .x file for a new program is never forgotten again.
* man/Makefile.am (programs): Define.
(check-programs-vs-1): New phony target.
(check-local): Depend on it.
2003-06-03 Jim Meyering <jim@meyering.net>
Avoid unnecessary copying of environment.
* src/env.c (main): Rather than clearing the environment and --
unless told to ignore environment -- copying all settings from
the saved, original environment, clear the environment only when
that is requested. Suggested by Jens Elkner.
2003-06-02 Jim Meyering <jim@meyering.net>
* src/system.h: Always include <string.h>, since we assume C89.
Include <limits.h> without checking for HAVE_LIMITS_H.
* src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
(STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
2003-06-01 Jim Meyering <jim@meyering.net>
Avoid a race condition in `tail -f' described by Ken Raeburn in
http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
* src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
(pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
(tail_bytes, tail_lines, tail): Likewise.
(tail_file): Use the new `read_pos' value as the size,
rather than stats.st_size from the fstat call.
2003-05-28 Jim Meyering <jim@meyering.net>
* src/extract-magic: Allow expansion of `$file' in the here-
document corresponding to the comment at the top of fs.h.
2003-05-26 Jim Meyering <jim@meyering.net>
* src/stat.c: Fix portability problem on FreeBSD5.0: don't include
<sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
Use #if/#elif/... cascade so we get only one set of include files.
Reported by Nelson Beebe.
2003-05-24 Jim Meyering <jim@meyering.net>
* src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
* tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
accept the BSD format.
2003-03-28 Joe Orton <jorton@redhat.com>
* src/md5sum.c (bsd_split_3): New function.
(split_3): Detect checksums from BSD 'md5' command and handle them
using bsd_split_3.
* tests/md5sum/basic-1: New tests for --check exit status, and for
BSD-style checksum files.
2003-05-21 Jim Meyering <jim@meyering.net>
* src/head.c (elide_tail_lines_pipe): Fix a thinko.
This sort of thing is why it'd be *Really Good* to factor
out the common code used here and in tail.c.
2003-05-14 Jim Meyering <jim@meyering.net>
* src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
* tests/du/slink: Skip this test if `.' is on an XFS file system.
* tests/du/fd-leak: New file. Test for the bug in du that
was fixed by the 2003-05-12 change to lib/ftw.c.
* tests/du/Makefile.am (TESTS): Add fd-leak.
* src/head.c (AUTHORS): Enclose string in N_(...), now that it
includes a translatable word, `and'.
* src/dd.c (usage): Don't use `,' as the thousands separator
in e.g. 1,000,000 and 1,048,576. Instead, do this:
`SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
* src/df.c (usage): Likewise.
* src/du.c (usage): Likewise.
* src/ls.c (usage): Likewise.
* Makefile.maint (syntax-check): Add another check.
2003-05-13 Paul Eggert <eggert@twinsun.com>
Fix uniq to conform to POSIX, which requires that "uniq -d -u"
must output nothing. Problem reported by Josh Hyman.
* src/uniq.c (enum output_mode, mode): Remove, replacing with:
(output_unique, output_first_repeated, output_later_repeated):
New vars. All uses of "mode" changed to use these variables,
which are not mutually exclusive as "mode" was.
(writeline): New arg "match", used to control whether to
obey output_first_repeated or output_later_repeated.
All callers changed.
(check_file, main): Adjust to above changes.
* tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
2003-05-14 Jim Meyering <jim@meyering.net>
* tests/rm/rm3: Use tr's \n notation rather than \012.
This package can afford to do that, since its tests are guaranteed use
GNU tr, which has accepted the more modern notation for 10 years.
* tests/rm/rm5: Likewise.
* tests/cp/same-file: Likewise.
* tests/stty/row-col-1: Likewise.
* tests/stty/basic-1: Likewise.
* tests/rm/deep-1: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mkdir/perm: Likewise.
* tests/misc/nice: Likewise.
2003-05-13 Jim Meyering <jim@meyering.net>
* src/copy.c (struct F_triple) [name]: Remove const attribute.
(triple_free): Don't apply cast to argument of free.
(seen_file): Add cast here instead.
* src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
(src_to_dest_free): Don't apply cast to argument of free.
* src/sort.c (zaptemp): Don't apply cast to argument of free.
* src/pr.c (init_fps, init_store_cols): Likewise.
* src/join.c (delseq, freeline): Likewise.
* src/expr.c (OLD): Likewise.
* src/sort.c (sort): Likewise.
* src/head.c (elide_tail_lines_pipe): Likewise.
* src/tail.c: Include "quote.h".
Use quote in diagnostics. Change many error format strings
from just `%s' to e.g., `error reading %s'.
(pipe_lines): Change type of parameter, n_lines, to uintmax_t.
Rewrite newline-counting loop to use memchr.
* src/head.c (elide_tail_lines_pipe): Use `if', not assert.
Now that assert is no longer used, don't include <assert.h>.
2003-05-12 Jim Meyering <jim@meyering.net>
* src/head.c: Include <assert.h>.
(AUTHORS): Add my name.
(elide_tail_lines_pipe): New function.
2003-05-10 Jim Meyering <jim@meyering.net>
* Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
* src/readlink.c (main): Set program_name before first use.
Remove that (redundant) first use.
Don't exit successfully just because --verbose was specified.
Pass 0, not EXIT_SUCCESS, as first argument to error; when that
parameter is 0, error does not exit.
* src/uname.c (main): When failing due to too many arguments, also say
that, rather than just "Try `uname --help' for more information.".
* src/comm.c (main): Likewise, but for too few arguments.
* src/logname.c: Include error.h.
(main): Say why we're failing.
* src/uniq.c (main): Don't segfault when argc < optind.
* src/who.c (main): Handle argc < optind.
* src/df.c (main): Likewise.
* src/install.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/pwd.c (main): Likewise.
* src/tty.c (main): Likewise.
* src/chroot.c (main): Likewise.
* src/hostname.c: Likewise.
* src/du.c (main): Likewise.
* src/expand.c (main): Likewise.
* src/env.c (main): Likewise.
* src/unexpand.c (main): Likewise.
* src/printenv.c (main): Likewise.
* src/sync.c (main): Handle argc == 0.
* src/expr.c (main): Likewise.
* src/printf.c (main): Likewise.
* src/basename.c (main): Likewise.
* src/ln.c (main): Test for `missing argument' before computing n_files.
* src/tail.c (main): Test for the case of no arguments before
computing n_files.
* src/kill.c (send_signals): Don't check command line arguments here.
(main): Check them here instead. Handle argc < optind.
* src/logname.c (main): Use error, rather than fprintf, for the sake
of consistency.
* src/rm.c (main): Don't overrun array bound if argc is 0.
2003-05-09 Jim Meyering <jim@meyering.net>
* src/sort.c (main): Don't overrun array bound if argc is 0.
That would happen when invoked via: execl ("/usr/bin/sort", NULL);
Reported by Wartan Hachaturow.
2003-05-07 Jim Meyering <jim@meyering.net>
Implement support so that `head --lines=-N' works on seekable files.
* src/head.c (enum Copy_fd_status): Define.
(COPY_FD_DIAGNOSE): New macro.
(elide_tail_lines_seekable): New funtion.
(elide_tail_lines_file): Call it here.
2003-05-06 Jim Meyering <jim@meyering.net>
* src/sys2.h (CHAR_BIT): Remove duplicate definition.
2003-05-04 Jim Meyering <jim@meyering.net>
* tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
caused the addition of thousands of small files to the tar archive.
* tests/misc/head-elide-tail: New file. Add them here instead.
* tests/misc/Makefile.am (TESTS): Add head-elide-tail.
2003-05-04 Paul Eggert <eggert@twinsun.com>
* src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
(IF_READDIR_NEEDS_REWINDDIR): Remove.
(remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
which was a bit weird because it couldn't be emulated by a function.
2003-05-03 Jim Meyering <jim@meyering.net>
Extend head to accept --lines=-N (--bytes=-N) and to print all
but the N lines (bytes) at the end of the file.
* src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
Use quote() in diagnostics, rather than literal `' marks.
(copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
New functions.
(elide_tail_lines_pipe, elide_tail_lines_file): New functions.
(head_file): Reorganize so as to call head from only one place.
(main): Likewise, for head_file.
Handle new, undocumented option, --presume-input-pipe.
Handle negative line and byte counts.
* tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
* tests/du/8gb: Skip test if the file system of `.' doesn't support
sparse files -- otherwise it'd create a file of size 8GB.
2003-05-02 Jim Meyering <jim@meyering.net>
* src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
Instead explain about `-' and standard input.
(main): Give a proper diagnostic for e.g., `fmt -c -72'.
Reported by Keith Thompson.
* tests/fmt/basic: Add test for the above fix.
* src/fmt.c: Include "quote.h".
Use quote() in diagnostics, rather than literal `' marks.
(main): Exit nonzero when unable to open an input file.
* tests/fmt/basic: Add test for the above fix.
* src/fmt.c (main): Diagnose invalid suffix on obsolescent width
specifications like `-72x'.
* tests/fmt/basic: Add test for the above fix.
Work around nasty readdir bug on Darwin6.5.
* src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
[! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
returned NULL and there has been at least one successful unlink or
rmdir call since the opendir or previous rewinddir, then call
rewinddir and reiterate the loop.
Factor out common code.
* src/remove.c (readdir_ignoring_dotdirs): New function.
(is_empty_dir): Use it here.
(remove_cwd_entries): Use it here.
2003-05-01 Jim Meyering <jim@meyering.net>
* tests/rm/r-3: Create 500 rather than just 300 files.
There's a bug in Darwin6.5's readdir that shows up only with
338 or more files.
Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
has two components.
* src/tail.c:
Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
(dump_remainder): Move two declarations `down' into the scope
where they are used.
(xlseek): Return the resulting offset.
(file_lines): Rename parameter, file_length, to end_pos.
(pipe_lines): Don't coerce safe_read return value to `int'.
Adapt tests accordingly.
(pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
to `unsigned int'.
Change type of `total_bytes' from `int' to `size_t',
since the former wouldn't always be wide enough.
Don't coerce safe_read return value to `int',
and adapt tests accordingly.
Now that testing for a read error no longer involves
using `tmp', handle that case *after* freeing `tmp'.
(start_bytes): Clean up.
(tail_bytes): Now that `n_bytes' may be larger than
OFF_T_MAX, test for that condition and, if it's true, don't
use lseek optimizations.
(parse_options): Don't fail just because N_UNITS is larger than
the maximum size of a file -- tail may be applied to an input
stream (e.g., a pipe) with more data than that.
* Makefile.maint (syntax-check): Rename from alloc-check.
Also check for SPACE-TAB sequences.
Also check for malloc/calloc/realloc casts.
2003-05-01 Jim Meyering <jim@meyering.net>
* src/tail.c (start_lines): Rewrite to use memchr. Clean up.
2003-04-28 Jim Meyering <jim@meyering.net>
* tests/misc/tty-eof: Send two tokens, not just one, so we don't
make the now-more-picky tsort fail.
2003-04-24 Jim Meyering <jim@meyering.net>
* src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
(main): Minor syntactic clean-up.
* src/tsort.c (tsort): Fail if the input contains an odd number of
tokens. Reported by junkio@cox.net.
* tests/tsort/basic-1: Test for the above fix.
2003-04-21 Jim Meyering <jim@meyering.net>
* tests/misc/printf: Add tests for the printf fixes below.
* Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
2003-04-20 Paul Eggert <eggert@twinsun.com>
Fix printf POSIX compatibility bug reported by Ben Harris in
<http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
* doc/coreutils.texi (printf invocation): It's \NNN in the format,
\0NNN in the %b operand.
* src/printf.c (usage): Likewise.
(print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
is desired. All uses changed. Behave like Bash printf if %b
operand uses \NNN where the initial N is not 0.
2003-04-17 Jim Meyering <jim@meyering.net>
* src/stty.c: Remove uses of PROTOTYPE macro.
2003-04-15 Jim Meyering <jim@meyering.net>
* Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
each sequence of spaces before a TAB character.
2003-04-13 Jim Meyering <jim@meyering.net>
* src/remove.c (is_empty_dir): Don't closedir (NULL).
2003-04-12 Jim Meyering <jim@meyering.net>
Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
--body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
* src/nl.c (main): Fix those problems and remove literal quote marks
(e.g., "`%s'") from format string; instead use "%s" in each format
string and `quote (optarg)' as the corresponding argument.
Also, diagnose all invalid command line options before failing.
* src/nl.c (proc_text): Fix a bug that would make nl output extra
newlines in some cases. Details here: http://bugs.debian.org/177256.
This bug was introduced on 2001-11-10 for textutils-2.0.17.
* tests/misc/nl: Add test for the above-fixed bug.
* tests/misc/readlink: New file. Test the --canonicalize option.
* tests/misc/Makefile.am (TESTS): Add readlink.
2003-04-11 Jim Meyering <jim@meyering.net>
Clean up.
* src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
* src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
* src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
retain alignment) each sequence of spaces before a TAB character.
* src/ls.c: Include <stdlib.h> unconditionally.
* Makefile.maint (xalloc-check): Rename from header-check.
* src/yes.c: Include error.h after system.h, not before.
Clean up.
* src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
* src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
* src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
* src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
* src/tr.c: * src/unexpand.c, src/users.c:
Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
return values and of xrealloc's first argument.
Fix the former with this:
perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
2003-04-10 Jim Meyering <jim@meyering.net>
* src/stty.c (wrapf): Declare with format attribute.
The S_MAGIC_... names shouldn't be maintained in two places (prior
to this change, one would have to keep stat.c and fs.h in sync).
This change makes it so those names and the corresponding
hexadecimal constants all reside in stat.c. fs.h is now generated.
* src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
(BUILT_SOURCES): Add fs.h, now that it's generated.
(EXTRA_DIST): Add extract-magic.
* src/extract-magic: New script to extract fs.h definitions from stat.c.
* src/stat.c (human_fstype) [__linux__]: Append each hex constant from
fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
* tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
file with nominal length > 4GB fails. Reported by Michael Deutschmann.
* man/unexpand.x: Add `SEE ALSO' reference to expand.
* man/expand.x: Add `SEE ALSO' reference to unexpand.
Suggestion from Dan Jacobson.
2003-04-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
* src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
* src/stat.c (human_fstype): Handle Linux's devpts.
2003-04-09 Paul Eggert <eggert@twinsun.com>
* src/split.c (line_bytes_split): Arg is of type size_t, since
that's all that is supported for now.
(main): Check for overflow in obsolescent line count option.
2003-04-09 Jim Meyering <jim@meyering.net>
* tests/misc/split-fail: Add a new test for the above fix.
* src/split.c (bytes_split): Use size_t temporary (rather than
uintmax_t original) in remaining computations. From Paul Eggert.
Handle command line option arguments larger than 2^31.
This allows e.g., splitting into files of size 2GB and larger,
and running split --lines=N with N=2^31 or more.
But for --line-bytes=N, the restriction that N <= SIZE_MAX
remains (for now), due to the way it is implemented.
* src/split.c: Include "inttostr.h".
(bytes_split, lines_split, line_bytes_split, main):
Use uintmax_t, not size_t, for file sizes.
(main): Give a better diagnostic for option arguments == 0.
Use umaxtostr to print file sizes.
Reported by Luke Hassell.
2003-04-08 Jim Meyering <jim@meyering.net>
* src/rm.c (usage): Mention that --directory (-d) works only
on some systems. Suggestion from Samuel Tardieu.
* tests/basename/basic: Run $PERL to see if it is available,
rather than testing its value.
* tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
* tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
* tests/expr/basic, tests/factor/basic, tests/fmt/basic:
* tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
* tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
* tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
* tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
* tests/sum/basic-1, tests/seq/basic: Likewise.
* tests/misc/Makefile.am (TESTS): Add split-fail.
* tests/misc/split-fail: New file.
* src/split.c: Rename local variables: nchars -> n_bytes.
(lines_split): Rename local, nlines -> n_lines.
(main): Rename local variable: s/accum/n_units/.
(main): Use STDIN_FILENO, not literal `0'.
2003-04-07 Jim Meyering <jim@meyering.net>
* src/stat.c: Add #include directives for Ultrix 4.4.
Based on a suggested change from Bert Deknuydt.
2003-04-06 Jim Meyering <jim@meyering.net>
* Makefile.maint (makefile-check): New rule.
(local-check): Add it.
2003-04-05 Jim Meyering <jim@meyering.net>
* Makefile.am (nearly all of them):
Use $(VAR) rather than @VAR@, now that we can rely on automake to
emit a definition for each substituted variable.
* tests/Makefile.am.in: Likewise.
* tests/rm/rm5: Add a comment explaining why this test fails when
using Tru64's broken sed.
* tests/rm/rm3: Likewise.
Make `kill -t' output signal descriptions (not `?') on Tru64.
* src/kill.c (sys_siglist): Also check for __sys_siglist.
Patch by Tony Leneis.
* configure.ac: Also check for declaration of __sys_siglist.
Required for Tru64 4.0D, 4.0F, and 5.1.
Reported by Tony Leneis.
2003-04-04 Jim Meyering <jim@meyering.net>
* src/Makefile.am (PERL): Remove unnecessary definition.
Because of inappropriate (but POSIX-mandated) behavior of rename,
`mv a b' would not remove `a' in some unusual cases. Work around
this by unlinking `a' when necessary.
* src/copy.c (same_file_ok): Add an output parameter.
Set it in the offending case.
(copy_internal): When necessary, unlink SRC_PATH and inform caller.
Reported by Ed Avis.
* tests/mv/hard-4: New test for the above.
* tests/mv/Makefile.am (TESTS): Add hard-4.
Clean up rules for automatically generated sources:
* src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
Make each generated file be read-only.
Add each file name to BUILT_SOURCES separately.
(MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
Put LOCALEDIR macro definition in new file: localedir.h.
* src/Makefile.am (DEFS): Remove definition.
(localedir.h): New rule.
(BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
* src/system.h: Include "localedir.h".
2003-04-02 Jim Meyering <jim@meyering.net>
* Version 5.0.
* tests/misc/Makefile.am (TESTS): Add false.
* Makefile.maint (TMPDIR): Make sure it's defined.
(my-distcheck): Build in $(TMPDIR), not `.'.
* src/Makefile.am (false.c): Change all occurrences of
`(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
unsuccessfully also with --help. Reported by Paul Jarc,
* tests/misc/false: New test for the above.
2003-03-30 Jim Meyering <jim@meyering.net>
* NEWS: Note the location of older NEWS files.
* src/remove.c (is_empty_dir): Don't let a failing closedir
clobber errno. Spotted by Arnold Robbins.
* src/env.c: Fix typo in comment. From Arnold Robbins.
2003-03-29 Jim Meyering <jim@meyering.net>
* Version 4.5.12.
* README: Note to expect build problems for stat.c on Ultrix 4.3.
Note that there are some harmless test failures when running
`make check' as root on some systems.
2003-03-28 Jim Meyering <jim@meyering.net>
* tests/stty/row-col-1: Skip this test if stty can't get window size.
This happens when connecting to sparc-solaris5.7 via ssh from within
emacs. Reported by Karl Berry.
* tests/du/basic: Use seq, not `yes' to generate 4KB of data.
Otherwise, on systems (DJGPP) that emulate pipes using files,
this test would never complete, waiting for `yes' to terminate.
* tests/du/slink: As above, use seq, not `yes' to generate link target.
* tests/rm/hash: As above, use seq, not `yes' to generate dir name.
Reported by Rich Dawe.
2003-03-27 Jim Meyering <jim@meyering.net>
* src/id.c: Remove Arnold Robbins' obsolete e-mail address
from `written by...' comment, at his request.
2003-03-24 Paul Eggert <eggert@twinsun.com>
Fix buffer overrun problem reported by TAKAI Kousuke, along
with some other POSIX incompatibilities.
* src/printf.c (print_esc): Do not treat \x specially if
POSIXLY_CORRECT. Avoid buffer overrun if the format ends
in backslash. Treat incomplete escape sequences as strings
of characters, as POSIX requires.
(print_formatted): Allow multiple flags. Avoid buffer overrun
if the format is incomplete.
2003-03-24 Jim Meyering <jim@meyering.net>
* tests/misc/printf: Add tests for the above fixes and changes.
2003-03-26 Jim Meyering <jim@meyering.net>
* src/copy.h (struct cp_options): Add a comment.
2003-03-23 Jim Meyering <jim@meyering.net>
* README: Describe problem with 64-bit mode on HPUX 11.x,
with patch for /usr/include/inttypes.h.
* TODO: Plan to add an autoconf test to work around the bug.
2003-03-22 Jim Meyering <jim@meyering.net>
* src/stat.c: Don't include <sys/sysmacros.h>.
That is already done via system.h. Otherwise, the multiple
inclusion would evoke redefinition warnings from Cray's /bin/cc,
aka Cray Standard C Version 4.0.3 (057126) Mar 22 2003 22:02:28.
(human_fstype): Factor some directives `up', out of this function.
Cast away `const' to avoid error from Cray's /bin/cc.
2003-03-20 Jim Meyering <jim@meyering.net>
* announce-gen (print_changelog_deltas): Ensure that a newline
precedes each row of `*'s.
2003-03-20 Jim Meyering <jim@meyering.net>
* Version 4.5.11.
* src/seq.c (valid_format): Also accept ` ' and `'' as valid
format flag characters.
Do not require that a field width be specified.
Do not fail when given a field width of `0'.
Reported by Dan Jacobson.
* tests/seq/basic: Add new tests for the above-fixed bug.
* src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
(install-root): Likewise.
(install-exec-local): Likewise.
Based on a patch from Richard Dawe.
2003-03-19 Jim Meyering <jim@meyering.net>
* man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
because the DJGPP 2.03 port of 'ln -s' doesn't work.
Include $(EXEEXT) in program names.
Since $(LN_S) may degenerate to `cp -p', be careful
to invoke it from the destination directory.
Mostly from Richard Dawe.
* configure.ac: Use AC_PROG_LN_S.
* tests/mv/part-symlink: Unset CDPATH. Otherwise, having the
CDPATH shell variable set could cause this test to fail.
Reported by Karl Berry.
2003-03-18 Jim Meyering <jim@meyering.net>
* src/fmt.c [struct Word] (paren, period, punct, final): Change the
type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
AIX 5.1's xlc could not compile the former.
Patch by Petter Reinholdtsen. Also reported by Mike Jetzer.
2003-03-17 Richard Dawe <rich@phekda.freeserve.co.uk>
* configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
program names, since automake only adds $(EXEEXT) to programs
in its *_PROGRAMS.
2003-03-16 Jim Meyering <jim@meyering.net>
* src/remove.c (rm): Put two local variables in static storage,
so they can't be clobbered by the potential longjmp.
2003-03-15 Jim Meyering <jim@meyering.net>
* Makefile.cfg (gnu_rel_host): Fix code to match the comment
so that a version number with a two-digit component can still count
as an alpha release. Reported by Richard A Downing.
(gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
2003-03-14 Jim Meyering <jim@meyering.net>
* src/ansi2knr.c: Remove no-longer-used file.
* src/ansi2knr.1: Likewise.
* Makefile.maint (prev_version_file): Don't use ?= for this particular
assignment, since it causes trouble with old versions of GNU make
(e.g. 3.76.1). The other uses of `?=' are inoffensive. Details here.
http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
Patch from Alexandre Duret-Lutz.
* Use patched automake-1.7.3. Regenerate Makefile.in files in
subdirectories so that each includes a definition of ACLOCAL_M4.
* announce-gen (main): Label the compressed source URLs.
* Version 4.5.10.
* tests/du/slink: Relax the test for the `local'ness of a file system,
so that now it works also for tmpfs.
* tests/du/hard-link: Transform output from first du, so that this
test doesn't fail on file systems like tmpfs that order directory
entries differently.
2003-03-13 Jim Meyering <jim@meyering.net>
* tests/du/8gb: Work around what appears to be an NFS failure that
would make this test fail on some systems.
2003-03-11 Jim Meyering <jim@meyering.net>
* tests/du/basic: Make the test file exactly 4k bytes long.
* src/split.c (longopts): Don't hard-code `2' here.
Instead, just specify `&verbose', and ...
(main): ... remove the `case 2:' block for --verbose.
* tests/du/basic: Make the test file larger than 64 bytes, so that
we don't immediately disqualify file systems (e.g., NetApp) on which
smaller files take up zero disk blocks. Reported by Vin Shelton.
2003-03-10 Jim Meyering <jim@meyering.net>
Don't segfault for a negative field width or precision in format string.
Note that this is just a stopgap fix. The longer term solution may
involve adapting bash's builtins/printf.def.
* src/printf.c: (UNSPECIFIED): Define.
(print_direc): Use the special value, UNSPECIFIED, to indicate
that field_width or precision has not been specified.
(print_formatted): Fail if field_width or precision is the
special value, UNSPECIFIED.
Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
* src/sys2.h (INT_MIN): Define, if necessary.
* tests/misc/printf: Add a test for the above-fixed bug.
2003-03-09 Jim Meyering <jim@meyering.net>
* src/remove.c (AD_stack_pop): Cast sizeof... to int before
changing its sign. This avoids a warning from gcc on 64-bit systems.
Reported by Bob Proulx.
(pop_dir): Reverse order of sign change and cast, to be consistent
with the above.
2003-03-08 Jim Meyering <jim@meyering.net>
* tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
shell variable, but only in the environment. With /bin/sh->bash, the
shell variable is set to `y', and that would cause a spurious warning.
Reported by Bob Proulx.
* tests/Makefile.am (check-root): Remove touch/fifo.
It doesn't appear to have to be run as root.
* tests/rm/fail-2eperm: Rather than simply using the first non-root
user name, make sure that the selected user name has a usable shell.
Reported by Paul Jarc.
Before, when using shred on a device, one had to specify --exact,
or be careful to choose a size that would not be rounded up and
exceed the maximum value; that could result in a failure of
the final write.
* src/shred.c (do_wipefd): --exact is now the default for non-regular
files. Suggestion from Ben Elliston.
(usage): Say it.
* tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
Patch by Bob Proulx.
* src/Makefile.am (check-misc): Check for use of `defined' in
#define directives.
Change to $(srcdir) before running grep.
* src/sleep.c: Remove now-unused #include and #define directives.
* src/du.c (process_file): If a file's size is not being counted
e.g., because it's a hard link to a file we've already counted,
then don't print a line for it.
* tests/du/hard-link: New test for the above-fixed bug.
* tests/du/Makefile.am (TESTS): Add hard-link.
`du -S' didn't work
* src/du.c: Revert most of the `reorganization' change of 2003-02-20,
and make the two-array approach work.
* tests/du/basic: Correct/add tests for the above fix.
Set LC_ALL, etc., now that we use sort.
Check the block/size of a small file, too.
Correct expected results for simple dir1/dir2/file case.
Add another test of du -S.
2003-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
middle-end/9986). As one of GCC's optimizations, it transforms a
fputs_unlocked call to a fputc_unlocked call when the string is
one character long. However, hpux doesn't have fputc_unlocked.
* expr.c (usage): Use putchar, not fputs, to output a single character.
* ls.c (dired_dump_obstack): Likewise.
* ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
* stat.c (print_it): Likewise.
2003-03-07 Jim Meyering <jim@meyering.net>
* src/cp.c: Remove everything associated with mmap-stack.c.
This reverts the two changes of 2003-02-21.
* src/du.c: Remove everything associated with mmap-stack.c.
This reverts the change of 2003-02-19.
2003-03-06 Jim Meyering <jim@meyering.net>
* tests/cp/same-file: Unset CDPATH. Otherwise, having the
CDPATH shell variable set could cause this test to fail.
Reported by Karl Berry.
2003-03-05 Jim Meyering <jim@meyering.net>
* Version 4.5.9.
* src/printf.c (print_esc): Remove pointless comparison of unsigned
integer with zero, to avoid a warning from Intel's ecc.
Reported by Nelson Beebe.
* src/du.c (process_file): Sizes must all be of type uintmax_t.
Otherwise, for files or totals that are too big, numbers would
be truncated. Patch mostly by Michael Stone.
Reported by Ingo Saitz as Debian bug #183210.
* tests/du/8gb: New test for the above-fixed bug.
* tests/du/Makefile.am (TESTS): Add 8gb.
* src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
rather than UTILS_OPEN_MAX - 10.
2003-03-04 Jim Meyering <jim@meyering.net>
* README: Refer new feature discussion to bug-coreutils@gnu.org,
rather than bug-gnu-utils, now that the former is better known.
Suggestion from Göran Uddeborg.
* src/stat.c (usage): Capitalize consistently.
Reported by Göran Uddeborg.
* Makefile.maint (rel-files): Include $(signatures), so that
those files are also copied into $(release_archive_dir).
* src/df.c (find_mount_point): Call error here, now that restore_cwd
no longer does it.
* src/remove.c (AD_pop_and_chdir): Likewise.
* tests/Makefile.am (check-root): Add fail-2eperm.
2003-03-03 Jim Meyering <jim@meyering.net>
* src/remove.c (remove_cwd_entries): Include the full filename of
the offending file, not just the basename.
* tests/misc/tty-eof: Set $ME properly.
* Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
Remove now-unused variables.
(tag-prev-version, prev-cvs-tag): Likewise.
* src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
accurate diagnostic when failing to remove a file owned by some other
user. Reported by Ivo Timmermans via Michael Stone.
This fixes Debian bug# 178471.
* tests/rm/Makefile.am (TESTS): Add fail-2eperm.
* tests/rm/fail-2eperm: New test, for the above-fixed bug.
Based on a report from Ivo Timmermans.
2003-03-02 Jim Meyering <jim@meyering.net>
* src/copy.c (copy_internal) [un_backup]: When recovering from a
failure to create a hard link, do not remove the entry associating
the source dev/ino with the destination file name.
* tests/mv/Makefile.am (TESTS): Add hard-3.
* tests/mv/hard-3: New test, for the above-fixed bug.
Inspired by a report from Iida Yosiaki.
2003-03-01 Jim Meyering <jim@meyering.net>
* src/df.c (print_header): Don't embed spaces in a separate `Type'
header string. Instead, put `Filesystem' and `Type' headers in the
same string, so translators can use horizontal space as needed.
Reported by Jean Charles Delepine.
2003-02-28 Jim Meyering <jim@meyering.net>
* src/copy.c (copy_internal): When link fails because of an
existing destination file, unlink that file and try again.
Reported by Iida Yosiaki.
* tests/mv/Makefile.am (TESTS): Add hard-2.
* tests/mv/hard-2: New test for the above-fixed bug.
Based on a test case from Iida Yosiaki.
2003-02-26 Jim Meyering <jim@meyering.net>
* tests/du/basic: Don't test du's -b option here. Directory byte
counts are smaller (512 rather than 4096) on at least OSF/1 5.1
and IBM AIX 4.2. Reported by Nelson Beebe.
2003-02-25 Jim Meyering <jim@meyering.net>
* Makefile.maint (announcement): Now that ChangeLog entries
are output by announce-gen, don't do it here.
* announce-gen (print_changelog_deltas): New function.
(main): Use it.
2003-02-22 Jim Meyering <jim@meyering.net>
* announce-gen: New option: --release-type=TYPE
* Makefile.maint (beta, major): New targets. Remove `release'.
Put them all together on a line.
Pass the release type (via RELEASE_TYPE envvar) to the MAKE
invocation of `announcement'.
(announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
* announce-gen: New option: --news=NEWS_FILE.
Extract NEWS entries here, not via rules in Makefile.maint.
* Makefile.maint (announcement): Now that NEWS entries are
extracted by announce-gen, don't do it here.
(news-r1, news-r2): Remove now-unused definitions.
2003-02-21 Jim Meyering <jim@meyering.net>
* Version 4.5.8.
Merge in changes from autoconf's version of this file.
* Makefile.maint (www-gnu): Define.
(standards.texi-url_prefix): Use $(www-gnu).
(make-stds.texi-url_prefix): Likewise.
* src/cp.c: Include "mmap-stack.h".
(main): Invoke `run' through a macro that (when possible) runs it
with a large, mmap'd stack.
* src/cp.c (run): New function, preparing for the above.
Exit from this function, not from main
(main): Call run.
* src/du.c: New option: --apparent-size.
(enum) [APPARENT_SIZE_OPTION]: New member.
(long_options): Add it.
(usage): Describe it.
(main): Handle it.
['b']: Set apparent_size.
David Eisner reported that the behavior of --bytes had changed.
Paul Eggert proposed the use of a new option, --apparent-size.
* src/du.c (apparent_size): New global.
(print_only_size): Reflect the fact that we're printing byte counts,
not ST_NBLOCKSIZE-byte-block counts.
(print_size): Call print_only_size rather than duplicating its code.
(process_file): Accumulate byte counts, rather than block counts.
* src/du.c (process_file): Always reset size_to_propagate_to_parent
for --separate-dirs (-S).
2003-02-20 Jim Meyering <jim@meyering.net>
* Use automake-1.7.3. Regenerate dependent files.
* src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
(usage) [%B]: Describe it.
[%b]: Refer to %B.
* src/du.c (process_file): Reorganize the code to use only
one `sum' array, and change how -S works back to the way it was
before 2003-01-31. Patch by Bruno Haible.
* tests/du/basic: New test.
* tests/du/Makefile.am (TESTS): Add basic.
* tests/envvar-check: Add checks for the following:
BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
* tests/Makefile.am: Rename phony target envvar-check to evar-check
so as not to conflict with the distributed file by the same name.
* src/du.c (process_file): Set info->skip before any possible return.
Report correct usage for directories, not 0.
* src/du.c (process_file): Return for `file_type == FTW_DPRE'
_before_ recording the dev/ino of a directory.
Reported by Bruno Haible.
Now, df always displays the device file name corresponding to the
listed mount point under `Filesystem'. Before, for an unmounted
block- or character-special file argument, it would display the
command-line argument instead.
* src/df.c (show_disk): Return a value indicating whether
there was a match. Don't try to find a mount point here.
(show_entry): If show_disk doesn't find a match, call show_point.
2003-02-19 Jim Meyering <jim@meyering.net>
* src/du.c: Include "mmap-stack.h".
(du_files): Add prototype with ATTRIBUTE_NORETURN.
Exit from this function, not from...
(main): ...here.
Instead, if possible, invoke du_files through a macro that
runs it with a large, mmap'd stack.
* src/join.c (usage): Change wording in --help output:
use FILENUM instead of `SIDE' and say what FILENUM means.
Reported by Bernhard Gabler.
* src/df.c (print_header): Rather than using a hard-coded literal
string of spaces matching the length of the English `...Type' header,
output the right number of spaces to match the selected translation.
Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
* src/split.c (bytes_split): Remove unnecessary `else' after break.
(lines_split): Likewise. and correct misleading indentation.
* src/split.c: Include "full-read.h".
(bytes_split, lines_split, line_bytes_split): Use full_read,
not safe_read. The way split was using the latter, a short read
could cause split to terminate before EOF.
* tests/misc/tty-eof: Test all programs that can read stdin,
requiring no arguments and that write to standard output.
* tests/misc/tty-eof: New file. Renamed from ...
* tests/misc/cat-tty-eof: Remove file. Rename to tty-eof.
* tests/misc/Makefile.am (TESTS): Reflect renaming.
2003-02-18 Jim Meyering <jim@meyering.net>
cksum would perform an extra read after encountering EOF
* src/cksum.c (cksum): Exit the loop upon EOF, too.
Patch by Michael Bacarella.
Test for the bug fixed today in cksum, md5sum, and sha1sum.
* tests/misc/cat-tty-eof: Generalize, clean-up, and test for
cat, cksum, md5sum, and sha1sum all in the same loop.
2003-02-14 Jim Meyering <jim@meyering.net>
* src/remove.c: Include "euidaccess.h".
Remove declaration of euidaccess.
2003-02-12 Jim Meyering <jim@meyering.net>
* src/pathchk.c (portable_chars_only): Remove unnecessary `const'
in cast to avoid warning from icc. Reported by Alexandre Duret-Lutz.
2003-02-10 Jim Meyering <jim@meyering.net>
* src/test.c: Don't include group-member.h.
Include euidaccess.h.
(eaccess): Rewrite function to set the real uid and gid temporarily
to the effective uid and gid, then invoke 'access', and then set the
real uid and gid back. On systems that lack setreuid or setregid,
fall back on the kludges in euidaccess. Before, it would not work
for e.g., files with ACLs, files that were marked immutable,
or on file systems mounted read-only. Nelson Beebe raised the issue.
Paul Eggert suggested the new implementation.
2003-02-09 Jim Meyering <jim@meyering.net>
* src/test.c (test_stat): Remove function. It's job is done (only
when necessary) by the wrapper in lib/stat.c. Adjust all uses.
2003-02-08 Jim Meyering <jim@meyering.net>
* Version 4.5.7.
* tests/mv/part-symlink: Don't assume that the file owner username
length is less than 9 in ls output: instead, omit that field
altogether. Reported by, and suggested fix from, Ferdinand.
* tests/du/restore-wd: New test for just-fixed bug in ftw.c.
* tests/du/Makefile.am (TESTS): Add restore-wd.
* src/rm.c: Correct now-invalid comment about cycle-detection.
2003-02-06 Jim Meyering <jim@meyering.net>
* NEWS: Add entries from old/*/NEWS
from fileutils-4.1 through 4.1.11 and
from sh-utils-2.0 through 2.0.15. Suggestion from Karl Berry.
* Version 4.5.6.
* src/du.c (process_file): Don't return early for excluded files
or for files whose dev/inode we've already seen.
2003-02-05 Jim Meyering <jim@meyering.net>
* tests/du/exclude: New file.
* tests/du/Makefile.am (TESTS): Add exclude.
2003-02-04 Dmitry V. Levin <ldv@altlinux.org>
* src/who.c (print_boottime, print_deadprocs, print_runlevel):
Fix memory allocation arithmetic.
2003-02-04 Jim Meyering <jim@meyering.net>
`df /dev/block-or-char-device-file--not-mounted' now reports
the name of the file system on which the file resides, usually `/'.
Before, it would leave the `Mounted on' field blank.
* src/df.c (show_disk): Move function to precede find_mount_point.
(show_disk): Add parameter: STATP.
If we don't find a matching device name, then resort to calling
find_mount_point. Reported by Bob Proulx.
2003-02-03 Andreas Schwab <schwab@suse.de>
* tests/rm/cycle: Require non-root.
* tests/rm/isatty: Likewise.
2003-02-02 Jim Meyering <jim@meyering.net>
* Version 4.5.5.
* man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
Ensure that there are no offending uses of `:'.
* Makefile.maint (makefile_path_separator_check): New rule.
(local-check): Add it to the list.
2003-02-01 Jim Meyering <jim@meyering.net>
* src/du.c (MAX_N_DESCRIPTORS): Define.
* src/stat.c (G_fail): New global.
(human_time): Diagnose failed localtime, not failed nstrftime.
(main): Fail if G_fail is set.
2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
* tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
hard-coding the path-separator. Also double-quote the new PATH,
to avoid problems when the path-separator is a semi-colon or when
`pwd` contains e.g. a space.
* tests/chgrp/Makefile.am: Likewise.
* tests/chmod/Makefile.am: Likewise.
* tests/chown/Makefile.am: Likewise.
* tests/cp/Makefile.am: Likewise.
* tests/dd/Makefile.am: Likewise.
* tests/dircolors/Makefile.am: Likewise.
* tests/du/Makefile.am: Likewise.
* tests/expr/Makefile.am: Likewise.
* tests/factor/Makefile.am: Likewise.
* tests/fmt/Makefile.am: Likewise.
* tests/install/Makefile.am: Likewise.
* tests/ln/Makefile.am: Likewise.
* tests/ls/Makefile.am: Likewise.
* tests/ls-2/Makefile.am: Likewise.
* tests/md5sum/Makefile.am: Likewise.
* tests/misc/Makefile.am: Likewise.
* tests/mkdir/Makefile.am: Likewise.
* tests/mv/Makefile.am: Likewise.
* tests/od/Makefile.am: Likewise.
* tests/rm/Makefile.am: Likewise.
* tests/rmdir/Makefile.am: Likewise.
* tests/seq/Makefile.am: Likewise.
* tests/sha1sum/Makefile.am: Likewise.
* tests/shred/Makefile.am: Likewise.
* tests/stty/Makefile.am: Likewise.
* tests/sum/Makefile.am: Likewise.
* tests/tail-2/Makefile.am: Likewise.
* tests/touch/Makefile.am: Likewise.
* tests/tsort/Makefile.am: Likewise.
* tests/unexpand/Makefile.am: Likewise.
2003-01-31 Jim Meyering <jim@meyering.net>
* src/stat.c: Include "file-type.h"
(print_human_type): Remove function.
(human_access): Rename from print_human_access. Return a string.
(human_time): Rename from print_human_time. Return a string.
(print_stat): Arrange so that field width and an alignment specifier
are honored for the %A, %F, %x, %y, and %z formats.
[%F]: Use file_type; this gives slightly different file type strings,
e.g., `directory' instead of `Directory' and `regular file' or
`regular empty file' instead of `Regular file'.
Prompted by a report from Richard Dawe that the uses of
S_IFSOCK and S_IFIFO in print_human_time were not portable
to systems using e.g., DJGPP.
2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
* src/stat.c (print_stat): Use S_ISLNK rather than an explicit
test using S_IFMT and S_IFLNK. S_IFLNK may not be defined.
2003-01-31 Jim Meyering <jim@meyering.net>
* src/du.c (main): Upon processing an invalid option or an invalid
--exclude-from or --max-depth option argument, don't exit right away,
in case there are others. Rather record the failure and exit after
processing other options.
* GNUmakefile (TAR_OPTIONS): Set and export, in order to make
tar archive easier to reproduce.
Rewrite to perform directory traversal using nftw.
* src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
(AUTHORS): Add self.
(opt_one_file_system): Move global into `main'.
(path, xstat, exit_status): Remove declarations.
(arg_length, suffix_length): New globals.
(G_fail): New global, sort of like the old `exit_status'.
(IS_FTW_DIR_TYPE): Define.
(print_only_size): New function.
(process_file): New function.
(str_init, ensure_space, str_copyc, str_concatc): Remove functions.
(str_trunc, pop_dir, count_entry): Likewise.
(du_files): Rewrite to use nftw.
2003-01-30 Jim Meyering <jim@meyering.net>
* tests/du/trailing-slash: Ensure that du/ftw follows a command-line
symlink-to-directory with -L, even without the trailing slash.
2003-01-27 Jim Meyering <jim@meyering.net>
* src/Makefile.am (check-misc): Check for st_blocks, too.
* src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
Reported by Richard Dawe.
2003-01-27 Andreas Schwab <schwab@suse.de>
* src/ls.c (quote_name): Add fourth parameter, width, into which to
store the screen columns, and return the number of bytes instead.
(print_dir): Pass NULL as fourth parameter of quote_name.
(print_name_with_quoting): Likewise.
(length_of_file_name_and_frills): Get the width from the fourth
parameter of quote_name instead of return value.
2003-01-27 Jim Meyering <jim@meyering.net>
* src/ls.c (decode_switches): If `dired' is set without
`format == long_format', then silently reset dired. This doesn't
change the behavior of ls (all prior uses of dired were protected
by `&& format == long_format'), and lets us...
(DIRED_INDENT): ... remove the `format == long_format' conjunct.
(PUSH_CURRENT_DIRED_POS): Likewise.
(main): Likewise.
2003-01-22 Jim Meyering <jim@meyering.net>
* tests/du/no-x: New test, for functionality added to lib/ftw.c.
* tests/du/Makefile.am (TESTS): Add no-x.
2003-01-21 Jim Meyering <jim@meyering.net>
* src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
&& HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
it may still be a directory -- or not (e.g., with FreeBSD on an
NFS-mounted file system), so resort to calling lstat to find out.
Based on a patch by Michael van Elst.
* tests/cp/same-file: Don't assume that the file owner username
length is less than 9 in ls output: instead, omit that field
altogether. Reported by, and suggested fix from, Ferdinand.
2003-01-20 Jim Meyering <jim@meyering.net>
* tests/date/Test.pm (wide-fmt): New test to demonstrate that
large format widths no longer cause strftime to infloop.
* Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
2003-01-19 Jim Meyering <jim@meyering.net>
* src/readlink.c: Include "canonicalize.h".
2003-01-18 Jim Meyering <jim@meyering.net>
* src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
New member.
(enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
(long_options): Add option --dereference-command-line-symlink-to-dir.
(main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
-d, -F, -l options is specified.
(decode_switches): Handle --dereference-command-line-symlink-to-dir.
(gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
Change --dereference-command-line (-H) to dereference *all*
command line arguments, including broken symlinks.
2003-01-15 Paul Eggert <eggert@twinsun.com>
Change ls -H back to the way it was yesterday, since this is
compatible with FreeBSD and the POSIX spec is confusing
and somewhat contradictory.
* src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
(long_options): Change the long option name back.
(usage): Change the usage back.
(gobble_file): When -H is specified, dereference a top-level
arg even if it points to a non-directory.
2003-01-15 Jim Meyering <jim@meyering.net>
* src/ls.c (gobble_file): Fall back on using lstat when required:
when --dereference (-L) is not specified, and
- when operating on a dangling symlink
- when operating on command-line-symlink-to-directories
This fixes numerous problems. Here are examples:
- `ls dangling-symlink' would fail with `no such file...'
Now it prints `dangling-symlink'.
- `ls -i symlink' would mistakenly print the inode of the referent.
Now it prints the inode of the symlink. Likewise for --size (-s).
Based on a patch from Michael Stone.
Reported by Deepak Goel as Debian bug #173793.
Rename ls's --dereference-command-line (-H)
option to --dereference-command-line-symlink-to-dir.
* src/ls.c [enum Dereference_symlink]
(DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
(long_options): Rename the long option.
(usage): Say that --dereference-... changes how ls treats
only symlinks to directories specified on the command line.
2003-01-14 Jim Meyering <jim@meyering.net>
* tests/ls/dangle: New file/test, for the above fix.
* tests/ls/inode: Another new file/test, for the above fix.
* tests/ls/Makefile.am (TESTS): Add dangle and inode.
* src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
so that ls --color would no longer highlight the names of files with
the execute bit set when not specified on the command line.
Patch by Michael Stone. Reported by Stephen Depooter as
Debian bug 175135.
* tests/ls-2/tests (color-exe): New test, for the above fix.
2003-01-13 Jim Meyering <jim@meyering.net>
* tests/shred/exact: Also test for just fixed bug with --zero.
* src/shred.c (long_opts): --zero does not require an argument.
Patch by Michael Stone. Reported by Roland Turner as Debian bug 172019.
2003-01-12 Jim Meyering <jim@meyering.net>
* Makefile.maint (cvs-update): Skip any file with local modifications.
* src/unexpand.c (usage): Document --first-only and mention that
--tabs=N (-t) enables --all (-a). Reported by wiregauze@yahoo.com.
2002-12-01 Dmitry V. Levin <ldv@altlinux.org>
* src/df.c: Include "canonicalize.h".
Use canonicalize_file_name unconditionally.
2003-01-09 Jim Meyering <jim@meyering.net>
* README: Add readlink.
2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
* src/df.c: Include "xgetcwd.h".
* src/pwd.c: Likewise.
2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
* src/shred.c: Remove declaration of xstrdup.
We already get it via xalloc.h which is included via system.h.
2002-08-27 Dmitry V. Levin <ldv@altlinux.org>
New program: readlink.
* src/Makefile.am (bin_PROGRAMS): Add readlink.
* src/readlink.c: New file.
* man/readlink.x: New file.
* man/Makefile.am (dist_man_MANS): Add readlink.1.
(readlink.1): New rule.
2003-01-09 Jim Meyering <jim@meyering.net>
When selecting ranges of byte offsets (as opposed to ranges of fields)
and when --output-delimiter=STRING is specified, output STRING between
ranges of selected bytes.
* src/cut.c (RANGE_START_SENTINEL): Define.
(output_delimiter_specified): New global.
(print_kth): Add parameter. Adjust all callers.
(set_fields): Mark each range-start index with RANGE_START_SENTINEL.
(cut_bytes): When requested, output STRING between ranges of
selected bytes.
(main): Make a diagnostic a little clearer.
Based on a patch from Jan Nieuwenhuizen.
* tests/cut/Test.pm: New tests for the above.
* src/cut.c (set_fields): Make code agree with comment:
Don't merge abutting ranges like 4- and 2-3. This makes no
difference currently, but is required to support an upcoming change.
2003-01-07 Jim Meyering <jim@meyering.net>
* src/cut.c (set_fields): Fix typo in comment.
* tests/touch/not-owner: New test, mostly extracted from fail-diag.
* tests/touch/Makefile.am (TESTS): Add not-owner.
* tests/touch/fail-diag: Remove the test for non-owner diagnostic.
Now, this tests only the nonexistent-directory diagnostic.
Suggestion from Michael Stone.
* tests/touch/fail-diag: Fix typo: s/ld/ls/.
2003-01-04 Jim Meyering <jim@meyering.net>
* src/copy.h: Remove use of PARAMS.
* src/remove.h: Likewise.
* src/chown-core.h: Likewise.
rm could be tricked into mistakenly reporting a cycle.
* src/remove.c: [cycle_check_state]: New global.
(remove_cwd_entries): Adapt to new semantics of cycle_check.
(rm): Call cycle_check_init and cycle_check_free for each file.
* tests/rm/cycle (rm): New test, for the above fix.
* tests/rm/Makefile.am (TESTS): Add cycle.
When rm detects a cycle, don't abort the entire command,
but rather just the affected command line argument.
* src/remove.c: Include <setjmp.h>
(struct dirstack_state) [current_arg_jumpbuf]: New member.
(remove_cwd_entries): Call longjmp if we detect a cycle.
(rm): Call setjmp here.
* src/remove.c (cycle_check, is_power_of_two): Remove functions.
Instead, include cycle-check.h and use it.
* src/remove.h (struct dev_ino): Remove declaration.
* src/remove.c (remove_cwd_entries): Fix typos in comment.
Don't include trailing /. in diagnostics about directories.
* src/remove.c (full_filename_): When FILENAME is just `.'
and there is a nonempty directory-name part, don't append `/.'.
* tests/rm/unread2: Remove trailing /. from diagnostic.
* tests/rm/rm2: Likewise.
* src/remove.c (struct dirstack_state): Define.
To be used in place of these file-scoped globals ...
(dir_stack, len_stack, Active_dir): Remove globals.
(ds_init, ds_free): New functions.
(full_filename): Define.
(full_filename_): Rename from full_filename.
Begin to make AD_* functions more generic.
* src/remove.c (AD_push_initial): Don't set status to RM_OK here.
(AD_push): Likewise.
(AD_INIT_OTHER_MEMBERS): Define.
(remove_dir): Define the `status' member manually after each
call to AD_push or AD_push_initial.
* src/Makefile.am (check-misc): New rule, to ensure that no more
S_IS* macro definitions sneak into the code.
(check): Depend on check-misc.
* src/remove.c [S_ISLNK]: Don't define. It's already defined in sys2.h.
* src/du.c (count_entry) [S_ISLNK]: Don't define.
* src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
2003-01-03 Jim Meyering <jim@meyering.net>
* src/true.c: Add copyright.
(AUTHORS): I suppose I've written it.
* src/Makefile.am (false.c): Make the generated file be read-only.
2003-01-04 Jim Meyering <jim@meyering.net>
* src/ls.c: Include "dev-ino.h".
[struct dev_ino]: Remove declaration.
2003-01-02 Jim Meyering <jim@meyering.net>
* src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
from mv: s/missing file arguments/missing file argument/.
With --target-directory=DIR, cp and mv work with a single file argument.
Reported by Karl Berry.
* tests/rm/isatty: Enable this test.
2002-12-31 Jim Meyering <jim@meyering.net>
* src/remove.c (AD_push_initial): Don't set status to RM_OK here.
(AD_push): Likewise.
(AD_INIT_OTHER_MEMBERS): Define.
(remove_dir): Define the `status' member manually after each
call to AD_push or AD_push_initial.
* src/ls.c [struct dev_ino]: Remove definition.
Include "dev-ino.h" instead.
2002-12-28 Jim Meyering <jim@meyering.net>
* tests/du/Makefile.am (TESTS): Add no-deref.
* tests/du/no-deref: New script.
2002-12-23 Jim Meyering <jim@meyering.net>
* src/remove.c (remove_cwd_entries): Fix typo in comment.
2002-12-21 Jim Meyering <jim@meyering.net>
* announce-gen: Generate MML-formatted announcement.
This makes it a *lot* harder to send stale MD5/SHA1 signatures.
2002-12-20 Jim Meyering <jim@meyering.net>
* src/touch.c (touch): Change the wording of a diagnostic so
that it makes sense both when the file exists and when it doesn't.
Suggestion from Michael Stone.
2002-12-18 Jim Meyering <jim@meyering.net>
* src/stty.c (valid_options): Declare to be static.
2002-12-15 Jim Meyering <jim@meyering.net>
* Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
* src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
* src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
* src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
* src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
* src/tee.c, src/test.c: Remove all uses of `PARAMS'.
* src/remove.c (PARAMS): Remove definition.
* src/sys2.h: Likewise.
* src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
Include strftime.h instead.
2002-12-14 Jim Meyering <jim@meyering.net>
* Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
* src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
This is necessary at least for Irix6.5 when using c89.
Reported by Nelson Beebe.
* tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
* tests/misc/cat-tty-eof: New test.
* src/mknod.c (usage): Specify how major and minor mode numbers
are interpreted. Report forwarded by Kristin E Thomas.
* src/mknod.c: Remove now-redundant usage-specifying comment.
2002-12-13 Jim Meyering <jim@meyering.net>
* Version 4.5.4.
* tests/du/trailing-slash: Allow for a directory of size `0'.
That happens at least on file systems of type tmpfs on linux-2.4.18.
* announce-gen: New script to begin replacing the commands
associated with the rule here...
* Makefile.maint (announcement): Invoke announce-gen.
* Makefile.am (EXTRA_DIST): Add announce-gen.
* tests/cp/preserve-2: New file/test, for latest fix.
* tests/cp/Makefile.am (TESTS): Add preserve-2.
2002-12-11 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
Fix a bug whereby cp would fail to parse an option like
--preserve=mode,ownership.
* src/cp.c (decode_preserve_arg): Advance `comma' to
point the character following the comma.
2002-12-11 Jim Meyering <jim@meyering.net>
* src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
in case it's already defined.
2002-12-09 Jim Meyering <jim@meyering.net>
* tests/touch/fail-diag: Don't get a test failure if /no exists.
Instead, evoke a framework failure if /no-$$ exists.
Reported by Michael Stone.
2002-12-08 Jim Meyering <jim@meyering.net>
* src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
Define to rpl_lstat, so that even on systems like Solaris 5.8,
du honors (per POSIX) the trailing slash on an argument referring
to a symlink-to-directory.
2002-12-06 Jim Meyering <jim@meyering.net>
* Use autoconf-2.57. Regenerate dependent files.
* Use automake-1.7.2. Regenerate dependent files.
* src/ls.c (gobble_file): Also stat the file if it's a
regular file and --indicator-style=classify (aka -F).
Thanks to Ed Santiago for opening my eyes.
* tests/ls/file-type: New file. Test for the above.
A test to contrast ls -F and ls --indicator-style=file-type.
* tests/ls/Makefile.am (TESTS): Add file-type.
2002-12-04 Jim Meyering <jim@meyering.net>
* tests/ls/follow-slink: Make sure the symlink was created.
Richard Dawe reported that `ln -s link link' succeeds, but creates
no file on systems running some version of the DJGPP libc.
2002-12-03 Jim Meyering <jim@meyering.net>
* src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
since this package no longer panders to K&R compilers.
2002-12-02 Jim Meyering <jim@meyering.net>
* tests/du/slink: Skip this test if `.' is on a non-local file system.
* tests/Fetish.pm (_at_replace): Do the substitution only if there's
something to replace.
2002-12-01 Jim Meyering <jim@meyering.net>
* src/stat.c: Don't include <string.h> or <ctype.h>.
That's already done via system.h.
* src/dircolors.c: Don't include <ctype.h>.
2002-11-30 Jim Meyering <jim@meyering.net>
* ls.c (gobble_file): Remove the block of code that caused
`ls --color -F symlink-to-dir' to list the files in
`symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just
like `ls -F symlink-to-dir') but with the addition of highlighting.
Similarly, `ls --color -dF symlink-to-dir' would print
`symlink-to-dir/'; now it prints `symlink-to-dir@'.
Reported by Jeff Sheinberg as Debian bug #168203.
* tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
ls is now more efficient: with certain options, it no longer needs
to stat each directory entry on systems with valid dirent.d_type.
* src/ls.c (print_dir): Add DT_LNK and DT_REG.
(main): Make --recursive set format_needs_type, not format_needs_stat.
(gobble_file): Remove a FIXME comment, now that it's fixed.
2002-11-24 Jim Meyering <jim@meyering.net>
* src/du.c (du_files): Don't strip any trailing slash.
Rewrite so that `/' is no longer represented internally as
the empty string.
(count_entry): When appending a file name component,
account for the fact that the current path may end in `/'.
François Pinard reported that `du symlink-to-dir/' was not
equivalent to `du symlink-to-dir/.'. Now it is.
* tests/du/trailing-slash: New file/test, for the above fix.
* tests/du/Makefile.am (TESTS): Add trailing-slash.
2002-11-23 Jim Meyering <jim@meyering.net>
* src/tac.c (output): Declare some local variables to be of type size_t,
rather than `int' to avoid warnings from gcc.
2002-11-21 Paul Eggert <eggert@twinsun.com>
* src/ls.c (decode_switches): Use case-sensitive matching to
decode the QUOTING_STYLE environment variable. This is more
consistent with the documentation, and with --quoting-style.
2002-11-21 Martin Buck <martin.buck@ascom.ch
* src/stty.c (struct speeds): Add support for all baud rates defined
in linux-2.4.19.
2002-11-19 Jim Meyering <jim@meyering.net>
* tests/sum/sysv: Export LC_ALL=C, to avoid failure when
run in a UTF locale. Report and suggested fix by Bruno Haible.
* tests/fmt/basic: Likewise.
2002-11-17 Jim Meyering <jim@meyering.net>
* configure.ac: Update via autoupdate.
Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
* src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
Reported by Hans Ginzel.
2002-11-15 Jim Meyering <jim@meyering.net>
* Makefile.cfg (gnu_rel_host): Define.
(url_dir_list): Choose from (alpha|ftp).gnu.org depending
on whether $(VERSION) looks like a major release number.
* Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
(release): Rename from `alpha'.
(alpha): Depend on release.
* Makefile.maint (signatures): Define with ?=, so it's easy to override.
2002-11-14 Jim Meyering <jim@meyering.net>
* Makefile.maint (mail_gpg_sign_cookie): Make optional.
(announcement): Use the new variable.
* Makefile.maint: Sync with Bison, i.e.:
(po-check): Scan .l and .y files instead of the
.c and the .h files that they generate. This fixes the bug
reported by Tim Van Holder in:
<http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
Look for N_ as well as for _. Try to avoid matching #define for
N_ and _.
From Paul Eggert.
2002-11-12 Jim Meyering <jim@meyering.net>
* src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
Replace sole use with equivalent `#ifdef S_ISLNK'.
Inconsistency reported by Dmitry V. Levin.
2002-11-11 Jim Meyering <jim@meyering.net>
* src/stat.c (usage): Transform --help items output via s/ - / /,
so that help2man produces properly formatted man pages.
Reported by Herbert Xu as Debian bug #168400.
2002-11-10 Jim Meyering <jim@meyering.net>
* src/ls.c (sighandler): Handle SIGTSTP specially.
Based on suggestions from Solar Designer and Dmitry V. Levin.
Add comments.
* Makefile.cfg (cvs_files): Define. From autoconf.
(local_updates): Likewise.
* src/ls.c (restore_default_color_handler, sigtstp_handler):
Remove functions.
(sighandler): New function, based on the one in sort.c.
(main): Use sigaction, if possible; otherwise signal.
Handle these signals:
SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
Don't register our handler if the signal is already being ignored.
* src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
* src/csplit.c (interrupt_handler): Likewise.
* src/sort.c (sighandler): Likewise.
(main): Declare `i' and `nsigs' to be unsigned, not int.
2002-11-09 Jim Meyering <jim@meyering.net>
ls --color: restore terminal text color upon signal.
* src/ls.c: Include "full-write.h" and <signal.h>.
(restore_default_color, restore_default_color_handler): New functions.
(sigtstp_handler, put_indicator_direct): New functions.
(main) [print_with_color]: Register signal handlers.
Patch mostly by Solar Designer and Stanislav Ievlev.
Update from autoconf.
* Makefile.maint (AMTAR): Remove definition.
(update, cvs-update, po-update, do-po-update): New rules.
(wget-update): Update (thus renaming to cvs-update).
(automake_repo): Use anoncvs@sources.redhat.com.
2002-11-06 Jim Meyering <jim@meyering.net>
* tests/misc/Makefile.am (TESTS): Add printf-hex.
* tests/misc/printf: Be careful to test the code in this package,
not the shell built-in function.
* src/printf.c (print_esc): A hexadecimal escape sequence has
at most two hex. digits, not three. Reported by Padraig Brady.
(usage): Update description.
* tests/misc/printf-hex: New file/test, for the above fix.
2002-10-07 Paul Eggert <eggert@twinsun.com>
Add support for locale-specific size indications (e.g.,
thousands-separators) and for explicit size suffixes on output.
* doc/coreutils.texi (Block size): Say that:
This affects display format as well as block size.
Fractional block counts are rounded up.
ls file size blocksize defaults to 1.
A block size spec preceded by ' generates thousands separators.
A suffix without a preceding integer generates suffixes.
(tail invocation): 32k -> 32 KiB.
(What information is listed): ls -h is now equivalent to
ls --block-size=human, and ls -H is now equivalent to
ls --block-size=si. Displayed file size is now always affected by
--block-size.
* lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
lib/umaxtostr.c: New files, taken from GNU tar.
* lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
umaxtostr.c.
(EXTRA_DIST): Add inttostr.c.
* lib/human.c, lib/human.h: Rewrite to support locale-specific
notations like thousands separators.
Specify what includer of include.h must include beforehand.
(human_group_digits, human_suppress_point_zero, human_autoscale,
human_base_1024, human_SI, human_B): New enum values.
(human_readable): Rename from human_readable_inexact; put the
options before the sizes. All uses changed. The old human_readable
function has been removed; use inttostr.h instead.
(human_options): Renamed from human_block_size, with new signature
that allows block sizes up to UINTMAX_MAX. All callers changed.
* m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
AC_HEADER_STDBOOL. No need to check for limits.h since it's in
freestanding C89. No need to check for stdlib.h or string.h since
autoconf does this now.
* src/cksum.c (cksum): Use primitives from inttostr.h, not
human.h, to print large numbers simply.
* src/csplit.c (handle_line_error, parse_patterns): Likewise.
* src/dd.c (print_stats, main): Likewise.
* src/df.c (print_header): Likewise.
* src/factor.c (print_factors): Likewise.
* src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
* src/shred.c (dopass): Likewise.
* src/sort.c (checkfp): Likewise.
* src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
* src/tail.c (xlseek): Likewise.
* src/wc.c (write_counts, wc): Likewise.
* src/df.c (human_output_opts): New var.
(output_block_size): Now uintmax_t, not int, to handle larger
block sizes. All uses changed.
* src/du.c: Likewise.
* src/ls.c: Likewise.
* src/df.c (print_header): In the header line, prefer SI to human
representation if it's shorter; if neither is shorter, try to
intuit what the user would prefer.
* src/expr.c (inttostr): Remove; use new imaxtostr library
function instead.
* src/ls.c (file_output_block_size): New var, to distinguish
file sizes from other sizes.
(decode_switches): Set it.
* src/shred.c (OUTPUT_BLOCK_SIZE): remove.
(dopass): When printing progress, use floor for what has been done
so far (since we should be conservative there), and ceiling for
what needs to be done (since that's what other programs use).
2002-10-19 Jim Meyering <jim@meyering.net>
* src/pinky.c (print_heading): Align TTY and Name headings.
Reported by Karl Eichwalder.
2002-10-18 Jim Meyering <jim@meyering.net>
* src/split.c (cwrite): Change type of `bytes' parameter to size_t
Remove now-useless cast.
(stdread): Remove function.
(bytes_split): Use size_t instead of int.
Use safe_read, not stdread.
(lines_split): Likewise.
Use memchr rather than a `while' loop.
(line_bytes_split): Use size_t instead of int.
Use safe_read, not stdread.
(main): Add some FIXME comments to remind me to remove casts.
* src/system.h (ST_BLKSIZE): Correct comment describing how to
reproduce HPUX-11 cat failure. From Petter Reinholdtsen.
2002-10-17 Jim Meyering <jim@meyering.net>
Fix a problem that could make e.g., `cat' misbehave on systems which
give invalid (unreasonably large) values for stat.st_blksize.
* src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
Reported by Petter Reinholdtsen.
2002-10-14 Jim Meyering <jim@meyering.net>
Specifying a printf conversion specifer as nl's separator string
could cause nl to segfault.
* src/nl.c (build_print_fmt): Don't include separator string
in the printf format; it might contain `%'.
Use a better bound on the length of the print_fmt buffer.
(print_lineno): Print the separator here instead.
Reported by Doug Coleman.
* tests/misc/nl: New file/tests, including a test for the above.
* tests/misc/Makefile.am (TESTS): Add nl.
* tests/misc/split-l: New test, to make sure `split --lines=N' works.
* tests/misc/Makefile.am (TESTS): Add split-l.
2002-10-13 Jim Meyering <jim@meyering.net>
* Version 4.5.3.
* src/du.c (usage): Tweak description of --dereference-args/-D.
* src/du.c (count_entry): Also save cwd when dereferencing (via
--dereference-args, -D) a command-line argument.
Reported by Michal Svec. Based on a patch by Andreas Schwab.
* src/Makefile.am (../AUTHORS): New target/rule.
2002-10-12 Jim Meyering <jim@meyering.net>
* src/paste.c (paste_parallel): Declare local, `delims_saved', to be
of type size_t, since that's the way it's used and avoids a warning.
* src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
since that's how it's always used and avoids a new warning from gcc.
(read_input): Adapt to new safe_read ABI.
* src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
to avoid warnings.
* src/pinky.c (print_long_entry): fread returns size_t.
Declare local `bytes' accordingly, to avoid warning.
tail -c +N would perform an extra read after encountering EOF
[this change is analogous (bytes vs. lines) to the one of 2002-01-27]
* src/tail.c (start_bytes): Detect EOF, inform caller.
(tail_bytes): Upon EOF in start_bytes, return immediately.
(file_lines): Reorganize to use memrchr rather than an explicit loop.
Adapt to new safe_read ABI.
2002-10-11 Jim Meyering <jim@meyering.net>
* tests/du/deref: New file/test, for the above fix.
* tests/du/Makefile.am (TESTS): Add deref.
2002-10-10 Jim Meyering <jim@meyering.net>
* tests/ln/Makefile.am (TESTS): Add target-1.
* tests/ln/target-1: New file/test, for the fix on 2002-10-08.
2002-10-09 Jim Meyering <jim@meyering.net>
* tests/cp/backup-is-src: Ensure that certain environment variables
are not set (e.g., SIMPLE_BACKUP_SUFFIX). Reported by Duncan Roe.
* tests/tail-2/big-4gb: Mark this as an expensive test; it would
consume 4GB of disk space on systems without support for sparse files.
Fix a logic error that'd make it `cat err' even though dd didn't fail.
* src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
Patch by steven@magelico.net, forwarded by Michael Stone.
* tests/ls/dired: Ensure that ls produces English messages.
Patch by Alexey Vyskubov, forwarded by Michael Stone.
2002-10-08 Dmitry V. Levin <ldv@altlinux.org>
* src/ln.c (main): Fix target_directory parsing when n_files == 1.
2002-10-08 Jim Meyering <jim@meyering.net>
* tests/tail-2/big-4gb: Use double quotes around diagnostic.
Fix syntax in test: use =, not ==.
Reported by Bob Proulx.
Change all the rest like this: grep -lR "testing framework'" .\
|xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
* src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
* src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
* src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
* src/wc.c (wc): Likewise.
2002-10-07 Paul Eggert <eggert@twinsun.com>
* src/cat.c (cat):
Don't advance the write pointer past the end of the write buffer.
* src/sort.c (begfield, limfield): Likewise.
2002-10-07 Jim Meyering <jim@meyering.net>
* src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
* src/head.c (head_bytes, head_lines): Likewise.
2002-10-06 Jim Meyering <jim@meyering.net>
* src/dd.c (scanargs): Ensure that specified block sizes (specified
via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
(skip, dd_copy): Adapt to new safe_read ABI.
* Makefile.maint (signatures): Define.
(%.sig): New rule.
(announcement): Depend on $(signatures).
* Makefile.maint (announcement): Output all URLs for detached
signatures, not just the last one from the previous loop.
2002-10-05 Jim Meyering <jim@meyering.net>
* Version 4.5.2.
* src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
don't recurse into directory, DIR. Prompted by a report from
Leonardo Milano.
* tests/rm/i-no-r: New file/test, for the above fix.
* tests/rm/Makefile.am (TESTS): Add i-no-r.
* tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
* tests/tail-2/Makefile.am (TESTS): Add big-4gb.
2002-10-03 Jim Meyering <jim@meyering.net>
* src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
* src/df.c (AUTHORS): Likewise.
* src/du.c (AUTHORS): Likewise.
* src/tail.c (AUTHORS): Likewise.
* src/touch.c (AUTHORS): Likewise.
2002-10-02 Jim Meyering <jim@meyering.net>
* Makefile.am (SUBDIRS): Remove `old'.
(EXTRA_DIST): List the files in old/.
* configure.ac (AC_CONFIG_FILES): Remove old/* names.
Suggestion from Akim Demaille.
2002-10-01 Jim Meyering <jim@meyering.net>
* src/sys2.h (SSIZE_MAX): Define.
2002-09-30 Jim Meyering <jim@meyering.net>
* src/csplit.c: Don't include stdlib.h here. It's already included
via system.h.
2002-09-29 Jim Meyering <jim@meyering.net>
* src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
expression to avoid bogus warning from gcc.
* src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
(cat): Declare insize and outsize to be of type size_t, not int.
Rearrange pointer/integer expressions to avoid bogus warnings.
(main): Declare insize and outsize to be of type size_t, not int.
* src/tail.c (parse_options): Give a sensible diagnostic for
an invalid byte or line count. Reported by Mikko Tuumanen.
* src/touch.c (main): Split a long line.
* tests/du/Makefile.am (TESTS): Add slink.
* tests/du/slink: New test for system.h change of 2002-08-31.
In move mode, always first try to rename. Before, upon failure to
rename a directory, this code would never attempt to rename any
other file in that directory, but would thenceforth always copy.
On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
may fail with EXDEV, yet renaming files within that directory to
a newly-created destination directory succeeds.
* src/copy.c (copy_internal): Remove local, move_mode;
use x->move_mode instead. Based on a patch from Tom Haynes.
2002-09-28 Jim Meyering <jim@meyering.net>
* src/split.c (FAIL_ONLY_ONE_WAY): New macro.
Factor out some duplication.
(main): Use it.
[case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
* src/sort.c (begfield, limfield): Rearrange comparisons to avoid
compiler warnings.
(fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
to avoid compiler warnings.
* src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
compiler warnings.
Fix things so `mkdir -p' can create very deep directories, e.g.,
mkdir -p $(perl -e 'print "a/" x 40000') now works.
* src/mkdir.c (main): For --parents (-p), call make_path with the
entire directory name, so we don't ever require that file operations
like stat or chmod be performed on the entire command line argument.
* makepath.c (make_path): Restore umask *before* creating the final
component.
2002-09-27 Andreas Schwab <schwab@suse.de>
* src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
to avoid overflow. Reported by Hans Lermen.
2002-09-26 Jim Meyering <jim@meyering.net>
* src/install.c (get_ids): Use strtoul, not strtol. Remove some casts.
2002-09-25 Jim Meyering <jim@meyering.net>
* src/test.c (eaccess): Change type of local `euid' from int to uid_t
and add a cast, to avoid a warning about `signed and unsigned type in
conditional expression'.
2002-09-22 Jim Meyering <jim@meyering.net>
* src/rmdir.c: Include "dirname.h", for declaration of
strip_trailing_slashes.
* src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
Now they're defined through system.h.
* src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
* src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
since it's already included from sys2.h via system.h.
* Use automake-1.6f. Regenerate dependent files.
* src/Makefile.am (PERL): Remove duplicate definition.
fmt's -s, -t, -c options didn't work properly for long lines.
Since get_line may end up calling put_paragraph (for long lines),
be sure to set global, `other_indent', before it is used there.
* src/fmt.c (set_other_indent): New function, factored out of...
(get_paragraph): ... here. Call it.
(get_line): Call set_other_indent before calling flush_paragraph,
which calls fmt_paragraph, which in turn calls put_paragraph,
which uses other_indent.
* tests/fmt/Makefile.am (TESTS): Add long-line.
* tests/fmt/long-line: New file/test, for the above fix.
2002-09-21 Jim Meyering <jim@meyering.net>
* src/od.c: No longer include deprecated <values.h>.
It was required solely for now-removed reference to BITSPERBYTE.
* src/install.c: Likewise.
Suggestion from Bruno Haible.
2002-09-06 Andreas Schwab <schwab@suse.de>
`rmdir -p dir-specified-with-trailing-slash/' would fail.
* src/rmdir.c (remove_parents): Strip trailing slashes.
2002-09-20 Jim Meyering <jim@meyering.net>
* tests/rmdir/t-slash: New file/test, for the above fix.
* tests/rmdir/Makefile.am (TESTS): Add t-slash.
* Makefile.maint (announcement): Arrange to gpg-sign the message.
Add a URL for each detached signature file.
2002-09-07 Bruno Haible <bruno@clisp.org>
* configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
2002-09-18 Jim Meyering <jim@meyering.net>
`od -t x8' used the wrong (`l'-prefixed) printf format.
Likewise for the o8 and u8 formats.
* src/od.c (ISPEC_TO_FORMAT): Define macro.
(decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
Reported by Arun Sharma.
2002-09-17 Jim Meyering <jim@meyering.net>
* src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
From gettext's intl/loadmsgcat.c.
* tests/od/x8: New file/test, for the above fix.
* tests/od/Makefile.am (TESTS): Add x8.
2002-09-15 Jim Meyering <jim@meyering.net>
* Use autoconf-2.54. Regenerate dependent files.
* src/csplit.c (get_format_width): Add cast to avoid
warning about `signed and unsigned type in conditional expression'.
2002-09-14 Jim Meyering <jim@meyering.net>
* src/who.c (print_user): Change type of local to size_t
to avoid warnings about `comparison between signed and unsigned'.
* src/ptx.c (generate_all_output): Likewise.
* src/dd.c (main, skip): Add casts to avoid warnings about
`comparison between signed and unsigned'.
* src/id.c (print_full_info, print_group_list): Add casts to avoid
warnings about `signed and unsigned type in conditional expression'.
* src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
to avoid warnings about `comparison between signed and unsigned'.
(split_3): Change parameter names to be readable and add comment.
Clean up the test for whether a line may be ignored.
2002-09-13 Jim Meyering <jim@meyering.net>
* src/printf.c (main): Handle leading command line argument of `--'.
Reported by Raul: DervishD <raul@pleyades.net>
* tests/misc/printf: New file: test for the above.
* tests/misc/Makefile.am (TESTS): Add printf.
* src/date.c (usage): Explain that %S's range of [0..60] is required --
rather than 0..59 -- to accommodate the occasional positive leap second.
Reported by Richard Neill.
2002-09-12 Jim Meyering <jim@meyering.net>
* src/Makefile.am (nanosec_libs): Define.
(sleep_LDADD, tail_LDADD): Use it here.
Factor nanosleep-related code into ../lib/xnanosleep.c.
* src/sleep.c: Include xnanosleep.h.
Factor out fenv.h-related code.
(timespec_subtract): Remove function.
(main): Remove code that deals with computing start and stop times
as well as the loop around nanosleep. Now that's in xnanosleep.c.
Allow S (in --sleep-interval=S) to be a floating point value.
* src/tail.c: Include xnanosleep.h and xstrtod.h.
Move declaration of global variable, sleep_interval, to ...
(main): ...here.
(usage): Update description of --sleep-interval option.
(tail_forever): New parameter, sleep_interval. Update caller.
Use xnanosleep, rather than sleep.
(parse_options): New parameter, sleep_interval. Update caller.
Use xstrtod, now that we accept floating point values.
Prompted by a patch from Augey Mikus.
2002-09-06 Jim Meyering <jim@meyering.net>
* src/remove.c (prompt): Change comment to give a better note to
translators. From Michael Piefel.
2002-09-02 Jim Meyering <jim@meyering.net>
* README: A good problem report/patch includes diffs against
the most recent test release.
* src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
(pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
* src/kill.c (print_table_row): Use an unsigned type for widths
to avoid warning about comparison between signed and unsigned.
(list_signals): Likewise.
* src/od.c (skip): Add a cast to avoid warning about comparison
between signed and unsigned.
* src/install.c (get_ids): Likewise. Also rearrange range-checking
comparisons to make them more readable.
2002-09-01 Jim Meyering <jim@meyering.net>
* Version 4.5.1.
2002-08-31 Jim Meyering <jim@meyering.net>
Symlinks were always reported as using 0 blocks.
* src/system.h (ST_NBLOCKS): Don't depend on file type.
This reverts the change of 2000-01-30.
Based on a report and patch from Neil Brown via Michael Stone.
This fixes Debian Bug#156358.
* Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
`exit (1)' to `exit (EXIT_FAILURE)', and
`usage (1)' to `usage (EXIT_FAILURE)'.
* chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
* hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
* nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
* su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
* users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
error never exits successfully.
2002-08-29 Jim Meyering <jim@meyering.net>
* src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
when ignoring any return value.
* src/remove.c (remove_cwd_entries): Detect and diagnose readdir
failures. On some systems (at least EMC Celerra and Solaris5.8),
this appears to be necessary.
(is_empty_dir): Likewise. Also, always close directory handle.
* src/ls.c (print_dir): Likewise.
(print_dir): Rename local variable: reading -> dirp.
Reported by Mike Coleman.
2002-08-28 Jim Meyering <jim@meyering.net>
* src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
Give a diagnostic and fail if closedir fails.
2002-08-26 Jim Meyering <jim@meyering.net>
* Makefile.am (THANKS-to-translators): New rule.
(EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
* THANKStt.in: New file.
* src/cat.c (close_stdout_wrapper): New, kludgey, function and
file-scoped global.
(main): Register it with atexit.
Close STDOUT_FILENO, to avoid a problem when writing to
/dev/audio on at least Solaris 5.7 and 5.8 systems.
Reported by Shing-Shong Shei.
2002-08-25 Jim Meyering <jim@meyering.net>
* src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
* src/tac.c (main): Likewise.
* src/tail.c (main): Likewise.
* src/tee.c (main): Likewise.
* src/tr.c (main): Likewise.
* src/wc.c (main): Likewise.
2002-08-20 Jim Meyering <jim@meyering.net>
* tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
2002-08-10 Paul Eggert <eggert@twinsun.com>
* src/nohup.sh: Don't use "exec --"; it's not portable and
shouldn't be needed.
2002-08-09 Jim Meyering <jim@meyering.net>
* src/pr.c (main): Don't ignore -COLUMN if it's the last option.
(usage): Clarify help text for the -COLUMN option.
Patch by Padraig Brady.
* tests/pr/Test.pm [col-last]: New test for the above.
* configure.ac: Start with version 4.5.1, chosen so that it's larger
than the latest version numbers of the component packages.
* man/Makefile.am (check-x-vs-1): Set and export PATH so we use
programs in ../src.
2002-08-08 Jim Meyering <jim@meyering.net>
* src/date.c: Guard inclusion of <langinfo.h> with
`#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
* src/sort.c: Likewise.
Patch by GOTO Masanori.
2002-08-05 Paul Eggert <eggert@twinsun.com>
Fix some minor time-related bugs with POSIX time arguments.
Some valid time stamps were being rejected (notably -1, and
time stamps before 1900 on 64-bit hosts). And some invalid
time stamps were being accepted, e.g. September 31.
* src/date.c (main): Adjust to posixtime signature change.
* src/touch.c (main): Likewise. Remove unnecessary initialization.
Use localtime, not posixtm, to warn about obsolete "touch".
2002-08-05 Jim Meyering <jim@meyering.net>
* tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
2002-08-04 Jim Meyering <jim@meyering.net>
* src/Makefile.am (check-README): New target/rule.
(check): Depend on it.
* configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
2002-08-03 Jim Meyering <jim@meyering.net>
* Makefile.am (SUBDIRS): Add old.
* old/: New directory, containing legacy ChangeLog* and NEWS files
from the fileutils, sh-utils, and textutils packages.
* src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
2002-08-02 Paul Eggert <eggert@twinsun.com>
* NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
* src/uniq.c: Include hard-locale.h, xmemcoll.h.
(hard_LC_COLLATE): New var.
(different): Args are now char *, not const char *.
Use xmemcoll instead of memcmp to compare lines, so that
LC_COLLATE has effect. However, use memcmp if it is an
easy locale.
(check_file): Do not include newline in comparison, so that
xmemcoll has a byte to stomp on temporarily.
(main): Set hard_LC_COLLATE.
2002-07-29 Jim Meyering <jim@meyering.net>
* Makefile.am (SUBDIRS): Remove djgpp, for now.
2002-07-20 Jim Meyering <jim@meyering.net>
* Makefile.am (false.c): Convert only the final EXIT_SUCCESS
into EXIT_FAILURE. Otherwise, false --help and false --version
would fail.
2002-07-08 Jim Meyering <jim@meyering.net>
* src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
rather than the hard-coded `sh-utils'.
2002-07-01 Jim Meyering <jim@meyering.net>
* configure.ac: Merge the three files from fileutils,
textutils, and sh-utils.
* Makefile.am: Likewise.
* src/Makefile.am: Likewise.
-----
Copyright (C) 2002-2016 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice
and this notice are preserved.
|