diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 09:25:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 09:25:10 +0000 |
commit | 5dced3d1b3deca80e01415a2e35dc7972dcbfae7 (patch) | |
tree | 6a403684e0978f0287d7f0ec0e5aab1fd31a59e1 /doc | |
parent | Initial commit. (diff) | |
download | e2fsprogs-5dced3d1b3deca80e01415a2e35dc7972dcbfae7.tar.xz e2fsprogs-5dced3d1b3deca80e01415a2e35dc7972dcbfae7.zip |
Adding upstream version 1.47.0.upstream/1.47.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'doc')
78 files changed, 19083 insertions, 0 deletions
diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..a359453 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,85 @@ +# +# Makefile for the doc directory +# + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +top_builddir = .. +my_dir = doc +INSTALL = @INSTALL@ +MKDIR_P = @MKDIR_P@ + +@MCONFIG@ + +DVI=texi2dvi --clean +DVIPS=dvips -o "$@" +INFO=@MAKEINFO@ +HTML=makeinfo --html --no-split +PS2PDF=ps2pdf + +all:: libext2fs.info libext2fs.dvi libext2fs.html + +install-doc-libs: libext2fs.info libext2fs.dvi + $(Q) $(RM) -rf $(DESTDIR)$(infodir)/libext2fs.info* + $(E) " MKDIR_P $(infodir)" + $(Q) $(MKDIR_P) $(DESTDIR)$(infodir) + -$(Q) for i in libext2fs.info* ; do \ + echo " INSTALL_DATA $(infodir)/$$i" ; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(infodir)/$$i ; \ + done + $(E) " GZIP $(infodir)/libext2fs.info*" + -$(Q) gzip -9n $(DESTDIR)$(infodir)/libext2fs.info* + +uninstall-doc-libs: + $(RM) -rf $(DESTDIR)$(infodir)/libext2fs.info* + +libext2fs.info: $(srcdir)/libext2fs.texinfo + $(E) " MAKEINFO $@" + -$(Q) $(INFO) $(srcdir)/libext2fs.texinfo + +libext2fs.dvi: $(srcdir)/libext2fs.texinfo + $(E) " TEXI2DVI $@" + -$(Q) $(DVI) $(srcdir)/libext2fs.texinfo + +libext2fs.ps: libext2fs.dvi + $(E) " DVIPS $@" + -$(Q) $(DVIPS) libext2fs.dvi + +libext2fs.pdf: libext2fs.ps + $(E) " PS2PDF $@" + -$(Q) $(PS2PDF) libext2fs.ps + +libext2fs.html: $(srcdir)/libext2fs.texinfo + $(E) " TEXI2HTML $@" + -$(Q) $(HTML) $(srcdir)/libext2fs.texinfo + +.PHONY: distclean +distclean:: clean + $(RM) -f Makefile + +.PHONY: clean +clean:: clean-all + +.PHONY: clean-all +clean-all:: clean-tex clean-backup clean-final clean-tarfiles clean-html + +.PHONY: clean-final +clean-final:: + $(RM) -f *.ps *.info *.info-? *.html *.pdf + +.PHONY: clean-tex +clean-tex:: + $(RM) -f *.aux *.cp *.dvi *.fn *.ky *.log *.pg *.toc *.tp *.vr *.fns + +.PHONY: clean-backup +clean-backup:: + $(RM) -f *~ #* + +.PHONY: clean-tarfiles +clean-tarfiles:: + $(RM) -f *.tar *.tar.gz *.tgz + +clean-html:: + $(RM) -f *.html + diff --git a/doc/RelNotes/v1.02.txt b/doc/RelNotes/v1.02.txt new file mode 100644 index 0000000..27dce52 --- /dev/null +++ b/doc/RelNotes/v1.02.txt @@ -0,0 +1,25 @@ +E2fsprogs 1.02 (January 16, 1996) +================================= + +Fix to allow e2fsprogs to be compiled on recent 1.3 (pl45+) kernels. + +Change e2fsck to print statistics of how many non-contiguous files are +on the system. Note that a file which is larger than 8k blocks, it is +guaranteed to be non-contiguous. + +In mke2fs, print a warning message if a user tries to format a whole +disk (/dev/hda versus /dev/hda1). If a user really wants to format a +whole disk, the -F (force) option forces mke2fs to format a whole disk +as a filesystem. + +Fix a bug in fsck where in some cases it might start checking +partitions in the next pass before it finishes checking partitions in +the current pass. This still won't cause two partitions on the same +disk will be checked, so it's rarely a problem in real life. + +Patch lsattr so that it won't hang when checking a named pipe. + +Minor compilation fixes: + * Fix the order of libraries that were linked in debugfs. + * Allow the sources to be compiled with -ansi turned on. + diff --git a/doc/RelNotes/v1.03.txt b/doc/RelNotes/v1.03.txt new file mode 100644 index 0000000..3e6b25e --- /dev/null +++ b/doc/RelNotes/v1.03.txt @@ -0,0 +1,33 @@ +E2fsprogs 1.03 (March 27, 1996) +=============================== + +Change the m68k bit numbering for bitmasks to match the bit numbering +used by all other ext2 implementations. (This change was requested by +the m68k kernel development team.) + +Support (in-development) filesystem format revision which supports +(among other things) dynamically sized inodes. + +Fixed a bug in the ext2 library so that an intelligent error is +returned if mke2fs is run with a ridiculously small number of blocks +for a partition. + +Fixed a bug in the ext2 library which required that the device be +openable in read/write mode in order to determine its size. This +caused e2fsck -n to require read/write access when it was not +previously necessary. + +Fixed a bug in e2fsck which caused it to occasionally fail the test +suite depending on which version of the floating point library it was +using. + +Fixed a bug in e2fsck so that it now halts with a fatal error when +certain superblock consistency checks fail. Previously it continued +running e2fsck, with some potential confusing/damaging consequences. + +Added new flag to fsck which allows the root to be checked in parallel +with other filesystems. This is not the safest thing in the world to +do, but some system administrators really wanted it. + +Fixed -Wall flames in lib/ss. + diff --git a/doc/RelNotes/v1.04.txt b/doc/RelNotes/v1.04.txt new file mode 100644 index 0000000..0120c90 --- /dev/null +++ b/doc/RelNotes/v1.04.txt @@ -0,0 +1,49 @@ +E2fsprogs 1.04 (May 16, 1996) +============================= + +First "official" (1.03 was a limited release only) to support building +e2fsprogs under Linux 2.0 kernels (as well as late model 1.3 and 1.99 +kernels). + +This package includes a RPM specs file, that it can be built using the +RedHat Package Manager. + +E2fsck now prints a hint that if there are lots of incorrectly located +inode bitmaps, block bitmaps, and inode table blocks, the user might +want to try using e2fsck -b 8193 first, to see if that fares any +better. + +For ext2 filesystem written with the hurd, debugfs will now print out +the translator field when printing an inode structure. + +Lots of miscellaneous linking/installation cleanups: + + Libraries are now linked using a relative pathname, instead of + relying on -L working correct. It doesn't, in many cases, including + current versions of GNU ld. This guarantees that the build tree is + linking with the right libraries, instead of the ones installed in + /usr/lib. + + Header files, man pages, and the et/ss shell scripts are now + generated using a custom substitution script, instead of relying on + the configure script. This prevents needless recompilation of + files; in addition, the custom substitution script is much faster. + + e2fsck may now be linked dynamically, by using the + --enable-dynamic-e2fsck flag to configure. This is not recommended, + since it increases e2fsck's dependence on other files, but some + people need to save disk space, and other critical programs on their + systems were being linked dynamically anyway. + + Programs such as fsck which didn't need to be linked against + libext2fs (or mke2fs which didn't need to be linked against libe2p) + only link against libraries they actually need. Otherwise, those + programs would require the presence of libraries that otherwise + could be removed from a rescue diskette. + + The ss include files are now installed correctly so they can + actually be used by another package. + + If the profiling libraries are built, they are now installed on a + "make install-libs". + diff --git a/doc/RelNotes/v1.05.txt b/doc/RelNotes/v1.05.txt new file mode 100644 index 0000000..b1d22c1 --- /dev/null +++ b/doc/RelNotes/v1.05.txt @@ -0,0 +1,104 @@ +E2fsprogs 1.05 (September 7, 1996) +================================== + +Add support for new fields in the ext2 superblock --- volume name, +volume UUID, and last mounted field. Dumpe2fs displays these fields, +tune2fs and mke2fs allows you to set them. E2fsck will automatically +generate a UUID for those volumes that don't have them. + +Put in support for e2fsck to recognize HURD specific ext2 features --- +most notably, the translator block. The e2fsprogs tools will now use +the creator_os field in the superblock to correctly handle different +OS-specific variants of the ext2 filesystem. + +E2fsck now fixes inodes which have a the deletion time set, but which +have a non-zero i_link_count field by offering to clear the deletion +time. Previously e2fsck assumed that the inode was deleted (per 0.3c +ext2 kernel behavior) and offered to unlink the file. + +If e2fsck sets the clean bit, but nothing else, set the exit code +FSCK_NONDESTRUCT. After all, e2fsck did fix a filesystem error --- it +set the filesystem valid bit when it was previously cleared. :-) This +was needed to make the HURD fsck driver happy. + +If the user refuses to attach an unattached inode, e2fsck will no +longer set the inode's link count. Otherwise, the inode would end up +getting marked as unused, which might cause loss of data later. + +Make the message issued by e2fsck when the superblock is corrupt less +confusing for users. It now mentions that another reason for the +"corrupt superblock" message might be that the partition might not be +an ext2 filesystem at all (it might swap, msdos filesystem, ufs, etc.) + +Make the libext2 library more robust so that e2fsck won't coredump on +an illegal superblock where the blocksize is zero. (f_crashdisk is +the test case). + +By default, create filesystems where the default checkinterval is 6 +months (180 days). Linux servers can be robust enough that 20 reboots +can be a long, long time. + +Added configure flag --enable-old-bitops, which forces the bitops to +use the old (native) bitmask operations. By default on the sparc +platform, the standard ext2 bit ordering is now used. + +Added a new feature to e2fsck to byte-swap filesystems; this can be +used to convert old m68k filesystems to use the standard byte-order +storage for the superblock, inodes, and directory blocks. This +function is invoked by using the '-s' option to e2fsck. + +Debugfs's "dump" command has been enhanced so that it writes out the +exact size of the file so that the nulls at the end of the file are +eliminated. The command also accept a new "-p" option which will +attempt to preserve the ownership, permissions, and file +modification/access times. + +Debugfs has two new options, -f and -R. The -R option allows the user +to execute a single debugfs command from the command line. The -f +option allows the user to specify a "command file" containing debugfs +commands which will get executed. + +Dumpe2fs now pretty prints the check interval, instead of just +printing the check interval as a number of seconds. + +Fix bugs in debugfs: the params command when no filesystem is opened +no longer causes a core dump. It is now possible to unlink a file +when a pathname containing a '/' is specified. + +Tune2fs has a new -C option which sets the number of times the +filesystem has been mounted. + +Fix the chattr '-v' option so that it actually works. Chattr was +being buggy about the -v option parsing. + +Programmers' notes: +------------------- + +The directory lib/uuid contains a set of library routines to generate +DCE compatible UUIDs. + +Extended ext2fs_namei() to handle symbolic links. Added new function +ext2fs_nami_follow() which will follow last symbolic link in the case +where the pathname points to a sym link. + +The ext2fs_block_iterate function will now return the HURD translator +block, if present. The new flag BLOCK_FLAG_DATA_ONLY will cause the +iterator to return data blocks only. The ext2fs.h file now defines +constants BLOCK_COUNT_IND, BLOCK_COUNT_DIND, BLOCK_COUNT_TIND, and +BLOCK_COUNT_TRANSLATOR, which are the magic values passed in the block +count field of the iterator callback function. + +The test script driver now takes an optional second argument, which is +the test case to be run. This allows you to run a test case without +needing to run the entire test suite. + +On Linux ELF systems, install the .so files in the correct places +(/usr/lib). The .so files must be stored in the same directory as the +.a files. + +Fixed miscellaneous HURD compilation issues with header file being +included in the right order. + +Fixed debugfs so that it resets optind to zero, not one, since setting +optind to zero is more correct. + diff --git a/doc/RelNotes/v1.06.txt b/doc/RelNotes/v1.06.txt new file mode 100644 index 0000000..c6b8c92 --- /dev/null +++ b/doc/RelNotes/v1.06.txt @@ -0,0 +1,51 @@ +E2fsprogs 1.06 (October 7, 1996) +================================ + +Fixed serious bug in e2fsck: if the block descriptors are bad, don't +smash the backup copies in ext2fs_close(). (The problem was that when +e2fsck -p discovered the problem, while it was closing the filesystem +and exiting, it was also blowing away the backup superblocks on the +disk, which was less than friendly.) We now make it the case that we +only write out the backup superblock and the back block descriptors if +the filesystem is completely free from problems. + +Fixed a bug in block_interate in the lib/ext2fs library which caused +e2fsck to fail on GNU Hurd-created filesystems. + +Add support for Linux/FT's bootloader, which actually uses +EXT2_BOOT_LOADER, and sets its mode bits which caused e2fsck to want +to clear the inode. + +Add support for the "A" (no atime update) attribute. (Note: this +attribute is not yet in production kernels.) + +The test suite is not automatically run when doing a "make all" from +the top level directory. Users should manually run "make check" if +they wish to run the test suite. + +Upon a preenhalt(), make the printed message more explicit that +running e2fsck "MANUALLY" means without the -p or -a options. + +In e2fsck, if a disconnected inode is zero-length, offer to clear it +instead of offering to connect it to lost+found. + +In e2fsck, if a filesystem was just unmounted uncleanly, and needs +e2fsck to be run over it, change e2fsck to explicitly display this +fact. + +For dumpe2fs and e2fsck, cause the -V option to print out which +version of the ext2fs library is actually getting used. (This will +help detect mismatches of using a 1.06 utility with a 1.05 library, +etc.) + +Programmers' notes: +------------------- + +EXT2_SWAP_BYTES was changed to EXT2_FLAG_SWAP_BYTES, which better fits +the naming convention. + +In ext2fs_initialize(), make sure the description for the inode bitmap +is correctly initialize. + +Fixed minor type typo in ext2fs_allocate_generic_bitmap(); + diff --git a/doc/RelNotes/v1.07.txt b/doc/RelNotes/v1.07.txt new file mode 100644 index 0000000..d780c93 --- /dev/null +++ b/doc/RelNotes/v1.07.txt @@ -0,0 +1,122 @@ +E2fsprogs 1.07 (March 9, 1997) +============================== + +E2fsck is now uses much less memory when checking really large +filesystems (or rather, filesystems with a large number of inodes). +Previously a filesystem with 1 million inodes required 4 megabytes of +memory to store inode count statistics; that storage requirement has +now been reduced to roughly half a megabyte. + +E2fsck can now properly deal with bad blocks appearing inside the +inode table. Instead of trying to relocate the inode table (which +often failed because there wasn't enough space), the inodes in the bad +block are marked as in use. + +E2fsck will automatically try to use the backup superblocks if the +primary superblocks have a bad magic number or have missing meta-data +blocks (or meta-data blocks which are out of range). + +E2fsck's pass 3 has been made more efficient; most noticeable on +filesystems with a very large number of directories. + +Completely revamped e2fsck's system of printing problem reports. It +is now table driven, to make them more easily customizable and +extendable. Error messages which can be printed out during preen mode +are now one line long. + +Fixed e2fsck's filesystem swapping code so that it won't try to swap +fast symbolic links or deleted files. + +Fixed e2fsck core dumping when fixing a filesystem which has no +directories (not even a root directory). + +Added a check to e2fsck to make sure that the length of every +directory entry is a multiple of 4 (since the kernel complains if it +isn't). + +Added a check to e2fsck to make sure that a directory entry isn't a +link to the root directory, since that isn't allowed. + +Added a check to e2fsck to now make sure the '.' and '..' directory +entries are null terminated, since the 2.0 kernel requires it. + +Added check to write_bitmaps() to make sure the superblock doesn't get +trashed if the inode or block bitmap is marked as being block zero. + +Added checking of the new feature set fields in the superblock, to +avoid dealing with new filesystem features that this package wasn't +set up to handle. + +Fixed a fencepost error in ext2fs_new_block() which would occasionally +try to allocate a block beyond the end of a filesystem. + +When the UUID library picks a random IEEE 802 address (because it +can't find one from a network card), it sets the multicast bit, to +avoid conflicting with a legitimate IEEE 802 address. + +Mke2fs now sets the root directory's owner to be the real uid of the +user running mke2fs. If the real uid is non-zero, it also sets +the group ownership of the root directory to be the real group-id of +the user running mke2fs. + +Mke2fs now has more intelligent error checking when it is given a +non-existent device. + +When badblocks is given the -vv option, it now updates the block that +it is currently testing on every block. + +Fixed a bug in fsck where it wouldn't modify the PATH environment +currently correctly if PATH wasn't already set. + +Shared libraries now built with dependencies. This allows the shared +library files to be used with dlopen(); it also makes the transition +to libc 6 easier, since ld.so can tell which libc a particular shared +library expects to use. + +Programmer's notes: +------------------- + +Added new abstraction (defined in dblist.c) for maintaining a list of +blocks which belongs to directories. This is used in e2fsck and other +programs which need to iterate over all directories. + +Added new functions which test to see if a contiguous range of blocks +(or inodes) are available. (ext2fs_*_bitmap_range). + +Added new function (ext2_inode_has_valid_blocks) which returns true if +an inode has valid blocks. (moved from e2fsck code). + +Added new function (ext2fs_allocate_tables) which allocates the +meta-data blocks as part of initializing a filesystem. (moved from +mke2fs code). + +Added a new I/O manager for testing purposes. It will either allow a +program to intercept I/O requests, or print debugging messages to +trace the activity of a program using the I/O manager. + +The badblocks_list functions now store the bad blocks in a sorted +order, and use a binary search to speed up badblocks_list_test. + +The inode scan function ext2fs_get_next_inode() may now return a soft +error returns: MISSING_INODE_TABLE and BAD_BLOCK_IN_INODE_TABLE in +those cases where part of an inode table is missing or there is a bad +block in the inode table. + +Added a new function (ext2fs_block_iterate2) which adds new arguments to +the callback function to return a pointer (block and offset) to the +reference of the block. + +Added new function (ext2fs_inode_scan_goto_blockgroup) which allows an +application to jump to a particular block group while doing an inode +scan. + +The badblocks list functions were renamed from badblocks_* to +ext2fs_badblocks_*. Backwards compatibility functions are available +for now, but programs should be modified to use the new interface. + +Some of the library functions were reorganized into separate files to +reduce the size of some programs which statically link against the +ext2 library. + +Put in some miscellaneous fixes for the Alpha platform. + diff --git a/doc/RelNotes/v1.08.txt b/doc/RelNotes/v1.08.txt new file mode 100644 index 0000000..f33ead5 --- /dev/null +++ b/doc/RelNotes/v1.08.txt @@ -0,0 +1,75 @@ +E2fsprogs 1.08 (April 10, 1997) +=============================== + +E2fsck 1.07 was very slow when checking very large filesystems with a +lot of files that had hard links (i.e., news spools). This was fixed +by seriously revamping the icount abstraction. Added a formal test +suite for the icount abstraction. + +Debugfs now has a "-l" option to the "ls" command, which lists the +inode number, permissions, owner, group, size, and name of the files +in the directory. + +Fix a bug in e2fsck where when a directory had its blocks moved to +another location during the pass 1b processing, the directory block +list wasn't updated, so pass 2 wouldn't check (and correct) the +correct directory block. + +E2fsck will now treat inodes which contain blocks which are claimed by +the filesystem metadata by treating them as multiply claimed blocks. +This way, the data in those blocks can be copied to a new block during +the pass 1b--1d processing. + +E2fsck will attempt to determine the correct superblock number and +display it in the diagnostic and warning messages if possible. + +Add support for a new (incompatible) feature, "sparse_super". This +feature reduces the number of blocks which contain copies of backup +superblocks and block group descriptors. (It is only an incompatible +feature because of a bug in ext2_free_blocks.) mke2fs and tune2fs now +support a new -s option; e2fsck will recognize filesystems built with +this feature turned on. + +E2fsck now checks the library to make sure is the correct version, +using new library functions. (This helps to diagnose incorrectly +installed e2fsprogs distributions.) + +Dumpe2fs now prints more information; its now prints the the +filesystem revision number, the filesystem sparse_super feature (if +present), the block ranges for each block group, and the offset from +the beginning of the block group. + +Mke2fs now distributes the inode and block bitmap blok so that the +won't be concentrated in one or two disks in RAID/striping setups. +Also, if the user chooses a 2k or 4k block group, mke2fs will try to +choose the largest blocks per group that be chosen. (For 2k blocks, +you can have up to 16384 blocks/group; for 4k blocks, you can have up +to 32768 blocks/group.) Previously mke2fs would not allow +specification of more than 8192 blocks per group, even if you were +using a 2k or 4k block group. + +Programmer's notes: +------------------- + +Added a new function ext2fs_create_icount2() which takes a "hint" +argument. This hint argument presets the icount array with the list +of inodes which actually need to be in the icount array. This really +helps to speed up e2fsck. + +Added a new function ext2fs_icount_validate() which checks the rep +invariant for the icount structure. This is used mostly for testing. + +The error message given when a bad inode number is passed to +test_generic_bitmap to reflect EXT2FS_TEST_ERROR (instead of +EXT2FS_UNMARK_ERROR). + +Added a new function ext2fs_set_dir_block which sets the block of a +dblist entry, given the directory inode and blockcnt. + +Added a new function ext2fs_get_library_version() which returns the +current library version, and ext2fs_parse_version_string() which +returns a version number based on a e2fsprogs version string. + +The icount functions will return EINVAL if the passed in inode number +is out of bounds. + diff --git a/doc/RelNotes/v1.09.txt b/doc/RelNotes/v1.09.txt new file mode 100644 index 0000000..415de75 --- /dev/null +++ b/doc/RelNotes/v1.09.txt @@ -0,0 +1,14 @@ +E2fsprogs 1.09 (April 14, 1997) +=============================== + +Fixed bug in mke2fs (really in lib/ext2fs/initialize.c) which was +accidentally introduced in the 1.08 release. The overhead calculation +was accidentally removed, which caused ext2fs_initialize() to not +notice when the filesystem size needed to be adjusted down because +there wasn't enough space in the last block group. + +Fixed bug in version parsing library routine; it was always parsing +the library version string, instead of using the passed-in string. + +Clarified chattr man page. + diff --git a/doc/RelNotes/v1.10.txt b/doc/RelNotes/v1.10.txt new file mode 100644 index 0000000..1fa0a5e --- /dev/null +++ b/doc/RelNotes/v1.10.txt @@ -0,0 +1,56 @@ +E2fsprogs 1.10 (April 24, 1997) +=============================== + +Mke2fs once again defaults to creating revision #0 filesystems, since +people were complaining about breaking compatibility with 1.2 kernels. +Warning messages were added to the mke2fs and tune2fs man pages that +the sparse superblock option isn't supported by most kernels yet (1.2 +and 2.0 both don't support parse superblocks.) + +Added new flag to mke2fs, -R <raid options>, which allows the user to +tell mke2fs about the RAID configuration of the filesystem. Currently +the only supported raid option is "stride" which specifies the width +of the RAID stripe. + +Fixed bug in e2fsck where pass1b would bomb out if there were any +blocks marked bad in the inode table. + +Fixed rare bug in mke2fs where if the user had a very unlucky number +of blocks in a filesystem (probability less than .002) the resulting +filesystem would be corrupt in the last block group. + +Fixed bug where if e2fsck tried to allocate a block to fix a +filesystem corruption problem and the filesystem had no free blocks, +ext2fs_new_block() would loop forever. + +The configure script now checks explicitly to see if "-static" works, +since that can't be assumed to be true --- RedHat doesn't install +libc-static by default. + +Fixed bug in libext2's block iterator functions where under some +circumstances, file with holes would cause the bcount parameter to the +callback function to be incorrect. This bug didn't affect any of +e2fsprogs programs, but it was discovered by Paul Mackerras, the +author of the PPC boot loader. + +Removed use of static variables to store the inode cache in libext2fs. +This caused problems if more than one filesystem was accessed via +libext2fs (static variables in libraries are generally a bad idea). +Again, this didn't affect e2fsprogs programs, but it was discovered by +Paul Mackerras. + +Fixed minor bugs and version code drift to assure that e2fsprogs 1.10 +will compile cleanly with 1.2.13 kernels (even with a.out shared +libraries!) + +Programmer's notes: +------------------- + +Added new functions to duplicate an ext2 filesystem handle, and its +associated substructure. New functions: ext2fs_dup_handle(), +ext2fs_copy_dblist(), ext2fs_badblocks_copy(), ext2fs_copy_bitmap(). +Other structures, such as the io_channel and the inode_cache, now have +a ref count so that they only get freed when they are no longer used +by any filesystem handle. (These functions were added as part of the +development effort for an ext2 resizer). + diff --git a/doc/RelNotes/v1.11.txt b/doc/RelNotes/v1.11.txt new file mode 100644 index 0000000..33c89d5 --- /dev/null +++ b/doc/RelNotes/v1.11.txt @@ -0,0 +1,61 @@ +E2fsprogs 1.11 (June 17, 1997) +============================== + +Fixed e2fsck to detect (previously ignored) conflicts between the +superblock or block group descriptors and block bitmaps, inode +bitmaps, and inode tables. + +Fixed bug in e2fsck so that when the message printed out when a block +or inode bitmap conflicts with other data, it has the correct group +number. + +Fixed bug in e2fsck and mke2fs where the blocksize wasn't being passed +to badblocks. This meant that not all of the filesystem was being +tested for bad blocks! + +Fixed an array boundary overrun case which cropped up in +ext2fs_badblocks_list_test when a user tried running "mke2fs -c +-b 4096". + +Adjusted the number of columns printed by mke2fs when displaying the +superblock backups to avoid running over 80 columns when making a +really big filesystem. + +Fixed up the man pages for e2fsck, debugfs, badblocks, chattr, +dumpe2fs, fsck, mke2fs, and tune2fs (typos and other minor grammar +fixes), thanks to some suggestions from Bill Hawes (whawes@star.net). + +Programmer's notes: +------------------- + +Fixed install rule in lib/ss so that ss_err.h is actually getting +installed. + +Fixed bug in ext2fs_copy_bitmap; the destination bitmap wasn't getting +passed back to the caller. + +Fixed bug in ext2fs_inode_scan_goto_blockgroup; it had not been +setting the current inode number (which meant this function wasn't +working at all). + +Fixed bug in ext2fs_resize_generic_bitmap; it had not be zeroing all +blocks in the bitmap when increasing the size of the bitmap. + +Changed the initial number of blocks allocated by ext2fs_init_dblist() +to be more realistic. + +Added a new function ext2fs_allocate_group_table, which sets up the +group descriptor information (and allocates inode and block bitmaps, +and inode tables for a particular group). The function was created by +factoring out code form ext2fs_allocate_tables(). + +Added a new function ext2fs_move_blocks which takes a bitmap of the +blocks to be moved, and moves them to another location on the +boardboard. + +Make the unix_io channel's io_channel_flush implementation calls sync() +to to flush the kernel buffers to disk. + +Added a new function ext2fs_dblist_count returns the number of +directory blocks in dblist. + diff --git a/doc/RelNotes/v1.12.txt b/doc/RelNotes/v1.12.txt new file mode 100644 index 0000000..9a11cd0 --- /dev/null +++ b/doc/RelNotes/v1.12.txt @@ -0,0 +1,153 @@ +E2fsprogs 1.12 (July 9, 1998) +================================== + +E2fsprogs now works with glibc (at least with the version shipped with +RedHat 5.0). The ext2fs_llseek() function should now work even with +i386 ELF shared libraries and if llseek() is not present. We also +explicitly do a configure test to see if (a) llseek is in libc, and +(b) if llseek is declared in the system header files. (See standard +complaints about libc developers don't understand the concept of +compatibility with previous versions of libc.) + +The ext2fs library now writes out the block group number in each of +the superblock copies. This makes it easier to automatically +determine the starting block group of the filesystem when the block +group information is trashed. + +Added support for the EXT2_FEATURE_INCOMPAT_FILETYPE feature, +which means that e2fsprogs will ignore the high 8 bits of the +directory entry's name_len field, so that it can be used for other +purposes. + +Added support for the EXT2_FEATURE_RO_COMPAT_LARGE_FILE feature. +E2fsprogs will now support filesystems with 64-bit sized files. + +Added support for the EXT2_FEATURE_COMPAT_DIR_PREALLOC feature. + +Added new program "e2label", contributed by Andries Brouwer. E2label +provides an easy-to-use interface to modify the filesystem label. + +Fixed bug so that lsattr -v works instead of producing a core dump. + +Fixed a minor bug in mke2fs so that all groups with bad superblock +backup blocks are printed (not just the first one). + +Mke2fs will check the size of the device, and if the user specifies a +filesystem size larger than the apparent size of the device it will +print a warning message and ask if the user wants to proceed. + +E2fsck has a new option -C, which sends completion information to the +specified file descriptor. For the most part, this is intended for +programs to use, although -C 0 will print a spinning character to the +stdout device, which may be useful for users who want to see something +happening while e2fsck goes about its business. + +Fixed a bug in e2fsck which could cause a core dump when it needs to +expand the /lost+found directory, and sometimes the bitmaps haven't +been merged in. Also fixed a related bug where ext2fs_write_dir_block +was used to write out a non-directory block. (Which would be bad on a +non-Intel platform with byte swapping going on.) + +Fixed bug in e2fsck where it would print a "programming error" message +instead of correctly identifying where a bad block was in used when +the bad block was in a non-primary superblock or block group +descriptor. Also fixed a related bug when sparse superblocks are in +use and there is a bad block where a superblock or block group +descriptor would have been in a group that doesn't include a +superblock. + +Fixed a bug in e2fsck (really in libext2fs's dblist function) where if +the block group descriptor table is corrupt, it was possible to try to +allocate a huge array, fail, and then abort e2fsck. +ext2fs_get_num_dirs() now sanity checks the block group descriptor, +and substitutes reasonable values if the descriptors are obviously bogus. + +If e2fsck finds a device file which has the immutable flag set and the +i_blocks beyond the normal device number are non-zero, e2fsck will +offer to remove it, since it's probably caused by garbage in the inode +table. + +When opening a filesystem, e2fsck specially checks for the EROFS error +code, and prints a specific error message to the user which is more +user friendly. + +If the filesystem revision is too high, change the e2fsck to print +that this is either because e2fsck is out of date, or because the +superblock is corrupt. + +E2fsck now checks for directories that have duplicate '.' and '..' +entries, and fixes this corruption. + +E2fsck no longer forces a sync of the filesystem (with attendant sleep +calls) at all times. The ext2fs_flush() function now performs a sync +only if it needed to write data blocks to disk. + +Fixed a minor bug in e2fsck's pass1b's file cloning function, where +certain errors would not be properly reported. + +Updated and expanded a few points in the man pages which users +complained weren't explicit enough. + +Added special case byte-swapping code if compiling on the PowerPC, to +accommodate the strange big-endian variant of the ext2 filesystem that +was previously used on the PowerPC port. + + +Programmer's notes: +------------------- + +Removed C++ keywords from the ext2fs libraries so that it could be +compiled with C++. + +E2fsck's internal organization has now been massively reorganized so +that pass*.c don't have any printf statements. Instead, all problems +are reported through the fix_problem() abstraction interface. E2fsck +has also been revamped so that it can be called as a library from a +application. + +Added new fileio primitives in libext2fs for reading and writing +files on an unmounted ext2 filesystem. This interface is now used by +debugfs. + +Added a new libext2fs function for mapping logical block numbers of +a file to a physical block number. + +Added a new libext2fs function, ext2fs_alloc_block(), which allocates +a block, zeros it, and updates the filesystem accounting records +appropriately. + +Added a new libext2fs function, ext2fs_set_bitmap_padding(), which +sets the padding of the bitmap to be all one's. Used by e2fsck pass 5. + +The libext2fs functions now use a set of memory allocation wrapper +functions: ext2fs_get_mem, ext2fs_free_mem, and ext2fs_resize_mem, +instead of malloc, free, and resize. This makes it easier for us to +be ported to strange environments where malloc, et. al. aren't +necessarily available. + +Change the libext2fs function to return ext2-specific error codes +(EXT2_DIR_EXISTS and EXT2_DB_NOT_FOUND, for example) instead of using +and depending on the existence of system error codes (such as EEXIST +and ENOENT). + +Renamed io.h to ext2_io.h to avoid collision with other OS's header +files. + +Add protection against ext2_io.h and ext2fs.h being included multiple +times. + +The types used for memory lengths, etc. have been made more portable. +In general, the code has been made 16-bit safe. Added Mark +Habersack's contributed DOS disk i/o routines. + +Miscellaneous portability fixes, including not depending on char's +being signed. + +The io_channel structure has a new element, app_data, which is +initialized by the ext2fs routines to contain a copy of the filesystem +handle. + +ext2fs_check_directory()'s callback function may now return the error +EXT2_ET_CALLBACK_NOTHANDLED if it wishes ext2fs_check_directory() to +really do the checking, despite the presence of the callback function. + diff --git a/doc/RelNotes/v1.13.txt b/doc/RelNotes/v1.13.txt new file mode 100644 index 0000000..35a69e6 --- /dev/null +++ b/doc/RelNotes/v1.13.txt @@ -0,0 +1,64 @@ +E2fsprogs 1.13 (December 15, 1998) +================================== + +Fixed a bug in debugfs where an error messages weren't getting printed +when the ext2 library routines to read inodes returned errors in the +stat, cmri and rm commands. + +Fixed a bug in mke2fs so that if a ridiculous inode ratio parameter is +provided, it won't create an inode table smaller than the minimum +number of inodes required for a proper ext2 filesystem. + +Fsck now parses the /etc/fstab file directly (instead of using +getmntent()), so that it can distinguish between a missing pass number +field and pass number field of zero. This caused problems for +diskless workstations where all of the filesystems in /etc/fstab have +an explicit pass number of zero, and fsck could not distinguish this +from a /etc/fstab file with missing pass numbers. + +E2fsck will create a /lost+found directory if there isn't one in the +filesystem, since it's safer to create the lost+found directory before +it's needed. + +Fixed e2fsck so that it would detect bogus immutable inodes which +happen to be sockets and FIFO files, and offer to clear them. + +If a filesystem has multiple reasons why it needs to be checked, and +one of the reasons is that it is uncleanly mounted, e2fsck will print +that as the reason why the filesystem is being checked. + +Cleaned up the output routines of mke2fs so that it doesn't overflow +an 80 column display when formatting really big filesystems. + +Added a sanity check to e2fsck to make sure that file descriptors 0, +1, 2 are open before opening the hard disk. This avoids a problem +where a broken program might exec e2fsck with those file descriptors +closed, which would cause disastrous results if the kernel returns a +file descriptor for the block device which is also used by FILE * +stdout. + +Fixed up the e2fsck progress reporting functions so that the values +reliably reach 100% at the completion of all of the e2fsck passes. + +Fixed minor documentation bugs in man pages and usage messages. + +Programmer's notes: +------------------- + +Fixed a number of lint warnings in the ext2fs library and potential +portability problems from other OS's header files that might define +CPP macros for names like "max" and "min". + +ext2fs_badblocks_list_add() has been made more efficient when it needs +to grow the bad blocks list. + +Fixed a bug in e2fsck which caused it to dereference a freed pointer +just before exiting. + +Fixed the substitution process for generating the mk_cmds and compile_et +scripts so that they will work outside of the build tree. + +Add sanity check to e2fsck so that if an internal routine +(ext2fs_get_dir_info) returns NULL, avoid dereferencing the pointer +and causing a core dump. This should never happen, but... + diff --git a/doc/RelNotes/v1.14.txt b/doc/RelNotes/v1.14.txt new file mode 100644 index 0000000..1653587 --- /dev/null +++ b/doc/RelNotes/v1.14.txt @@ -0,0 +1,34 @@ +E2fsprogs 1.14 (January 9, 1999) +================================ + +Fix the fstab parsing code so that it can handle blank lines and +comment characters. Also, missing pass numbers need to be treated as +zero. + +Fixed a bug in e2fsck where under some circumstances (when e2fsck +needs to restart processing after fixing an egregious inconsistency) +it would try to access already freed memory. + +E2fsck now prints non-printable characters in directory entries and +pathnames using '^' and 'M-' notation. + +Fixed chattr so that it will ignore symbolic links when doing +recursive descent traversals. For both chattr and lsattr, no longer +print the version string unless the -V option is given. + +Allow the system administrator to directly specify the number of +inodes desired in the filesystem, for some special cases where this is +necessary. + +Fix portability problems so that e2fsprogs can be compiled under Linux +1.2 systems and Solaris systems. + +Update the config.guess file with a more recent version that will +identify newer Linux platforms. + +Programmer's notes +------------------ + +Ext2fs_read_inode and ext2fs_write_inode will now return an error if +an inode number of zero is passed to them. + diff --git a/doc/RelNotes/v1.15.txt b/doc/RelNotes/v1.15.txt new file mode 100644 index 0000000..1b132bb --- /dev/null +++ b/doc/RelNotes/v1.15.txt @@ -0,0 +1,122 @@ +E2fsprogs 1.15 (July 18, 1999) +============================== + +Add configuration checks so that e2fsprogs will compile cleanly on +Linux 2.3 kernels that have renamed i_version to i_generation. + +E2fsck now prints a progress/completion bar (and not just a simple +spinner) if the -C0 option is requested or if it receives a SIGUSR1 +signal. Fsck will automatically manage the (potentially multiple) +e2fsck processes to print completion bars if it is given a -C option, +with the right thing happening if multiple filesystems are being +checked in parallel. + +Mke2fs now has better automatic heuristics to determine the filesystem +parameters to be used for a particular filesystem. Added a new option +-T which allows the user to specify how the filesystem is to be used, +which helps mke2fs do a better job selecting the filesystem parameters. + +Mke2fs now creates revision 1 filesystems by default, and with the +sparse superblock feature enabled. The sparse superblock feature is +not understood by Linux 2.0 kernels, so they will only allow read-only +mounts of filesystems with this sparse superblocks. + +Fix bug where if /dev/null couldn't be opened (should never happen), +e2fsck would hang in a tight loop. + +Make e2fsck handle the case where /lost+found isn't a directory. + +E2fsck now uses mallinfo if it exists to get accurate statistics about +its memory usage. + +Fix bug in e2fsck where it wouldn't check to see if a disconnected +inode had any problems before connecting it to /lost+found. + +Add check to e2fsck so it makes sure that total number of inodes in +the filesystem is a sane number. + +Fix fencepost error when clearing an the end of the block bitmap which +caused the last block in the bitmap not to get cleared. + +Cleaned up a number of messages in e2fsck: + * The message "Group's #'s copy of the group descriptor..." + was fixed so that the correct number would be displayed. + * Added missing space in the "disk write-protected" error message + * Cleaned up the error message printed when a non-interactive + e2fsck needs to abort a check because the filesystem + appears to be mounted. + +Added a new command-line utility, uuidgen, which will create and print +a UUID. + +Make debugfs's icheck command more robust by checking to make sure an +inode has valid blocks before iterating over the inode's blocks. + +UUID generation now uses a random-based scheme whenever possible to +prevent potential privacy problems. + +Man pages for all of the UUID functions in the library were added. + +Fixed bug in fsck so it won't coredump if a filesystem not in +/etc/fstab is given to it. + +Fsck now understands the UUID=xxxx and LABEL=yyyy forms in /etc/fstab +that most of the other mount utilities understands. + +Mke2fs will make a filesystem even if it appears mounted if the force +option is given. + +Dumpe2fs has new command-line options which allow a filesystem expert +to specify the superblock and blocksize when opening a filesystem. +This is mainly useful when examining the remains of a toasted +filesystem. + +The badblocks program has been updated to display correctly on disks +with large block numbers. + +The badblocks program no longer gives spurious errors when errors +occur on non-block boundaries, which is common if the blocksize is +larger than 1k. + +Mke2fs will sync the disk device every MKE2FS_SYNC block groups if the +MKE2FS_SYNC environment variable is set. This is to work around a VM +bug in the 2.0 kernel. I've heard a report that a RAID user was able +to trigger it even using a 2.2 kernel, but hopefully it will not be +needed for most Linux 2.2 users. + +Fixed miscellaneous documentation and man pages. + +Programmer's notes: +------------------- + +Cleaned up functions such as pass1_get_blocks, pass1_read_inode which +in e2fsck's pass1.c really should have been static. + +The return value of the uuid_compare() function was changed to make it +match with the conventions used by strcmp, memcmp, and Paul Leach's +UUID sample document. + +The "make depend" process has now been made more automated; it now +automatically word-wraps the dependencies, and only replaces source +Makefile.in if there has been a change in the dependencies. Also, a +top-level "make depend" now recurses through all the subdirectories +automatically. + +The Makefile in .../util has been changed so that subst is built using +the native C compiler during a cross-compilation, since the subst +program is only used during the build process. Also add an explicit +rule to build util/subst by cd'ing to the correct directory and +running Makefile. + +The man directories are defined in terms mandir, so that the configure +script can override the location of the manual pages. + +The config files have been updated to recognize new machine types for +both the i386 and alpha families. + +Fsck has been modified so that it will accurately create an +fsck_instance even when the noexecute flag is set. This allows for +accurate debugging of the fsck pass structure. Also, when the verbose +flag is given twice, fsck will print debugging information about when +fsck is waiting for jobs to finish. + diff --git a/doc/RelNotes/v1.16.txt b/doc/RelNotes/v1.16.txt new file mode 100644 index 0000000..babf0fa --- /dev/null +++ b/doc/RelNotes/v1.16.txt @@ -0,0 +1,87 @@ +E2fsprogs 1.16 (October 22, 1999) +================================= + +Fixed a race condition bug in fsck; when printing a progress bar, if +checking multiple filesystems in parallel, it was possible for fsck to +send e2fsck a SIGUSR1 signal before e2fsck had installed its signal +handler, which would cause it to terminate with a signal 10. + +E2fsck now properly handles filesystems that have the +INCOMPAT_FILETYPE feature turned on. It can be used to convert a +filesystem into using or not using FILETYPE feature. + +E2fsck now properly handles filesystems that have the IMAGIC feature +turned on (this is used on Linux AFS servers). + +The mke2fs program now creates filesystems that have the filetype and +sparse_superblock features enabled by default, unless it is run on a +pre-2.2 kernel. These features are not supported by a pre-2.2 kernel, +so there is now a new flag -O which allows the user to specify with +which features she would like to create the filesystem; "mke2fs -O +none" will create a filesystem compatible with 2.0 kernels. + +The tune2fs program now has a -O option which allows the user to set +and reset "safe" filesystem features. Currently, the only ones which +allows to be modified are the filetype and sparse_superblock features. +Note setting or clearing either feature will require running e2fsck on +the filesystem afterwards. (n.b. Clearing the sparse_superblock feature +requires that there is enough free space on the filesystem for the +extra superblocks which will be created by e2fsck.) + +Debugfs can now set and print filesystem features in the superblock +using the "features" command. Dumpe2fs will print out the complete +set of features when listing the superblock. + +Dumpe2fs has new options -f (force) and -h (header-only). + +Fixed a bug in e2fsck which could cause the PROGRAMMING ERROR/bonehead +message to come up. This could happen when decrementing or +incrementing a link count could result in an overflow. + +Fixed a bug in e2fsck where the block count on the lost+found +directory would not be properly incremented when the directory was +expanded to the point where an indirect block needed to be allocated. + +E2fsck now makes some additional sanity checks on the superblock to +avoid crashing or giving a memory allocation error if some of the +values in the superblock are unreasonable (but the superblock otherwise +looks valid). + +Fixed a bug in e2fsck where a very badly corrupted filesystem might +require two passes to completely fix the filesystem. This happened if +an inode claimed blocks that was part of the filesystem metadata +(typically, when garbage was written into an inode table or indirect +block, since this kind of filesystem corruption normally doesn't +happen otherwise). + +On the Alpha, glibc declares st_flags although it isn't actually used; +the configure script was improved to detect this case so that +e2fsprogs can avoid using the non-functional stat field. + +The manual pages were updated to use a more consistent formatting +style consistent with standard Unix man pages. Mke2fs's man page +added documentation for a few previously undocumented options. + +Fixed minor display bugs in tune2fs and mke2fs. + +Programmer's notes: +------------------- + +Improved portability of e2fsprogs to non-Unix systems (in particular, NT). + +Added features to parse and print feature strings into the e2p library. +(e2p_feature2string, e2p_string2feature, e2p_edit_feature). + +ext2fs_mkdir() and ext2fs_new_dir_block() now creates directories +whose directory entries contain proper filetype information if the +filesystem supports it. + +ext2fs_link() now uses the low 3 bits of its flags parameter to pass +the directory entry filetype information. This is used to set the +directory entry filetype information if the filesystem supports it. + +Fixed a bug in ext2fs_expand_dir() where the block count in a +directory's inode would not be properly incremented when the directory +was expanded to the point where an indirect block needed to be +allocated. + diff --git a/doc/RelNotes/v1.17.txt b/doc/RelNotes/v1.17.txt new file mode 100644 index 0000000..21ba194 --- /dev/null +++ b/doc/RelNotes/v1.17.txt @@ -0,0 +1,32 @@ +E2fsprogs 1.17 (October 26, 1999) +================================= + +Fixed nasty typo in fsck which caused parallelized fsck's to go into an +infinite loop. + +Fixed a bug in fsck where it used strncmp to compare a binary UUID, +thus potentially causing problems if a binary UUID contained a NULL +character. + +E2fsck now uses stricter checks for directory entries in pass 2: +zero-length filenames are not allowed; neither are 8 byte long +directory entries. + +The debugfs "dirty" command now clears the filesystem valid bit. +(Previously this just set the dirty-as-in-needs-writing-out-to-disk +bit in the in-core superblock image. The new functionality is more +what the user expects, and is more useful.) + +Added a debugging hook to test parallel fsck; if the environment +variable FSCK_FORCE_ALL_PARALLEL, then filesystems on the same drive +will be checked in parallel when they normally would not be. + +Programmer's notes: +------------------- + +Fixed some #ifdef's for compilation under the Hurd OS. + +Fixed minor W2K compatibility problems. + +Fixed some miscellaneous GCC warnings. + diff --git a/doc/RelNotes/v1.18.txt b/doc/RelNotes/v1.18.txt new file mode 100644 index 0000000..17cc283 --- /dev/null +++ b/doc/RelNotes/v1.18.txt @@ -0,0 +1,46 @@ +E2fsprogs 1.18 (November 10, 1999) +================================== + +Fix a core dumping bug in e2fsck if an imagic inode is present or +(more rarely) if the filesystem is badly corrupted enough that e2fsck +has to restart pass 1 processing. E2fsck now closes the filesystem +before freeing a large number of its data structures, so in the case +of future memory faults, at least the fixed filesystem will be fully +written out. + +If a filesystem doesn't support imagic inodes, and e2fsck discovers an +imagic inode, it will offer to clear the imagic flag. + +E2fsck will now offer to clear the immutable flag on special files +(device/socket/fifos) when running it in non-preen mode. + +E2fsck will now set the filetype when creating /lost+found, and when +connected orphaned inodes to /lost+found. + +Debugfs's ncheck and icheck commands now handles the case where there +are bad blocks in the inode table without bombing out. + +The badblocks list processing code has been made more efficiently for +appending a large number of (ordered) badblocks to the badblocks list. + +Some minor man page updates. + +Fsck now allows interactive e2fsck's when using fsck -As (not a common +mode, but some people like to do this in boot scripts for silly reasons). + +Programmer's notes: +------------------- + +The internal e2fsck problem code for PR_2_SPLIT_DOT was fixed to meet +with the problem code convention. + +The badblocks list regression test program has been updated to work +with previously made API name changes. + +The ext2fs_free() command now uses the new badblocks API to avoid +using the compatibility layer. + +Added new regression test cases; the run_e2fsck test script now +supports the ability for a test case to run a preparatory command +before running e2fsck. + diff --git a/doc/RelNotes/v1.19.txt b/doc/RelNotes/v1.19.txt new file mode 100644 index 0000000..1b8bbc6 --- /dev/null +++ b/doc/RelNotes/v1.19.txt @@ -0,0 +1,180 @@ +E2fsprogs 1.19 (July 13, 2000) +============================== + +Release the resize2fs program since the timeout before it could +be released under the GPL has finally expired. + +Add experimental support needed for the ext2 compression patches. +This requires compiling e2fsprogs with the --enable-compression flag +to the configure script. + +Added ext3 journalling support. E2fsck will run the journal (if +necessary) by temporarily mounting the filesystem. /sbin/fsck.ext3 is +installed as a symlink to e2fsck. Fsck has been taught about ext3, +and treats it the same as ext2 in terms of the progress bar logic. +Dumpe2fs will display the superblock journalling information if the +filesystem has a journal. The ext2 library will now permit opening an +ext3 filesystem with the recovery flag set. This is necessary for +on-line dump's to work correctly, but there may be issues with this +working well since ext3 is much less aggressive about syncing blocks to +the filesystem, since they're safe on the journal. + +Tune2fs and e2fsck have been changed to allow the mount_count check to +be disabled by setting max_mount_count to -1. (This was already +supported by the kernel.) + +Create a symbolic link for fsck.ext3, since the e2fsprogs utilities +are used for ext3 as well. + +Added internationalization support for e2fsprogs; must be enabled +by passing --enable-nls to configure. + +Always use the provided ext2fs header files to insulate ourselves from +kernel version changes. Which include files are used by e2fsprogs +have also been cleaned up to improve portability. + +Limit the number of times that e2fsck updates the progress bar so that +people who are booting using a 9600 baud console don't get swamped by +too many updates. + +Improved the loop detection algorithm in e2sck's pass #3 so that it is +much, much faster for large filesystems with a large number of +directories. + +The memory footprint for e2fsck is now slightly smaller than before. + +E2fsck now checks if special devices have a non-zero size, and offers +to clear the size field if it finds such an inode. + +E2fsck now checks if special devices have the append-only flag set, +and offers to clear the inode. + +E2fsck now properly handles some "should never fail" cases during a +bitmap copy in pass5. + +E2fsck now properly prints control characters in filenames as ^A .. ^Z. + +E2fsck now calculates the correct location of the backup superblock in +the case of filesystem blocksizes > 1k. + +Fixed a bug in e2fsck's calculation of the number of inodes_per_block +which normally didn't cause problems under most filesystem parameters, +but could cause a valid superblock to be rejected in extreme cases. +Other checks for validating superblock values were made more +stringent. + +Added non-destructive write testing to the badblocks program, courtesy +of David Beattie. The badblocks also now has an option to input the +current set of bad blocks, so that known bad blocks are skipped to +speed up the badblocks test. There is also a persistent rescan +feature which causes badblocks to run until it has completed some +number of passes without discovering any new bad blocks. + +Badblocks now checks to see if the device is mounted and refuses to do +the tests involving writing to the device if it is mounted. Also, +badblocks now allows the number of blocks to be checked to be +defaulted to the size of the partition. + +Fixed a bug in fsck which didn't allow non-root users to be able to +check filesystems if there were any LABEL= or UUID= entries in +/etc/fstab. + +The Hurd doesn't support the filetype filesystem feature. The mke2fs +program now makes sure that for the Hurd, the filetype feature is +turned off. E2fsck will check to see if the filetype feature is +turned on for Hurd filesystems, and offer to turn off the feature. + +Mke2fs now has a safety check to make sure the number of blocks do not +exceed 32 bits even on a 64 bit platform. + +Really fixed a bug in fsck to allow "fsck -As" to run interactive +fsck's. (For those people who like to do interactive fsck's in the +/etc/rc scripts!?!) + +Debugfs has a few new features: the rdump command, which will do a +recursive dump of a directory and all of its contents, and the lcd +command which does a local chdir (much like the ftp command of the +same name). In addition, the debugfs program and the open_filesystem +command now takes three new options: -b and -s, which allows the +blocksize and superblock location to be specified, and the -c option +which is used in catastrophic situations where the block group +descriptors are corrupt. If the -c option is specified, debugfs will +skip trying to read in the block and inode bitmaps. + +Debugfs's lsdel command was fixed to handle bad blocks in the inode +table. + +A Y2K bug in debugfs's "ls -l" handling was fixed by switching to use +4 digit years. + +General improvements in error messages + + - Mke2fs prints a sane error message if the partition size is zero + (usually because the partition table wasn't reread by the + kernel due to the partition being busy), instead of "invalid + argument passed to ext2 library while initializing superblock". + + - Fsck now prints more self-explanatory message if an invalid UUID= + or LABEL= specification is passed to it. + +UUID library changed to use the LGPL. + +Fixed a bug in the UUID library where very rapid calls to the +time-based UUID generator could cause duplicate UUID's to be returned. +This was not a problem for e2fsprogs, but it could be a problem for +other users of the library. + +Make the UUID library more robust in the face of missing or an +improper /dev/urandom or /dev/random files. + +Added some random portability fixes for Solaris. + +Some minor man page updates. + +Fixed a memory leak in the ss library. + + +Programmer's notes: +------------------- + +We now try to use lseek64 and open64 from the LFS if possible. + +The 3rd parameter in e2p's print_flags is now a flags word, instead of +a boolean option. + +The mark and unmark bitmap functions now return the previous state of +the bit that was being changed, which is useful for some speed +optimizations. + +The following functions have been added to enhance the badblocks list +handling in libext2fs: ext2fs_write_bb_FILE, ext2fs_read_bb_FILE2, and +ext2fs_badblocks_equal. + +The ext2 header files now have the latest journalling fields to the +superblock. + +The ext2fs_mkdir function in libext2fs now properly backs out of error +conditions robustly. + +Cleaned up makefiles: + - to cleanly compile with the -j flag. + - so distclean removes all generated files. + - so in case of an error while installing header files, the make aborts. + +Fix test_script so that it works correctly when compiling in the +source directory. + +The random UUID generation routine has been made slightly better in +the case where /dev/random doesn't exist. (Use of randomly-based UUID +is still not recommended if /dev/random doesn't exist, however; it's +better to use the time/ethernet MAC address UUID in this case.) + +Clean up the build process so it's more friendly in case of missing +directories. + +The ext2fs header file can now be #include'd into C++ programs. + +The e2p.h header file is now installed. + +Added workaround to a gawk 3.0.5 bug in lib/ss/mk_cmds. + diff --git a/doc/RelNotes/v1.20.txt b/doc/RelNotes/v1.20.txt new file mode 100644 index 0000000..c2423ad --- /dev/null +++ b/doc/RelNotes/v1.20.txt @@ -0,0 +1,206 @@ +E2fsprogs 1.20 (May 20, 2001) +============================= + +Add support for replaying the ext3 journal purely in user mode, +including handling the orphaned inode list. Used code contributed by +Andreas Dilger, with bug fixes and the orphaned inode handling done +by Theodore Ts'o. + +The mke2fs and tune2fs programs can create or modify a filesystem to +include an ext3 journal. Tune2fs also can be used to remove an ext3 +journal from a filesystem. + +E2fsck will now check for the existence of a linked list of orphan +inodes in the superblock, and clear those inodes before starting the +rest of the filesystem check (but after the journal playback). + +E2fsck now validates the file descriptor passed to the -C option, +which saves against the completion bar getting written to an +unexpected location, such as the disk being checked. (Debian +bug/wishlist #55220) + +E2fsck will now bump the filesystem revision number from zero to one +if any of the compatibility bits are set. + +Fixed a bug where a badly corrupted directory on a big endian system +could cause e2fsck to die with a bus error. The +ext2fs_read_dir_block() and ext2fs_process_dir_block() functions in +the ext2 library now does alignment sanity checks on the rec_len field +of the directory entry before using it. + +The ext2 library has been enhanced to make tune2fs safe to run on +mounted filesystems. (Users could usually get away with using tune2fs +on mounted filesystems before, but with the advent of ext3 and +journalling, it became important to make tune2fs was *really* safe for +use even when the filesystem being modified is mounted.) E2label is +now implemented by tune2fs using an argv[0] dispatch, so that e2label +is also now safe for use on mounted filesystems. + +Added a new program, e2image, which creates a backup of critical ext2 +filesystem data structures. The generated image file can be examined +using dumpe2fs and debugfs. In the future, e2fsck will be able to use +the image file to help recover very badly damaged filesystems. + +Fixed a number of LFS bugs in e2fsck; very, very large (> 2**42) files +no longer cause e2fsck to bomb out. Also treat files > 2GB as being +large file when deciding whether or not the filesystem has large files. + +Fixed lsattr and chattr so that they work correctly on large files. +(Fixes Debian bug #72690.) + +Removed limitation in get_device_size() which imposed a one terabyte +filesystem limitation. (Most 2.2 kernels still have a signed int +problem which cause 1 TB block device limitation. Fortunately, the +kernel patches to fix this are much easier than fixing the 2TB +limitation in the kernel. :-) + +A max_mount_count of zero is now treated as if no mount count were +set. (Previously, no mount count was indicated by using -1, and a +mount count of zero caused e2fsck to always be run.) + +Mke2fs supports two new filesystem types largefile and largefile4. + +Mke2fs now adds some randomness in s_max_mount_count so that multiple +filesystems won't be all checked at the same time under normal +operations. + +Fixed bug in the progress bar printing code which could cause e2fsck +to core dump on an illegal filesystem. + +Fixed bug in fsck which could allow more than one instance of e2fsck +to be printing a progress bar. (Debian bug #65267) + +Fsck using a UUID or a LABEL specifier will work even if devfs is +compiled into the kernel and not mounted. If the pathnames in +/proc/partitions are incorrect, fsck will search /dev for the correct +device (using the new ext2fs_find_block_device library function). +Fsck now also checks the RAID devices first so that they are properly +found when they are in use. Support has also been added to support +additional IDE disks and the DAC 960 device names. (Debian bug #94159) + +Fixed a bug in fsck which caused it not deal properly with 16 +byte long filesystem labels. + +Fsck's -t option has been made a lot more flexible. The semantics for +what happens if a comma-separated list to fsck has been regularized, +and it is now possible to filter what filesystems will get checked +based what is in the filesystem's fstab entry's option field. (Debian +bug #89483.) + +The dumpe2fs program can now print out the group description +information in hex, and also prints the location of the superblock and +block group descriptor for those block groups that have them. + +Mke2fs now clears the ext2 superblock before it starts creating a +filesystem, so that the superblock magic number is only written if the +filesystem creation process successfully completes. + +The debugfs program's stat command now pretty-prints the blocks used +by an inode so that it's more compact and informative. + +The debugfs stats command now uses the same libe2p code (which is used +by dumpe2fs) to print the superblock header information. This is more +complete, and it avoids a bit of code duplication. + +Added a new debugfs command, set_super_value (ssv) which allows the +user to set arbitrary superblock fields. + +Debugfs was extended to support inode numbers in hex (by prefixing +them with 0x), and so that modify_inode can set the inode generation +number. Also, there is now a new function command called logdump +which will dump an ext3 journal. + +Fixed a bug in debugfs so that quitting out of the pager doesn't kill +debugfs. + +Debugfs's dump command now stops immediately upon reporting a disk +read error. (Fixed a bug in ext2fs_file_read library routine which +caused debugfs not to stop.) (Debian bug #79163) + +On systems with /proc/mounts (mainly Linux systems), /proc/mounts is +checked before /etc/mtab is used, since /proc/mounts is more likely to +be accurate. + +Added portability fixes for Solaris and Linux/ia64. + +Various manual pages were clarified and cleaned up. (Fixed debian +bugs #63442, #67446, and #87216) + + +Programmer's notes: +------------------- + +The e2fsck message printer now supports %Iu and %Ig, which will print +out the inode's user and group owners, respectively. + +E2fsprogs now includes its own version of include/linux/ext2_fs.h, so +that no longer dependent on the system having the correct version of +the kernel header files. + +Added a new function to libext2, ext2fs_find_block_device(), which +searches the system (i.e., /dev, /devfs, /devices) for a pathname to a +device given its device number. + +Added a new function to libext2, ext2fs_sync_device, which centralizes +all of the places which might try to use the BLKFLSBUF or FDFLUSH +ioctls (and usually failing to define them since the system header +files don't usually do this for us, and we're trying to avoid usage of +kernel include files now). + +Added new utility programs in tests/progs: random_exercise and +hold_inode. They aren't built by default; they're useful for +exercising ext3 filesystem code. + +Added a new ext2 filesystem flag, EXT2_FLAG_SUPER_ONLY, which causes +the filesystem close functions to only update the superblock, and to +not touch the block group descriptors. Needed by tune2fs when +modifying a mounted filesystem. + +Got rid of struct ext2fs_sb and replaced it with the standard struct +ext2_super_block from include/linux/ext2_fs.h. Note: this may break +source (but not binary) compatibility of some users of the ext2 +library. Those applications should just simply do a global search and +replace of struct ext2fs_sb with struct ext2_super_block, and include +the new header file <ext2fs/ext2_fs.h> which defines it. + +The ino_t type has been renamed ext2_ino_t to protect applications +that attempt to compile -D_FILE_OFFSET_BITS=64, since this +inexplicably changes ino_t(!?). So we use ext2_ino_t to avoid an +unexpected ABI change. + +The Makefiles have been reworked so that "make check" can be run from +the top-level Makefile. + +Fix general gcc -Wall complaints and removed dead code. + +Remove use of NOARGS, because we assume everyone does ANSI C these +days. + +Added build-rpm script from sct. + +New functions ext2fs_image_{inode,super,bitmap}_{read,write} added +to support e2image. + +New function ext2fs_flush_icache which must be called if the +application program modifies the inode table blocks without going +through ext2fs_write_inode() interface. + +New ext2fs_check_mount_point() function, which will return the mount +point of a device if mounted. + +The io_channel abstraction now has an optional interface, +io_channel_write_range, which allows specific byte ranges to be +written. + +The unix_io IO channel now supports write-through caching, so that +journal creation is more efficient. + +Added x86 assembly language routines to support byte swapping, to +reduce executable size. + +Fixed bug in the utility program subst so that it's possible to +replace a substitution variable with a zero-length string. + +Fixed numbering e2fsck pass1 problem numbers; an extra zero had +slipped into some of the problem number. + diff --git a/doc/RelNotes/v1.21.txt b/doc/RelNotes/v1.21.txt new file mode 100644 index 0000000..c0a56e3 --- /dev/null +++ b/doc/RelNotes/v1.21.txt @@ -0,0 +1,119 @@ +E2fsprogs 1.21 (June 15, 2001) +============================== + +Added new configure flags which allow a subset e2fsprogs to be built; +this is most useful for boot floppies, since the resulting shared +libraries and programs are slimmed down by removing features that +aren't necessary for a boot floppy. The new flags that were added +are: --disable-swapfs, which removes support for byte swapping old +legacy PPC/68k filesystems, --disable-debugfs, which removes support +for debugfs from the libext2fs library, --disable-imager, which +removes support for the e2image program, and --disable-resizer, which +removes support for resize2fs. + +E2fsck now prints the number of mounts or days elapsed since the last +check when e2fsck is forced to check an otherwise clean filesystem. + +Tune2fs now prints an informative message about how often a filesystem +will be checked when adding a journal to the filesystem, to remind the +user that he/she may want to adjust those parameters using tune2fs +-c/-i. + +Worked around hurd brain-damage which causes e2fsck to sometimes +believe a filesystem is the root filesystem based on device numbers +(since Hurd doesn't have dev_t's, which is arguably a POSIX.1 +violation). + +Fixed a bug introduced in 1.20 which caused e2fsck to abort with an +erroneous error with the -F option was specified. + +Fixed a ext3 recovery bug in the revoke handling; synchronized with +ext3 0.7a. + +Fixed two bugs in e2fsck's handling of dup block handling, dealing +with relatively uncommon edge cases: a directory with an indirect +block which is claimed by another file, and when the last inode in the +filesystem has blocks claimed by another file. + +E2fsck now checks to see if the i_size field of a fast symlink is too +big, and offers to clear the symlink if so. + +E2fsck now checks to see if i_size_high of special files is non-zero, +and offers to clear i_size_high. + +Fix e2fsck's handling of incompatible journal flags so that the user +has chance to abort, and then has the option to clear out the journal +entirely. (Addresses Debian bug #98527.) + +Fixed a bug in fsck which could cause it to core dump if a mix of +standard and non-standard device names are used in /etc/fstab. +(Debian bug #100559) + +Fixed a bug in debugfs which caused read errors when copying a file to +not be noticed. + +The debugfs set_super_value command can now modify the s_lastcheck field. + +Fixed a bug in lsattr and chattr which was accidentally introduced in +1.20 to support > 2GB files; both lsattr and chattr wasn't reading +directories correctly because the change modified the layout of struct +dirent to be incompatible with the libe2p shared library. + +Cleaned up the mke2fs manual page and included a discussion about why +it's good to periodically check the filesystem even when journalling is +enabled. + +Programmer's notes: +------------------- + +Fix general gcc -Wall complaints. + +The types needed by the ext2 header files are now provided by +lib/ext2fs/ext2_types.h, instead of include/asm/types.h. + +Integers are now preferred to longs when trying to find a 32-bit type +in ext2_types.h. Also, if linux/types.h has already been defined, +don't try to redefine the types. + +Fixed make depend script so that it automatically corrects the +pathname cleanups performed by make -M, so I don't have to fix them up +by hand. + +Fixed the d_loaddump test case to be more robust, and not depend on +bash'isms. + +Removed debugfs's dependence on pread(), which was accidentally +introduced in e2fsprogs 1.20 + +Fixed a performance bug in the libext2fs's icount routine; the size +estimate of the icount array was incorrectly being calculated. + +Removed use of the badblocks compatibility functions in the e2fsprogs +programs. + +Added paranoia code which protects against strange cases where /etc +isn't on the root filesystem, or if /etc/mtab doesn't exist. + +The header file ext2_types.h is now installed. + +Autoconf is used to determine when we are on big-endian machines, +instead of doing run-time tests, to save a few bytes of code. + +The ext2fs_mark_generic_bitmap and ext2fs_unmark_generic_bitmap +functions are no longer inline functions, which saves space and +doesn't really cost any real performance. + +The ext2fs library no longer depends on the e2p library. (What need +there was of it --- namely, fsetflags, was coded in-line). + +Fixed the makefile so that lib/ext2fs/ext2_types.h is generated even +when the user is stupid and tries compiling the package using "make +install" as root. + +Miscellaneous code cleanups: + * Added missing files from Makefile.in's SRCS file, so that + their dependencies would be properly calculated. + * Removed redundant code + * Fixed comments in code + * Removed no-longer needed argsused #pragma. + diff --git a/doc/RelNotes/v1.22.txt b/doc/RelNotes/v1.22.txt new file mode 100644 index 0000000..204a0c5 --- /dev/null +++ b/doc/RelNotes/v1.22.txt @@ -0,0 +1,31 @@ +E2fsprogs 1.22 (June 22, 2001) +============================== + +Fixed a bug in e2fsck's handling of orphan inodes which are special +files (i.e., block/character device files, named FIFO's, etc.). + +Fixed a bug accidentally introduced in e2fsprogs 1.21 which caused +tune2fs to fail at adding a journal to a mounted filesystem. + +Fixed a few big-endian bugs in e2fsprogs + * The directory block functions were accidentally reporting + some directories as corrupted when they weren't. + * If e2fsprogs is compiled --disable-swapfs, the C language + equivalents weren't being included for big-endian platforms. + (Fixes Debian bug #101686). + +Fixed a Hurd compilation problem. (Addresses Debian bug #101361) + +Programmer's notes: +------------------- + +Use platform independent method of defining the BLKFLSBUF and FDFLUSH +ioctls, and allow them to be defined for non-i386 platforms. + +The uuid.h header file is now protected against multiple inclusions. + +E2fsprogs is now being developed using BitKeeper. Changed the test +scripts to deal with BK's stripping CR characters from text files, +and changed the top-level Makefile.in to avoid including BitKeeper +files when generating the source tarball. + diff --git a/doc/RelNotes/v1.23.txt b/doc/RelNotes/v1.23.txt new file mode 100644 index 0000000..c62b6f2 --- /dev/null +++ b/doc/RelNotes/v1.23.txt @@ -0,0 +1,65 @@ +E2fsprogs 1.23 (August 15, 2001) +================================ + +Add initial support for extended attributes (EA); e2fsck will +correctly handle a filesystem with EA's and check the EA blocks for +corruptions. + +E2fsck's symlink sanity checking has been cleaned up. It now checks +the i_size value of fast symlinks, and checks for immutable flags +being set of symlinks, etc. + +E2fsck now offers to clear inodes which are special files that have a +non-zero i_blocks or i_size field. (The i_size field check was in the +previous version of the code, but due to a bug it didn't offer to +clear the inode unless i_size and i_size_high were both non-zero.) + +E2image can now create "raw" image files, which only contain the +filesystem metadata placed in a spare file so that e2fsck, dumpe2fs, +debugfs, etc., can be run directly on the raw image file. + +Add support for the 64-bit block device patches. + +Fixed bugs in creating external journals with a 1k blocksize. + +Add initial support for external journals (so long as the external +journal only supports a single filesystem) in e2fsck. + +Remove requirement for needing to run fsck on a filesystem after +removing a journal (either internal or external). + +The man pages now document how to create and manage external journals. + +Speed up the check of an ext3 filesystems by avoiding a needless flush +of all of the superblock and block group descriptors. + +Speed up creating an internal journal using tune2fs in the case where +the filesystem has a lot blocks already allocated. + +Tune2fs has been fixed to make sure that only error messages go to +stderr, and normal message go to stdout. (Addresses Debian bug #108555) + +Fixed a minor bug in mke2fs; if -O none is passed to mke2fs, it will +now not set the sparse_super feature. (Addresses Debian bug #108165) + +Add support in fsck for the filesystem type "auto". + +Fsck -A will not try to interpret device names for filesystems which +have a pass number is 0. (Addresses Debian bug #106696). + +Fsck prints a warning message if now valid filesystems are passed to +it. (Addresses Debian Bug #107458.) + +E2fsck now gives an explicit warning if there filesystem still has +errors at the end of the run. (Addresses Debian bug #104502) + +E2fsck will set the EXT2_ERROR_FS flag if the journal superblock +reflects an error. E2fsck will also not run the orphan list if the +filesystem contains errors, since the orphan list might be corrupted. + +E2fsck now prints the number of large files when given the -v option. + +Fixed minor memory leaks in e2fsck. + +Some minor man pages updates. (Addresses Debian bug #30833, #108174) + diff --git a/doc/RelNotes/v1.24.txt b/doc/RelNotes/v1.24.txt new file mode 100644 index 0000000..f8fd56c --- /dev/null +++ b/doc/RelNotes/v1.24.txt @@ -0,0 +1,38 @@ +E2fsprogs 1.24a (September 2, 2001) +=================================== + +Fix brown-paper bug in mke2fs which caused it to segfault when +printing the version string. + + +E2fsprogs 1.24 (August 30, 2001) +================================ + +Revert the BLKGETSIZE64 support, since for some distributions, this +ioctl has been used by an unofficial kernel patch to update the last +sector on the disk, and this was causing disk corruption problems as a +result. + +Mke2fs is now more careful about zapping swap space signatures and +other filesystem/raid superblock magic values so that programs like +mount who try to use heuristics to determine the filesystem type of a +partition are less likely to be confused. + +E2fsck will no longer complain if the the mode of EXT2_RESIZE_INO is a +regular file (since Andreas Dilger's on-line resizing tools will set +its mode bits). + +Fixed some minor texinfo, man pages nits for spelling errors, +texinfo warnings, etc. (Addresses Debian bug #110621.) + +E2fsprogs program no longer print the filesystem version number +(i.e. 0.5b), since it only confuses people and doesn't serve any real +purpose. + +E2fsck will once again compile under libc5, since it will supply its +own version of strnlen if necessary. + +mke2fs and tune2fs will allow the use of UUID= or LABEL= specifiers +when specifying the external journal device. tune2fs will also search +devices looking for the external journal device when removing it. + diff --git a/doc/RelNotes/v1.25.txt b/doc/RelNotes/v1.25.txt new file mode 100644 index 0000000..2f3be23 --- /dev/null +++ b/doc/RelNotes/v1.25.txt @@ -0,0 +1,46 @@ +E2fsprogs 1.25 (September 20, 2001) +=================================== + +This is primarily a bug-fix release; no new features were added, but +there are a number of embarrassing bug fixes and cleanups applied. + +Fix a bug mke2fs which causes stack garbage to be written to disk when +zapping disk sectors. (This bug could cause mke2fs to core dump for +some kernels, I suspect with security enhancement patches.) + +Remove unneeded #include of <linux/config.h> which was breaking +building e2fsprogs on the Hurd. (Addresses Debian bug #112414.) + +Updated tune2fs man page to reflect the fact that adding or removing a +journal doesn't require running e2fsck. + +Remove use of AC_REQUIRE from autoconf which had been used to prevent +AC_CANONICAL_HOST from being called twice; unfortunately this causes +recent autoconf to bomb out since they don't allow AC_REQUIRE to be +used outside of autoconf macros. Fortunately, it doesn't seem to be +necessary any more, anyway. + +E2fsck will now not fall back to an alternate superblock if the user +specifies the superblock location explicitly on the command-line. +This allows easier recovery from a situation where the primary +superblock and block groups are slightly corrupted, but the backup +superblocks are completely broken. + +Fix problem which caused compile_et and mk_cmds to blow up if +e2fsprogs was in a directory with a pathname that contained spaces. + +We are now more paranoid about checking the entry in /etc/mtab to make +sure the filesystem is really mounted, since some broken distributions +(read: Slackware) don't initialize /etc/mtab before checking non-root +filesystems. (Slackware also doesn't check the root filesystem +separately, and reboot if the root filesystem had changes applied to +it, which is dangerous and broken, but there's nothing I can do about +that.) + +Make UUID library C++ friendly by adding appropriate extern "C" +declarations and using const in the function declarations. + +Fix up the com_err texinfo file so that it can product a valid info +file (previously, it could only be used to generate paper +documentation using texinfo.tex). + diff --git a/doc/RelNotes/v1.26.txt b/doc/RelNotes/v1.26.txt new file mode 100644 index 0000000..0c4609c --- /dev/null +++ b/doc/RelNotes/v1.26.txt @@ -0,0 +1,164 @@ +E2fsprogs 1.26 (February 3, 2002) +================================= + +Dumpe2fs will keep going now if the bad block inode can't be read. +(Previously it stopped with a fatal error.) + +E2fsck will now give an opportunity to run the journal even if the +recovery flag is not set. This is the default behaviour if e2fsck is +using a backup superblock, since the needs_recovery flag will never be +set in the backup superblock copies. + +E2fsck now automatically finds the backup superblock/group descriptors +even when the primary superblock is completely destroyed for 2k and 4k +filesystems. (Previously it just guessed/assumed that we were dealing +with a 1k filesystem in that case, and users had to manually specify +the backup superblock number.) + +Fixed a bug in e2fsck where it dereferences a null pointer when there +is a problem opening a filesystem in preen mode. + +E2fsck now handles external journals correctly; previously it trashed +the external journal device if the journal needed to be replayed. + +Work around ulimit incompatibility problem caused by recent 2.4 +kernels; the unix IO module will automatically try to set any resource +limits to be infinite on startup. + +Fixed a bug in e2fsck where it wasn't allocating a new block or inode +bitmap if it wasn't present and the blocksize was 2k or 4k. + (Addresses Debian Bug #116975) + +E2fsck will check and fix botched ext3 V1 to V2 superblock updates by +clearing the new V2 fields if they do not make sense or if the ext3 +superblock is version 1 superblock. + +E2fsck will automatically relocate the ext3 journal from a visible +file (i.e., /.journal) to an hidden inode if the filesystem has been +opened read/write. This allows the users to add a journal while the +filesystem is mounted, but the next time the system is rebooted, the +journal file will disappear. This avoids problems with backups, +stupid operators with superuser bits, etc. + +Fix a bug in fsck where it would not support a filesystem type of +"auto" if the device was specified in terms of LABEL=xxx or UUID=xxx. + +Fsck now supports fstab entries of the form "ext3,ext2". It will also +automatically identify reiserfs filesystems. + +The number of processes spawned by fsck can now be limited using the +FSCK_MAX_INST environment variable. + +Fsck now searches the LVM proc hierarchy to find logical volumes which +should be searched for UUID and label information. + +Work around a bug in 2.4.10+ kernels by trying to unset the filesize +limit if at all possible, when opening a block device. (The filesize +limit shouldn't be applied against writes to a block device.) + +In mke2fs and e2fsck, specifying the -c option twice will now do +a read/write test on the disk. Update the man pages to encourage +using the -c option, and to discouraging running badblocks separately, +since users tend to forget to set the blocksize when running +badblocks. + +Mke2fs now automatically clears the immutable attribute on a +pre-existing .journal file left over from a previous failed attempt to +add a journal to an already-mounted filesystem. + +Fixed mke2fs's exit codes to consistently indicate when the mke2fs +operation failed. + +Mke2fs now creates the lost+found directory with permissions of 0700, +so that files that had previously lived in protected directory are +safe if they get dropped in lost+found and the system administrator +doesn't deal with immediately. (Addresses Debian #bug 118443) + +Mke2fs and e2fsck (and all programs that use the +ext2fs_check_if_mounted function) will now properly identify that a +device is mounted, even in cases where devfs has confused things with +multiple devices names with the same identity, or if a dim-witted +system administrator has done something stupid like creating device +file aliases in their home directory. Also now checks for swap devices +by using /proc/swaps. (Addresses Debian bug #106622) + +Added a new option (-T) to tune2fs which sets the time a filesystem +was last checked. + +Speed up e2image when creating sparse raw image files by optimizing +away excess lseek() system calls. + +Fix support of large (> 2GB) files when used as a filesystem in +mke2fs, tune2fs, debugfs, and findsuper. + +Debugfs's stat and icheck commands now properly deals with large (> +2GB) files. + +Debugfs's set_super_value command now prints out the list of valid +superblock fields which can be set using the command. + +Debugfs's rm and kill_file command now updates the superblock free block +and inode counts, thus keeping the filesystem consistent. + +Debugfs's lsdel command now takes an optional argument which allows +the user to only see the most recently deleted files. + +A new command (undel) was added to debugfs which automates +undeleting a deleted inode and linking it back to a directory. + +Debugfs's ls command now takes a new option, -d, which lists +deleted directory entries. + +Debugfs's testb, freeb, setb, and find_free_block commands now take an +optional count argument. + +Add support for a new ext2 file attribute, EXT2_NOTAIL_FL, which will +be used to signal that a particular inode should not be eligible for +tail-merging --- this is needed for programs like LILO. + +The findsuper (an unreleased, uninstalled utility program) has been +improved to add extra validity checks and to add a progress meter. +(It is still an unsupported program; the officially supported way to +recover from a trashed partition table is to use gpart; findsuper is +for wizards only. :-) + +Debugfs was fixed to compile with "configure --disable-swapfs". + +Cleaned up various manual pages. (Addresses Debian bug #119624, #120171) + +Added new translation file for Turkish. + +Programmer's notes: +------------------- + +Fix general gcc -Wall complaints. + +E2fsprogs (mostly) works with the dietlibc. + +The programming texinfo file has been expanded to include description +of additional libext2fs functions. (Still not completely done, but a +lot of the more important functions have been documented.) + +Added a umask structure to struct_ext2_filsys, which currently only +modifies the behaviour of ext2fs_mkdir(), but if we add any file +creation functions to libext2fs, we should also make sure they respect +the umask setting. + +The build-rpm script was fixed to be a bit more safe. + +The tests' Makefile now has a way of automating test case creation +for e2fsck, using "make testnew". + +Created a new function, ext2fs_dir_iterate2 which passes more +information to the callback function (identical to the one used by +ext2fs_dblist_dir_iterate). The directory iterator functions take a +new flag, DIRENT_FLAG_INCLUDE_REMOVED, which will return deleted +directory entries. If the directory entry is deleted, the callback +function will be called with the entry parameter set to +DIRENT_DELETED_FILE. + +Added new functions, ext2fs_inode_alloc_stats and +ext2fs_block_alloc_stats, which takes updates block/inode allocation +statistics in the bitmaps, block group descriptors, and superblock +when inodes or blocks are allocated or deallocated. + diff --git a/doc/RelNotes/v1.27.txt b/doc/RelNotes/v1.27.txt new file mode 100644 index 0000000..fc302af --- /dev/null +++ b/doc/RelNotes/v1.27.txt @@ -0,0 +1,60 @@ +E2fsprogs 1.27 (March 8, 2002) +============================== + +The warning messages for mke2fs now go to standard error. + +Fixed to make sure "make check" runs all of the test programs with +LD_LIBRARY_PATH set, so that we test the libraries in the build tree. + +The mke2fs program checks the boot sector for the BSD disk label, and +avoids erasing it if it is there. + +Fixed a bug in e2fsck which caused it to core dump if the journal +inode was missing when it was supposed to be there. + +E2fsck now prints ranges in pass 5 when printing deltas for the block +and inode bitmaps. + +Debugfs's "ls -l" command now will print out the file type information +in the directory entry. + +Create man pages and hard links for fsck.ext3 and mkfs.ext3. If +mke2fs is invoked as mkfs.ext3, create the filesystem with a journal. + +Debugfs can now examine the experimental directory indexing +information. + +Fixed bug in debugfs which caused it to core dump if modify_inode is +called without an open filesystem. + +The debugfs lsdel command now runs its output through a pager first. + +When installing manual pages, remove the compressed manual pages first. + +Synchronized with Debian's packaging information for e2fsprogs-1.26-1. + +Fix the 2.4 resource limitation workaround introduced in 1.26 which +actually broke things on mips32, sparc32, and Alpha platforms. + +Updated the I18N code so that calls to setlocate(LC_CTYPE, 0) are made +(which is required by the newer libintl libraries). + +Programmer's notes: +------------------- + +Fixed various gcc -Wall complaints. + +Fixed a few memory leaks in the e2fsck journalling code, and in the +ismounted code checking for a swap device. + +Add new inode I/O abstraction interface which exports an inode as +an I/O object. + +Exported ext2_file_flush as a public interface. + +In ext2_file_write, we now mark the buffer void * argument as a const, since ext2_file_write doesn't modify the buffer. + +Lots of small random portability fixes to make e2fsprogs build under +AIX --- even without the 5L compatibility toolkit, and even using the +uber-crippled AIX native C compiler. + diff --git a/doc/RelNotes/v1.28.txt b/doc/RelNotes/v1.28.txt new file mode 100644 index 0000000..4463996 --- /dev/null +++ b/doc/RelNotes/v1.28.txt @@ -0,0 +1,146 @@ +E2fsprogs 1.28 (August 31, 2002) +================================ + +Add support for the Hashed-Tree Directory Indexing to e2fsck. Support +for setting the htree flag is not included yet, although it can be +manually turned on via the debugfs program. + +Clarified e2fsck error message which is printed when it cannot find +sufficient contiguous block when relocating filesystem metadata. + +Added support for building an EVMS plugin module for ext2/3. This +module is substantially the same as the EVMS module shipping with EVMS +1.1, with one or two bugfixes. E2fsprogs can also build this plugin +for use with EVMS 1.0 (which did not include the ext2 plugin module), +if the configure --enable-old-evms flag is given. + +Fsck will search through EVMS volumes when trying to resolve +filesystem specifications such as LABEL=xxx or UUID=xxx. + +Added a new utility program, /sbin/findfs, which will return +filesystem specifications such as LABEL=xxx or UUID=xxx, and prints +the device name. + +Update and clarified various man pages. (addresses Debian Bug #145044, +#146437, #131350, #151990, #144621, #141938) + +If there are no filesystems specified on fsck's command line, fsck now +treat that as if the -As options were given. Previously it would +simply do nothing. (Addresses Debian Bug #153102) + +Mke2fs no longer treats a failure to be able to clear the MD signature +at the end of the filesystem as a fatal error. (Addresses Debian Bug +#155007) + +The e2p library functions (which are used by lsattr and chattr) now +double check to make sure the file is a regular file or directory +before attempting to use the ext2 ioctls. Some device drivers +unfortunately respond to the ext2 ioctl's with unknown behaviour. +(Addresses Debian Bug #152029). + +The extended attribute handling has been updated to correspond with +the latest V2 bestbits ACL code. + +Fixed bug in e2fsck which caused it to not clear the dtime field when +processing truncated inodes on the orphan list. This could cause data +loss(!) if a filesystem is rebooted before a truncate has been +committed. + +E2fsck now uses red/black trees in pass1b, which removes some O(n**2) +algorithms. This makes e2fsck much faster in the case of severely +corrupted filesystems where a large number of blocks are claimed by a +large number of inodes. (Thanks to the 2.5 IDE device driver for +inspiring this work.) + +Resize2fs has been significantly sped up when shrinking and expanding +a filesystem by a very small number of blocks (for example, when EVMS +is converting a partition to be an EVMS legacy volume). + +Added a new option to e2fsck, -D, which will optimize or compress all +of the directories in the filesystem. + +E2fsck now catches SIGINT and SIGTERM to make sure it will can +properly clean up and only exit at safe points. Fsck will pass +SIGINT/SIGTERM to its child processes, and wait until they have all +exited before it exits. + +The uuid parsing code in the uuid library now properly complains when +an illegally formatted uuid is presented to it. (Addresses Debian bug +#152891) + +Restrict use of the 2.4 setrlimit ABI f*ckup to kernels between 2.4.10 +and 2.4.17, since the workaround can cause problems when using a 2.4 +kernel with an old version of glibc built with the 2.2 headers. + +Fixed a bug in mke2fs where it wasn't properly clearing the initial +superblock used by other filesystems. (Addresses Debian bug #147256.) + +Added support for the synchronous directory feature written by Andrew +Morton. + +The debugfs program can delete directories using the rmdir command. + +Add support for 8k and 16k filesystems (for systems with page sizes +that are greater or equal to 8k or 16k, respectively). Note that +these filesystems can not be mounted on x86 systems, or other systems +with only 4k page sizes, due to limitations in the current Linux VM +code. + +Resize2fs requires that the filesystem state be valid and have no +errors; otherwise, e2fsck -f must be run first. (Previously it simply +required that the last fsck time be greater than the last mount time.) + +Configure now defaults the man pages directory to /usr/share/man on +Linux systems. + +E2fsck now offers to truncate inodes which contain too many blocks (so +that i_blocks would overflow. Also fixed handling of large sparse +files. + +E2fsck now more completely checks for symlink validity, including +requiring NULL termination and length checks. + +E2fsck will offer to try forcing a disk write to remap a bad block +after finding a read error when reading a filesystem metadata block. + +Fixed a bug in debugfs which caused the -b and -s options to crash +debugfs, as well as breaking the testb, setb, and clearb functions. + +Added a bmap command to debugfs which calculates the logical to +physical block mapping for a particular inode. + +Fixed a bug in code which checked to see if a device was mounted which +sometimes (rarely) failed in the case of a plain file. + +Fixed a bug in resize2fs where when it reported an error, it would +print a message erroneously indicating that the filesystem had been +resized before it aborted. + +When resizing a plain file which is smaller than the requested size, +resize2fs will attempt to extended the file so that programs like +e2fsck will not complain that the file is too small. + +Resize2fs will print the actual new size of the filesystem when it is +finished resizing. + +Fixed a bug in debugfs where "ls -l" would report incorrect file type +information on big-endian systems. + + +Programmer's notes: +------------------- + +Fixed collisions with C++ reserved words. + +Added portability fixes for building e2fsprogs on the HURD and AIX. + +Added the ext2ed program for creation of test cases. (ext2ed has many +limitations and bugs which make it unsuitable for production use.) + +The ext2fs_read_dir_block2 and ext2fs_write_dir_block now take a new +flag, EXT2_DIRBLOCK_V2_STRUCT, which will will reverse when the +name_len field is byte swapped on big-endian machines, since in the +V2 structure, name_len is a char field which is doesn't need to be +byte swapped --- except if an old-style kernel had byte-swapped the +name_len field as part of the V1 structure. + diff --git a/doc/RelNotes/v1.29.txt b/doc/RelNotes/v1.29.txt new file mode 100644 index 0000000..8a060eb --- /dev/null +++ b/doc/RelNotes/v1.29.txt @@ -0,0 +1,31 @@ +E2fsprogs 1.29 (September 24, 2002) +=================================== + +Fixed a bug in e2fsck which could corrupt a directory when optimizing +it (via the -D option) or rebuilding the hash tree index with a 1 in +512 probability, due to a fence post error. + +Fixed a bug in the LVM support code which caused LABEL='xxx' not to +work correctly. + +Mke2fs now enables the directory indexing flag by default. (Since +this is a compatible feature flag, it's safe to do so.) + +Tune2fs will support setting the directory indexing feature flag. It +will automatically set up the default hash algorithm and hash seed +fields in the superblock. + +If the bone-headed user enters the root filesystem twice in +/etc/fstab, the -R option which skips the root filesystem will skip +all of them. (Addresses Debian bug #159423). Note! This is not a +precedent for dealing intelligently with any other kind of doubled +entry in /etc/fstab! + + +Programmer's notes: +------------------- + +Removed perror declaration in lib/et/internal.h. All modern systems +can be expected to define perror() these days. Besides, the lib/et +code wasn't using perror at all anyway. :-) + diff --git a/doc/RelNotes/v1.30.txt b/doc/RelNotes/v1.30.txt new file mode 100644 index 0000000..36b2f14 --- /dev/null +++ b/doc/RelNotes/v1.30.txt @@ -0,0 +1,122 @@ +E2fsprogs 1.30 (October 31, 2002) +================================= + +When resizing a filesystem, and inodes need to moved, resize2fs will +update the inode's ctime field, and the mtime field of the containing +directories, so that incremental backups using dump/restore will work +correctly. + +In order to avoid spurious errors, e2fsck will check the last +superblock write time to determine whether or not it can safely use +the LOW_DTIME checks to determine if there are inodes on the orphan +inode linked list that had somehow gotten disconnected. (Addresses +Sourceforge bug #620980) + +Partition in /proc/partitions that being with the string "lvm" are +considered real partitions even if they do not end with a number. + +Fixed a bug in the the uuid generation function, where if /dev/urandom +is not present, but /dev/random is, and there isn't sufficient +entropy, the get_random_byte function could spin a loop forever. + +E2fsck, mke2fs, etc. will now reliably notice when image files are +mounted using the loopback interface. (Addresses Sourceforge bug +#619119) + +When flushing buffers (as is done by badblocks, for example) check to +see if the BLKFLSBUF ioctl succeeds, and if so, avoid using the +FDFLUSH ioctl which causes the MD device driver which causes confusing +syslog messages about obsolete ioctl messages. (Addresses Sourceforge +bug #545832). + +Debugfs's write command now checks to see if the destination filename +exists before creating it. (Addresses Sourceforge bug #478195.) + +When installing man pages, search for compressed man pages using all +commonly used compression extensions (i.e., .Z, .gz, .bz2, etc.) + +Fixed a bug in fsck where multiple filesystems specified on the +command were not being checked in parallel due to a logic bug +introduced to support the FSCK_MAX_INST environment variable. + +We have added a new superblock field, s_mkfs_time, which indicates +when a filesystem was created. It is set via mke2fs, and printed out +by dumpe2fs, but is not actually touched by the kernel. + +Dumpe2fs has been made more robust by not aborting if there is an +error reading the block/inode bitmaps; instead it will still print out +the location of the block/inode bitmaps and inode table. + +Add support for the an alternative block group descriptor layout which +allows for on-line resizing without needing to prepare the filesystem +in advance. (This is the incompat feature flag meta_bg.) + +Add support for storing default mount options in the superblock, so +that the filesystem can be mounted with specific mount options without +needing to specify them on the mount command line or in the /etc/fstab +file. + +Add support for a new inode flag, which is to be used for indicating +the top of directory hierarchies for the Orlov block allocator. + +Fix e2fsck so that if it creates the lost+found directory, it does so +with the more appropriate permissions of 0700. Also change +mklost+found so that it also creates the directory 0700. + +Fixed format bug in e2fsck if NLS is in use. + +Add a German translation for e2fsprogs's NLS support. + +Fixed e2fsck so that it more handles BAD_BLOCK_IN_INODE_TABLE even at +the beginning of the inode table. This won't matter much, since if +there is a bad block at the beginning of the inode table, the root +directory won't be available. But at least e2fsck won't crash in this +case. + +Fixed endian problems in the htree code for e2fsck and debugfs. + +When byte-swapping a filesystem on a PPC architecture, byte-swap the +bitmaps since the historical big-endian ext2 variant had byte-swapped +bitmaps, and the ext2fs library assumes this. This fixes the +regression test suite on PPC machines. + +Fix e2image so that it handles a bad block in the inode table +appropriately. + +E2fsck now uses a more sophisticated algorithm to salvage corrupted +directories that recovers more information in the corrupted directory +block. + +E2fsck now performs additional consistency checks on indexed (HTREE) +directories. + +Fix a bug where e2fsck might get confused about whether a completely +empty directory block is an empty leaf block or an interior htree +node. This could cause e2fsck to get confused into think that a valid +indexed directory was corrupted. + +E2fsck no longer creates an empty directory entry at the end of a +directory block when optimizing a directory. This would cause some +earlier versions of the dxdir kernel code to corrupt the directory +when attempting to split a node containing an empty directory entry. + +E2fsck could sometimes in rare circumstances leave the indexed flag +set after a small directory was optimized by compressing it instead of +indexing it. (This should never happen in real life, since +directories that small wouldn't have been indexed, but better safe +than sorry.) + +E2fsck now only updates the master superblock in all cases. This +slightly shortens its run time. + +Ext2ed can deal with directory entries of length 0; previously it +would get stuck in an infinite loop. + +Fsck now has support for reiserfs volumes when parsing LABEL= and UUID= +specifiers. (Sourceforge patch #613447) + +Badblocks will now work correctly on read-only devices such as +CD-ROM's. (Sourceforge patch #600451) + +Updated and clarified man pages. (Addresses Debian bug #167108) + diff --git a/doc/RelNotes/v1.31.txt b/doc/RelNotes/v1.31.txt new file mode 100644 index 0000000..fcc55ac --- /dev/null +++ b/doc/RelNotes/v1.31.txt @@ -0,0 +1,39 @@ +E2fsprogs 1.31 (November 8, 2002) +================================= + +Update EVMS ext2fsim plugin with EVMS 1.2. (We still support +compiling the fsim plugin with EVMS 1.0 and 1.1.) Add better error +handling for child process that die unexpectedly. Add a hack to force +mkfs to create filesystems that won't cause problems with hardware +that has 2k or 4k minimum blocksize requirements. Read from child +processes in non-blocking mode, so that the GUI continues to update. + +Fix e2fsck so that it returns the appropriate exit code when the root +filesystem has been changed, so that system's rc scripts will be told that +the system needs to be rebooted. + +Fix a bug in ext2fs_flush/ext2fs_close; when the MASTER_SB_ONLY flag +was set, some of the descriptor blocks that should have been written +out were getting skipped. + +Changed e2fsck to force out changes to the backup copies of the +superblock and block group descriptors when important changes are made +to those data structures. + +Fix a bug where e2fsck could erroneously mark a filesystem as being +clean if a check of dirty filesystem is interrupted with a ^C. (Bug +introduced in e2fsprogs 1.28.) + +If journal debugging is enabled using --enable-jbd-debug, the debugging +level is now set via the E2FSCK_JBD_DEBUG environment variable. + +If byteswapping support is disabled using configure --disable-swapfs, +skip the tests which depend on byte-swapping, so that "make check" +won't bomb out. + +Lsattr will now display the indexed directory flag. Also, some of +the more esoteric compression flags are suppressed unless compression +support has been enabled. + +Update man pages. + diff --git a/doc/RelNotes/v1.32.txt b/doc/RelNotes/v1.32.txt new file mode 100644 index 0000000..15af94d --- /dev/null +++ b/doc/RelNotes/v1.32.txt @@ -0,0 +1,14 @@ +E2fsprogs 1.32 (November 9, 2002) +================================= + +Fixed a bug in the Unix I/O routines which caused needless writebacks +of clean blocks from the unix_io cache (they were erroneously marked +as being dirty, so they were getting written back to disk before +getting evicted from the disk cache). This was harmless, but it +significantly slowed down e2fsck. + +Made some other minor optimizations to the Unix I/O routines to save a +small amount of CPU time. + +Updated internationalization files. + diff --git a/doc/RelNotes/v1.33.txt b/doc/RelNotes/v1.33.txt new file mode 100644 index 0000000..d0f1742 --- /dev/null +++ b/doc/RelNotes/v1.33.txt @@ -0,0 +1,142 @@ +E2fsprogs 1.33 (April 21, 2003) +=============================== + +Added a new utility program, logsave, which captures the output of a +command in a log file, even if the containing directory hasn't been +mounted yet (in which case the it saves the output in memory until it +can write out the logfile). This is useful for capturing the +output of fsck during the boot sequence. + +Fixed some portability problems that were causing problems under +the Cygwin32 environment. + +Mke2fs now interprets a negative number to the -b option as a minimum +block size. + +Fixed a bug in mke2fs which was incorrectly checking the argument to +the -g option if the default block size was used. (Addresses Debian +bug #188319) + +Fsck now explicitly ignores tmpfs and devpts, and it will complain if +it can not find filesystem checkers for jfs, reseirfs, and xfs. + +E2fsck now updates the global free block and inode counters from the +block group specific counters quietly. This is needed for an +experimental patch which eliminates locking the entire filesystem when +allocating blocks or inodes; if the filesystem is not unmounted +cleanly, the global counts may not be accurate. + +Imported bug fixes to the EVMS plugin from the EVMS 2.0 tree. (EVMS +2.0 is not yet supported; this only pulled in the bug fixes: fixed +possible hangs caused by bugs in calling waitpid, and not setting the +pipe to non-blocking mode; also fixed a file descriptor leak; made +sure all functions call log entry/exit functions.) + +Badblocks now flushes its output file as bad blocks are discovered. + +The uuid library is now more paranoid about assuming the correctness +of the /dev/random device; it mixes in a stream of bytes from +random/srandom, just in case. + +Update Debian files to reflect the fact that I am now the Debian +maintainer of e2fsprogs. Other various Debian-specific packaging +cleanups. + +Move the source tarball generation functions from the top-level +makefile to the util/gen-tarball script. + +Updated the Turkish .po translation file. + +Added Heimdal and MIT krb5 extensions to the com_err library to make +it more compatible with com_err libraries from those distributions. + +Changed dumpe2fs to always display the superblock fields relating to +the journalling and/or directory indexing feature even if those +features are not enabled. + +Updated and clarify copyright statement vis-a-vis alpha releases of +e2fsprogs. + +The ss library will now try to dynamically link to the readline +library and use it if it is present in the system. This means that +the debugfs program now has line editing and history features. The +SS_READLINE_PATH environment variable is used to find a readline or +readline-compatible library. + +E2fsck now finds most duplicate filenames (all when rebuilding all +directories via the -D option) and offers to delete or rename +duplicate filenames/directory entries. (Addresses Debian Bug #176814). + +Fix bug in e2image. When writing out a raw image file, include data +blocks from symlinks that do not store the symlink within the inode. + +Fix bug in resize2fs which incorrectly moved the block and inode +bitmaps for sparse superblock filesystems and incorrectly marked +blocks as in use. (Addresses Debian bug #174766) + +Added a new shared library, the blkid library, which efficiently +allows fsck, mke2fs, e2fsck, and tune2fs to be able to look up LABEL +and UUID filesystem specifiers without needing to search all of the +devices in the system. Instead, the device is looked up in a cache +file, and then verified to make sure the blkid cache is correct. + +Tune2fs and e2label will accept LABEL=xxx and UID=yyy specifiers for +the device name, using the blkid library. (Addresses Debian bugs +#166048, #179671) + +Fsck now supports backslash escapes in /etc/fstab so that \040 can be +used for spaces in device labels. + +Removed 32-bit limitations for debugfs's dump command. + +If the user specifies a large number of inodes, Mke2fs will +automatically adjust the number of blocks per group to find a valid +set of filesystem parameters. + +Add workaround to detect broken MD devices where when some of the +underlying devices are marked read-only, writes to the MD device are +silently dropped. E2fsck will detect if there is an attempt to run +the journal twice, and abort with an error if this is the case. +(Addresses IBM Bugzilla bug #1226) + +E2fsck will print an error if more than one of the -p/-a, -n or -y +options are specified. + +E2fsck will fix HTREE corruptions in preen mode, without stopping the +boot process. This is needed because the 2.4 ext2 filesystem +accidentally had the INDEX_FL backwards compatibility code removed. + +Mke2fs no longer creates filesystems with the dir_index flag set by +default; the user has to specifically request it. + +Update and clarified various man pages. (Addresses Debian bugs +#173612, #175233, #175113, and #170497, #185945, #188318) + +Created man page for the mk_cmds program (from the libss library). + +Programmer's notes: +------------------- + +Fix various gcc -Wall nits. + +Fixed a lot of portability problems that caused e2fsprogs not to build +successfully under Solaris and Apple/Darwin. + +Fixed a Makefile dependency to allow building e2fsprogs using parallel +make jobs. + +Changes to create a subset distribution which consists only of the +et, ss, uuid, and blkid libraries. The configure script and top-level +makefile were changed to support working with a subset distribution. + +Removed EXT2_FEATURE_RO_COMPAT_BTREE_DIR mention of since it's not +actually used, and might people who are looking for +EXT2_FEATURE_COMPAT_DIR_INDEX, which is in use. + +Updated debian files to fix a number of Lintian warnings. + +Updated config.guess and config.sub with newer versions from the FSF. + +Removed unnecessary libraries from being linked into the fsck, lsattr, +chattr, and blkid executables. + diff --git a/doc/RelNotes/v1.34.txt b/doc/RelNotes/v1.34.txt new file mode 100644 index 0000000..f61095c --- /dev/null +++ b/doc/RelNotes/v1.34.txt @@ -0,0 +1,130 @@ +E2fsprogs 1.34 (July 25, 2003) +=============================== + +Fixed a bug introduced in E2fsprogs 1.30 which caused fsck to spin in +a tight loop while waiting for a child fsck to exit in some cases. +This burns CPU times which slows down the low-level filesystem check. + +Added code to mke2fs to assure that the default block size for a +filesystem is at least as big as the sector size of the device, if it +can be determined. + +Changed mke2fs and resize2fs to round the default size of a filesystem +to be an even multiple of the VM pagesize in order to avoid a Linux +kernel bug introduced when the storage of the buffer cache was moved +into the page cache. + +Mke2fs will warn the user when creating a filesystem with journalling +and a blocksize greater than 4096. (Addresses Debian bug #193773) + +Fixed a bug in resize2fs which caused it to fail on filesystems with a +non-empty bad block list. Resize2fs now discards any blocks on the +badblock list which are no longer part of the filesystem as the result +of a filesystem shrink. (Note: this means that shrinking and then +enlarging a filesystem is no longer a reversible operation; +information about bad blocks in the part of the filesystem which is to +be chopped off will be lost.) + +Changed resize2fs so the user can use prefixes to specify the units of +the new filesystem size (sectors, kilobytes, megabytes, or gigabytes), +and to make the error and informational messages explicitly display +the blocksize used by the filesystem, in order to avoid confusion. +(Addresses Debian bug: #189814) + +Added a new debugfs command, dump_unused, which dumps the contents of +all unused blocks to stdout. (Useful as an emergency try-to-find +deleted data command.) + +Added a new debugfs command, imap, which prints the location of a +specified inode in the inode table. + +Fixed a bug in the badblocks program which caused it to use one bit of +randomness in its non-destructive read/write test, instead of using a +full 8 bits of randomness. + +Added a new option (-t) to badblocks, which allows the user to control +the test pattern(s) used when checking a disk. + +The blkid probe function now more correctly detects UDF filesystems. + +Fixed a bug in the blkid library which caused it to not update its +cache if a filesystem changes from having a label to not having a +label. + +Fixed a bug in the blkid library which could avoid an infinite loop +in blkid_find_dev_with_tag() if /proc is not mounted and there the +/etc/blkid.tab file has not yet been created. + +Fixed the badblocks program so that the destructive read/write test +honors the -c option, and to use O_DIRECT when possible to avoid +thrashing the system block buffer cache. + +Fixed various NLS issues. + - Added Czech and Swedish translations + - Removed testing NYC translation + - Fixed NLS support for message abbreviations in e2fsck + - Remove de-utf.po, since we shouldn't have two versions using different + charset encodings. + - Used ngettext() (abbreviated with the macro P_(str1, str2, n)) to + simplify the statistics reporting in e2fsck. + +Changed configure.in so that its defaults for *BSD systems no longer +build an fsck wrapper, and not to install in /usr/local by default. + +Fixed some minor spelling errors/typo's in e2fsck and the configure +script. + +Fixed various Debian packaging issues (see debian/changelog). + +Updated and clarified man pages. (Addresses Debian Bug #195616) + +Programmer's notes: +------------------- + +Fix gcc -Wall nitpicks. + +Updated gettext implementation used by e2fsprogs to 0.11.5, and enable +NLS support by default. (Added partial workaround for gettext/Darwin +incompatibility problems.) + +Added full MIT KRB5 and Himdall compatibility support to the com_err +library and the compile_et program. (Addresses Debian bug #191900) + +Added the blkid_known_fstype() function to the blkid library, which +returns true if it is passed a filesystem type which is recognized by +the blkid probing functions. + +Improved the documentation for the blkid library. + +Added the ext2fs_get_device_sectsize() function the the ext2fs library, which +returns the hardware sector size of a device, if it is available. + +Added a dependency in the blkid library's .so file to the uuid +library, since the former uses the latter. (Addresses Debian bug +#194094) + +Added --with-diet-libc and --disable-evms to the configure script. + +Fixed a minor memory leak in the badblocks program. + +Fixed a portability problem in tune2fs --- not all systems have strptime(). + +Fixed a portability problem in debugfs with the use of getopt() more +than once. Old-style BSD, new-style BSD, and Linux C libraries all do +things differently. + +Add support Windows support to ext2fs_get_device_size(). + +Added (normally disabled) debugging code to the Unix I/O manager which +causes it to disable all userspace caching if the NO_IO_CACHE is +defined. + +Changed the test I/O manager so it can always be linked into e2fsck, +mke2fs, and tune2fs if enabled via --enable-test-io-debug to the +configure script. The test I/O manager will only print any debugging +information if the TEST_IO_FLAGS or TEST_IO_BLOCK environment +variables are set, which specifies which I/O operations are logged and +a block number to watch, respectively. The log messages are sent to +stderr by default, unless a filename is specified via the +TEST_IO_LOGFILE environment variable. + diff --git a/doc/RelNotes/v1.35.txt b/doc/RelNotes/v1.35.txt new file mode 100644 index 0000000..2a4c520 --- /dev/null +++ b/doc/RelNotes/v1.35.txt @@ -0,0 +1,166 @@ +E2fsprogs 1.35 (February 28, 2004) +================================== + +E2fsck has a new -k option, which in conjunction with the -c options, +preserves the existing badblocks list. + +Cleaned up e2fsck's preen-mode messages during the passes 1b, 1c, and 1d. + +E2fsprogs will now deal correctly with symlinks that contain +extended attribute information, which can be created using SE Linux. +(Addresses Debian Bug #232328) + +Remove a double longjmp into an invalid stack frame bug in e2fsck. +(This was during an abort sequence, which normally worked on Linux and +caused a core dump on other operating systems.) + +Fix NLS bug in e2fsck, by avoiding trying to expand an empty string +(the NLS library will replace "" with the .po header information). + +Fix a bug in mke2fs which caused -T largefile or -T largefile4 to core +dump due to a division by zero error. (Addresses Debian bug #207082) + +Fixed a bug in e2fsck which caused it to incorrectly fix a filesystem +when reconnecting a directory requires creating a lost+found +directory. (Addresses Debian bug #219640). + +Fixed a bug where e2fsck would bomb out if a journal needed to be +replayed when using an alternate superblock. + +E2fsck will give an extra grace period before actually forcing a check +if the laptop is running on battery. The next time fsck runs while +the system is on the AC mains, or after the grace period is exceeded, +the filesystem will be checked. (Addresses Debian bug #205177) + +E2fsck will inform the user when there are 5 or fewer mounts before a +filesystem check will be forced. (Addresses Debian bug #157194) + +Fix e2fsck's handling of corrupted indirect blocks in the bad block. +We now correctly handle the case where there is an overlap between a +block group descriptor or a superblock and a bad block indirect block. +In the case where the indirect block is corrupted, we now suggest +"e2fsck -c". + +Fix byte swap bugs in e2fsck that caused the journal backup location +in the superblock and symlinks created by SE Linux to be cleared +by e2fsck on big-endian machines. (Addresses Debian bug #228723) + +E2fsck -c now replaces the current list of bad blocks with the ones +found by badblocks. + +Fix bugs in e2fsck and tune2fs which could cause a core dump if a +non-existent LABEL or UUID specifier is to e2fsck or tune2fs. + +Fix a potential bug in e2fsck which could cause it to core dump when +trying to print the location of the backup superblock. + +Protect against a potential core dump in e2fsck when printing a +message about backup superblocks. + +Add support for backing up the journal inode location in the +superblock. E2fsck will automatically save the journal information in +the superblock if it is not there already, and will use it if the +journal inode appears to be corrupted. ext2fs_add_journal_inode() +will also save the backup information, so that new filesystems created +by mke2fs and filesystems that have journals added via tune2fs will +also have journal location written to the superblock as well. +Debugfs's logdump command has been enhanced so that it can use the +journal information in the superblock. + +E2fsck will now update all superblocks when moving the journal inode. + +Shrink the size of the e2fsck executable by moving some initialized +variables to the BSS segment. + +E2fsck will avoid printing the ^A and ^B characters which bracket the +progress bar when stdout and stdin are a tty device instead of a pipe +to another program. (Addresses Debian bug #204137) + +Debugfs's mkdir command will automatically expand the directory if +necessary. (Addresses Debian Bug: #217892) + +Fixed a bug in debugfs so that copying a file from /dev/null uses the +correct mode bits. (Addresses Debian Bug: #217456) + +If the environment variables DEBUFS_PAGER and PAGER are not set, +debugfs now searches for the appropriate pager to use, beginning with +/usr/bin/pager, and then falling back to 'more' and 'less'. +(Addresses Debian bug #221977) + +Debugfs will now support 2.6 device numbers where the major or minor +number may be larger than 255. (Addresses Sourceforge bug #865289) + +Fix debugging printf in resize2fs. (Addresses Debian Bug #271605) + +Chattr now stops processing options when it sees '--'. (Addresses +Debian bug #225188) + +Fix regression tests so they work correctly when e2fsprogs is compiled +with configure --disable-htree. + +Fix bug in uuid library when there is no network card and the library +is generating a time-based uuid. The random MAC address was not +correctly generated to be a multicast address. + +Add compile_et extensions from Heimdall that were missed the first time +around. + +Fix bug in badblocks when using O_DIRECT; we need to make sure that +we're reading from an offset which is page aligned. For read-only and +read-write tests, we try to recover after an error so that we can +continue reading on page-aligned boundaries. (Addresses Debian Bug +#203713) + +Badblocks now checks 64 blocks at a time instead of 16. (Addresses +Debian bug #232240) + +Updated and clarified various man pages. (Addresses Debian Bug +#206845, #222606, #214920, #232406) + +Updated and fixed translations. (Addresses Debian bugs #200086, #214633) + +Fixed various Debian packaging issues (see debian/changelog). + +Programmer's notes: +------------------- + +Fixed a build problem so that e2fsprogs would compile with the +--enable-profile option to configure selected. (Addresses Sourceforge +bug #811408) + +Fixed C++ problems with the ext2fs.h header. (Addresses Red Hat +Bugzilla Bug #112448) + +Centralize code which calculates the location of the superblock +and block group descriptors so that it is in a single library routine. + +Added two new functions, ext2fs_file_open2() and +ext2fs_inode_io_intern2() which take a pointer to an inode structure. + +Fix compile_et to output the correct prototype for +initialize_xxx_err_table_r() in the header file. (Addresses Debian +bug #204332) + +In the lib/et makefile, make sure com_err.info is deleted on "make clean". + +Fix 64-bit warnings in e2fsprogs pass1b by using inttypes.h if +present. This is for when we try stuffing an int into void * pointer. + +Fix type-punning which can cause gcc 3.x to miscompile code by getting +confused about pointer aliasing. ext2fs_getmem(), ext2fs_free_mem(), +and ext2fs_resize_mem() all now take a 'void *' instead of a 'void +**'. The EVMS code uses an ugly union approach since we don't want to +modify the EVMS interfaces. + +Make sure all Makefiles use $(MAKE) rather than hardcoded "make", to +aid build process on systems can use invoke GNU make as "gmake". + +Added regression testing for mke2fs. + +Fixed gcc -Wall nitpicks. + +Fixed various compiler warnings. + +Add portability fixes for FreeBSD and for using fsctl under Darwin to +support ext2 ioctl's. + diff --git a/doc/RelNotes/v1.36.txt b/doc/RelNotes/v1.36.txt new file mode 100644 index 0000000..912bad2 --- /dev/null +++ b/doc/RelNotes/v1.36.txt @@ -0,0 +1,302 @@ +E2fsprogs 1.36 (February 4, 2005) +================================= + +All of the patches that were applied to Fedora Core 3's +e2fsprogs-1.35-11.2 have been integrated, although sometimes with a +lot of bug fixes first. Users of Fedora Core 3 are strongly +encouraged to upgrade to e2fsprogs 1.36 as soon as possible. + +Add support for filesystem with the online resizing via resize inode +feature. Fixed numerous bugs from the Fedora patches. The Fedora +patches also didn't bother to do any consistency checking on the +resize inode, or add any tests to the regression test suite. The "-R +resize=4g" option to mke2fs was a no-op in the Fedora patches, despite +being listed in mke2fs's usage message. All of these shortcomings +have been corrected. + +E2fsck can also also fix filesystems trashed by Fedora's resize2fs +program. In order to do this, the user must run the commands: + + debugfs -w /dev/hdXXX -R "features ^resize_inode" + e2fsck -f /dev/hdXXX + +Optionally, the ext2prepare command can be used to re-enable online +resizing after the filesystem has been fixed. + +The fsck program will now accept an optional filedescriptor argument +to the -C option. (The Fedora version of this patch would sometimes +cause fsck to ignore a parameter on fsck's command line in some rare +cases, sigh.) + +Make sure e2fsprogs doesn't write garbage into the reserved portion of +large inodes. + +Make sure resize2fs releases the blocks belonging to the old inode +table blocks when moving the inode table. (Addresses Debian Bug: +#290894) + +Skip the r_resize_inode test if resize2fs is not compiled (due to +configure --disable-resizer) + +E2fsck now checks the summary filesystem accounting information, and +if any of the information is obviously wrong, it will force a full +filesystem check. (Addresses Debian Bug #291571) + +Fix e2fsck to not complain when the resize_inode feature is enabled, +s_reserved_gdt_blocks is zero, and there is no DIND block allocated in +the resize inode. + +Fix e2fsck to note delete symlinks that contain an extended attribute +after the ext_attr feature flag has been cleared. (Addresses Red Hat +Bugzilla #146284). + +Add new utility program, copy_sparse.c, which is very useful +for dealing with large sparse files (such as e2image files). + +Add support for jnl_blocks[] for debugfs's set_super_value. + +Fix filefrag so that it works correctly with sparse files. + +Filefrag -v will print first and last blocks. + +Add interpretation of OS Creator values for FreeBSD and Lites in mke2fs +and dumpe2fs. + +Add mke2fs support so that it can support filesystems larger than 4TB +automatically, by retrying with a 4k blocksize if the device size is +too big to be expressed using a 1k blocksize. (Addresses Sourceforge +bug #1106631) + +Change blkid to test for NTFS first because Windows sometimes doesn't +clear enough of the partition to confuse the probing routines into +thinking the old filesystem type is still valid. (Addresses Debian +Bug #291990) + +Add support for swap partition label and uuid's in the blkid library. + +Add support to the blkid library to recognize Oracle ASM volumes. + +Make blkid -t display all devices that match the specified criteria, +not just the first one, and work more consistently when the blkid +cache file is not available or set to /dev/null. (Addresses Debian +Bug #290530 and #292425) + +Badblocks will now correctly display block numbers greater than +999,999,999 in its progress display. + +The tune2fs program will not allow the user from setting a ridiculous +number of reserved blocks which would cause e2fsck to assume the +superblock was corrupt. E2fsck's standards for what is a ridiculous +number of reserved block has also been relaxed to 50% of the blocks in +the filesystem. + +The blkid library will return vfat in preference to msdos, and ext3 in +preference to ext2 (if the journalling flag is set) so that mount will +do the right thing. (Addresses Debian bug #287455) + +Mke2fs will now use the -E option for extended options; the old -R +(raid options) option is still accepted for backwards compatibility. +Fix a double-free problem in resize2fs. (Red Hat Bugzilla #132707) + +Mke2fs will now accept a size in megabytes, gigabytes, and other units +(via "32m" or "4g" on the command line) if the user finds this more +convenient than specifying a block count. + +Fix an obscure, hard-to find bug in "e2fsck -S" caused by an inode +cache coherency problem. + +Debugfs now supports a new command, set_inode_field, which allows a +user to manually set a specific inode field more conveniently, as well +as set entries in the indirect block map. + +Debugfs's set_super_value command has been enhanced so that the user +can set most superblock fields, including the date/time fields and +some of the more newly added superblock fields. + +E2fsprogs programs now accept an offset to be passed to the file +specifiers, via the syntax: "/tmp/test.img?offset=1024". + +E2fsprogs programs will now accept blocksizes up to 65536; kernel +support on the x86 doesn't exist for now, but it can be useful on +other architectures with page sizes greater than 4k. There are 2.6 +kernel patches out there which enable this, but they are of this +writing still experimental. + +The e2image command now takes the -s option which will scramble +directory entries for raw image files. + +Fix a file descriptor leak in the filefrag program. + +Make sure e2fsck doesn't crash when /proc/acpi/ac_adapter is not +present. + +Fix bug in debugfs where kill_file would lead to errors when deleting +devices and symlinks. (Sourceforge Bugs #954741 and #957244) + +Fix bug in the blkid library when detecting the ocfs1 filesystem + +Remove obsolete EVMS 1.x and a.out DLL support. + +E2fsck will attempt to recover from a journal containing illegal blocks. + +Fixed two potential ordering constraint problems in e2fsck which might +cause the filesystem to be corrupted if e2fsck is interrupted during a +(extremely narrow) race window. Thanks to Junfeng Yang from the +Stanford Metacompilation group for pointing this out. + +Fixed bug in e2fsck where it would not accurately detect whether or +not the system is running on adaptor if the ACPI device representing +the AC adapter didn't correspond to the what was used on IBM +Thinkpads. + +Change e2fsck to accept directories greater than 32MB. + +Fix e2fsck so that a checkinterval of zero disables a time-based check +of the filesystem. + +Debugfs will check the DEBUGFS_PAGER environment variable in preference +to the PAGER environment variable. (Addresses Debian Bug #239547) + +Tune2fs will not mark rewrite the superblock if the feature bitmasks +are not modified. + +The debugfs program will set the filetype information when creating a +link. + +Add debugfs -d option to use a separate source of data blocks when +reading from an e2image file. + +Add e2image -I option which allows the e2image metadata to be +installed into a filesystem. + +Fixed bug in the badblocks program which caused "done" to always +appear in English even when a translation was available. (Addresses +Debian Bug #252836) + +The blkid program has a new option -o which controls the output format +of the blkid program; this is makes blkid more convenient to use in +shell scripts. + +Fix a minor bug in uuid library, which was not using the full 14 bits +of clock sequence when generating UUID's. + +Fix a Y8.8888K problem in the uuid library. + +Logsave now creates a new session id for itself to avoid getting +killed by init when transitioning between init levels. + +Change the licensing of the UUID library to be the 3-clause BSD-style +license; this allows Apple to use the uuid library in Darwin. + +Add ocfs and ocfs2 probe support into the blkid library. + +Fix a memory and file descriptor leak in the blkid library. + +The blkid library will revalidate the device if the system time is +earlier than last verification time of the device, since that +indicates that the system time is probably not trustworthy. + +The blkid library will override the default location of the blkid.tab +file by the BLKID_FILE environment variable, if it is available. + +Change the getsize functions to use the BLKGETSIZE64 ioctl on Linux 2.6. + +Add various portability fixes for lame new versions of glibc, Darwin +and GNU/KFreeBSD, as well as removing XSI:ism's. (Addresses Debian +Bugs #239934, #264630, #269044, #255589, #289133) + +Add support for Windows 9x/NT under Cygwin. + +Updated and clarified various man pages. (Addresses Debian Bugs #236383, + #241940, #238741, #242995, #256669, #268148, #256760, #273679) + +Updated and fixed translations. (Addresses Debian bugs #244105, #262836) + +Update the rpm spec files so that it works better with Fedora core 2 +and RH9. + +Fixed various Debian packaging issues (see debian/changelog). In +particular, fixed the Debian initrd scripts. (#241183, #248050, +#253595, #247775) + + +Programmer's notes: +------------------- + +Fixed various gcc -Wall warnings. + +The uuid library now has new functions uuid_unparse_upper() and +uuid_unparse_lower() which forces the case of the hex digits to be +upper case, or lower case. + +The build process has been sped up by enhancing the subst program +to update the modtime on the generated files even when the generated +file hasn't changed. + +The uuid library now uses C99 stdint.h types instead of custom types. + +Updated config.guess and config.sub with newer versions from the FSF. + +Removed out of date .cvsignore files from the source distribution. + +The ext2fs_unlink() function will return an error if both the name and +inode number are unspecified, to avoid doing something surprising +(such as unconditionally deleting the first directory entry). +Directory entries are now deleted by coalescing them with the previous +directory entry if possible, to avoid directory fragmentation. This +is not an issue with the e2fsprogs suite, but may be a problem for +some of the users of libext2fs, such as e2tools. + +Add support for version numbers of the form "1.36-rc1". + +Fix build of mke2fs.static. + +Add basic ext2fs library support for large (EA in inode) inodes. + +The test_io mechanism can now abort after n reads or writes to a +particular block. The block is specified by TEST_IO_BLOCK environment +variable, and the read/write count by the TEST_IO_READ_ABORT and +TEST_IO_WRITE_ABORT environment variables. The block data is now only +dumped if the 0x10 bit is set in TEST_IO_FLAGS. + +UUID_DEFINE() in the uuid library now creates a static variable, with +__attribute__ ((unused)) if we are using GCC, so that UUID_DEFINE can +be used in header files. + +Add support for the install-strip and install-shlibs-strip targets, as +suggested by the GNU coding guidelines. "make install" no longer +strips the binaries which are installed. + +Remove support for the --enable-old-bitops configure option which was +only for very old sparc systems. + +Remove support for --enable-clear-htree; this was only needed during +the early development of the htree patch. + +Use Linux-kernel-style makefile output so it is easier to see compiler +warnings. + +Update gettext files to version 0.14.1. + +Update to use autoconf 2.5x. + +Improved support for compiling e2fsprogs under dietlibc. + +Make e2fsprogs portable to Solaris and FreeBSD systems. + +Add blkid_verify(), blkid_get_library_version(), and +blkid_parse_version_string() functions to the blkid library. + +Add pkg-config files for e2fsprogs's libraries. + +Fix "make uninstall" to so that it removes everything that is installed. + +Add a configure --enable-maintainer-mode option which enables the +makefile rules to rebuild the configure script from configure.in, and +to rebuild the .gmo files in po directory. + +Drop the sparc assembly bitwise operations; it's less efficient +than the GCC 3.4 compile code and triggers compiler warnings on +sparc64. Thanks to Matthias Andree for his analysis and suggestions. +(Addresses Debian Bug #232326) + diff --git a/doc/RelNotes/v1.37.txt b/doc/RelNotes/v1.37.txt new file mode 100644 index 0000000..2b2646b --- /dev/null +++ b/doc/RelNotes/v1.37.txt @@ -0,0 +1,55 @@ +E2fsprogs 1.37 (March 21, 2005) +=============================== + +Add support for checking the validity of Extended Attributes stored in +inodes to e2fsck. + +Add support for dumping the contents of large inodes to debugfs, +including the extended attributes stored in inodes. + +Fix mke2fs, e2fsck, debugfs, and the ext2fs_mkdir function so that +when we create a new inode we make sure that the extra information in +the inode (any extra fields in a large inode and any ea-in-inode +information) is initialized correctly. This can take place when +mke2fs creates the root and lost+found directory, when e2fsck creates +a new root inode or a new lost+found directory, and when the user uses +the debugfs write, mknod, or mkdir commands. Otherwise, the newly +create inode could inherit garbage (or old EA information) from a +previously deleted inode. + +Fixed a bug in e2fsck so it would notice if a file with an extended +attribute block was exactly 2**32 blocks, such that i_blocks wrapped +to zero. + +Added support to filefrag to detect files which are using the new +experimental file extents format, and use the non-ext2 algorithm in +that case. Fixed a bug to avoid reporting a false discontinuity if +there is one or more unallocated blocks at the beginning of a file. + +Duplicated a check for noticing whether or not the number of blocks +(given a certain blocksize) is greater than 2**32 when the +BLKGETSIZE64 ioctl is not available to ext2fs_get_device_size(). This +allows mke2fs to automatically use a larger blocksize when creating a +filesystem on a very large device when run on systems that do not +support BLKGETSIZE64. + +Fix the I18N build which was broken in e2fsprogs 1.36 because the +build system had been switched to treat the .gmo files as shipped +files (for backwards compatibility with systems that have older GNU +I18N tools installed), but the gen_tarball.in script was still +removing the .gmo files from the official source distribution. + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs ##296769, #299341) + +Programmer's notes: +------------------- + +Added new functions to the e2p library which convert between a string +and os_type: e2p_os2string() and e2p_string2os(), and used them to +make the generated binaries more compact. + +Fixed a compile-time error on Darwin systems. + +Cleaned up the lib/ext2fs Makefile slightly. + diff --git a/doc/RelNotes/v1.38.txt b/doc/RelNotes/v1.38.txt new file mode 100644 index 0000000..d8ab030 --- /dev/null +++ b/doc/RelNotes/v1.38.txt @@ -0,0 +1,138 @@ +E2fsprogs 1.38 (June 30, 2005) +============================== + +Fix blkid's test programs (built with "make check") compile correctly +even without "configure --enable-blkid-debug". + +Fix ia64 core dump bug caused by e2fsprogs running afoul of C99 strict +type aliasing rules on newer gcc compilers. (Addresses Red Hat +Bugzilla ##161183.) + +Fix com_err library to make it more compatible with recent changes +made to the com_err library in MIT Kerberos V5 version 1.4. +(Addresses Sourceforge Bug #1150146) + +General cleanup of messages printed by e2fsprogs programs for grammar, +consistency, and to make life easier for translators. Fixed a few +strings containing English that had not been marked as needing +translations. Removed strings that do not need to be translated, to +make life easier for translators. + +Mke2fs and badblocks will take advantage of a feature in Linux 2.6 to +test to see if a device appears to be in use instead of just relying +on /proc/mounts and /etc/mtab. (Addresses Debian Bug #308594). + +Fix portability problem in the filefrag program affecting platforms +where the size of an integer is smaller than the size of a long. +(Addresses Debian Bug #309655) + +Mke2fs will now use a larger journal by default for filesystems +greater than 4GB. (128 MB instead of 32MB). + +Mke2fs will refuse to create filesystems greater than 2**31-1 blocks, +unless forced. This is to avoid signed vs. unsigned kernel bugs in +block numbers that still need to be fixed. + +The blkid program has a new option which will more efficiently search +for device when it is known (or expected) that only one matching +device will be found in the system, such as when doing a lookup by +UUID. + +Debian's e2fsprogs-specific initrd fragment will avoid including +unnecessary libraries into the initrd ramdisk by unsetting LD_PRELOAD +and LD_LIBRARY_PATH, and filtering out libraries found in +/etc/ld.so.preload. (Addresses Debian Bug: #304003) + +Fixed a potential portability issue in the blkid programs for +architectures where the char type is unsigned. (Addresses Sourceforge +Bug: #1180585) + +Fix a bug in filefrag so that it doesn't falsely count an extra +discontinuity when the first block found is an indirect block. +(Addresses Debian Bug #307607). + +Fix blkid's recognition of cramfs filesystems, and enhance it to be +able to handle cramfs labels. + +Fix debugfs's stat command to not core dump when a filesystem is not +open. + +Fix e2fsck's handling of error conditions caused by the resize inode +claiming blocks that are also used by other inodes, a filesystem +corruption which was commonly caused by a bug in Fedora Core 3's +resize2fs program. + +Fixed bug in filefrag which caused it to fail on non-ext2/3 +filesystems. (Addresses Debian Bug: #303509) + +If the superblock last mount time indicates that the system clock may +not be accurate, then e2fsck will omit checking inodes' deletion time +field for indications of a potential corrupted orphaned inode list. +(Previously e2fsck only omitted these LOW_DTIME checks when the +superblock's last write time looked insane.) + +Fixed a IA64 core dump bug in the e2p library which affected dumpe2fs. +(Addresses Debian bug #302200) + +Make the blkid library more paranoid about being run from setgid +programs, and to use __secure_getenv() from libc if it is available. + +Fixed spelling mistakes, typos, and otherwise clarified man pages. +(Addresses Debian Bugs: #304591, #304592, #304594, #304597, #304593 +and Sourceforge Bug: #1189803) + +Updated and fixed translations. + +Fixed various Debian packaging issues --- see debian/changelog for +details. + +Programmer's notes: +------------------- + +Ext2fs_set_bit(), ext2fs_clear_bit(), and ext2fs_test_bit( have been +changed to take an unsigned int for the bit number. Negative bit +numbers were never allowed (and didn't make any sense), so this should +be a safe change. This is needed to allow safe use of block numbers +greater than or equal to 2**31. + +The compile_et program will avoid recreating generated foo_err.c and +foo_err.h files if no changes are necessary. The compile_et program +will also atomically replace these files to avoid a potential parallel +build race problem on SMP systems. (Addresses Sourceforge Bug: +#1157933) + +Added a new function to the blkid library, blkid_probe_all_new(), +which only probes newly added disk devices, and change +blkid_find_dev_with_tag() to use this function so that when a +requested tag is not found, devices that were previously not checked +are searched before searching all devices in the system. + +Added new functions to the blkid library, blkid_dev_set_search() and +blkid_dev_has_tag(). + +E2fsck's problem strings can now use @m and @n as abbreviations for +"multiply-claimed" and "invalid", respectively. + +The e2fsprog.pot file now has an explanation of how the @-expansion +and %-expansion works, and strings in e2fsck/problem.c which contain @ +characters now have comments in e2fsprogs.pot with the @-expansion to +make life easier for translators. + +Fixed missing return values in the ext2fs library which could cause it +to return random garbage in certain error conditions. + +Allow the current time to be overridden via the E2FSCK_TIME environment +variable for use in regression tests. + +The test script driver program now exits with a non-zero status if +there any of its test that it ran failed. + +Fixed problems with parabuilds on SMP systems. (Addresses Sourceforge +Bug: #1157933) + +Fixed "make check" so that it compiles correctly even when e2fsprogs' +header files have not be installed in the system include directories. +(Addresses Sourceforge Bug: #1180572) + +Fixed gcc -Wall nits. + diff --git a/doc/RelNotes/v1.39.txt b/doc/RelNotes/v1.39.txt new file mode 100644 index 0000000..f7c4e9d --- /dev/null +++ b/doc/RelNotes/v1.39.txt @@ -0,0 +1,248 @@ +E2fsprogs 1.39 (May 29, 2006) +============================= + +Fix 32-bit cleanliness in e2fsprogs so that we can support filesystems +between 2**31 and 2**32 blocks. + +Change mke2fs to use /etc/mke2fs.conf as a configuration file to +configure the filesystem features, blocksize, and inode_ratio for +different filesystem types. + +Mke2fs will now create filesystems hash trees and on-line resizing +enabled by default, based on the new /etc/mke2fs.conf file. + +The e2fsprogs tools (resize2fs, e2fsck, mke2fs) will open the +filesystem device node in exclusive mode to prevent accidents by +system administrators. In the case of resize2fs and mke2fs, it will +only use exclusive mode if the filesystem is not mounted. + +Fixed a bug in mke2fs which caused it to to fail when creating the +resize inode for large filesystems. (Addresses Debian Bug #346580) + +When allocating space for the RAID filesystems with the stride +parameter, mke2fs will now place each portion of the group's inode +table right up after the superblock (if present) in order to minimize +fragmentation of the free space. + +Speed up mke2fs and e2fsck by writing inode and block bitmaps more +efficiently by writing the inode and block bitmaps in one pass, thus +reducing the number of disk seeks required. + +Add support for on-line resizing to resize2fs. + +Fix blkid library so that logic to determine whether or not a device's +cached information in /etc/blkid.tab needs to be verified or not +doesn't get confused by a system clock which is insane (for example, +if the battery is dead on a Macintosh running PPC Linux. (Addresses +Red Hat Bug: #182188) + +The blkid library will now store the UUID of the external journal used +by ext3 filesystems, so that in the future, the userspace mount binary +can use this to find the location of the external journal and pass +this information to the kernel. + +E2fsck will now consult a configuration file, /etc/e2fsck.conf to +control how various options should be handled. See the e2fsck.conf +man page for more details. (Addresses Debian Bug: #150295) + +E2fsck now prints an explanatory message when delaying a filesystem +check when the system is running on battery. (Addresses Debian Bug: +#350306) + +E2fsck will detect if the superblock's last mount field or last write +field is in the future, and offer to fix if so. (Addresses Debian Bug +#327580) These problems will be fixed automatically in preen mode +since Debian's boot sequence bogusly doesn't set the time correctly +until potentially very late in the bootup process, and this can cause +false positives which will cause users' systems to fail to boot. +(Addresses Debian Bugs #343662 and #343645) + +E2fsck now checks to see if the superblock hint for the location of +the external journal is incorrect, and if so, offer to update it. +(Addresses Debian Bug: #355644) + +Fix e2fsck from segfaulting on disconnected inodes that contain one or +more extended attributes. (Addresses Debian Bug: #316736, #318463) + +E2fsck will stop and print a warning if the user tries running a +read/write badblocks test on a read-only mounted root filesystem. + +Fix a memory leak in e2fsck's error paths. (Thanks to Michael +C. Thompson for pointing these out; they were originally found using +Coverity.) + +When resizing a file containing a filesystem, resize2fs will expand or +truncate a file as necessary. (Addresses Debian Bug: #271607) + +Resize2fs will now automatically determine the RAID stride parameter that +had been used to create the filesystem, and use that for newly created +block groups. The RAID stride parameter may also be manually specified +on the command line using the new -S option to resize2fs. + +Fix mke2fs so that it correctly creates external journals on +big-endian machines (such as a S/390). + +Fix a bug in the e2p library which could cause dumpe2fs to (rarely) +fail to print out the journal or hash seed UUID. (Thanks to Guillaume +Chambraud for pointing this out.) + +Dumpe2fs will now print the size of the journal (if present). + +Fix debugfs's set_inode_field command so it can properly set the frag, +fsize, uid_high, gid_high, and author fields in the inode instead of +silently failing, and so that setting the i_size actually sets i_size +correctly. + +Add a new debugfs command, set_current_time, which sets fs->now so +that regression test suites can repeatedly modify the filesystem's +last_write fields. + +Fix a bug in debugfs's icheck which would incorrectly report the owner +of an extended attribute block. + +Fix the debugfs commands htree_dump, dx_hash, and list_dir so they print a +print a usage message when an illegal option character is given. + +Fix debugfs's dump_unsued command on filesystems with a 64k blocksize +so it won't core dump. (Addresses SourceForge bug #1424311) + +Fix mklost+found so that it creates a full-sized directory on +filesystems with larger block sizes. + +Fix a file descriptor leak in blkid library. + +Fix a display bug in "badblocks -sv" so that the done message properly +clears the block number at the end of the test. (Addresses Debian Bug +#322231) + +Allow fractional percentages to the -m option in mke2fs and tune2fs +(Addresses Debian Bug: #80205) + +Use fstat/fstat64 in getsize.c if the the target is a regular file, +instead of attempting to do a binary search. Fix some fd leaks in +error cases. + +Add support for device mapper library to the blkid library to ensure +that the "best" (i.e., leaf) device is probed by the blkid library. + +Fix the blkid library so that it notices when an ext2 filesystem is +upgraded to ext3. + +Improve the blkid's library VFAT/FAT detection; it now understands +labels stored in the root directory, and is more paranoid about +checking the FAT superblock values. + +Fixed a fd leak in the uuid library which was causing problems for the +LVM tools. (Addresses Debian Bug: #345832) + +Add support for the reiser4 and software suspend partitions to the +blkid library. Also add support for extract the label from iso9660 +filesystems. + +Fix a compile_et bug which miscount the number of error messages if +continuations are used in the .et file. + +Add extra sanity checks to protect users from unusual circumstances +where /etc/mtab may not be sane, by checking to see if the device is +reported busy (works on Linux 2.6) kernels. (Addresses Debian Bug +#319002) + +Updated French, Dutch, Polish, and Swedish translations. (Addresses Debian +Bug: #343149, #341911, #300871, #316604, #316782, #330789) + +Fix use-after-free bug in e2fsck when finishing up the use of the +e2fsck context structure. + +Fixed spelling mistakes, typos, and otherwise clarified man pages and +documentation. (Addresses Debian Bugs: #329859, #322188, #316811, +#312515, #351268, #357951, #347295, #316040, #368392, #368393, #368394, +#368179) + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs #317862, #320389, #290429, #310950, +#310428, #330737, #330736, #329074, #356293, #360046, #366017, #364516, +#362544, #362970) + + +Programmer's notes: +------------------- + +Update config.guess and config.sub to latest version (2006-02-23) from +FSF. + +Fix asm_types.h type conflicts on AMD 64 platforms. (Addresses Debian +Bugs: #360661, #360317) + +Fixed the Makefile so that they work correctly on newer versions of +GNU make (i.e., 3.81). + +Add valgrind support to the regression test suites, and eliminate +false positives from valgrind. + +Add a regression test suite for the blkid library. + +Fix a fencepost error in resize2fs caught by valgrind. + +Fix compiler warnings about missing memcpy prototypes. + +We no longer have the sparc assembly code in the header file any more, +so we shouldn't set _EXT2_HAVE_HAS_BITOPS_ for the sparc. This would +break compiles on the sparc architectures when using gcc. + +In the libext2fs library, add the new field fs->now which if non-zero +is used instead of the system time when setting various filesystem +fields (last modified time, last write time, etc.) + +Fix gcc 4.01 complaints by adding a missing #include <string.h> to +ext2fs.h which is needed since the inline functions use memcpy(). +(Addresses Sourceforge Bug #1251062) + +Use BUILD_CFLAGS and BUILD_LDFLAGS instead of CFLAGS and LDFLAGS in +the build system when building files in the util directory which are +needed during the build process. This avoids potential problems when +cross-compiling and some of the options specified in CFLAGS or LDFLAGS +are not recognized as valid by the host compiler. (Addresses +Sourceforge Bug #1261547) + +Clean up the blkid library by making the superblock and generic i/o +functions to be more generic. Clean up interface to the probe +function, and fix memory leak. Finally, remove an unneeded reference +to probe.h in the lib/blkid/resolve.c + +Add an ext2fs_read_bb_FILE regression test to confirm proper detection +of invalid block #'s. + +The x86 asm constraints for ext2fs_{set/clear}_bit have been fixed to +indicate that the the function read/writes the memory location. + +Fix various gcc -Wall complaints. + +Add a dependency to make sure that the subdirectories are created +before creating all of the object files, in order to address parallel +build problem in the library Makefiles. (Addresses Sourceforge Bug: +#1261553) + +Add $(LDFLAGS) to the command line argument when generating an ELF or +Solaris shared library, to allow cross-compile and other builds that +might need to specify -L paths to needed libraries. (Addresses +Sourceforge Bug #1261549) + +Add a new feature, EXT2_FEATURE_COMPAT_LAZY_BG, which is initially +intended for testing purposes. It allows an ext2/ext3 developer to +create very large filesystems using sparse files where most of the +block groups are not initialized and so do not require much disk +space. Eventually it could be used as a way of speeding up mke2fs and +e2fsck for large filesystem, but that would be best done by adding an +RO_COMPAT extension to the filesystem to allow the inode table to be +lazily initialized on a per-block basis, instead of being entirely +initialized or entirely unused on a per-blockgroup basis. + +Fix backwards compatibility so e2fsprogs will better compile on Linux +2.0.35 systems. + +Make test scripts more robust against locale-related environment variables + +Fix type warning problem with sizeof() in ext2fs_open2(). + +Fix type warning problem with time_t in debugfs. + diff --git a/doc/RelNotes/v1.40.txt b/doc/RelNotes/v1.40.txt new file mode 100644 index 0000000..08608d2 --- /dev/null +++ b/doc/RelNotes/v1.40.txt @@ -0,0 +1,1043 @@ +E2fsprogs 1.40.11 (June 17, 2008) +================================= + +Mke2fs, tune2fs, and resize2fs now use floating point to calculate the +percentage of reserved blocks. (Addresses Debian Bug: #452639) + +Updated Spanish and Catalan translations. + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs: #483962, #483023) + +Add detection for ZFS volumes to the libblkid library. + +Fixed spelling mistakes, typos, and otherwise clarified man pages. +(Addresses Debian Bug: #486463) + +Programmer's notes: +------------------- + +Fix marginal C code in probe_lvm2() function to the blkid library more +portable for older compilers. + +Fix build problems on MacOS X. (Addresses Sourceforge Bug: #1972473) + +Fix ext2fs_swap{16,32,64} functions so they can be used by external +applications on big-endian machines. (Addresses Debian Bug: #484879) + + +E2fsprogs 1.40.10 (May 21, 2008) +================================ + +When deciding whether or not to revalidate a blkid cache entry, if the +device's mtime is newer than the last time the cached entry was +validated, force a revalidation. + +Fix a potential data corruption bug in e2fsck in the journal replay. +The chances of this is happening is extremely remote, especially the +default data=ordered or data=writeback modes. However, if a block +which has been journalled starts with the first four bytes 0xc03b3998, +when e2fsck replays the journal, those four bytes will be replaced +with zero's. Fortunately, it is highly, highly unlikely for e2fsck +metadata to begin with those fatal 4 byte sequence, and unless +data=ordered mode is in use, data blocks are never journalled. + +Updated German, Dutch, Swedish, and Vietnamese translations. + +Programmer's notes: +------------------- + +Fixed various Debian packaging issues --- see debian/changelog for +details. + +Remove default sizes of types when cross compiling, since autoconf +2.50 can figure this out automatically now. + + +E2fsprogs 1.40.9 (April 27, 2008) +================================= + +SuSE's security team audited uuidd and came up with a few minor +issues. None of them are serious given that uuidd runs setuid as a +unprivileged user which has no special access other than libuuid +directory, but it's good to get them fixed. + +One additional fix in ext2fs_swap_inode_full() needed for resize2fs to +work correctly with in-inode extended attributes. + +Updated German, Czech, Dutch, French, Polish, Swedish, and Vietnamese +translations. + +Debugfs will avoid using a pager if the standard output is not a tty. + +Fix debugfs and tune2fs to correctly handle daylight savings time when +parsing a time string. + +Fixed spelling mistakes, typos, and otherwise clarified man pages. + +Fix fsck completion bars when multiple filesystems were being checked +in parallel. (Addresses Debian Bug: #432865, Addresses Launchpad Bug: +#203323, Addresses Sourceforge Bug: #1926023) + +Fix fsck so that progress information is sent back correctly when +multiple filesystems are being check and the output of fsck is being +redirected to a file descriptor. Also, include the device name (w/o +spaces) in the progress information sent back via a file descriptor. +(Addresses Launchpad Bug: #203323, Addresses Sourceforge Bug: +#1926023) + +Teach fsck to treat "ext4" and "ext4dev" as ext* filesystems. + +If logsave receives a SIGTERM or SIGINT signal, it will now pass that +signal to its child process. + +Fix mke2fs's creation of are resize inode when there is a non-standard +s_first_data_block setting. + +Fix bug in blkid when run by an unprivileged user; most devices were +not reported correctly. 9Addresses Launchpad Bug: #220275) + +Mke2fs will not allow the logically incorrect combination of +resize_inode and meta_bg, which had previously caused mke2fs to create +a corrupt filesystem. + +Fix fsck in German locales so that a 'j' means yes. +(Addresses Sourceforge Bug: #1947683) + + +Programmer's notes: +------------------- + +Fixed various Debian packaging issues --- see debian/changelog for +details. + +Update valgrind options in test_script to work with valgrind 3.2.3 + +Update texinfo.tex to a much newer version from the FSF. + +Remove bashism for configure script and from the lib/ss Makefile. +Addresses Sourceforge Bug: 1921969 + +Fix some silently broken tests: m_no_opt, m_meta_bg, and m_raid_opt. + +Fix build system so that if texinfo is not installed, it won't print a +(harmless) error message. + + +E2fsprogs 1.40.8 (March 13, 2008) +================================= + +Fixed e2image -I so it works on image files which are larger than 2GB. + +Fixed e2fsck's handling of directory inodes with a corrupt size field. If +the size is larger than the number of blocks found in the inode, don't +try to allocate extra empty blocks at the end of the directory to make +up the difference; there's no point to doing that. In addition, if +the size is not a multiple of a blocksize, always fix it. + +E2fsck handled a pass 2 "should never happen error" by not giving +enough information and then core dumping. Unfortunately, it was all +too easy to trigger the "should never happen" situation if a +directory's inode size was not correct. This has been fixed, but +e2fsck has also been taught how to handle this situation more +gracefully, by simply removing the inode hash tree information, so +that it can be rebuilt again after e2fsck's pass 3. (Addresses +Launchpad Bug: #129395) + +Resize2fs had a bug resizing large inodes with extended attributes +that was fixed in 1.40.6; unfortunately, it turned out it wasn't fixed +completely on big-endian systems such as PowerPC. The bug should be +completely fixed now. Yay for regression test suites. (Addresses Red +Hat Bugzilla: #434893) + +Updated German, Czech, Dutch, Polish, Swedish, and Vietnamese +translations. Many thanks to Philipp Thomas from Novell for stepping +up to become the new German translation maintainer! (Addresses Debian +Bugs: #302512, #370247, #401092, #412882). + +When e2fsck is clearing a corrupt inode's HTREE directory information, +make it clear that it is just clearing the HTREE information, not the +entire inode. + +Fixed spelling mistakes, typos, and otherwise clarified man pages. + +Programmer's notes +------------------ + +Add new functions, ext2fs_dblist_get_last() and +ext2fs_dblist_drop_last(), which allows the caller to examine the last +directory block entry added to the list, and to drop if it necessary. + +Fixed a portability problem in libblkid with DJGPP. + +Fix an obvious typo in an "internal error" message in e2fsck. Thanks +to Philipp Thomas for pointing this out. + +If the info files are not built, change "make install" so it doesn't +fail with an error code. + + +E2fsprogs 1.40.7 (February 28, 2008) +==================================== + +Remove support for clearing the SPARSE_SUPER feature from tune2fs, and +depreciate the -s option, since it can result in filesystems which +e2fsck can't fix easily. There are very good reasons for wanting to +disable sparse_super; users who wants to turn off sparse_super can use +debugfs. (Addresses Sourceforge Bug: #1840286) + +Add missing options to mke2fs's usage message. (Addresses Sourceforge +Bug: #1751393) + +Fix bug in resize2fs when large (greater than 128 byte) inodes are +moved when a filesystem is shrunk; it was only moving the first 128 +bytes, so extended attributes were not getting moved. (Addresses Red +Hat Bugzilla: #434893) + +E2fsck now prints an explicit message when the bad block inode is +updated, to avoid confusion about why the filesystem was modified. +(Addresses Sourceforge Bug: #756460) + +Allow mke2fs and tune2fs manipulate the large_file feature. +Previously we just let the kernel and e2fsck do this automatically, +but e2fsck will no longer automatically clear the large_file feature. +It still isn't really necessary to worry about this feature flag +explicitly, but some users seem to care. (Addresses Red Hat Bugzilla: +#258381) + +Suppress message about an old-style fstab if the fstab file is empty. +(Addresses Debian Bug: #468176) + +Fix (really minor) bug in debugfs's find_free_block so it avoids +reporting a free block more than once if there are too few free blocks +in the filesystem. (Addresses Sourceforge Bug: #1096315) + +Change e2fsck to no longer clear the LARGE_FILES feature flag +automatically, when there are no more > 2GB files in the filesystem. +It's been almost a decade since there have been kernels that don't +support this flag, and e2fsck clears it quietly without telling the +user why the filesystem has been changed. + +Fix bug which could cause libblkid to seg fault if a device mapper +volume disappears while it is being probed. (Addresses RedHat +Bugzilla: #433857) + +Enhance e2fsck's reporting of unsupported filesystem feature flags. +(Addresses Sourceforge Feature Request: #1175808) + +Fix option syntax in dumpe2fs for explicit superblock and blocksize +parameters. What was currently documented in the man page has been +broken for some time, due to getopt() implementation changes. The +option syntax has been changed to one which is can be more portable +supported and which is consistent with the format for extended options +in mke2fs and tune2fs. (Addresses Sourceforge Bug: #1830994) + +Add support to tune2fs to clear the resize_inode feature. This +requires an fsck afterwards. (Addresses Red Hat Bugzilla: #167816) + +Teach blkid to detect LVM2 physical volumes. (Addresses Red Hat +Bugzilla: #409321) + +Add support for setting RAID stride and stripe-width via mke2fs and +tune2fs. Teach dumpe2fs to print the RAID parameters. + +Add support for setting new superblock fields to debugfs's +set_super_value. + +Add support for printing "mostly-printable" extended attributes in +Debugfs. + +Add support for the -M option to fsck, which causes it to ignore +mounted filesystem. + +Fix uuidd so that it creates the pid file with the correct pid number. +(Addresses Sourceforge Bug: #1893244) + +Fix various gcc -Wall warnings. + +Update Czech, Dutch, Polish, Swedish, and Vietnamese translations + +Fixed spelling mistakes, typos, and otherwise clarified man pages. +(Addresses Sourceforge Patch: #1399325) + + +Programmer's notes: +------------------- + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bug: #466929) + +Add new flag EXT2_FLAG_NONFREE_ON_ERROR ext2fs_open2() which returns a +partially filled-in filesystem object on an error, so that e2fsck can +print more intelligent error messages. + +Add a new function e2p_edit_feature2() which allows the caller to +specify which feature flags are OK to set or clear, and which returns +more specific information about feature flags which are not allowed to +be set/cleared. + +Set the C locale in the test_script driver since it uses [A-Za-z]. +(Addresses Sourceforge Bug: #1890526) + +Use fcntl locking instead of lockf in libuuid since Cygwin doesn't +support lockf(). + +Change configure.in to avoid using the 'dc' command unless it is +absolutely needed. (i.e., when using parsing a WIP-style version +number) (Addresses Sourceforge Bug: #1893024) + +Add portability checks to support compilation under DJGPP. + +Update to the latest samba tdb code before the LGPLv3 change, which +fixes a realloc() leak on failure. + +Fix memory leak in ext2fs_alloc_block(). + +Fix makefile dependency issues for various install targets. +(Addresses-Sourceforge-Patches: #1903484, #1903466, #1903456) + +Improve descriptions for the r_move_itable and r_resize_inode tests. + + +E2fsprogs 1.40.6 (February 9, 2008) +=================================== + +Add support for returning labels for UDF filesystems in the blkid +library. + +Fix bug in the blkid library where cached filesystems was not being +flushed when opening USB devices returned the error ENOMEDIUM. +(Addresses Debian Bug: #463787) + +Added logic to the blkid library to automatically choose whether a +filesystem should be mounted as ext4 or ext4dev, as appropriate. + +Allow tune2fs to set and clear the test_fs flag on ext4 filesystems. + +Fix a bug in e2fsck which caused it to core dump if e2fsprogs had been +configured with --enable-jbd-debug. + +Document the BLKID_FILE environment variable in the libblkid man page + +Programmer's Notes: +------------------- + +Update e2fsprogs translation template and Vietnamese and Czech translations + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs: #436058) + +Don't try to create $DESTDIR/etc/init.d as part of make install as we +don't install the init.d script (and it's not the recommended way to +start uuidd anyway). (Addresses Sourceforge Bug: #1885085) + +Use thread local storage to fix a theoretical race condition if two +threads try to format an unknown error code at the same time in the +com_err library. + + +E2fsprogs 1.40.5 (January 27, 2008) +=================================== + +Fix a potential overflow big in e2image if the device name is too +long. + +Mke2fs will now create new filesystems with 256 byte inodes and the +ext_attr feature flag by default. This allows for much better future +compatibility with ext4 and speeds up extended attributes even on ext3 +filesystems. + +Teach e2fsck to ignore certain "safe" filesystem features which are +set automatically by the kernel. Having the kernel set features +automagically behind the user's back is a bad idea, and we should try +to break the kernel of this habit, especially for the newer ext4 +feature flags. But for now, we will try to avoid needless full checks +which can annoy users who are doing fresh installs. + +Add support in tune2fs and mke2fs for making a filesystem as being "ok +to be used with test kernel code". This will be needed for using test +filesystems with the latest ext4 kernel code. + +Change e2fsck -fD so that it sorts non-htree directories by inode +numbers instead of by name, since that optimizes performances much +more significantly. (Addresses-Sourceforge-Feature-Request: #532439) + +If e2image fills the disk, fix it so it exits right away instead of +spewing large numbers of error messages. +(Addresses-Sourceforge-Feature-Request: #606508) + +If ftruncate64() is not available for resize2fs, let it use ftrucate() +instead, but have it check to see if the size would get truncated, and +skip calling ftruncate in that case. + +Add support for detecting HFS+ filesystems in the blkid library. + +Add support in the blkid library for ext4/ext4dev filesystems. + +Fix a bug in blkid where it could die on a floating point exception +when presented with a corrupt reiserfs image. + +Fix blkid's handling of ntfs UUID's so that leading zeros are printed +such that UUID string is a fixed length. + +Add sample python bindings for the uuid library to the contrib +directory. (Addresses-Sourceforge-Patches: #778817) + +Fix debugfs's 'lsdel' command so it uses ext2fs_block_iterate2 so it +will work with large files. (Addresses Sourceforge Feature Request: +#1257500 and Sourceforge Support Request: #1253511) + +Allow the debugfs 'undel' command to undelete an inode without linking +it to a specific destination directory, since this might require +allocating blocks that could overwrite some yet-to-be-recovered +deleted files. (Addresses-Sourceforge-Feature-Request: #967141) + +Update Swedish translation from the Translation Project. + +Programmer's Notes: +------------------- + +Fix configure handling of --sbindir (which should rarely be used, but +someone did complain, so let's fix it). (Addresses Sourceforge Bug: +#498381) + +Updated e2fsprogs.spec file to include a new uuidd package + +Use pkg-config to determine where to find the devmapper library so we +can find out where it is located on different distributions. + +Fix Makefile race so that "make -j3 distclean" works correctly + +Fix portability problems on non-Linux/non-Hurd/non-Masix systems, +especially on MacOS X systems. (Addresses Sourceforge Bugs: #1861633, +#1819034, #1863819) + +Fixed spelling mistakes, typos, and otherwise clarified man pages. + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs: #459403, #459475, #459614) + +Remove the --enable-dynamic-static configure option, and build e2fsck +dynamically by default. If the user wants e2fsck.static, he/she will +need to build it via "make -C e2fsck e2fsck.static" + +Fix various build warnings due to missing prototypes. +(Addresses Sourceforge Patch: #1861663, #1861659) + + +E2fsprogs 1.40.4 (December 31, 2007) +==================================== + +Improve time-based UUID generation. A new daemon uuidd, is started +automatically by libuuid if necessary. This daemon is setuid to allow +updates to /var/lib/libuuid, so the clock sequence number can be +stored and so if the clock is set backwards, it can be detected. +(Addresses Sourceforge Bug: #1529672, Addresses Red Hat Bugzilla: +#233471) + +Filter out the NEEDS_RECOVERY feature flag when writing out the backup +superblocks. This avoids e2fsck from concluding that a full +filesystem check is required before backing up the superblock due to +changes in the feature flags. (Addresses Debian Bug: #454926) + +Fix fsck to only treat the '#' character as a comment at the beginning +of the line in /etc/fstab. Otherwise fstabs for the fuse filesystem +will cause fsck to issue an bogus warning message. +(Addresses Gentoo bug: #195405, Addresses Sourceforge bug: #1826147) + +Format control characters and characters with the high eighth bit set +when printing the contents of the blkid cache, to prevent filesystems +with garbage labels from sending escape sequences to the user's screen +that might, for example place it in graphics mode. (Addresses Ubuntu +Bug: #78087) + +Fix sign-extension problem on 64-bit systems in in the com_err +library. (Addresses Sourceforge Bug: #1809658) + +Avoid division by zero error when probing an invalid FAT filesystem in +the blkid library. (Addresses Sourceforge Bug: #1831627) + +Update Dutch, Polish, and Vietnamese translations from the Translation +Project. Remove the Rwandan translation upon advice of the +Translation Project. + +Programmer's Notes: +------------------- + +Fix the libss "make check" regression test so that it works if the +current directory is not in the user's path or if the libss shared +library is not installed. (Addresses Sourceforge Bug: #1848974) + +Fixed spelling mistakes, typos, and otherwise clarified man pages. +(Addresses Debian Bugs: #444883, #441872) + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs: #437720, #451172, #458017) + +Fix build failure on non-Linux/non-Hurd/non-Masix systems. +(Addresses Sourceforge Bug: #1859778) + +Fix Hurd portability issues. (Addresses Debian Bug: #437720) + + +E2fsprogs 1.40.3 (December 5, 2007) +=================================== + +Fix a potential security vulnerability where an untrusted filesystem +can be corrupted in such a way that a program using libext2fs will +allocate a buffer which is far too small. This can lead to either a +crash or potentially a heap-based buffer overflow crash. No known +exploits exist, but main concern is where an untrusted user who +possesses privileged access in a guest Xen environment could corrupt a +filesystem which is then accessed by the pygrub program, running as +root in the dom0 host environment, thus allowing the untrusted user to +gain privileged access in the host OS. Thanks to the McAfee AVERT +Research group for reporting this issue. (Addresses CVE-2007-5497.) + +Fix heuristics in blkid which could cause a disk without partitions to +be incorrectly skipped when a loopback device is present. (Addresses +Red Hat Bugzilla #400321.) + +Fix e2image so that in raw mode it does not create an image file which +is one byte too large. + +Change mke2fs's usage message so it recommends the preferred -E option +instead of the deprecated -R option. + +Enhance the blkid library so it will recognize squashfs filesystems. +(Addresses Red Hat Bugzilla #305151.) + +Enhance e2fsck so it will force the backup superblocks to be backed up +if the filesystem is consistent and key constants have been changed +(i.e., by an on-line resize) or by e2fsck in the course of its +operations. + +Enhance blkid's detection of FAT filesystems; so that USB disks with +only a single bootable partition will not get missed. + +E2fsck will no longer mark a filesystem as invalid if it has time +errors (i.e., if superblock mount time or last write time is in the +future) and the user refuses to fix the problem. + +The Ubuntu init scripts don't properly set the system time correctly +from hardware clock if the hardware clock is configured to tick local +time instead of GMT time. Work around this as best as we can by +providing an option, buggy_init_scripts, in /etc/e2fsck.conf which can +be set on Ubuntu systems. (Addresses Debian Bug #441093, and Ubuntu +Bug #131201.) + +Fix fsck to ignore /etc/fstab entries for bind mounts. (Addresses Red +Hat Bugzilla #151533.) + +Fix e2fsck so that if the superblock is corrupt, but still looks +vaguely like an ext2/3/4 superblock, that it automatically tries to +fall back to the backup superblock, instead of failing with a hard +error. + +Make the e2fsprogs program more robust so that they will not crash +when opening a corrupt filesystem where s_inode_size is zero. + +Change e2fsck so it uses sscanf() instead of atoi() so it non-numeric +arguments are detected as such and the parse error is reported to the +user. (Addresses Debian Bug #435381.) + +Change e2fsck so it will not complain if a file has blocks reallocated +up to the next multiple of a system's page size. + +Fix bug in ext2fs_check_desc() which will cause e2fsck to complain +about (valid) filesystems where the inode table extends to the last +block of the block group. (Addresses Red Hat Bugzilla #214765.) + +Fix a bug in ext2fs_initialize() which causes mke2fs to fail while +allocating inode tables for some relatively rare odd disk sizes. +(Addresses Red Hat Bugzilla #241767.) + +Add Catalan translation and update Dutch and Swedish translations +from the Translation Project. + +Fix big-endian byte-swapping bug in ext2fs_swap_inode_full(). We +still had an issue when trying to figure out whether we need to +byte-swap fast symlinks that contained extended attributes. + +Fixed spelling mistakes, typos, and otherwise clarified man pages. +(Addresses SourceForge Bug #1821333.) + + +Programmer's Notes: +------------------- + +Fix mke2fs tests to avoid needing any significant ^M (CR) characters + +Add "make check" to the RPM spec file + +Fix "make install" and 'make uninstall" in misc/Makefile.in so that it +works correctly when the prefix is not the root directory. + +Fix the resize2fs tests, r_move_itable and r_resize_inode, so they +clean up after themselves by deleting the test.img temporary file +after completing the test. + +Fixed a corner case bug ext2fs_unlink() when trying to delete the +first directory entry in a directory block and the last directory +entry in the previous directory block is not in use. Fortunately +ext2fs_unlink() is only used by debugfs and e2fsck, and in e2fsck in +places where it is extremely unlikely to run into this corner case. + +Fix missing dependency which would cause parallel builds to fail. +(Addresses Sourceforge Bug #1842331.) + +Fix a build error on newer gcc caused by lib/ext2fs/ismounted.c +calling open(O_CREATE) with a missing mode parameter. + +Fix the test_ss.c in lib/ss so it can be used as an example +application program for the library as well as a regression test +suite. + +Fix ext2fs_dblist_dir_iterate() so that error codes and abort codes +are properly passed back up through the call stack. + +E2fsprogs 1.40.2 (July 12, 2007) +================================ + +A recent change to e2fsck_add_dir_info() to use tdb files to check +filesystems with a very large number of filesystems had a typo which +caused us to resize the wrong data structure. This would cause a +array overrun leading to malloc pointer corruptions and segfaults. +Since we normally can very accurately predict how big the the dirinfo +array needs to be, this bug only got triggered on very badly corrupted +filesystems. + +Fix a bug in e2fsck which caused it to incorrectly salvage +directories when the last entry's rec_len is bogusly too big. This +resulted in a nonsense filesystem corruption to be reported, and +required a second run of e2fsck to fully fix up the directory. + +Update tune2fs man page to include more discussion of reserved blocks +(Addresses Launchpad bug #47817) + +Update Turkish, Polish, Dutch, and Vietnamese PO files from the +Translation Project + + +E2fsprogs 1.40.1 (July 7, 2007) +=============================== + +Fix bug which could cause libblkid to loop forever. When revalidating +a partition where there is obsolete information in /etc/blkid.tab, we +end up freeing a the type tag without clearing dev->bid_type, causing +blkid_verify() to loop forever. (Addresses Debian Bug: #432052) + +The Turkish translation has a bug in it where it has the translation +of "E@e '%Dn' in %p (%i)" to "E@E". This causes @E to be expanded at +@E, recursively, forever, until the stack fills up and e2fsck core +dumps. We fix this by making e2fsck stop @-expansions after a +recursive depth of 10, which is far more than we need. +(Addresses Sourceforge Bug: #1646081) + +Compile the default mke2fs.conf into mke2fs program. People are +getting surprised by mke2fs creating filesystems with different +defaults than earlier versions of mke2fs if mke2fs.conf is not +present. So we now create a built in version of mke2fs.conf file +which is used by mke2fs if the /etc/mke2fs.conf is not present. +(Addresses SourceforgeBug: #1745818) + +Improve the config/parse_types.sh helper script. Fix a potential +security problem if e2fsprogs is built as root (as Gentoo does!). In +addition fix the script and how it is called from the configure script +so that it does the right thing when cross-compiling. (Fixes Gentoo +bug: #146903) + +Update Vietnamese, French, and Dutch PO files from the Translation +Project. Also created a new e2fsprogs.pot file for translator. + +Fix bogus strip permission errors when building under Debian. When +building the e2fsprogs dpkg's, the dh_strip command emits a large +number of error messages caused by the permissions not being right. +So run dh_fixperms before running dh_strip. + +Programmer's Notes: +------------------- + +Add new function: profile_set_default(). This function sets the value +of the pseudo file "<default>". If the file "<default>" had +previously been passed to profile_init(), then def_string parameter +will be parsed and used as the profile information for the "<default>" +file. + +Fix mk_cmds's error reporting so that it is unambiguous that it is the +mk_cmds script which is generating the error. (Obviates Gentoo patch: +e2fsprogs-1.32-mk_cmds-cosmetic.patch) + +Fix the test suite to use LC_ALL instead of LANG. LC_ALL is the "high +priority" environment variable that overrides all others, where as +LANG is the lowest priority environment variable. If LC_ALL is set, it +doesn't matter whether LANG, LANGUAGE, LC_COLLATE, LC_MESSAGES, and +the all the rest are set. This will assure that the locale when +running the test suites is the "C" locale. (Obviates Gentoo patch: +e2fsprogs-1.38-tests-locale.patch) + + +E2fsprogs 1.40 (June 29, 2007) +============================== + +Fix divide by zero error in blkid's NTFS probing logic. + +Add new blkid -g option which causes the blkid cache to be garbage +collected. + +Fix a bug in libblkid which could cause the internal field bid_type to +become corrupted. Fortunately bid_type isn't used much, and bid_label +and bid_uuid is only used by debugging code, so the impact of this bug +was very minor. + +Mke2fs will now store the RAID stride value when a filesystem is +created with a requested RAID stride, and then use it automatically in +resize2fs. + +Mke2fs has a sanity check added to make sure (inode_size * num_inodes) +isn't too big. In some cases Lustre users have tried specifying an +inode size of 4096 bytes, while keeping an inode ratio of one inode +per 4096 bytes. + +Improve sanity check in e2fsck's algorithm for finding a backup +superblock, so that it won't accidentally find a superblock that was +located in the journal, and then later reject it as being not a valid +backup superblock. + +Fix e2fsck get_size logic so that it will work with the Linux floppy +driver. The Linux floppy driver is a bit different from the other +block device drivers, in that if the device has been opened with +O_EXCL, it disallows another open(), even if the second open() does +not have the O_EXCL flag. (Addresses Debian Bug: #410569) + +Fix error checking of badblock's last-block and start-block arguments. +(Addresses Debian Bug: #416477) + +Fix e2fsck so that it doesn't overwrite the backup superblocks when +recovering a journal until the master superblock has been confirmed as +being sane. + +Change the blkid library to be much more paranoid about concluding +that a partition contains an NTFS filesystem, and fetch the UUID and +LABEL information from NTFS filesystems. (Addresses Launchpad Bug: +#110138) + +Factor out the code which sets the default journal size and move it +into libext2fs. + +Enhance e2fsck so it will recreate the ext3 journal if the original +journal inode was cleared to due it being corrupt after finishing the +filesystem check. + +Fix e2fsck so that it updates the journal inode if it is corrupted and +the backup journal information from the superblock was successfully +used to recover the filesystem. + +Fix e2fsck so that it checks all of the blocks in the journal inode +for validity. The original code only checked the direct blocks to +make sure the journal inode was sane. Unfortunately, if some or all +of the indirect or doubly indirect blocks were corrupted, this would +not be caught. + +Add support in blkid to detect LUKS encrypted partitions. + +Add extra sanity checks for extended attributes in the case where the +size is zero but the offset is very large. + +Fix byte-swapping issues for large inodes in ext2fs_read_inode_full() +and ext2fs_get_next_inode_full(). + +Clarify the copyright licenses used by the various libraries in +the top-level COPYING file (Red Hat Bugzilla: 166058) + +Make mke2fs's defaults when /etc/mke2fs.conf doesn't exist more sane. + +Fix mke2fs and debugfs to support large (> 16 bit) uid's and gid's. + +Remove check in e2fsck which requires EA's in inodes to be sorted; +they don't need to be sorted, and e2fsck was previously wrongly +clearing unsorted EA's stored in the inode structure. + +Allow mke2fs or tune2fs to create a substantially larger journal (up +to 10,240,000 blocks). + +Fix MD superblock detection, and make sure the correct UUID is +reported from the MD superblock. + +Fix a signed vs. unsigned bug in debugfs. + +Enhance debugfs's date parser so that it accepts integer values. + +Fix e2fsck's pass1c accounting so it doesn't terminate too early if a +file with multiply claimed blocks is hard linked. or not at all if the +root directory contains shared blocks + +Enhance debugfs so it can modify the block group descriptors using the +command set_block_group_descriptor. + +Improve e2fsck's reporting of I/O errors so it's clearer what it was +trying to do when an error happens + +Fix a bug in in how e2fsprogs byte swaps inodes containing fast +symlinks that have extended attributes. (Addresses Red Hat Bugzilla: +#232663 and LTC Bugzilla: #27634) + +Fix potential file descriptor leak in ext2fs_get_device_size() in an +error case. + +Add libreadline.so.5 support to libss. + +Improve badblocks -n/-w exclusive usage message. + +Fix dump_unused segfault in debugfs when a filesystem is not open + +Fix memory leak in blkid library. (Addresses Debian Bug: #413661) + +Allow the debugfs lcd command to work w/o a filesystem being open. +(Addresses LTC Bugzilla #27513) + +Fix e2fsck to clear i_size for special devices with a bogus i_blocks +field on the first pass. + +Fix e2fsck to set the file type of the '..' entry when connecting +a directory to lost+found. (Addresses Lustre Bug: #11645) + +Enhance e2fsck to recover directories whose modes field were corrupted +to look like special files. This is probably only useful in +artificial test cases, but it will be useful if we ever do the "inodes +in directory" idea for ext4. + +Allow debugfs to dump (and rdump) > 2GB files. (Addresses Debian Bug: +#412614) + +Fix resize2fs parsing of size parameter (in sector units). This was +actually a bug in libe2p's parse_num_blocks() function. When handling +the 's' suffix, it was ignoring the blocksize information passed in +from the caller and always interpreting the number in terms of a 1k +blocksize. (Addresses Debian Bug: #408298) + +There was a floating point precision error which could cause e2fsck to +loop forever on really big filesystems with a large inode count. +(Addresses Debian Bug: #411838) + +Fix memory leak in ext2fs_write_new_inode() + +Add support for using a scratch files directory to reduce e2fsck's +memory utilization on really big filesystems. This uses the TDB +library. See the [scratch_files] section of the e2fsck.conf man page +for more details. + +Fixed type-punning bug which caused dumpe2fs to crash on the Arm +platform (Addresses Debian Bug: #397044) + +Add explanatory message to badblocks that -n and -w are mutually exclusive +(Addresses Debian Bug: #371869) + +Allow debugfs and dumpe2fs to support fs features under development. + +Add support for the new flag EXT2_FLAG_SOFTSUPP_FEATURES flag to +ext2fs_open() , which allows application to open filesystems with features +which are currently only partially supported by e2fsprogs. + +Allow unix_io to support offsets greater than 2G (Addresses +SourceForge Bug: #1547922) + +Fixed overflow and signed/unsigned problems caused by the number of +blocks or inodes exceeding 2**31 or being close to 2**32-1. + +Add support for unsigned directory hash calculations with hints in the +superblock to fix cross-architectural portability for htree +directories with filenames where the high 8th bit is set. (Addresses +Debian: #389772) + +Fix resize2fs so that it gives user-intelligible error messages if the +filesystem or the kernel does not support on-line resizing. +(Addresses Debian Bug: #380548) + +Require mke2fs -F -F for really dangerous operations, since -F is +needed for less dangerous operations such as creating filesystems +images in regular files, or creating filesystems on whole block +devices. These relatively innocuous usages should NOT be confused +with running mke2fs on an apparently-mounted or in-use filesystem. + +Allow the default inode size to be specified into the mke2fs.conf +file. + +Make the smallest default journal size is big enough so that on-line +resizing should always work. + +Fix silly spelling error in e2fsck. (Addresses SourceForge bug: +#1531372) + +Fix debugfs coredump when lsdel is run without an open filesystem +(Addresses Debian Bug: #378335) + +Fix debugfs display bug us that bytes that have the high bit set are +displayed as "ec" instead of "ffffffec". + +Add support in lsattr so it will display the EXT4_EXTENTS_FL flag. + +Device mapper scanning wasn't working in the blkid library because the +pathnames had an extra "/dev" when they were being probed. + +Add GFS/GFS2 support to the blkid library. + +Fix blkid support of empty FAT filesystem labels. + +Avoid recursing forever (or for a long time) when the blkid library +searches for a device and there are symlinks to directories in /dev. + +Avoid unaligned halfword access in blkid when accessing FAT +superblocks, as this will cause Sparc/Solaris systems to throw a +SIGBUS error. + +The latest devmapper libraries requires pthreads, add -lpthreads to +the static link libraries for e2fsck.static if devmapper is enabled. +(Addresses Debian bug: #388718) + +Improve the (non-installed, for experts only) findsuper program by +printing the uuid and label from the superblocks, as well as the +starting and ending offsets of the filesystem given the information in +the superblock. Omit by default printing superblocks that are likely +found in located in an ext3 journal unless an explicit -j option is +given. + +Updated Spanish, French and Dutch translations and added Catalan +translation. (Addresses Debian bug: #411562) + +Use FreeBSD's DIOCGMEDIASIZE and DIOCGDINFO ioctls if available when +determining a partition's size, since binary searching to determine +the device doesn't work on FreeBSD. + +Documentation about UUID's is available in enough places, and it's +awkward to deal with debian-legal's insanities. So I'm caving in the +"more-lunatic-than-RMS" wing of Debian by removing RFC-4122 so we +don't have do the dfsg tarball. Also remove the rule that only tried +to install RFC-4122 on Ubuntu, since Ubuntu seems to want to fetch +e2fsprogs exclusively from Debian. (Addresses Debian Bug: #407107) + +Fix the info-dir line so that the menu name does not contain a .info +prefix. First of all, it's ugly, secondly, it causes the install-info +command to fail to remove the com_err info file from the +/usr/share/info/dir file when the comerr-dev package is removed and +purged. (Addresses Debian Bug: #401711) + +Fixed spelling mistakes, typos, and otherwise clarified man pages. +(Addresses Debian Bug: #369761, #373004, #379695) + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs #389554, #390664, #413208, #419605, +#408352, #415560, #399155) + + +Programmer's notes: +------------------- + +E2fsck now supports the %It expansion when printing a problem report. +It will print the type of the inode in the problem context. + +Fix misc/Makefile.in so that it builds even if e2fsck hasn't been built yet +(Addresses Sourceforge Bug: #1565561) + +Remove unused variables and other lint/gcc -Wall cleanups + +Add check to ext2fs_get_device_size() so it will return EFBIG for for +filesystems contained in regular files where the filesystem image size +is returned by stat64(). + +Set local environment variables to C so mk_cmds and compile_et always +work. (Addresses SourceForge Bug: #1532177) + +Added the 64-bit byte swapping function ext2fs_swab64(). + +Added two new helper functions to prevent 2**31/2**32-1 overflow +problems: ext2fs_div_ceil() and e2p_percent(). + +Create new ext2fs library inline functions ext2fs_group_first_block() +and ext2fs_group_last_block() in order to calculate the starting and +ending blocks in a block group. + +Create the generated files read-only to remind developers not to edit them. + +Add support for autoconf 2.60 (with backwards compatibility for older +versions of autoconf). + +Added an "make rpm" target to top-level Makefile + +Added various FreeBSD portability fixes. + +Exclude mercurial files from the RPM build tree to speed up copy/build. + +Use root_sysconfdir to define the locations of mke2fs.conf and +e2fsck.conf instead of using a hard-coded /etc pathname. + +Prevent e2fsck.h and ext2_ext_attr.h from getting included multiple times. + +Fixed "make clean" in blkid's Makefile.in file from removing tst_*.c files. + +If diff -u is supported, use it to report test failures. + +Updates/improvements to RPM spec file + +Add on-disk format definitions for the following new features: +EXT4_FEATURE_RO_COMPAT_HUGE_FILE, EXT4_FEATURE_RO_COMPAT_GDT_CSUM, +EXT4_FEATURE_RO_COMPAT_DIR_NLINK, EXT4_FEATURE_INCOMPAT_64BIT, +EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE + +Add a new make target "checked-failed" in the tests directory which +reruns any failed tests + +Update draft-leach-uuids-guids-01.txt with rfc4122.txt + +Fix miscellaneous bugs reported by Coverity: Dead code, potential nul +pointer dereferences, memory leaks, etc. None were security-critical +problems. + +Fix up usage and decrement error messages in the test_icount program + +Add debugging code to the com_err library; if the environment variable +COMERR_DEBUG is set to 1, print out debugging messages as error tables +are added and removed from the com_err library. If the +COMERR_DEBUG_FILE environment variable is set (and the process is not +setuid) the debugging messages may be redirected to a file. + +Change all of the e2fsprogs programs to use the newer add_error_table() +and remove_error_table() interfaces instead of the much older +initialize_*_error_table() function. + +Add TDB support into the ext2fs library. This allows us to have a +guaranteed library we can count on always being present so we can +store data in an on-disk database. + +Add support for using TDB to store the icount data, so we don't run out +of memory when checking really large filesystems. + +Change the regression test suite so that it skips empty test directories. + +Define the l_i_iversion field in ext2_inode. The l_i_version field is +now defined from the old l_i_reserved1 field in the ext2 inode. This +field will be used to store high 32 bits of the 64-bit inode version +number. + +Add Makefile production rule for e2fsprogs.spec in case it gets +deleted. + +Add new function profile_get_uint() to allow for a clean way to fetch +unsigned integers from the context. + +Add test to make sure the ext2 superblock structure is 1024 bytes. + +Fix typo in name of f_dup4 regression test + +Add new function blkid_gc_cache() which performs a garbage collection +pass on the /etc/blkid.tab file. + +The ext2fs_open() function now sets EXT2_FLAG_MASTER_SB_ONLY. In +general, only e2fsck (after the filesystem is clean), tune2fs, and +resize2fs should change the backup superblocks by default. Most +callers of ext2fs_open() should not be touching any superblock fields +which require the backups to be touched. + +Add new function to libext2fs, ext2fs_default_journal_size(), which +returns the default journal size. + diff --git a/doc/RelNotes/v1.41.txt b/doc/RelNotes/v1.41.txt new file mode 100644 index 0000000..e36e35d --- /dev/null +++ b/doc/RelNotes/v1.41.txt @@ -0,0 +1,1594 @@ +E2fsprogs 1.41.14 (December 22, 2010) +===================================== + +Fix spurious complaint in mke2fs where it would complain if the file +system type "default" is not defined in mke2fs.conf. + +The resize2fs program will no longer clear the resize_inode feature +when the number reserved group descriptor blocks reaches zero. This +allows for subsequent shrinks of the file system to work cleanly for +flex_bg file systems. + +The resize2fs program now handles devices which are exactly 16T; +previously it would give an error saying that the file system was too +big. + +E2fsck (and the libext2fs library) will not use the extended rec_len +encoding for file systems whose block size is less than 64k, for +consistency with the kernel. + +Programming notes +----------------- + +E2fsprogs 1.41.13 would not compile on big-endian systems. This has +been fixed. (Addresses Sourceforge Bug: #3138115) + +The ext2fs_block_iterator2() function passed an incorrect ref_offset +to its callback function in the case of sparse files. (Addresses +Sourceforge Bug: #3081087) + +Fix some type-punning warnings generated by newer versions of gcc. + + +E2fsprogs 1.41.13 (December 13, 2010) +===================================== + +E2fsck now supports the extended option "-E journal_only", which +causes it to only do a journal replay. This is useful for scripts +that want to first replay the journal and then check to see if it +contains errors. + +E2fsck will now support UUID= and LABEL= specifiers for the -j option +(which specifies where to find the external journal). (Addresses +Debian Bug #559315) + +E2fsck now has support for the problems/<problem code>/force_no +configuration option in e2fsck.conf, which forces a problem to not be +fixed. + +Dumpe2fs will now avoid printing large negative offsets for the bitmap +blocks and instead print a message which is a bit more helpful for +flex_bg file systems. + +Mke2fs will now check the file system type (specified with the -t +option) to make sure it is defined in the mke2fs.conf file; if it is +not, it will print an error and abort. If the usage type (specified +with the -T option) is not defined in mke2fs.conf, mke2fs will print a +warning but will continue. (Addresses Debian Bug #594609) + +Clarified error message from resize2fs clarifying that on-line +shrinking is not supported at all. (Addresses Debian Bug #599786) + +Fix an e2fsck bug that could cause a PROGRAMMING BUG error to be +displayed. (Addresses Debian Bug #555456) + +E2fsck will open the external journal in exclusive mode, to prevent +the journal from getting truncated while it is in use due to a user +accidentally trying to run e2fsck on a snapshotted file system volume. +(Addresses Debian Bug #587531) + +Fix a bug in e2fsck so it has the correct test for the EOFBLOCKS_FL +flag. + +The tune2fs program can now set the uninit_bg feature without +requiring an fsck. + +The tune2fs, dumpe2fs, and debugfs programs now support the new ext4 +default mount options settings which were added in 2.6.35. + +The e2fsck and dumpe2fs programs now support the new ext4 superblock +fields which track where and when the first and most recent file +system errors occurred. These fields are displayed by dumpe2fs and +cleared by e2fsck. These new superblock fields were added in 2.6.36. + +Debugfs now uses a more concise format for listing extents in its +stat command. This format also includes the interior extent tree +blocks, which previously was missing from stat's output for +extent-based files. + +Debugfs has a new option, -D, which will request Direct I/O access of +the file system. + +Mke2fs will skip initializing the inode table if a device supports +discard and the discard operation will result in zero'ed blocks. + +Badblocks will now correctly backspace over UTF-8 characters when +displaying its progress bar. (Addresses Gentoo Bug #309909; Addresses +Debian Bugs #583782 and #587834) + +E2freefrag will now display the total number of free extents. + +Resize2fs -P no longer requires a freshly checked filesystem before +printing the minimum resize size. + +Fixed a floating point precision error in a binary tree search routine +that can lead to seg fault in e2fsck and resize2fs. + +Fixed a bug in e2fsck where if both the original and backup superblock +are invalid in some way, e2fsck will fail going back to the original +superblock because it didn't close the backup superblock first, and +the exclusive open prevented the file system from being reopened. + +Fixed a big in e2freefrag which caused getopt parsing to fail on +architectures with unsigned chars. (Addresses Gentoo Bug: #299386) + +Clarified an mke2fs error message so a missed common in an -E option +(i.e., mke2fs -t ext4 -E stride=128 stripe-width=512 /dev/sda1") +results in a more understandable explanation to the user. + +Mke2fs now displays the correct valid inode ratio range when +complaining about an invalid inode ratio specified by the user. + +Mke2fs now understands the extended option "discard" and "nodiscard", +and the older option -K is deprecated. The default of whether +discards are enabled by default can be controlled by the mke2fs.conf +file. + +Mke2fs's handling of logical and physical sector sizes has been +improved to reflect the fact that there will be some SSD's with 8k and +16k physical sectors arriving soon. Mke2fs will no longer force block +size to be the physical sector size, since there will be devices where +the physical sector size is larger than the system's page size, and +hence larger than the maximal supported block size. In addition, if +the minimal and optimal io size are not exported by the device, and +the physical sector size is larger than the block size, the physical +sector size will be used to set the Raid I/O optimization hints in the +superblock. + +E2fsck will now display a better, more specific error message when the +user enters a typo'ed device name, instead of blathering on about +alternate superblocks. + +Fixed various Debian Packaging Issues + +Updated/clarified man pages (Addresses Debian Bugs: #580236, #594004, +#589345, #591083; Addresses Launchpad Bug: #505719) + +Update the Chinese, Chzech, Dutch, French, Germany, Indonesian, +Polish, Swedish, and Vietnamese translations. + + +Programmer's Notes +------------------ + +Fix a dependency definition for the static and profiled blkid +libraries which could cause compile failures in some configurations. +(Addresses Debian Bug: #604629) + +Add support for Direct I/O in the Unix I/O access layer. + +Fixed a memory leak in the Unix I/O layer when changing block sizes. + +Fixed minor memory leaks in mke2fs. + +Added a new function to the ext2fs library, ext2fs_get_memalign(). + +The tst_super_size test program will check to make sure the superblock +fields are correctly aligned and will print them out so they can be +manually checked for correctness. + +Fixed some makefile dependencies for test programs in lib/ext2fs. + +Reserved the feature flags and superblock fields needed for the Next3 +snapshot feature. + +Reserved the feature flags for EXT4_FEATURE_INCOMPAT_DIRDATA and +EXT4_INCOMPAT_EA_INODE. + + +E2fsprogs 1.41.12 (May 17, 2010) +================================ + +Mke2fs now gives a correct error message if the external journal +device is not found. (Addresses Red Hat Bug #572935) + +Resize2fs -P will now refuse to print a minimum size if the file +system is not clean. Previously it would go ahead and print a minimum +size anyway, which might not be correct, leading to user confusion. + +E2fsck now tests for extents that begin at physical block 0 and +rejects them as invalid. (Addresses Google Bug: #2573806) + +Fixed a bug in e2fsck which could cause it to crash when trying to +remove an invalid extent and the block bitmaps hadn't yet been loaded. +(Addresses SourceForge Bug: #2971800) + +E2fsck now will completely skip time-based checks if the system clock +looks insane or the option broken_system_clock is set in +/etc/e2fsck.conf. + +E2fsck would previously report an i_blocks corruption for a 4T file +created using posix_fallocate; this bug has been fixed. + +E2fsck will now correctly mark a sparse journal as invalid and will +delete and recreate the journal to address the problem. + +E2fsck would previously incorrectly ask the user whether she would +like to abort the file system check after finding a problem --- and +then abort regardless of the user's answer. This is annoying, and +has been fixed. + +E2fsck can now continue even if it fails to recreate the resize +inode; previously it would just abort the file system check +altogether. + +E2fsck could potentially remove directory entries for inodes found in +the unused region of the inode table; this would generally happen on +ext4 file systems that do not use journalling. This bug has been fixed +by not clearing these directory entries once it has been established +that bg_unused_inodes may not be trustworthy; once pass #2 has been +completed, e2fsck will restart the file system check from the +beginning, and then it will be safe to delete any directory entries +pointing to inodes that appear to be deleted. (Addresses Google Bug: +#2642165) + +E2fsck will not try to set the block group checksums if the user +cancels the fsck with a control-C. It's a bad idea to set the +checksums if e2fsck hasn't been completed, and it often results an the +error message, "Inode bitmap not loaded while setting block group +checksum info". (Addresses Launchpad Bug: #582035) + +The mke2fs program now queries the kernel for the physical as well as +the logical sector size, and will not allow a blocksize below the +logical, and will strongly encourage a blocksize at least as big as +the physical blocksize. This is needed for 4k sector drives that +emulate 512 byte sector sizes. + +Mke2fs will now allow a flex_bg size of 1. This is unusual, and +rarely needed, but it is a legal value. + +E2fsck will check for cases where the EOFBLOCKS_FL is set when it is +not needed, and offer to clear it; this is a sign of a kernel bug, but +more importantly, some released kernels may crash when this situation +is encountered on ext4 file systems. (Addresses Google Bug: #2604224) + +E2fsck will use the EOFBLOCKS_FL flag exclusively to check whether +i_size is correct. (Kernels starting with 2.6.34 will set +EOFBLOCKS_FL.) + +The com_err library will now only output ^M (a CR character) when the +tty is in raw mode. + +Update the Czech, Chinese, Dutch, French, Germany, Indonesian, Polish, +and Vietnamese translations. + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs: #571247, #563487) + + +Programmer's Notes +------------------ + +The regression test suite now uses its own mke2fs.conf file, so that +downstream distributions want change the mke2fs.conf file which is +distributed in the RPM or dpkg file, without worrying about screwing +up the regression test results. + +Always build namei.o so that building with configure --disable-debugfs +works correctly. Long-term, if we care about reduced e2fsprogs +builds, we need a more general solution for deciding what .o files are +needed for a particular build. Given that install floppies are going +(gone?) the way the dodo bird, we probably don't care, though. +(Addresses Sourceforge Bug: #2911433) + +Add configure options --enable-symlink-build and +--enable-symlink-install, which allow e2fsprogs be built using +symlinks instead of hard links, and to be installed using symlinks +instead of hard links, respectively. It is useful when the file +system where the build is taking place, or the file system where +e2fsprogs is installed, can't handle hard links for some reason. +(Addresses Sourceforge Bug: #1436294) + +Fixed compile warning in mke2fs.c. + + +E2fsprogs 1.41.11 (March 14, 2010) +================================== + +E2fsck will no longer give a fatal error and abort if the physical +device has been resized beyond 2**32 blocks. (Addresses Launchpad +Bug: #521648) + +Debugfs has a bug fixed so that "logdump -b <blk>" now properly shows +the allocation status of the block <blk>. (Addresses Debian Bug: +#564084) + +E2fsck now prints a much more emphatic and hopefully scary message +when a file system is detected as mounted while doing a read/write +check of the filesystem. Hopefully this will dissuade users from +thinking, "surely that message doesn't apply to *me*" :-( + +E2fsck -n will now always open the file system read-only. We now +disallow certain combination of options which previously were manual +exceptions; this is bad because it causes users to think they are +smarter than they really are. So "-n -c", "-n -l", "-n -L", and "-n +-D" are no longer supported. (Addresses Launchpad Bug: #537483) + +In e2fsprogs 1.41.10, mke2fs would ask for confirmation to proceed if +it detected a badly aligned partition. Unfortunately, this broke some +distribution installation scripts, so it now just prints the warning +message and proceeds. (Addresses Red Hat Bug: #569021. Addresses +Launchpad Bug: #530071) + +Mke2fs would take a long time to create very large journal files for +ext4. This was caused by a bug in ext2fs_block_iterate2(), which is +now fixed. + +E2fsck now understands the EOFBLOCKS_FL flag which will be used in +2.6.34 kernels to make e2fsck not complain about blocks deliberately +fallocated() beyond an inode's i_size. + +E2fsprogs 1.41.10 introduced a regression (in commit b71e018) where +e2fsck -fD can corrupt non-indexed directories when are exists one or +more file names which alphabetically sort before ".". This can happen +with ext2 filesystems or for small directories (take less than a lock) +which contain filenames that begin with a space or some other +punctuation mark. (Addresses Debian Bug: #573923, Addresses Launchpad +Bug: #525114) + + +Programmer's Notes +------------------ + +Add new test, f_rehash_dir, which checks to make sure e2fsck -D works +correctly. + +The libcom_err function now has support for Heimdal's com_right_r +function(). (Addresses Sourceforge Bug: #2963865, Addresses Debian +Bug: #558910) + + +E2fsprogs 1.41.10 (February 7, 2010) +==================================== + +Fix resize2fs bug which causes it to access invalid memory. + +Add libss support for libreadline.so.6. + +Fix e2fsck's check for extent-mapped directory with an incorrect file +type. + +Add new e2fsck.conf configuration option, default/broken_system_clock +to support systems with broken CMOS hardware clocks. Also, since too +many distributions seem to have broken virtualization scripts now, +e2fsck will by default accept dates which are off by up to 24 hours by +default. (Addresses Debian Bugs: #559776, #557636) + +Fix a bug where mke2fs may not use the best placement of the inode +table when there is only room for a single block group in the last +flex_bg. + +E2fsck is now smarter when it needs to allocate blocks in the course +of fixing file system problems. This reduces the number of spurious +differences found in pass #5. + +E2fsck will no longer rehash directories which fit in a single +directory block. + +E2fsck now correctly handles holes in extent-mapped directories (i.e., +sparse directories which use extents). + +Fix big-endian problems with ext2fs_bmap() and ext2fs_bmap2(). + +Fix a bug in filefrag where on platforms which can allow file systems +with 8k blocks, that it doesn't core dump when it sees a file system +with 8k block sizes. (Thanks to Mikulas Patocka for pointing this +out.) + +E2fsck will correctly fix directories that are have an inaccurate +i_size as well as other problems in a single pass, instead of +requiring two e2fsck runs before the file system is fully fixed. + +Fix e2fsck so it will correctly find and detect duplicate directory +entries for non-indexed directories. ( Addresses Sourceforge Bug: +#2862551) + +Mke2fs will use BLKDISCARD to pre-discard all blocks on an SSD or +thinly-provisioned storage device. This can be disabled using the -K +option. + +Enhance libext2fs so it works around bug in Linux version 2.6.19 +and earlier where the /proc/swaps file was missing the header on +the first line. + +Fix bug in Linux version 2.6.19 and earlier where the /proc/swaps file +was missing the header on the first line. + +Fix some big-endian bugs in e2fsck and libext2fs. + +Fix resize2fs so it works correctly on file systems with external +journals instead of failing early with the error "Illegal inode +number". + +Fix libss so that it does not seg fault when using a readline library +which does not supply a readline_shutdown() function. + +Updated dumpe2fs's usage message so it correctly gives the right +arguments summary for "-o superblock=<num>" and "-o blocksize=<num>". +(Addresses Launchpad Bug: #448099) + +Teach libext2fs to ignore the high 32 bits of the i_blocks field +when huge_file file system feature is set, but the inode does not +have the HUGE_FILE_FL flag set. + +Fix e2fsck's handling of 64-bit i_blocks fields. + +E2fsck will now print "Illegal indirect block", "Illegal +double-indirect block", etc., instead of "Illegal block #-1" or +"Illegal block #-2", etc. This makes it easier for users to +understand what has gone wrong. (Addresses SourceForge Bug: #2871782) + +Mke2fs now will obtain get device topology information from blkid and +use it to populate the superblock stride and stripe sizes. It will +also warn if the block device is misaligned + +Fix file descriptor leaks in fsck and debugfs. (Addresses Novell Bug: +##524526) + +Fix the libext2fs library code to round up the bitmap size to a 4-byte +boundary, to prevent spurious seg faults caused by the x86 +architecture. This doesn't affect Linux systems, but was a major +problem on a number of *BSD systems. (Addresses Sourceforge Bug: +#2328708) + +Fix resize2fs's minimum size required for a file system so it doesn't +fail when "resize2fs -M" is run. (Addresses RedHat Bugzilla: #519131) + +Dumpe2fs now prints summary information about the contents of the +journal. + +Avoid printing scary error messages when e2fsck starts running +problems on low-memory systems, as it tends to panic and mislead the +user. (Addresses Debian Bug: #509529) + +Fix blkid's modules.dep parser so it handles compressed (.ko.gz) +modules files. (Address Red Hat Bug: #518572) + +Fix tune2fs so it can add a journal when an extent-enabled file system +is mounted. (Addresses Launchpad bug: #416648) + +Update Czech, Indonesian, Polish and Vietnamese translations (from the +Translation Project). + +Update/clarify man pages. (Addresses Sourceforge Bug: #2822186) + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs: #540111) + +Programmer's Notes +------------------ + +The configure script supports the --with-cc, --with-ccopts, and +--with-ldopts options. Instead, the more standard use of CC=, +CCFLAGS=, and LDFLAGS= in the configure command line is used instead. +Also, --with-ld, which never worked, was also removed. +(Addresses Sourceforge Bug: #2843248) + +The in-tree header files are only used if the in-tree uuid or blkid +libraries are used. Otherwise, use the system-provided uuid or blkid +header files if using the system-provided libraries. + +Fix some build failures caused by --disable-* configure options. + +Work around a bug in autoconf 2.64. + + +E2fsprogs 1.41.9 (August 22, 2009) +================================== + +Fix a bug in e2fsck routines for reallocating an inode table which +could cause it to loop forever on an ext4 filesystem with the FLEX_BG +filesystem feature with a relatively rare (and specific) filesystem +corruption. This fix causes e2fsck to try to find space for a new +portion of the inode table in the containing flex_bg, and if that +fails, the new portion of the inode table will be allocated in any +free space available in the filesystem. + +Make e2fsck less annoying by only asking for permission to relocate a +block group's inode table once, instead of for every overlapping +block. Similarly, only ask once to recompute the block group +checksums, instead of once for each corrupted block group's checksum. + +Fix filefrag to avoid print the extent header if the FIEMAP ioctl is +not present, and it needs to fall back to using the FIBMAP ioctl. + +Fix filefrag to correctly print the number of extents for zero-length +files. (Addresses Debian Bug: #540376) + +Filefrag now has a -B option which forces the use of the FIBMAP ioctl +to more easily debug the FIBMAP code. + +Fixed filefrag for non-extent based files. + +Add a new program, e2freefrag, which displays information about the +free space fragmentation in an ext2/3/4 filesystem. + +Fix inode resizing via tune2fs -I so that it works correctly in the +face of non-empty bad blocks inodes, and if the filesystem was +formatted using the "mke2fs -E stride=N" option for RAID arrays. + +Fix regression in ext2fs_extent_set_bmap() caused e2fsck -fD to fail +and corrupt large directories if the directory needs to shrink by more +than one block. (Addresses Debian Bug: #537510) + +Fix e2fsck's buggy_init_scritps=1 so that the if the last write and/or +last mount times are in the future, they are corrected even if +buggy_init_scripts is set. This is needed because otherwise resize2fs +will refuse to resize the filesystem, even after running "e2fsck -f". +(Addresses Launchpad bug: #373409) + +E2fsck will now print much fuller information when the last mount time +or last written time is in the future, since most people can't seem to +believe their distribution has buggy init scripts, or they have a +failed CMOS/RTS clock battery. + +Enhance dumpe2fs to dump the extent information via the 'stat' +command, and more detailed extent information via the new command +'dump_extents'. + +Update French, Polish, Czech, and Swedish translations from the +Translation Project. + +Fixed various Debian packaging issues --- see debian/changelog for +details. + +Programmer's Notes +------------------ + +Fixed miscellaneous gcc -Wall warnings. + +Fixed memory leak in error path in ext2fs_block_iterate2() + +Fixed non-Linux build of the intl directory by adding support for the +E/Q/V macros. + +The bitmap read/write functions now treat uninitialized bitmaps as +unallocated; this fixes a number of problems in all e2fsprogs for ext4 +filesystems when there is a need to allocate new blocks or inodes, and +there aren't any free blocks or inodes in the already-used block +groups. + +Improve ext2fs_extent_set_bmap() to avoid creating new extents which +get inserted into the extent tree when they are not needed. + + +E2fsprogs 1.41.8 (July 11, 2009) +================================ + +Fix resize2fs's online resizing, fixing a regression which in +e2fpsrogs 1.41.7. (Addresses Debian Bug: #535452) + +Fix potential filesystem corruptions caused by using resize2fs to +shrinking ext4 filesystems with extents enabled. (Addresses Red Hat +Bug: #510379) + +Optimize uuid_generate() to avoid running uuidd if it is not setuid or +setgid and the currently running program doesn't have write access to +the uuidd work directory. + +Add safety checks (for non-Linux systems) so that uuidd isn't run with +file descriptors 0, 1, and 2 closed; and if they are closed, uuidd +will be careful not to close the file descriptor for its unix domain +socket when it detaches itself from the controlling tty. Also add +safety checks so that if the unix domain socket between the uuid +library and uuidd program is closed for any reason, both the library +and the uuidd will return an appropriate error code instead of looping +in an infinite loop. + +The e2croncheck script, which creates an LVM snapshot and then checks +the ext3/4 filesystem via the LVM snapshot, has been added to the +contrib directory. + +Fix the filefrag program for files that have more than 144 extents. + +Update French, Polish, Czech, Indonesian, and Swedish translations from +the Translation Project. + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bug #535530) + +Update/clarify man pages. + +Programmer's Notes +------------------ + +Fix compilation problem when configured with --disable-uuid. + +Don't build uuidgen if configured with --disable-uuid. + +Add the new library function ext2fs_test_inode_bitmap_range(), and +optimized ext2fs_test_block_bitmap_range(), which will be needed for +future optimizations for e2fsck. + +Fix makefile dependencies for libcom_err so that the Makefiles work +well on non-GNU make program. (Addresses Sourceforge Patches: #2813809) + +Enhance the build system so that the full set of commands executed by +the Makefiles are displayed, instead of the Linux kernel summary +output, if the build was configured with --enable-verbose-makecmds, or +if GNU make is in use and the V variable is non-null, i.e., via "make +V=1". + + +E2fsprogs 1.41.7 (June 29, 2009) +================================ + +Fix a bug in libext2fs which can cause e2fsck and resize2fs to write +uninitialized data into the portion of the inode beyond the first 128 +bytes when operating on inodes mapped via extents; potentially +corrupting filesystems. + +Fix memory leaks in e2fsprogs, including a very large memory leak +which can cause e2fsck to run out of memory when checking very large +filesystems using extents. + +The logsave program will now filter out the ^A and ^B characters when +writing to the console. + +Harden ext2fs_validate_entry() so that lsdel will not read beyond the +end of the block even if the directory block is corrupted. + +Fix debugfs from core dumping if the logdump command fails to open the +output file. + +Enhance badblocks to print the currently tested block number when +interrupted with ^C. + +Fix lsattr to exit with a non-zero status when it encounters errors. +(Addresses RedHat Bugzilla #489841) + +Fix e2fsprogs to use the same encoding for rec_len in 64k (and larger) +filesystems as the kernel when encoding rec_len >= 64k. For 64k +filesystems (currently all that is supported by e2fsprogs, this is +only a minor corner case). + +Resize2fs will now update the journal backup fields in the superblock +if the journal is moved; this avoids an unnecessary full fsck after +resizing the filesystem. (Addresses RedHat Bugzilla: #505339) + +Fix libext2fs to properly initialize i_extra_size when creating the +journal and resize inodes. + +Change badblocks to allow block sizes larger than 4k. + +Fix the filefrag program so it correctly checks for errors from the +fiemap ioctl. + +Update Chinese and Czech translation from the Translation Project. + +Clean up various man pages. (Addresses Debian Bug #531385 and #523063) + + +Programmer's Notes +------------------ + +Add --disable-libuuid option to configure which uses an in-system +installed version of libuuid; the private version is enabled by +default. + +Add --valgrind-leakcheck option to the test_script program which runs +valgrind with the appropriate options to find memory leaks. + + +E2fsprogs 1.41.6 (May 30, 2009) +=============================== + +Fix a critical regression in e2fsck introduced version 1.41.5 which +can undo updates to the block group descriptors after a journal replay. + +If e2fsck receives an I/O error while replaying the journal, prompt +the user whether they want to ignore the error or not; if e2fsck is +run in preen mode, force fsck to abort the preen pass. + +Fix a bug which would cause e2fsck to core dump if the filesystem +contains a corrupt extent header, and the user declines to clear the +inode. (Addresses Sourceforge Bug: #2791794) + +Fix e2fsck to restart only once in the case of multiple block groups +which inodes in use that are in the uninitialized part of the block +group's inode table. + +To reduce user confusion, if the /etc/mtab file is missing +ext2fs_check_mount_point and ext2fs_check_if_mounted will return a +new, explicit error code to indicate this case. This will cause +e2fsck to give a clearer error message when the user is using buggy +rescue CD's that don't properly set up /etc/mtab. (Addresses Debian +Bug: #527859) + +Fix e2fsck so that if the primary group descriptors are corrupted, but +the backup superblock is entirely invalid, to go back to using (and +fixing) the primary group descriptors instead of completely giving up +on the filesystem. (Addresses Debian Bug: #516820) + +Change e2fsck to not abort a preen pass if an inode is found to have +i_file_acl_hi non-zero. Ext3 filesystems don't care, and newer +kernels (post 2.6.29) will ignore this field. So let's fix it +automatically during the preen pass instead of forcing the user to fix +this up manually. (Addresses Debian Bug: #526524) + +Add resource tracking for e2fsck passes 1b through 1d. + +Speed up e2fsck by eliminating unnecessary journal checks if the +filesystem is already mounted and doesn't need recovery (since the +kernel would have run the journal when the filesystem was mounted.) +Also speed up e2fsck by avoiding unnecessary block group descriptor +updates in ext2fs_close(). + +Add support to chattr to migrate inodes from using direct/indirect +blocks to extents. + +Avoid corrupting the filesystem if there is an attempt to shrink a +filesystem using resize2fs smaller than possible by making +ext2fs_set_bmap() more careful not to delete the old block until the +new block can be inserted. In addition, fix a bug in how the minimum +size of the filesystem (plus a safety margin) is calculated, and +modify resize2fs to refuse to shrink the filesystem below that minimum +size without the force flag. + +Teach blkid to try to figure out DM device names using take advantage +of information in sysfs when running on kernels (2.6.29 and later) +which provide this information in /sys/block/dm-<N>/dm/name; this is +much faster than scanning for the device number in /dev/mapper. + +Fix blkid to prefer /dev/mapper/<name> device names instead of the +private /dev/dm-X names. + +Add an -a option to debugfs's close_filesys command which writes any +changes to the superblock or block group descriptors to all of the +backup superblock locations. + +Add support to the filefrag program to use the FIEMAP ioctl. + +Update Chinese translation from the Translation Project. + +Clean up various man pages. (Addresses Red Hat Bugzilla: #502971 and +Launchpad Bug: #381854) + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bug #506064) + + +Programmer's Notes +------------------ + +Add test code to make sure e2fsck's problem.c doesn't have two problem +codes assigned to duplicate values. + +Avoid using a hard-coded path for /bin/rm in block's test_probe.in. +(Addresses Sourceforge Bug: #2780205) + +Clean up e2fsck by removing #ifdef RESOURCE_TRACK by adding an empty +function declaration for init_resource_track() and +print_resource_track() when RESOURCE_TRACK is not defined. + +The test code which is used to build the tst_csum program has been +moved from from tst_csum.c into csum.c under an #ifdef DEBUG to to +avoid compile problems caused by not having a prototype for +ext2fs_group_desc_csum(). (Addresses Sourceforge Bug #2484331) + +Update the config.guess and config.sub file to the latest from the +FSF, to allow e2fsprogs to build on the avr32 platform. (Addresses +Debian Bug: #528330) + +Add a new function, ext2fs_extent_open2(), which behaves like +pext2fs_extent_open(), but uses the user-supplied inode structure +when opening an extent instead of reading the inode from disk. + + +E2fsprogs 1.41.5 (April 23, 2009) +================================= + +Fix a number of filesystem corruption bugs in resize2fs when growing +or shrinking ext4 filesystems off-line (i.e., when the ext4 filesystem +is not mounted). + +Debugfs can now set i_file_acl_high via the set_inodes_field command, +and print a 64-bit file acl. This is useful for debugging filesystem +corruptions where the high bits of i_file_acl_high are set. E2fsck +will detect and fix non-zero i_file_acl_high on 32-bit filesystems +since some Linux kernel versions pay attention to this field even when +they shouldn't. + +Speed up e2fsck when checking clean filesystems by avoiding +unnecessary block reads, and coalescing the block group descriptor +blocks so they are read using a single read operation. + +The libuuid library will now close all file descriptors before running +uuidd. This avoids problems when the calling program has open sockets +which then never get closed because uuidd is a long-running helper +daemon. (Addresses Launchpad bug: #305057) + +In order to avoid unnecessary full filesystem checks by e2fsck after +an on-line resize, e2fsck will ignore the NEEDS_RECOVERY flag set on +the backup superblocks. (Addresses Red Hat Bugzilla: #471925) + +Mke2fs will avoid trying to create the journal when run in +superblock-only mode (mke2fs -S), since the left-over journal in the +inode table will cause mke2fs to fail. + +Fix a bug in libext2fs functions that check to see if a particular +device or filesystem image is mounted, which would cause these +functions to report that a file identical to the (relative) pathname +used by a pseudo-filesystem was mounted when in fact it was not. + +Update Czech translation from the Translation Project. + +Add Chinese (simplified) translation from the Translation Project. + +Fix support for external journals (which was broken in e2fsprogs +1.41.4). + +Fix a regression in debugfs where the "stat" command when no +filesystem was open would cause debugfs to crash with a segmentation +violation. + +Starting in the 2.6.29 linux kernel, the ext4 filesystem driver can be +used to support filesystems without a journal. Update the blkid +library so it understands this. + +The blkid library will remove an entry from the blkid cache +representing the entire disk if partitions are found, since presumably +the device previously had no partition table, but has now transitioned +to using a partition table. + +Add a check to mke2fs and tune2fs that the argument to the -m option +(which specifies the reserved ratio) must be greater than zero. +(Addresses Debian Bug: #517015) + +Add support for tracking the number kilobytes written to the +filesystem via the superblock field s_kbytes_written. It will be +updated by the kernel as well as by e2fsprogs programs which write to +the filesystem. This is useful for tracking the wear to filesystems +on Solid State Drives. + +Fix compatibility issue in the libext2fs info file and makeinfo +version 4.12. (Addresses Red Hat Bugzilla: #481620) + +Update/clarify man pages. (Addresses Debian Bug: #515693, #365619) + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bug: #506279) + +Programmer's Notes +------------------ + +Fix Hurd compilation problem in e2fsck and tune2fs (Addresses Debian +Bug: #521602) + +Fix various gcc compilation warnings and other programming cleanups. +(Addresses Red Hat Bugzilla: #486997) + +Add support for building the blkid command statically. + +Add support for disabling the built-in blkid library in favor of a +system-installed blkid implementation via the configure option +--disable-libblkid. + + +E2fsprogs 1.41.4 (January 27, 2009) +=================================== + +Fixed a bug which could sometimes cause blkid to return an exit value +of zero for a non-existent device (Addresses Debian Bug: #502541) + +Blkid will now recognize ext3 filesystems that have the test_fs flag +set as ext3 filesystems. + +The blkid library will now recognize btrfs filesystems and swap +devices currently used by user-level software suspend. + +Tune2fs now updates the block group checksums when changing the UUID +to avoid causing e2fsck to complain vociferously at the next reboot. + +Tune2fs's inode size resizing algorithms have been fixed so it is not +vastly inefficient for moderate-to-large filesystems, due to some +O(n**2) and O(n*m) algorithms that didn't scale well at all. + +Fix tune2fs's inode resizing algorithm so it will not corrupt +filesystems laid out for RAID filesystems; in addition, tune2fs will +refuse to change the inode size for filesystems that have the flex_bg +feature enabled. (This is a limitation in the current implementation +of tune2fs -I.) + +E2fsprogs 1.41 broke debugfs's logdump command for normal ext3/4 +filesystems with 32-bit block numbers, when the headers for 64-bit +block numbers was added. This regression has been fixed. + +Debugfs's ncheck command has been fixed to avoid printing garbage +characters at the end of file names. + +Fix resize2fs for ext4 filesystems. Some blocks that that need moving +when shrinking filesystems with uninit_bg feature would not be moved. +In addition, blocks and inode table blocks were not being correctly +freed when shrinking filesystems with the flex_bg feable, which caused +resize2fs -M to fail. Finally, when blocks are moved, make sure the +uninitialized flag in extents is preserved. + +Fix bug which caused dumpe2fs to abort with an error if run on a +filesystem that contained an external journal. + +Some distributions used "mke3fs" as an alias for "mkfs.ext3"; check +for this in argv[0] to provide better legacy support for these +distributions. This is a practice that should NOT be continued, +however. + +Mke2fs now has a new option -U, which allows the user to specify the +UUID that should be used for the new filesystem. + +Mke2fs will treat devices that are exactly 16TB as if they were 16TB +minus one block. This allows users who have read that ext3 supports +up to 16TB filesystems and who create a 16TB LVM to not get confused, +since the true limit is really 16TB minus one block. + +E2fsck will no longer abort an fsck run if block group has an errant +INODE_UNINIT flag. + +E2fsck now distinguishes between fragmented directories and fragmented +files in verbose mode statistics and in the fragcheck report. + +Fix a bug in e2fsck which caused it double count non-contiguous +extent-based inodes. + +E2fsck will leave some slack space when repacking directories to allow +room for a few directory entries to be added without causing leaf +nodes to be split right away. + +Fix a bug which caused e2fsck to crash when it comes across a +corrupted interior node in an extent tree with the error message: +"Error1: Corrupt extent header on inode XXXXXX" + +E2fsck problem descriptions involving the journal are no longer +referred to as "ext3" problems, since ext4 filesystems also have +journals. + +Fix a long-standing bug in e2fsck which would cause it to crash when +replying journals for filesystems with block sizes greater than 8k. + +Update Catalan translation from the Translation Project. + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs: #503057, #502323, #511207) + +Programmer's Notes +------------------ + +Fix build of e2fsck.profiled, and add support for building profiled +binaries in the misc directory if configured with --enable-profile. + +The ext2fs_open() function now performs more sanity checks on the +superblock to avoid potential divide by zero errors by other parts of +library. + +The ext2fs_read_inode_full() function now has a safety check to avoid +a segmentation fault on corrupted filesystems. + +The ext2fs_new_inode() function now has a sanity check so that if the +s_first_inode field in the superblock is insane, it will return +EXT2_ET_INODE_ALLOC_FAIL instead of returning an invalid inode number. + +To avoid segmentation faults, ext2fs_block_alloc_stats() and +ext2fs_inode_alloc_stats() now validates the passed inode or block +number to avoid overrunning an array boundary. + +Various signed/unsigned errors for variables containing block numbers +have been fixed. + +Accommodations for gcc's stupidity in not realizing that constant +strings that do not contain a '%' character are safe to use in format +strings have been made so that distributions that want to compile +e2fsprogs with -Werror=format-security have an easier time doing so. + +Added a new 64-bit getsize interface, ext2fs_get_device_size2(). + +Added the utility make-sparse.c to the contrib directory. + +The ext2fs_block_iterate2() function now reflects errors from +ext2fs_extent_set_bmap() to the caller, if the callback tries to +change a block on an extent-based file, and ext2fs_extent_set_bmap() +fails for some reason (for example, there isn't enough disk space to +split a node and expand the extent tree. + +The ext2fs_block_iterate2() function will preserve the uninit flag in +extents when the callback function modifies a block in an extent-based +file. + +E2fsck will now flag filesystems that have an insane s_first_ino field +in their superblock, and attempt to use a backup superblock to repair +the filesystem. + + +E2fsprogs 1.41.3 (October 12, 2008) +=================================== + +E2fsck has been fixed so it prints the correct inode number for +uinit_bg related problems. + +E2fsck will now offer to clear the test_fs flag if the ext4 filesystem +is available on linux. This can be disabled via a configuration +option in /etc/e2fsck.conf. + +Fix a file descriptor leak in libblkid when checking to see if an ext4 +or ext4dev module exists. + +Fix a bug in e2fsck where in preen mode, if there are disk I/O errors +while trying to close a filesystem can lead to infinite loops. +(Addresses Red Hat Bugzilla #465679) + +Fix a bug in resize2fs where passing in a bogus new size of 0 blocks +will cause resize2fs to drop into an infinite loop. (Addresses Red +Hat Bugzilla: #465984) + +Add a check in the Unix I/O functions in libext2fs so that when a +device is opened read/write, return an error if the device is +read-only using the BLKROGET ioctl. + +Fix debugfs's ncheck command so that it prints all of the names of +hardlinks in the same directory. + +Fix a bug in libblkid so it correctly detects whether the ext4 and +ext4dev filesystems are available, so that the ext4dev->ext4 +fallback code works correctly. + +Programmer's Notes +------------------ + +Fix a parallel build problem by making sure util/subst is built before +trying to build the lib/et directory. (Addresses Sourceforge Bug: +#2143281) + +Updated "make depend" information for crc16.o + + +E2fsprogs 1.41.2 (October 2, 2008) +================================== + +Fix e2fsck's automatic blocksize detection. This fixes a regression +from e2fsprogs 1.40.7 which caused e2fsck to fail if the user +specifies a block number using the -b option if the blocksize option +isn't also specified using -B. Unfortunately, users very commonly +invoke e2fsck using "e2fsck -b 32768 /dev/hdXXX" to use the backup +superblock; in fact e2fsck will often suggest this kind of command +line. Oops. + +Enhance the debugfs's "ncheck" command so it will print all of the +pathnames for the specified inodes. (Previously, in some cases ncheck +might not print a pathname for an inode at all if some of the other +inodes had multiple hard links.) + +Enhance debugfs's "hash" command so the hash seed can be specified via +a command-line option. In addition, allow the hash algorithm to be +specified by name instead of just by number. + +Fix e2fsck so that we don't accidentally print the translation file's +header when asking the user a custom question so there is no prompt +defined for a particular problem record. For example, the question +"Run journal anyway" will get the PO header tacked on because e2fsck +erroneously passed the null string to _(). (Addresses Launchpad Bug: +#246892) + +Enhance badblocks so that it can test a normal file which is greater +than 2GB. + +Enhance the badblocks command so that it displays the time and +percentage complete when in verbose mode. (Addresses Debian Bug: +#429739) + +Fix a potential memory leak in a error handling path in debugfs's +ncheck function. + +Fix a potential memory corruption problem if a memory allocation fails +in resize2fs. + +Fix the usage message for debugfs's logdump command to be consistent +with its man manpage. + +Update Polish, French, Vietnamese, Dutch, Indonesian, German, Czech, +and Swedish translations from the Translation Project. + +Add documentation for the file I/O functions to the libext2fs.texinfo +file. (Addresses Debian Bug: #484877) + +Update and clarified various man pages. (Addresses Launchpad Bug +#275272; Addresses Debian Bugs: #498100, #498101, #498102, #498103) + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bug: #497619) + +Programmer's Notes +------------------ + +Fix a potential file descriptor leak in libcom_err by setting the +close-on-exec flag for a fd used for debugging. (Addresses Red Hat +Bugzilla #464689) + +Fix a potential race in libcom_err by using sem_post/sem_init. SuSE +has been carrying a patch for a long time to prevent a largely +theoretical race condition if a multi-threaded application adds and +removes error tables in multiple threads. Unfortunately SuSE's +approach breaks compatibility by forcing applications to link and +compile with the -pthread option; using pthread mutexes has +historically been problematic. We fix this by using sem_post/sem_init +instead. + +Fix e2fsprogs-libs build failure due to 'subs' target. (Addresses +Sourceforge Bug: #2087502) + +Avoid linking e2initrd_helper, debugfs, blkid, and fsck with unneeded +libraries when using ELF shared libraries. + +Fix ELF shared library when building on systems that don't already +have the e2fsprogs shared libraries already installed. (Addresses +Sourceforge Bug: #2088537) + +Fix the pkg-config files so they work correctly when linking with +static libraries and fix the include directory so programs don't have +to use #include <ext2fs/ext2fs.h>, but can use #include <ext2fs.h> +instead. (Addresses Sourceforge Bug: #2089537) + +Make sure ext2fs_swab64() is compiled for all platforms, and not just +for x86. (Addresses Debian Bug: #497515) + +Remove the unused ext2fs_find_{first,ext}_bit_set() functions for all +non-x86 platforms. (They had been removed for x86 earlier.) + +Fix diet libc compilation support, which had bitrotted due to lack of +TLC. Fixing this improves general portability. + +When installing the link library when using ELF shared libraries, +avoid using absolute pathnames if the link library and the shared +library are installed in the same directory. (Addresses Sourceforge +Bug: #1782913) + +Fix gen-tarball so it will work even if the top-level directory has +been renamed to something other than "e2fsprogs". Also make +gen-tarball print the size of the resulting tar.gz file. + + +E2fsprogs 1.41.1 (September 1, 2008) +==================================== + +Many people are forgetting to update their mke2fs.conf file, and this +causes ext3, ext4, and ext4dev filesystems won't get created with the +proper features enabled. We address this in two ways. First, mke2fs +will issue a warning if there is not definition for an ext3, ext4, or +ext4dev filesystem and the user is trying to create such a filesystem +type. Secondly, when installing from a source build, "make install" +will provide basic configuration file handling for /etc/mke2fs.conf. +If it exists, and does not mention ext4dev, it will be moved aside to +/etc/mke2fs.conf.e2fpsrogs-old and the new /etc/mke2fs.conf file will +be installed. If the existing /etc/mke2fs.conf file does mention +ext4dev, then "make install" will install official mke2fs.conf file as +/etc/mke2fs.conf.e2fsprogs-new and issue a message to the user that +they should look to see if any changes need to be merged. + +The mke2fs program will now create the journal in the middle of the +filesystem, since this minimizes seek times on average for fsync-heavy +workloads. In addition, mke2fs will now create journals using extents +for filesystems that support them. This results in a more efficient +encoding for the journal since it eliminates the need for using +indirect blocks. + +The mke2fs program will avoid allocating an extra block to the +journal. (Addresses Sourceforge Bug: #1483791) + +Mke2fs will correctly enforce the prohibition against features +(specifically read-only features) in revision 0 filesystems. (Thanks +to Benno Schulenberg for noticing this problem.) + +Mke2fs previously would occasionally create some slightly non-optimally +placed inode tables; this bug has been fixed. + +The mke2fs and tune2fs programs now print the correct usage message +describing the maximum journal size. (Addresses Debian Bug: #491620) + +Add support for setting the default hash algorithm used in b-tree +directories in tune2fs (from a command-line option) or mke2fs (via +mke2fs.conf). In addition, change the default hash algorithm to +half_md4, since it is faster and better. + +The blkid library will now recognize MacOS hfsx filesystems, and +correctly extract the label and uuid for hfs, hfsx, and hfsplus +filesystems. (Addresses Sourceforge Feature Requests: #2060292) + +The blkid library has improved detection of JFS and HPFS filesystems. +(Addresses Launchpad Bug: #255255) + +The blkid library is now much more efficiently handling devicemapper +devices, mainly by no longer using the devicemapper library. This can +speed up access for systems with a large number of device mapper +devices. + +Blkid had a number of cache validation bugs in libblkid that have been +fixed. (Addresses Debian Bug: #493216) + +Resize2fs will now properly close out the "updating inode references" +progress bar so there is a newline printed before printing the final +"resize is successful" message. + +Resize2fs will now correctly handle filesystems with extents and/o +uninitialized block groups correctly when file/directory blocks need +to relocated (i.e., when shrinking a filesystem or if the resize_inode +is not present). To support this, the ext2fs library now supports +initializing inode and block bitmaps that are not yet initialized when +allocating them using ext2fs_new_block() and ext2fs_new_inode(). In +addition, e2fs_block_iterate2() can now support changing the location +of interior nodes of an extent tree, and ext2fs_extent_set_bmap() has +been optimized to avoid creating unnecessary new extents when updating +the location of blocks in the extent tree. This will also help out +e2fsck's recovery of obscurely corrupted filesystems with extents, +when blocks are claimed by multiple inodes. + +Add support for on-line resizing ext4 filesystem with the flex_bg +filesystem feature. The method for doing so is not optimal, but to do +a better job will require kernel support. + +E2fsprogs 1.41.0 introduced a bug in libext2fs which caused e2image and +debugfs programs to not be able to read e2image files; the signed +vs. unsigned bug in the code which read bitmaps from the e2image has +been fixed. (Addresses Debian Bug: #495830) + +Resize2fs is now correctly managing the directory in-use counts when +shrinking filesystems and directory inodes needed to be moved from one +block group to another. This bug has been around since e2fsprogs +1.26, and is largely harmless, but does cause a filesystem corruption +which will be flagged by e2fsck after the filesystem has been shrunk. + +E2fsck will no longer issue spurious complaints about the inode size +caused by very large extent-based files, and by blocks reallocated +using fallocate() with the FALLOC_FL_KEEP_SIZE option. (Addresses +Kernel Bugzilla: #11341) + +Mke2fs will now set the creation timestamp on the lost+found directory +and the root directory. (More generally, all new inodes created using +the ext2fs library will correctly set the creation timestamp.) + +E2fsck now correctly calculates ind/dind/tind statistics in the +presence of extent-based files. In addition, "e2fsck -v" will report +statistics of the depth of extent trees in the filesystem. E2fsck can +also give an inode fragmentation report using "e2fsck -E fragcheck" +which can be useful when debugging the kernel block allocation +routines. + +Fix support for empty directory blocks in ext4 filesystems with 64k +blocksize filesystems. + +E2fsck will now print the depth of corrupt htree directories. + +Debugfs's htree command now correctly understands extent-based +directories. It will also print out the minor hash as well as the +major hash. + +Debugfs has a new command which will print the supported features of +e2fsprogs, to enable scripts to know whether the installed version of +e2fsprogs can support a specific feature. + +Debugfs will now write files using extents for filesystems that +support them. + +The error message printed by "tune2fs -I" if the inode size was too +small was rather confusing, so it has been improved. Also, we won't +try to create an undo log until we know that command-line-specified +parameters such as "tune2fs -I <inode size>" are valid. + +Given some filesystems found "in the wild" that had non-zero block +group checksums even though the uninit_bg/gdt_sum feature was not +enabled, e2fsck would issue spurious error messages. Teach +ext2fs_group_desc_csum_verify() to ignore the block group checksum +entirely if the feature flag is not set. (Addresses Debian Bug: +#490637) + +The blkid program will now print out a user-friendly listing of all of +the block devices in the system and what they contain when given the +-L option. (Addresses Debian Bug: #490527) + +The filefrag program now has a more accurate calculation for the +number of ideal extents. (Addresses Debian Bug: #458306) + +The test I/O manager is now enabled by default, but its overhead is +only incurred when it would be enabled via the TEST_IO_FLAGS or +TEST_IO_BLOCK environment variables. + +Typographical errors in various program strings and usage messages +have been fixed; most of these were pointed out by the e2fsprogs +message catalog translators. (Thanks, translators!) + +Update and clarified various man pages, as well as some typographical +errors in the libext2fs texinfo file. + +Fixed various Debian packaging issues --- see debian/changelog for +details. + +Add Indonesian and update French, Polish, Dutch, German, Swedish, +Czech, and Vietnamese Translations. (Addresses Debian Bugs: #313697, +#401092) + +Programmer's Notes +------------------ + +Fix portability problem with the badblocks group; for systems that +don't have nanosleep(), try using usleep() instead. + +The "make check" target in the e2fsck directory now sets +LD_LIBRARY_PATH before running the various e2fsck internal library +regression tests. + +The crc32 regression test in the e2fsck library is now portable to +greater variety of environments, including big-endian systems and +when cross-building e2fsprogs for embedded systems. (Addresses +Sourceforge Bug: #2019287) + +The ext2fs_extent_set_bmap() had some bugs when setting the first +block in a file, or when replacing a single block extent. Those cases +fortunately were came up relatively rarely when e2fsck was checking +files, but caused some problems when resize2fs was shrinking +extent-based files. + +Fix a potential core-dumping bug in libe2p's iterate_on_dir() +function. + +Various ext2fs library functions --- ext2fs_block_iterate2(), +ext2fs_initialize() and ext2fs_extent_open() --- now correctly free +allocated memory to avoid memory leaks in all of their error return +paths. + +Ext2ed was failing to build because masix support had been removed in +the rest of e2fsprogs, so ext2ed no longer has masix support, either. + +The configure script now respects the LDFLAGS environment variable if +it is set when configure is called. (Addresses Sourceforge Feature +Request: #1937287) + +Libuuid is now more portable to the Windows platform. (Addresses +Sourceforge Feature Request: #1937287) + +The configure script now uses AC_MSG_{RESULT,WARN,ERROR} instead of +bare echo commands so that configure flags such as --quiet work +correctly. (Addresses Sourceforge Patches: #2058794) + +A few uses of sprintf have been removed from the ext2fs library to +make life easier for bootloaders with a limited libc environment. +(Addresses Sourceforge Bug: #2049120) + +The ext2fs_read_inode() checks the validity of the inode number passed +to it earlier, to avoid doing some needless work when it would fail +anyway. + +The ext2fs_open() checks the validity of the blocksize parameter +passed to it earlier, to avoid doing some needless work when it would +fail anyway. + +Disable a very annoying automatic "%.sh -> %" GNU make rule in the +top-level Makefile. That automatic rule is used to better support +SCCS, but it caused problems for a particular niche distribution which +likes to use configure.sh files to store the configure options used to +build a package. Unfortunately GNU make will use the configure.sh to +replace the configure script, resulting in a self-inflicted fork bomb +leading to an out-of-memory crash. + +To support old GNU C compilers don't use C99/C++ comments, but only +K&R style comments, and don't try to use __builtin_expect if __GNUC__ +is less than 3. (__builtin_expect is only supported for gcc versions +2.96 and up, and it's tricky to check for gcc 2.95 vs gcc 2.96; since +this is an optimization, we only try to use __builtin_expect for gcc 3 +and up.) + +In e2fsck's crc routines, make sure we use WORDS_BIGENDIAN instead of +__LITTLE_ENDIAN, which are only defined by glibc's header files and +hence isn't portable. + +For the convenience for some distributions that need a static tune2fs, +the Makefile for misc/ now has a tune2fs.static target. + +The ext2fs_block_iterate2() function now supports BLOCK_FLAG_APPEND +for extent-based files + +The ext2fs_bmap() function now supports BMAP_ALLOC for extent-based +files. + +All source files no longer have any trailing white space. + +The io_channel_read_blk64() and io_channel_write_blk64() functions are +now functions instead of C preprocessor macros to provide better +forward compatibility. + +The e2fpsrogs translation template now expands the @x abbreviation. + +Various namespace leakages in libblkid, libe2p, and libext2fs have +been fixed. + +Fix a parallel build problem in e2fsprogs. + +E2fsprogs is now more portable to Solaris. + * blkid no longer assumes that the TIOCGSIZE and TIOCGWINSZ ioctl's + are always present. + * Scripts do not assume that /bin/true is always in /bin + * Don't use __FUNCTION__ since Solaris's C99 doesn't support it. + * Flush stdio handles before calling setbuf(), since Solaris will + discard any pending output to the stream. + * Define _XOPEN_SOURCE to 600 since Solaris's header files are very + picky about which C compiler can be used for SUSv3 conformance. + Use of C99 is not compatible with SUSv2 (_XOPEN_SOURCE=500), + and C89 is not compatible with SUSv3 (_XOPEN_SOURCE=600). + Since we need some SUSv3 functions, consistently use SUSv3 so + that e2fsprogs will build on Solaris using c99. + * Solaris C99 does not support varargs C preprocessor macros + * Solaris header files pollute the C namespace if in/netinet.h + is included, which conflicts with e2fsprogs' use of the kmem_cache_t + typedef. + * Solaris ships with a pathetically ancient shell in /bin/sh so we + avoid the use of various more advanced shell constructs such as $(). + +The "make rpm" command will now take some extra configure options from +the build environment without needing to patch the source tree. + +The ext2fs_add_dir_block() function will now grow the dblist more +aggressively as an optimization to avoid copying the array too often. + +The e2fsck_write_bitmaps() will write the block and inode bitmaps +together instead of in two passes. + + +E2fsprogs 1.41 (July 10, 2008) +============================== + +Add support for ext4 filesystem features, in particular extents, +uninit_bg, flex_bg, huge_file, and dir_nlink features. Also add +support for checking journal checksums. Debugfs will print new +superblock and inode fields that were defined for ext4. For example, +the nanosecond and i_version fields of an inode, and the +s_min_extra_isize and s_wanted_extra_isize fields from the superblock. +Note: Resize2fs doesn't currently support the combination of flex_bg +and !resize_inode. (Addresses Debian Bug: #388452, #425477) + +Tune2fs can support migrating a filesystem from using 128 byte inodes +to 256 byte inodes, so it can take advantage of the full features of +ext4. + +Add support for "undo" support. E2fsck and mke2fs can optionally +record an undo log which can replayed by the program e2undo. + +E2fsck could damage a filesystem by trying to relocate inode tables +due to corrupted block group descriptors, where the attempted inode +table relocation would do far more harm than good. E2fsck has been +fixed to detect this these sorts of corrupted block group descriptors +much earlier in e2fsck processing, so it can try to use the backup +superblock and block group descriptors first. This should be a much +better strategy for recovering these types of corrupted filesystems. +(Addresses Sourceforge Bug: #1840291) + +E2fsck will display a more understandable message when the last check +field in the superblock is in the future. (Addresses Debian Bug: +#446005). + +E2fsck now performs more extensive and careful checks of extended +attributes stored in the inode. + +Enhance mke2fs to print a more explanatory error message when +ext2fs_get_device_size() returns EFBIG. (Addresses Debian Bug: +#488663) + +Fix mke2fs to use a default block size of 4k when formatting an +external journal device. This is done by using a fixed filesystem +type list that consists only of the single filesystem type "journal" +when looking up configuration keys in /etc/mke2fs.conf. (Addresses +Debian Bug: #488663) + +Speed up how mke2fs writes the journal data blocks by writing the disk +blocks in larger chunks. + +Fix blkid handling of stale devices. Fix a bug which could cause a +core dump while garbage collecting the blkid cache, and assure that +blkid_find_dev_with_tag() never returns a non-existent device. Also, +if a filesystem is found at a new /dev location, eliminate any +duplicate stale entries which can not be verified. +(Addresses Debian Bugs: #487758, #487783) + +Add more paranoid checks for LVM volumes and swap partitions in +blkid's probe function, to reduce the chances of false positives. + +The mke2fs program now has a much more sophisticated system for +controlling configuration parameters of a newly created filesystem +based on a split filesystem and usage type system. The -t option to +mke2fs was a deprecated alias to -c; it now specifies a filesystem +type (ext2, ext3, ext4, etc.), while the -T option can now be a comma +separated usage list. The filesystem type information and type +information is used to extract configuration parameters from the +/etc/mke2fs.conf file. + +The mke2fs program will no longer complain and request the -f option +when the user tries to create a filesystem with greater than 2**31 +blocks. + +When creating a filesystem for the GNU Hurd use a fs-type of Hurd and +adjust the mke2fs.conf file so filesystems for the Hurd are created +with a blocksize of 4096 and inode size of 128, which is all it knows +how to handle. (Addresses Debian Bug: #471977) + +Mke2fs will always make sure that lost+found always has at least 2 +blocks, even for filesystems with very large blocksizes (i.e., 64kb). + +Resize2fs will now print the minimum needed filesystem size if given +the -P option, and will resize the filesystem to the smallest possible +size if given the -M option. + +Fix resize2fs to clean up the resize_inode if all of the reserved gdt +blocks are consumed during an off-line resize. + +The "ls" command in debugfs now supports the -p option, which causes +it to quote the filenames so that spaces or tabs in directory entries +are easily visible. (Addresses Red Hat Bugzilla: #149480; Addresses +Sourceforge Feature Request: #1201667) + +Fix a potential off-by-one buffer overflow in the fs_device_name in an +e2image file. + +The chattr program will return a non-zero exit code in case of +failures, and error messages can be suppressed with the -f option. +(Addresses Red Hat Bugzilla: #180596) + +Fix a bug in badblocks which caused it to overrun an array and likely +crash if more than 8 test patterns are specified using the -t option. +(Addresses Debian Bug: #487298) + +Add support to badblocks to limit how quickly it reads from the disk +drive (so it can be used for background scrubbing), and so it will +abort after finding a given number of errors. + +Remove support for the legacy big-endian filesystem format which only +existed on extremely long-dead PowerPC kernels almost a decade ago. + +Remove MASIX support from e2fsprogs. + +Add I/O statistics reporting to e2fsck. + +Update Vietnamese, Polish, French, Spanish, German, Catalan, Dutch, +Czech translations. + +Fixed various Debian packaging issues --- see debian/changelog for +details. (Addresses Debian Bugs: #487443, #487675, #490003) + +Fixed spelling mistakes, typos, and otherwise clarified man pages. +(Addresses Debian Bugs: #393313, #487849, #440983, #440981) + +Programmer's Notes +------------------ + +Factor out bitmap code in preparation for adding 64-bit new-style +bitmaps. + +Fix gcc -Wall warnings + +Fix the pkg-config files so that private libraries are specified in +"Libs.private:". + +Fix the libext2fs.texinfo manual so it builds with modern versions of +texinfo. + +Silence the makefile from showing the awk command used to build the + +Clean up the badblocks group so to make it more portable and robust. + +Avoid using predictable filenames in /tmp in blkid's regression test +suite. Also remove bashism's in the regression test script. + +If the configure script is given --with-diet-libc, don't use thread +local storage, since diet libc doesn't support TLS. (Addresses +Sourceforge Bug: #2000654) + +Fix the blkid regression test suite to tolerate older versions of +mkswap that don't support the -U option. + +A few library routines have been converted to support 64-bit block +numbers; in particular, the I/O manager functions, the test_io, +inode_io, and unix_io managers have all be converted to support 64-bit +operation. + +Debugfs can now be extended for use by test programs. See +lib/ext2fs/extents.c for an example for how it can be used. The test +program links against the debugfs object files, and provides +additional commands by defining an auxiliary libss command table. + +The lazy_bg filesystem feature, which was only used by developer's +testing, has been removed since it has been largely supplanted by +uninit_bg. This also simplifies the code. + diff --git a/doc/RelNotes/v1.42.txt b/doc/RelNotes/v1.42.txt new file mode 100644 index 0000000..f0d2dd2 --- /dev/null +++ b/doc/RelNotes/v1.42.txt @@ -0,0 +1,1690 @@ +E2fsprogs 1.42.13 (May 17, 2015) +================================ + +Fixed a potential buffer overflow while closing a file system in +libext2fs. (CVE-2015-1572, Addresses Debian Bug: #778948) + +Fixed a bug which could cause e2fsck to corrupt Hurd file systems. +(Addresses Debian Bug: #760275) + +Fixed a deadlock which occurs when using systemd and e2fsck.conf's +logging feature. (Addresses Debian Bug: #775234) + +Fixed a bug which could cause programs using libext2's inode table +scanning functions from crashing on certain corrupted file systems. +(Addresses Debian Bug: #773795) + +Fixed dumpe2fs so it won't crash if the user doesn't specify a block +device (file system). (Addresses Debian Bug: #764293) + +Fixed e2fsck so if it notices unexpected HTREE blocks in pass 2, it +will report the correct directory inode containing the inconsistency. + +If e2fsck fails to grow the dir_info structure due realloc(3) not +having enough memory, it will now fail with explanatory message +instead of staggering on failing with a confusing internal error +messages. + +The tune2fs program will zero out the superblock journal backup +information when removing a journal from a file system. + +The mke2fs program now enables the large_file feature by default. + +Fixed a bug which could cause badblocks to crash if there are millions +and millions of bad blocks. + +Fixed some use-after-free bug in resize2fs and e2fsck. + +Fixed a memory leak in tune2fs. + +Fixed some bigendian bugs that had crept into both indirect and extent +handling inside libext2fs. + +Updated/fixed various man pages. + +Update Esperanto, German, and Spanish translations. Added Danish +translation. + +Programmer's Notes +------------------ + +Fixed coverity, sparse, gcc -Wall, and clang warnings/nits. + +Clean up some build system problems (build failures with various +configure options, fix Posix portability issues, etc.) + +The functions ext2fs_inode_alloc_stats[2]() and +ext2fs_block_alloc_stats[2]() now check the inode and block numbers +passed to them, to avoid crashes caused by buggy callers. + +The libext2fs directory iterator will now check for an invalid +directory entry length instead of possibly walking off the end of the +directory buffer. + + +E2fsprogs 1.42.12 (August 25, 2014) +=================================== + +Fix various e2fsck bugs when trying to repair bigalloc file systems. + +E2fsck can now repair a file system with an overly large +s_first_meta_bg field, which had previously caused all e2fsprogs +programs to crash when trying to open such a file system. + +Fix e2fsck so that it can correctly fix a number of rare file system +corruptions that were discovered when using a file system fuzzer. + +Fix e2fsck so it does not try to write back block group descriptors if +they have not been modified. + +Mke2fs program will now place metadata blocks in the last flex_bg so +they are contiguous. This reduces free space fragmentation in a +freshly created file system, as well as allowing mke2fs commands which +request extremely large flex_bg size to succeed. + +Mke2fs now creates hugefiles more efficiently (with fewer extent tree +blocks). + +Fix a 32/64-bit overflow bug that could cause resize2fs to loop +forever. (Addresses-Launchpad-Bug: #1321958) + +The resize2fs program will now use much less memory when resizing very +large file systems. + +Fix a bug which could cause resize2fs to get confused and produce a +corrupted file system when shrinking a file system that had been +previously expanded and converted to use the meta_bg file system +format, but which no longer needs to use the meta_bg file system +format any longer. This typically happened with large (> 16TB) file +systems. (Addresses Debian Bug: #756922) + +The e4defrag program will now defrag backwards-allocated files. + +Fix tune2fs updating UUID's when manipulating file systems with +external journals (both the file system and journal UUID). + +Fix tune2fs so it can remove an external journal for file systems with +a 1k block size. + +Add a new debugfs command, "inode_dump", which prints the inode in hex +and ASCII format. + +The debugfs's "set_inode_field" will now automatically allocate blocks +for indirect blocks and extent tree blocks. + +Fix debugfs's "set_inode_field" so can properly handle +"block[IND|DIND|TIND]". + +The debugfs "rdump" command will now take multiple source arguments. + +Fixed a double close(2) bug in "rdump" and "rdump -p". + +Fix debugfs's argument parsing for the freefrag command. + +Fix filefrag to properly handle using the FIBMAP ioctl (with -B). +(Addresses Launchpad Bug: #1356496) + +Clarified messages that were confusing users in debugfs, e2fsck, +mke2fs, and resize2fs (Addresses Debian Bugs: #758029, #757543, +#757544) + +Dumpe2fs will now complain if extra arguments are given to it. +(Addresses Debian Bug: #758074) + +Updated/fixed various man pages. (Addresses-Debian-Bug: #726760) + +Update Czech, Dutch, French, Polish, Spanish, Swedish, Ukrainian, and +Vietnamese translations. + +Programmer's Notes +------------------ + +The Unix I/O layer will now use pread[64]/pwrite[64] to reduce the +number of system calls issued. + +Fixed profiled build. + +The libext2fs library will now more efficiently split an extent tree +index block when appending to an end of a file. + +Fixed free block accounting for 64-bit file systems. + +Add a new function ext2s_inode_size_set() which takes care of all of +the required feature flag modifications. + +The regression tests no longer require the presence of the md5sum +program. + +Fix build failure on MIPS platforms on Debian (Addresses Debian Bug: +#754605) + +Fix various Coverity warnings (#1225003, #1229243, #1252003) + + +E2fsprogs 1.42.11 (July 9, 2014) +================================ + +Add support so that mke2fs can create hugefiles so that they are +aligned relative to the beginning of the disk, instead of relative to +the beginning of the partition, using the mke2fs.conf configuration +parameter "hugefiles_align_disk". + +Fix a bug which causes e2fsck to abort a journal replay on a file +system with bigalloc enabled. (Addresses Debian Bug: #744953) + +Add sanity checks so that mke2fs will refuse insanely large flex_bg +counts specified by the -G option. Insanely large flex_bg sizes can +result in a file system which can't be unmounted, or with extremely +pessimal metadata layouts. + +The mke2fs program will provide a better metadata layout for +moderately large (but believable) flex_bg counts, such as 133,072. + +The mke2fs program will also check the kernel version number to +determine whether the lazy_itable_init option is supported, so that +lazy inode table initialization can be used even if the ext4 is +compiled as a module which isn't loaded at the time that mke2fs is +run. + +Add description of ext4's mount options to the ext4 section 5 man +page. + +Improve the chattr man page and clean up the chattr usage message. + +E2fsck will now automatically fix a last mount time or last write time +which is in the future in preen mode, instead of aborting the fsck +check. + +Mke2fs will now check the file system revision number requested by the +command line, and reject it if it is too large. A file system with an +unsupported revision number will not be accepted by any of the other +file system tools, and this command line option is rarely used, so +let's try to help the user not shoot their own foot off. + +The debugfs program can now set the error count and associated +first_error and last_error fields in the superblock using the +set_super_value command. + +Resize2fs will not try to calculate the minimum size of a file system +if it contains errors. Otherwise a very badly corrupted file system +image can cause the minimum size calculation to loop forever. Since +resize2fs will not allow a file system marked as containing errors to +be resized. It's pointless to calculate the minimum size, so just +skip it. + +Fixed a typo in one of mke2fs's error message. + +If filefrag runs into an error, it will continue processing the rest +of the files specified on the command line, but then exit with an +error code. + +Filefrag now prints some additional new flags (such as +FIEMAP_EXTENT_ENCODED), and print unknown flags as hex values. + +Fixed support in filefrag for files with > 2**32 blocks on 32-bit +platforms. + +Fixed a file descriptor leak in debugfs when copying files. + +Fixed a regression introduced in 1.42.10 which caused mke2fs to fail +to create file systems larger than 2GB on 32-bit platforms. +(Addresses Red Hat Bugzilla: #1099892, Debian Bug: #752107) + +Add Esperanto and Ukrainian translations, and update Czech, Dutch, +French, German, Italian, Polish, Swedish, and Vietnamese +translations. + +Fixed various compiler warnings. + + +Programmer's Notes +------------------ + +The gcc "-checker" option has been long deprecated, so remove support +from e2fsprogs. It was causing a few people to be confused when they +tried enabling the configure option. + +Update to the latest version of the config.status and config.rpath +files, as well as newer versions of the autoconf files in aclocal.m4. +Also, move the e2fsprogs-specific macros to acinclude.m4, which allows +people who want to use autoreconf to do so. + +Make the use of strptime() function in debugfs to be more portable to +fix regression test failures for FreeBSD and MacOS. + +A few miscellaneous changes designed to make life easier for +translators. + +Fix the f_quota test and some Makefile dependencies if quota support +is not enabled. + +Fix cross-compilation support, which got broken in 1.42.10. +(Addresses Debian Bug: #753375) + +Delete lib/ext2_types.h on a make clean, and build it as necessary. + +Add a debug program used for libext2fs unit tests. + +Clean up the tests so that it avoids using GNU-specific behaviour in +mktemp. Make sure the temporary files are cleaned up if the tests are +interrupted. + +Add a new ext2fs_close_free() helper function which automatically +takes care of freeing the ext2_filsys structure even if ext2fs_close() +returns an error. + + +E2fsprogs 1.42.10 (May 18, 2014) +================================ + +Mke2fs now creates file systems in regular files (which is very often +used when maintaining virtual machine images) without requiring the +user to use the force option. In addition, the mke2fs output has been +made much less verbose and only displays information that users will +be more likely to find useful by default. + +Mke2fs now will ask the user to confirm that they want to continue +before wiping out a pre-existing file system, partition table, or LVM +physical volume. + +Mke2fs now has the ability to create file systems where all the +metadata is located at the very beginning of the device. This can be +useful for flash devices which have SLC flash at the beginning of the +disk, for FAT compatibility, for example. As part of this, mke2fs and +tune2fs can control the location of the data blocks used by the +journal inode. In addition, the new sparse_super2 feature allows for +even fewer (anywhere from zero to two) backup superblocks. + +Mke2fs now uses much less CPU when allocating the blocks used for very +large file systems. + +Mke2fs can now support creating a file system at an offset. This can +be useful when creating a disk image for virtual machines (Addresses +Debian Bug: #497984) + +Previously, e2fsck had a number of very serious bugs when checking a +file system which used the new the quota file system option (where the +quota inodes were stored in hidden inodes) and the quota inode was +inconsistent with the actual usage data. This problem was documented +in https://ext4.wiki.kernel.org/index.php/Quota. These problems have +been fixed in 1.42.10, so the quota should be safe to use with +e2fsprogs 1.42.10. + +Fixed in a bug in resize2fs which could cause shrink operation fail in +the unlikely situation when the inode table needs to be moved to a +location before the current location. + +Resize2fs now has a much more accurate (and less conservative) +estimation of how far the file system can be shrunk. This allows a +mostly empty filesystem which is a few terabytes, to be shrunk to a +few megabytes in a single resize2fs -M operation. + +E2fsck will now force a full file system check if there are any file +system inconsistencies detected in the super block. + +The filefrag program will now display the shared extent flag, which is +used by file systems such as btrfs. + +If the number of inodes in the file systems is larger than the time +that file system was created (as measured by the number of seconds +since January 1, 1970) e2fsck would print a scary (but otherwise +harmless) warning of file system corruption for each inode in the +orphan list. This false positive has been fixed. + +The e4defrag program has been fixed so it will no longer refuse with +filesystem with the 64-bit or the bigalloc feature enabled. + +The logsave program will print a much less scary message which could +lead users to believe something has gone very wrong with e2fsck exits +with a non-zero exit status (since this is normal after e2fsck has +automatically fixed a file system corruption during a preen +operation). (Addresses Debian Bug: #468821) + +When creating a file system which is larger than 16TB, the +resize_inode option must be disabled -- since the resize_inode simply +doesn't support reserving metadata block numbers which is larger than +32 bits. The mke2fs program does this automatically if the file +system size is determined automatically. It will now also do this if +the file size is specified explicitly. + +Fixed bugs associated with resize2fs and shrinking bigalloc file +systems. + +The e2fsck program will no longer try to add a UUID on a mounted file +system with checksums enabled, since this could leave the file system +checksums broken. + +Tune2fs will allow the removal of an external journal from file system +which is marked as needing the journal replayed when the force ("-f") +option is given twice. (Addresses Debian Bug: #559301) + +Tune2fs will no longer support enabling sparse_super if the meta_bg +file system feature is enabled, since it could result in data loss. +In practice, all modern file systems have sparse_super is enabled, so +it's not worth trying to change how tune2fs handles enabling the +sparse_super feature. + +Fixed support for 1k block file systems with the meta_bg feature. + +When the superblock is corrupt, e2fsck can't figure out the location +of the alternate superblock. Unfortunately, the routine that +calculates the location of the alternate superblock uses 8193 if it +can't figure this out, so the message printed by e2fsck always +suggests using "e2fsck -b 8193". This message has been fixed to +suggest both the superblock location of 8193 and and 32768. +(Addresses Debian Bug: #719185) + +The lookback mount detection code that was introduced in 1.42.9 wasn't +actually compiled in due to an autoconf oops, so it's fixed now in +1.42.10. (Addresses Debian Bug: #497984) + +A bug introduced in 1.42.9 would cause debugfs to print two error +messages if it found an error while parsing a user-supplied block +number. This has been fixed in 1.42.10. + +Update Czech, Dutch, French, German, Polish, Spanish, Swedish, and +Vietnamese translations. (Addresses Debian Bug: #703048) + +Updated/fixed various man pages. (Addresses Debian Bugs: #719189, +#719184) + +Fixed various Debian Packaging Issues. (Addresses Debian Bug: #718725) + + +Programmer's Notes +------------------ + +Fixed a lot of coverity, sparse, gcc -Wall, and clang warnings/nits. + +Allow the location of pkg-config files to be specified independent of +the libdir location via a makefile variable. + +Fixed parse-types.sh not to complain when cross-compiling and the +sizes of types are different between the target architecture and the +architecture of the build system + +Allow the regression test suite to work correctly on systems which do +not have the "truncate" or "mksawp" programs. + +Allow e2fsck to build correctly on systems (such as Android) that do +not have the signal.h file. + +E2fsprogs now has code coverage testing which can be enabled using +"configure --enable-gcov". + +The libe2p.h header file can now be used included by C++ programs. + +The profile/config file used by e2fsck and mke2fs will interpret +numbers with a leading 0 character to mean that they should be +interpreted as an octal integer. + +The extent handling functions in libext2fs have been improved so they +have proper rollback when there is an error splitting an extent. Also +fix a number of bugs when punching holes in files, and fix an +off-by-one bug when inserting an extent into an empty inode. + +The libext2fs library now handles the support of BLOCK_UNINIT by +clearing the portion of block bitmap when it is loaded, instead of +when it is used. This reduces the chances of bugs, and and simplifies +the code. It also means that debugfs will properly show that blocks +in uninitialized block groups as being unused when using the testb +command. + +The e4defrag program will try to use fadvise64 or posix_fadvise64() if +it is present, which allows 64-bit offsets on 32-bit systems. + + +E2fsprogs 1.42.9 (December 28, 2013) +==================================== + +Mke2fs will detect an attempt to create a file system on a loop +mounted file and complain without the -FF option. Also fixed mke2fs +so it allows the creation of a file system on a mounted device with +two -F options, as documented in the man page, instead of three -F +options. + +Fixed a large number of bugs in resize2fs, e2fsck, debugfs, and +libext2fs to correctly handle bigalloc and 64-bit file systems. There +were many corner cases that had not been noticed in previous uses of +these file systems, since they are not as common. Some of the bugs +could cause file system corruption or data loss, so users of 64-bit or +bigalloc file systems are strongly urged to upgrade to e2fsprogs +1.42.9. + +The tune2fs program will now not allow changing the uuid on a mounted +file system which has the uninit_bg feature enabled. This avoids a +nasty race where the kernel and tune2fs are both retrying rewrite the +group descriptors at the same time, with different ideas about what +the UUID should be. + +When e2fsck is rehashing an extent-mapped directory, it's possible +(although very rare) that an extent block will need to be allocated; +fix e2fsck to make sure that the block gets marked as used. + +Mke2fs will now properly set the LARGE_FILE feature when creating a +journal >= 2GB --- which can happen when using 64k block size. + +Fixed debugfs so that its freei command will correctly handle a request +to free a range of consecutive inodes. + +Fixed 2fsck so it will not erroneously complain that an external journal +is invalid if it is exactly 2**32 blocks. + +Fixed e2fsck so it won't try checking for, and adding, a missing +lost+found directory when running in read-only mode. + +Fixed e2image so that progress information won't get leaked to stdout. +(Addresses Red Hat Bugzilla: #1327329) + +Fixed e2image to avoid some buffer overruns which would cause it to when +creating a "standard (non-raw, non-qcow2) image file. Standard +e2image files are actually very rarely used, so we didn't notice when +the changes to enable the qcow2 format broke this e2image mode. + +Fixed mke2fs so that the extended option "-E resize=NNN" will not turn +on the resize_inode feature when the meta_bg feature is set, since +these two features can not be set at the same time. + +Fixed tune2fs so that when it disables the quota feature, it updates all +of the backup superblocks. + +Fixed dumpe2fs that would cause it to abort when run using an image file +when trying to print the journal information (which is not present in +an e2image created image file). + +Fixed a potential integer overflow in e2reefrag. +(Addresses-Debian-Bug: #718205) + +Enhance debugfs so that when copying a sparse file from a native file +system into the file system image using the "write" command, it will +create a sparse file into the destination file system. + +Enhanced debugfs so it can support a command line which is up to 8k +long. + +E2image will refuse (unless the -f option is specified to force the +issue) to create a raw or qcow image using a mounted file system, +unless the -f option is specified to force the issue. + +E2image has been optimized for using it to efficiently copy a file +system by only copying the allocated blocks, by using the options -ra. +New options (-o and -O) have been added so that a source and +destination offset can be given. The -p option will print progress +information so the user will know how far along the copy is going. +And finally, the new option -c is useful for updating a file system on +an SSD, by avoiding unnecessary writes. E2image can also shift a file +system image by doing an in place move. + +Fix a regression introduced in 1.42.8 which would cause e2fsck to +erroneously report uninitialized extents past the EOF (as determined by +i_size) to be invalid. + +Fixed resize2fs so under a corner case when an inode has a complex +extent tree, it will not corrupt an interior node in the extent tree. + +Fixed resize2fs which would sometimes corrupt a file system when +shrinking a file system to a minimum size using resize2fs -M. +(Addresses Debian Bug: #660793) + +Fixed resize2fs so that it will relocate inode table blocks if this +becomes necessary when shrinking the file system. + +Fixed resize2fs and e2fsck so they will not crash when hit a failure +while operating on a file system with the MMP feature enabled. + +Fixed a bug in debugfs which caused it create an invalid inode when +trying to write a zero-length file. + +E2fsck will no longer crash if it tries to delete an invalid +extent-mapped symlink. + +E2fsck will no longer crash if it comes across an directory which is +larger than 2GB (which is not allowed in valid file systems). + +Fixed debugfs's help texts to fully document all options and otherwise +be more helpful. + +Updated/fixed various man pages. (Addresses Debian Bugs: #586218, +#669730, #698076) + +Fixed various Debian Packaging Issues (#698879, #721365) + + +Programmer's Notes +------------------ + +Fix sparse, gcc -Wall and clang nits. + +Update config.{guess,sub} to the latest version + +Fixed various memory and file descriptor leaks on various error paths, +as well as some missing error return checks, which were found using +Coverity. + +Run sparse against source files when building e2fsprogs with 'make +C=1'. If instead C=2, it configures basic ext2 types for bitwise +checking with sparse, which can help find the (many many) spots where +conversion errors are (possibly) happening. + +Allow the regression test to be run in chrooted environments where +/etc/mtab might be missing. + +The ext2fs_punch() function, which was introduced in 1.42, was broken +in many ways, but this was never noticed since it wasn't used for +anything significant. Some of the bugs include failing when trying to +punch a completely sparse file, failing when punching an extent-mapped +inode when the starting block was at the beginning of the inode, and +not being able to punch a single block (where start_blk == end_block). +It also didn't handle being passed an invalid, too-large ending block +number, and didn't handle properly terminate at the right place when +operating on an indirect-mapped inode. + +Fixed some minor typo's in the error catalog for libext2fs. + +Fixed ext2fs_file_set_size2() so that if it truncates an inode by +setting the file size, to zero the rest of the block to the end of the +file, so that if an ext4 FUSE driver tries to extended the file, that +we don't avoid stale data from being returned. + +Fixed ext2fs_bmap() to disallow clients from trying to map or set +logical blocks which are larger than what an extent-mapped or indirect +block-mapped inode can allow. + +If debugfs (or some userspace program using libext2fs) creates a file +which is larger than 2GB, make sure the large_file feature flag gets +set. + +Fix a bug in ext2fs_link() where if there is multiple empty slots in the +directory which are large enough, the directory entry could get +inserted more than once in the directory. + +If quota support is disabled (which is the default), make sure that +all traces of the quota support is removed from usage messages, man +pages, and tune2fs must not be able to enable the quota file system +feature. (Addresses Red Hat Bugzilla: #1010709) + +The ext2fs_file_write() now updates i_size on a successful write, +instead of only updating i_size wen the file is closed via +ext2fs_file_close(). + +Added a shell script, populate-extfs.sh which uses debugfs to populate +an ext2/3/4 file system image from a given directory. It is similar +to the genext2fs program, but it supports ext3 and ext4 file system. + +Add changes to the libext2fs library to support block group +descriptors larger than 64 bytes (for future compatibility). + +Fixed an off-by-one bug in ext2fs_file_set_size2() so that it will not +leave an extra block in the file when truncating the file down to +size. + +The html version info pages are now built using makeinfo --html +instead of the unmaintained and now-obsolete texi2html program. + + +E2fsprogs 1.42.8 (June 20, 2013) +================================ + +As a part of mke2fs's option parsing cleanup, the use of the -R option +will give a warning that it is deprecated (it has been so documented +since 2005) and -E should be used instead. + +Mke2fs will not give warnings about the bigalloc and quota options in +quiet mode. + +If an invalid journal size is given to mke2fs, it will now complain +and exit sooner. + +Debugfs was erroneously giving spurious error messages for certain +extent_inode subcommands which take arguments (split_node, +replace_node, and insert_node). This has been fixed. + +Fix the parsing of the 's' (sectors) in parse_num_blocks2, which among +other programs is used by mke2fs. + +Change mke2fs so that it does not set the root directory to the real +uid/gid of the mke2fs process. Add the extended option root_owner to +override this behavior. + +Fix resize2fs when shrinking file systems to make sure that bitmap +blocks aren't left outside the bounds of the shrunken file system. +This could happen with flex_bg file systems that were grown using +the old online resizing algorithm. + +E2fsck will now detect and repair corrupted extent trees which contain +invalid extents at the end of the extent tree leaf block. + +E2fsck will now longer complain about zero length extended attribute +values. + +Fix a regression introduced in e2fsprogs v1.42 which caused e2image -s +to crash. + +Add safety check so tune2fs will not attempt to set the inode size to +be larger than the block size. + +Fix e2fsck so it can check a read-only root file system with an +external journal. (Addresses Debian Bug: #707030 + +Fix off-line resizing of file systems with flex_bg && !resize_inode +(Addresses Debian Bug: #696746) + +Fix e2image with large (> 32-bit) file systems (Addresses Debian Bug: +#703067) + +Enhance chattr to allow clearing the extent flag if the kernel allows +migrating extent based files to use indirect blocks. + +Update German translation. + +Updated/fixed various man pages. (Addresses Debian Bugs: #712429, +#712430, #707609) + +Fixed various Debian Packaging Issues (Addresses Debian Bug #708307) + +Programmer's Notes +------------------ + +Use secure_getenv() in preference to __secure_getenv(). + +Optimize CPU utilization of ext2fs_bg_has_super(). + +Fix ext2fs_llseek() on 32-bit i386 systems to work correctly when +SEEK_CUR is used with large files. + +The ext2fs_read_inode_full() function will no longer use +fs->read_inode() if the caller has requested more than the base 128 +byte inode structure and the inode size is greater than 128 bytes. + +Fix build failure with --enable-jbd-debug. + +Clean up filtering of outputs for the regression tests by using a +common sed script. + +Fix gcc -Wall and clang nits. + + +E2fsprogs 1.42.7 (January 21, 2013) +=================================== + +Add warnings to mke2fs, resize2fs, and tune2fs that the bigalloc and +quota features are still under development. For more information +please see: + * https://ext4.wiki.kernel.org/index.php/Bigalloc + * https://ext4.wiki.kernel.org/index.php/Quota + +Add some new options to filefrag from Lustre's patches to e2fsprogs: + * add -k option to print extents in kB-sized units (like df -k) + * add -b {blocksize} to print extents in blocksize units + * add -e option to print extent format, even when FIBMAP is used + * add -X option to print extents in hexadecimal format + +Fix resize2fs so that it can handle off-line resizes of file systems +with the flex_bg feature but without a resize_inode (or if we run out +of reserved gdt blocks). This also fixes a problem where if the user +creates a filesystem with a restricted number of reserved gdt blocks, +an off-line resize which grows the file system could potentially +result in file system corruption. + +Fix a resize2fs bug which could cause it to corrupt bigalloc file +systems when doing an off-line resize. + +Further optimize resize2fs so it doesn't use quite as much CPU when +resizing very large file systems. + +Fixed 32-bit overflow bugs which could cause resize2fs to fail and +possibly corrupt the file system while resizing 64-bit file systems. + +Fix a bug in mke2fs where parsing "-E resize=NNN" will result in a +mke2fs crash due to a divide-by-zero if the 64bit file system feature +is enabled. + +Add better error checking to mke2fs to check for invalid parameters +when creating bigalloc file system. + +When creating bigalloc filesystems, the -g option to mke2fs will now +specify the number of clusters per block group. + +Add to debugfs the functionality to corrupt a specific file system +block via the "zap_block" command. + +Add to debugfs the functionality to print out a hex dump of a block in +the file system via the "block_dump" command. + +Add to debugfs the functionality to manipulate the extent tree +directly via the "extent_open" command. + +Fixed debugfs's mknod command so that it updates the block group +statistics. + +Fix e2fsck so it can detect and fix inconsistencies in the interior +nodes of an inode's extent tree. + +Fix a potential memory corruption failure in e2fsck's error path if +the call to ext2fs_open2() fails. + +Fix e2fsck if its logging function is enabled in e2fsck.conf, and the +resulting file name for the log file is longer than 100 bytes, that it +properly handles this situation instead of crashing. + +E2fsck will now report the amount of memory that it attempted to +allocate when a memory allocation request fails, to make it easier to +track down the problem. + +Fix mke2fs's handling of the mmp_update_interval option. (Addresses +Lustre Bug: LU-1888) + +E2image can now include all data blocks in the e2image output file +when the user specifies the -a option. + +If e2fsprogs is compiled without --enable-quota, make sure that +tune2fs can not turn on the feature for new-style quota support, since +afterwards, none of the e2fsprogs tools will be willing to touch that +file system. + +Optimize e2fsck's so that it uses much less CPU for large file +systems. This can result in significant speedups, especially on +CPU-constrained systems. This was primarily done by optimizing +libext2fs's bitmap functions. (Addresses Google Bug: #7534813) + +Fix debugfs's htree command so that all its messages are sent through +the pager. + +Fixed debugfs's "dump_file" and "cat" functions work correctly +on file systems whose block size is greater than 8k. + +Fix e2freefrag so it works on 64-bit file systems, and so it uses much +less memory. (Addresses Google Bug: 7269948) + +Update the spd_readdir.c file in the contrib directory to include some +additions which were made in 2008 that didn't get folded into the +version which we checked into the e2fsprogs source tree. These +enhancements include thread safety, support for readdir64_r(), and +safe_getenv() support in case spd_readdir.so is used for setuid binaries. + +Update Czech, Dutch, French, German, Polish, Swedish, and Vietnamese +translations + +Add a command to debugfs to create symlinks. + +Document the bigalloc feature in the mke2fs man page. (Addresses +Debian Bug: #669730) + + +Programmer's Notes +------------------ + +Fix gcc -Wall nits. + +Fix a spelling typo in the libext2fs texinfo documentation. + +Change the output from "make check" so that tools such as emacs's "M-x +compile" does not mistake the output as containing a compiler error. + +Export two new functions from libext2fs: ext2fs_extent_node_split() +and ext2fs_extent_goto2(). + +The ext2fs_extents_fix_parents() was fixed so it does not modify the +location of the extent handle if its current location is at an +interior node, rather than a leaf node of an inode's extent tree. + +Add a regression test to assure that e2fsck can correctly fix an +inconsistent interior node in an inode's extent tree. + +The ext2fs_{mark,unmark,test}_block_bitmap_range2() functions now +correctly support bigalloc file systems which use store block usage +information in units of clusters. + +Fixed the help text in the configure script for --enable-quota. + +The m68k-specific bitops code has been removed since they were +incorrectly treating bit numbers with the high bit set as signed +integers. Furthermore, modern compilers do a good enough job +optimizing the generic code there is no point in having the m68k +specific asm statements. + +Fixed how we link the test programs so they always use the static +libraries, so that we test using the libraries which we have just +built. + +Update config.guess and config.sub to the latest versions from the GNU +project. + +Fixed the com_err.texinfo file so that it can produce a valid +postscript/pdf printed output. + +Add a regression test which checks debugfs's ability to create +symlinks, named FIFO's, and device nodes. + +Add a function ext2fs_symlink(), which creates symlinks to the +libext2fs library. + +Add debugging code so we can test old kernel interfaces for online +resize to resize2fs. This backwards compatibility checking is keyed +off of the RESIZE2FS_KERNEL_VERSION, which is designed to allow us to +test the functionality of the kernel's older resize ioctls without +needing to install an old version of resize2fs, and to also test a +modern resize2fs's ability to work with older kernels without having +to install an older version of the kernel. + + +E2fsprogs 1.42.6 (September 21, 2012) +===================================== + +When mke2fs creates file systems with lazy itable initialization, the +progress updates for writing the inode table happens so quickly that +on a serial console, the time to write the progress updates can be the +bottleneck. So mke2fs will now only update its progress indicators +once a second. + +Resize2fs will skip initializing the inode tables if the kernel +supports lazy_itable_init, which speeds up growing off-line growth of +uninit_bg file systems significantly. Resize2fs will now also +correctly set the itable_unused field in the block group descriptor to +speed up the first e2fsck after the file system is grown. + +Resize2fs has been fixed so that on-line resizing of meta_bg file +systems work correctly. This is needed to grow file system which are +larger than 16T. + +Resize2fs will now correctly handle resizing file systems to 16TB on +32-bit file systems when "16TB" is specified on the command line. + +Fix mke2fs so that it will be careful to set the reserved blocks ratio +larger than 50%; this can happen when creating small file systems and +when the last block group is dropped because there are not enough +blocks to support the metadata blocks in the last block group. + +Fixed spelling mistake in debugfs's help message. + +Fixed a potential seg fault in e2fsck when there is an I/O error while +reading the superblock. + +Fixed various Debian Packaging Issues (Addresses Debian Bug #677497) + +Updated/fixed various man pages. (Addresses Sourceforge Bug: +#3559210) + +Programmer's Notes +------------------ + +The configure option --enable-relative-symlink was broken so that it +needed to be --enable-symlink-relative-symlinks. We will support both +for at least two years, but then the wrong configure option will be +removed. + +Fixed a regression introduced in 1.42.5 so the link order for +e2fsprogs' libraries will be correct for both static and shared +linking. (Addresses Sourceforge Bug: #3554345) + +Add support for e2fsprogs to be compiled using clang/LLVM. + +Fix portability problems on non-Linux systems: avoid compile failures +on systems that don't have malloc.h + +Fix f_mmp regression test suite so that debugfs gets killed if the +test is interrupted. + + + +E2fsprogs 1.42.5 (July 29, 2012) +================================ + +Fixed a bug with mke2fs where if there is only 8 inodes per block +group, the calculation of the number of uninitialized inodes in the +first block group would go negative. This resulted in "mke2fs -N 256 +-t ext4 /tmp/foo.img 256m" trying to write so many blocks that /tmp +would run out of space. (Addresses Sourceforge Bug: #3528892) + +Fixed a bug in how e2fsck would uniquify directory entry names. +(AddressesSourceforge Bug: #3540545) + +Previously, e2fsck would only allow a mounted file system to be +checked if it was the root file system and it was mounted read-only. +Now it will allow any file system mounted read-only to be checked if +the -f option is specified. This makes it easier to test how e2fsck +handles checking file systems which are mounted without having to test +on the root file system. + +Fixed a problem if e2fsck where if the root file system is mounted +read-only, e2fsck would not clear an error indication in the journal +superblock. Combined with a kernel bug, this would cause the e2fsck +to check the file system after every single boot. + +The e4defrag program can now handle device symlinks, such as +/dev/mapper/testvg-testlv, instead of insisting on a less +human-friendly name such as /dev/dm-2. (Addresses Red Hat Bugzilla: +#707209) + +Fixed filefrag so it will not crash with a segfault on files from a +virtual file system such as /proc. (e.g., "filefrag +/proc/partitions") + +Fixed filefrag so that it correctly reports the number of extents. +(Addresses Red Hat Bugzilla: #840848) + +Fixed a file descriptor leak in logsave which could cause it to hang. +(Addresses Debian Bug: #682592) + +Fixed e2fsck so that the file system is marked as containing an error +if the user chooses not to fix the quota usage information. + +Fixed tune2fs so that it correctly removes the quota feature when the +last quota inode is removed. + +Fix tune2fs so that after removing a quota inode, the block bitmap is +updated; otherwise, e2fsck would complain after running 'tune2fs -O +^quota <dev>'. + +Fix tune2fs so that when converting a file system from using legacy +quota files to the new quota file system feature with hidden quota +files, the accounting for these files is handled correctly so that +e2fsck doesn't complain. + +Improved e2fsck's verbose reporting statistics, and allow the more +verbose reporting to be enabled via /etc/e2fsck.conf. + +Fixed various Debian Packaging Issues (Addresses Debian Bug #678395) + +Updated/fixed various man pages. (Addresses Debian Bugs: #680114) + + +Programmer's Notes +------------------ + +Fixed portability problems on other operating systems (e.g., Hurd and +FreeBsd) caused by the attempted inclusion of <sys/quota.h>. + +Make sure that shared libraries link with the shared libraries built +in the build tree, instead of the system provided libraries. +Previously, libraries and executables were linked with the system +libraries if present, and possibly using static archives instead of +shared libraries. This was also problematic since if libext2fs.so is +linked with a static libcom_err.a from system, the build system would +attempt to link without -lpthread. (Addresses Sourceforge Bug: +#3542572) + + +E2fsprogs 1.42.4 (June 12, 2012) +================================ + +Fixed more 64-bit block number bugs (which could end up corrupting +file systems!) in e2fsck, debugfs, and libext2fs. + +Fixed e2fsck's handling of the journal's s_errno field. E2fsck was +not properly propagating the journal's s_errno field to the superblock +field; it was not checking this field if the journal had already been +replayed, and if the journal *was* being replayed, the "error bit" +wasn't getting flushed out to disk. + +Fixed a false positive complaint by e2fsck if all of the extents in +the last extent tree block are uninitialized and located after the end +of the file as defined by i_size. + +The dumpe2fs will now display the journal's s_errno field if it is +non-zero, and it will also display the journal's 64-bit feature flag +if present. + +Fix e2fsck so that it always opens the device file in exclusive mode +when it might need to modify the file system, and never if the -n +option is specified. (Previously, there were a few corner cases where +it might get things wrong in either direction.) + +E2fsck now correctly truncates or deallocates extent-mapped inodes on +the orphan list. The root cause was a bug in libext2fs's block +iterator which could end up skipping an extent when the last block in +an extent is removed, causing the current extent to be removed from +the extent tree. + +E2fsck now correctly sets the global free block and inode counts when +truncating or removing inodes on the orphan list in preen mode. +Previously, it would leave these values would be set incorrectly, +which is largely a cosmetic issue since the kernel no longer pays +attention to those fields, but it can cause spurious complaints in +subsequent e2fsck runs. + +Fix i_blocks accounting when the libext2fs library needs to add or +remove an extent tree block on bigalloc file systems. + +The lsattr and chattr programs now support the No_COW flag for the +benefit of btrfs. + +Debugfs now interprets date strings of the form @ddd as ddd seconds +after the beginning of the epoch. This is handy when setting an inode +number into the d_time field when debugging orphan list handling. + +Fix a precedence bug with built-in quota support which might result in +e2fsck paying attention to the quota inode field even if the built-in +quota feature flag is not set. Fortunately, in practice that +superblock field should be zero for non-built-in quota file systems, +so it's unlikely this bug would have caused problems. + +Updated/fixed various man pages. (Addresses Debian Bugs: #674453, +#674694) + +Programmer's Notes +------------------ + +The regression test suite can now run the integration tests in the +tests directory in parallel, via "make -jN check". + +Add new test, f_zero_extent_length which tests e2fsck's handling of +the case where all of the extents in the last extent tree block are +uninitialized extents after i_size. + +Add a new test, f_jnl_errno, which checks handling of an error +indication set in the journal superblock. + +Fix the test f_jnl_64bit so that it properly checks e2fsck's handling +of a 64-bit journal. + +Add two tests, f_orphan_indirect_inode and f_orphan_extent_inode which +tests e2fsck's handling of orphan inodes in preen mode, and truncation +of extent inodes on the orphan list. + +Fixed more OS X portability issues. + + +E2fsprogs 1.42.3 (May 14, 2012) +=============================== + +Fix a bug in the Unix I/O manager which could cause corruption of file +systems with more than 16TB when e2fsprogs is compiled in 32-bit mode +(i.e., when unsigned long is 32-bits). Also fix a bug which caused +dumpe2fs to incorrectly display block numbers > 32-bits. + +Improve the support for integrated quota files (where quota is a first +class supported feature using hidden files in the ext4 file system). +Previously the quota file was getting rewritten even when it was not +necessary, and e2fsck would erroneously try to hide quota files which +were already hidden. + +Quiet complaints in e2fsck when the total free blocks or inodes are +incorrect in the superblock after an system crash, since we don't +update nor depend on the superblock summaries at each commit boundary. + +Fixed a regression introduced in 1.42.2 which would cause applications +outside of e2fsprogs which did not pass the EXT2_FLAG_64BIT (and so +would were still using the legacy 32-bit bitmaps) to crash. This was +due to missing 32-bit compat code in side the function +ext2fs_find_first_zero_generic_bmap(). (Addresses Red Hat Bugzilla: +#808421) + +Fix a bug which would cause mke2fs to fail creating the journal if +/etc/mtab and /proc/mounts are missing. (Addresses Sourceforge Bug: +#3509398) + +Updated/fixed various man pages. + +Update Czech, Dutch, French, German, Polish, Swedish, and Vietnamese +translations + +Fixed various Debian Packaging issues. + + +Programmer's Notes +------------------ + +Change the nonsensically wrong types in the function signature of the +inline function ext2fs_find_first_zero_block_bitmap2(). This was +caused by a cut and paste error; fortunately no code in e2fsprogs used +this inline function, and there are any users of this functions +outside of e2fsprogs. + +Add support for systems which have valloc(), but which do have +posix_memalign() nor memalign() (such as MacOS 10.5). + +Refactor and clean up the allocation of aligned buffers for Direct I/O +support. Previously some allocations were requesting a greater +alignment factor that what was strictly necessary. Also optimize +reading and writing bitmaps using Direct I/O when the size of the +bitmap did not fully cover the file system blocksize. + +Reserve the codepoints for the INCOMPAT features LARGEDATA and +INLINEDATA. + +Improved the regression test suite by adding some new integration +tests (f_jnl_32bit, f_jnl_64bit) which detect breakage of the on-disk +jbd2 format, as well as f_eofblocks which tests the new handling of +uninitialized and initialized blocks beyond i_size. Also add a new +unit test which verifies 32-bit bitmaps support and the new +find_first_zero primitives. + +Add a few dependencies to fix parallel (make -j) builds. + +Removed bash'isms which were breaking the regression test suite on +systems where /bin/sh is not bash. + +The config.guess and config.sub have been updated to the 2012-02-10 +version. + +Fix a portability problem caused by assuming the present of mntent.h +means that setmntent() exists. Instead, explicitly test for this in +the configure script. + +If the sys/signal.h header file does not exist, don't try to include +it, since it's not available on all systems. + +Add support for systems that do not support getpwuid_r() + +The configure script now supports a new option, +--enable-relative-symlinks, which will install relative symlinks for +the ELF shared library files. (Addresses Sourceforge Bug: #3520767). + +When building BSD shared libraries make sure the LDFLAGS variable is +passed to the linker. Fixing this allows, for example, e2fsprogs to +be built in 32-bit mode on Mac OS X Lion (Addresses Sourceforge Bug: +#3517272) + +Fix gcc -Wall nitpicks + + +E2fsprogs 1.42.2 (March 27, 2012) +================================= + +The resize2fs program uses much less CPU and is much faster for very +large file systems. (Addresses Debian Bug: #663237) + +The seti and freei commands in debugfs can now take an optional length +argument to set and clear a contiguous range of inodes. + +E2fsck will now make explicit checks for the EOFBLOCKS_FL, since we +plan to remove support for it from the kernel file system driver. It +really wasn't very useful and was causing more problems than it +solves. Since e2fsck will complain if inodes that should have +EOFBLOCKS_FL do not have the flag set, we are going to remove this +check from e2fsprogs first, and then only remove the flag from the +kernel much later. + +The mke2fs program can now use direct I/O via "mke2fs -D". This will +slow down the mke2fs, but it makes it more polite on a loaded server +by limiting the amount of memory that gets dirtied by mke2fs when it +is using buffered I/O. + +E2fsck was needlessly closing and re-opening the file system as a side +effect of adding Multiple Mount Protection (MMP). This isn't +necessary for non-MMP file systems, so drop it. + +Print errors returned by ext2fs_open2() and ext2fs_check_desc() so we +can more easily diagnose memory allocation failures caused by +insufficient memory. E2fsck will now abort if there are memory +allocation failures when the file system is initially opened and +during the block group descriptor checks. (Addresses Google Bug: +#6208183) + +If there are incorrect block group checks, e2fsck will now report the +incorrect and corrected checksum values. + +The e2fsck program can now write log files containing the details of +the problems that were found and fixed directly, via configuration +parameters in /etc/e2fsck.conf. + +Added the ability to limit the number of messages reported by e2fsck +for a given problem type. This avoids a potential bottleneck if there +is a serial console which can cause a boot sequence to take a long +time if e2fsck needs to report many, many file system errors. + +The dumpe2fs, debugfs, and tune2fs now use rbtree bitmaps, which cause +them to use much less memory for large file systems. + +The dumpe2fs program will now print the expected block group checksum +if it is incorrect. This helps to diagnose problems caused by +incorrect block group checksums. + +E2fsck now checks for extents with a zero length, since the kernel +will oops if it comes across such a corrupted data structure. (See +https://bugzilla.kernel.org/show_bug.cgi?id=42859) + +E2fsck has a number of bugs relating to discard that have been fixed. +(1) Fixed a bug which could cause e2fsck to discard portions of the +inode table which were actually in use. (2) E2fsck will now avoid +using discard if the block device doesn't zero data on discard, since +otherwise this could cause problems if the file system gets corrupted +in the future. (3) E2fsck will now avoid using discard when it is run +in read-only mode. (4) Fixed a bug which caused e2fsck to not issue +discards in the last block group. + +E2fsck's CPU utilization in pass 5 has been optimized, which will +speed up e2fsck slightly. + +E2image will now skip copying uninitialized bitmap and inode table +blocks. + +Fixed mke2fs -S so it does not corrupt the first block group's +information. + +E2fsck will now check the new sysfs interface to determine if we are +using the battery or AC mains. (Addresses SourceForge Bug: #3439277) + +Updated/fixed various man pages. (Addresses Debian Bug: #665427) + +Fixed various Debian Packaging issues. (Addresses Debian Bug: #665885) + +Programmer's Notes +------------------ + +Fixed various portability issues for non-Linux systems, particularly +MacOS X, as well as Linux systems running with the just-released glibc +2.15. + +Fix file descriptor leak in ext2fs_close() if the file system with +uninit_bg is opened read/only with a backup superblock. (Addresses +SourceForge Bug: #3444351) + +Fixed an invalid return in a non-void function in the quota code. +(Addresses SourceForge Bug: #3468423) + +Fixed the debian rules file so that the calls to dpkg-buildflags works +when the shell is dash. + +The debian package build now uses V=1 so that there is more +information about potential build failures in debian build logs. + +If the uninit flags get cleared by functions such as +ext2fs_new_inode() or ext2fs_new_block2(), we now make sure the +superblock is marked dirty and the block group descriptor checksum is +updated if necessary. + +The debian rules file will now try to load debian/rules.custom of it +exists. This file can skip various builds for speed reasons if there +is no need for the e2fsck-static or udeb packages. Available +customizations in the rules file includes SKIP_STATIC=yes, +SKIP_BF=yes, and SKIP_DIETLIBC=yes. + +In addition, if the file misc/mke2fs.conf.custom.in exists in the +source tree, it will be used instead of the standard misc.conf file in +the upstream sources. This makes it easier for Debian-derived systems +to distribute a custom mke2fs.conf file without having to worry about +merge issues if future versions of e2fsprogs makes changes in the +upstream default version of mke2fs.conf. + + +E2fsprogs 1.42.1 (February 17, 2012) +=================================== + +The mke2fs and e2fsck now use significantly less memory when creating +or checking very large file systems. This was enabled by adding +extent-based bitmaps which are stored using a red-block tree, since +block and inode allocations tend to be contiguous. + +The command mke2fs -S is used as a last ditch recovery command to +write new superblock and block group descriptors, but _not_ to destroy +the inode table in hopes of recovering from a badly corrupted file +system. So if the uninit_bg feature is enabled, mke2fs -S will now +set the unused inodes count field to zero. Otherwise, e2fsck -fy +after using mke2fs -S would leave the file system completely empty. + +Since mke2fs recognizes mke3fs in argv[0] to mean "mkfs.ext3", also +honor "mke4fs" to work the same as "mke2fs.ext4", since RHEL5 has +installed an mke2fs binary using that name. + +The usage and help messages for the -G, -t and -T options in mke2fs +have been fixed. + +If e2fsck needs to use the backup group descriptors, the +ext2fs_open2() function clears the UNINIT bits to ensure all of the +inodes in the file systems get scanned. However, the code which reset +the UNINIT flags did not also recalculate the checksum, which produced +many spurious (and scary) e2fsck messages. This has been fixed by +resetting checksums when the UNINIT bits are cleared. + +Relax a check in e2fsck which required that the block bitmap to be +initialized when the inode bitmap is in use. This will allow us to +eventually eliminate code from the kernel which forcibly initialized +the block bitmap when the inode bitmap is first used, requiring an +extra journal credit and disk write. (Addresses Google Bug: #5944440) + +Make sure rdebugfs (which may be installed setuid or setgid disk) does +not honor environment variables if euid != uid or egid != gid. + +Debugfs's ncheck command has been optimized and now is much more +robust with faced with corrupted file systems. The ncheck command +also now has a -c option which will verify the file type information +in the directory entry to see if matches the inode's mode bits. This +is extremely useful when trying to use debugsfs to determine which +parts of the file system metadata can be trusted. + +E2image will try to use ftruncate64() to set the i_size for raw +images, instead of writing a single null byte. This avoid allocating +an extra block to the raw image, for those file systems and/or +operating systems that support this. (Linux does.) In addition, fix +a logic bug that caused the file to not be properly extended if the +size of the last hole was exactly an multiple of a megabyte. + +Fixed a bug in resize2fs where for 1k and 2k file systems, where +s_first_data_block is non-zero, this wasn't taken into account when +calculate the minimum file system size for use with the -M option. + +Fixed the badblocks program to honor the -s flag when in read-only -t +mode. (Addresses Debian Bug #646629) + +Update Czech, Dutch, French, Polish, and Swedish translations from the +Translation Project. + +Fixed various Debian Packaging issues so that dpkg-buildflags is used +if present, which allows e2fsprogs to be built with security hardening +flags. (Addresses Debian Bugs: #654457) + +Programmer's Notes +------------------ + +Fix a bug in ext2fs_clear_generic_bmap() when used for 32-bit bitmaps. +This was only an issue for programs compiled against e2fsprogs 1.41 +that manipulate bitmaps directly. (Addresses Sourceforge Bugs: +#3451486) + +The libext2fs library now uses sysconf() to fetch the page size, instead +of the deprecated getpagesize(). + +The ext2fs_get_pathname() function will return a partial path if an a +directory in the path is not a directory, displaying it as an inode +number in angle brackets instead of giving up and displaying an error. +This is much more helpful when a user is trying to debug a corrupted +file system. + +Codepoints for the RO_COMPAT_REPLICA feature has been reserved. + +Added a new library function, ext2fs_file_get_inode_num(), for use by +fuse2fs. + +Fixed a bug in ext2fs_file_set_size2() so that when it is truncating a +file, it actually works. + +The block iterator now properly honors the BLOCK_ABORT flag for +extent-based flags. Previously, it didn't, which generally made code +be less efficient, but it could cause bugs in ext2fs_link(), for +example, by causing it to insert multiple directory entries. + +Fixed an (harmless other than causing a compiler warning) use of an +uninitialized variable in e2fsck's MMP code. + + +E2fsprogs 1.42 (November 29, 2011) +================================== + +This release of e2fsprogs has support for file systems > 16TB. Online +resize requires kernel support which will hopefully be in Linux +version 3.2. Offline support is not yet available for > 16TB file +systems, but will be coming. + +This release of e2fsprogs has support for clustered allocation. This +reduces the number of block (now cluster) bitmaps by allocating and +deallocating space in contiguous power-of-2 collections of blocks, +which are called clustered. This is a file system level feature, +called 'bigalloc', which must be enabled when the file system is +initially formatted. It is not backwards compatible with older +kernels. + +Added support for the Multi-Mount Protection (MMP) feature. + +E2fsck more efficiently uses scratch files for really big file +systems. (This is a feature that has to be turned on explicitly; see +[scratch_files] in the e2fsck.conf man page.) + +Fix a bug in e2fsck where if the free blocks and inodes counts are +incorrect, e2fsck would fix them without printing an error message. +This would cause a "*** FILE SYSTEM WAS MODIFIED ***" message without +any explanation of what was fixed. + +E2fsck will no longer attempt to clone an extended attribute block in +pass1b handling if the file system does not support extended +attributes. + +E2fsck will be more careful accidentally asking the user to continue +if the file system is mounted, so that an escape sequence won't cause +a false positive. (Addresses Debian Bug: #619859) + +E2fsck now uses less cpu time in pass 5 when large portions of the +bitmaps are uninitialized. + +E2fsck will no longer segfault when a corrupted file system has a bad +extent, and removing it leads to a block needing to be deallocated. +(Addresses SourceForge Bug: #2971800) + +E2fsck will catch termination signals (segfaults, bus errors, sigfpe) +and print debugging information to make it easier to find potential +problems. + +E2fsck will check to see if the bad block inode looks insane, and will +skip trying to use if it certain fields which should be zero look +non-zero. This is to avoid a corrupted bad block inode causing e2fsck +to get confused and do more harm than good. + +If e2fsck modifies certain superblock fields which the kernel doesn't +look at, it will now mark the superblock as dirty without marking the +file system as changed. This avoids signaling the init scripts that +a reboot is necessary, since the kernel isn't going to look at those +fields, so it won't care if they have been changed. + +Fixed a bug in the libext2fs library (in the binary search routine of +the icount abstraction) that could (very, very rarely) cause e2fsck to +die in the middle of pass 1 or pass 2 processing. + +E2fsck will not try to do a discard operation if the -n option was +specified on the command line. + +E2fsck now supports an extended "discard" option which will cause +e2fsck to attempt discard all unused blocks after a full, successful +file system check. + +E2fsck will check for the bad block inode to make sure it looks sane +before trusting it, to avoid causing more harm than good to the file +system. + +E2fsck now returns additional status bits in its exit code if it +aborts early in the e2fsck run. + +E2fsck now correctly calculates the maximum file size in the case of +the huge_file file system feature enabled without extents. + +The mke2fs and e2fsck programs now tries to use the punch hole command +as a "discard" when operating on normal files. + +The e2image program now supports the qcow2 format, which is a more +efficient way of capturing file system dumps. + +Mke2fs now supports the [devices] stanza in mke2fs.conf which allows +per-device defaults to be specified in the configuration file. + +Mke2fs now supports the reserved_ratio relation in the [defaults] and +[fs_types] section in mke2fs.conf. + +Mke2fs now creates extent-mapped directories for the root and +lost+found directories. + +Mke2fs will skip zero'ing the journal if the extended option +"lazy_journal_init" is specified. This can save a lot of time, but it +does add a small amount of risk if the system crashes before the +journal is overwritten entirely once. It is especially useful for +testing. + +Mke2fs will now create file systems that enable user namespace +extended attributes and with time- and mount count-based file +system checks disabled. + +Mke2fs will not set a stride or strip size of one block based on block +device attributes obtained from sysfs. + +Mke2fs now displays a progress report during the discard process. + +Mke2fs now handles extreme file system parameters correctly which +previously caused the inodes per group to drop below 8, leading to a +segfault. (The inodes per group must be a multiple of 8, but the code +didn't correctly deal with an inodes per group count less than 8.) + +Mke2fs and tune2fs previously would give an error if the user tried +setting the stride and stripe-width parameters to zero; but this is +necessary to disable the stride and stripe-width settings. So allow +setting these superblock fields to zero. (Addresses Google Bug: +#4988557) + +Mke2fs now gives a warning if the auto-detected block size exceeds the +system's page size. + +If the enable_periodic_fsck option is false in /etc/mke2fs.conf (which +is the default), mke2fs will now set the s_max_mnt_count superblock +field to -1, instead of 0. Kernels older then 3.0 will print a +spurious message on each mount then they see a s_max_mnt_count set to +0, which will annoy users. (Addresses Debian Bug: #632637) + +The default mke2fs.conf now has entries for "big" and "huge", which +are needed for very big file systems. + +The resize2fs program now has support for a new online resize ioctl +that can support file systems > 16TB, once it arrives in v3.x kernels. + +Fixed bug which caused resize2fs to fail when shrinking an empty file +system down to its minimal size. (Addresses Sourceforge Bug #3404051) + +Fixed tune2fs's mount options parsing. (Addresses Debian Bug: #641667) + +Allow tune2fs to remove external journals if the device can not be +found. + +Debugfs's icheck will now correctly find inodes which use the +searched-for block as an extended attribute block. + +Debugfs now has a new "punch" command which remove blocks from the +middle of an inode. + +Debugfs now has a new "e2freefrag" command which analyzes the free +space fragmentation of the file system, using the same code as the +e2freefrag program. + +Debugfs now has a "filefrag" command which displays information about +a file's fragmentation. + +Add support to build a metadata-only, read-only, stripped-down version +of debugfs called rdebugfs. + +Fixed a potential stack overrun bug in debugfs. + +The badblocks program now correctly recovers from I/O errors when +direct I/O is being used. The badblocks command now also supports a +-B option which forces the use of buffered I/O, and the -v option will +provide a more detailed breakdown of read, write, and failed +comparison errors. + +Added e4defrag tool which uses the EXT4_IOC_MOVE_EXT ioctl. + +Added support for journals larger than 2GB. + +Support using both hard links and symlinks when installing e2fsprogs. + +Add overflow checking to tune2fs -i's fsck interval, which must fit in +a 32-bit field. + +The debugfs command now has a new 'blocks' command which prints out +data blocks of a particular inode in a format which is useful for +scripting. + +Filefrag will report 0 extents correctly in verbose mode. (Addresses +RedHat Bugzilla: #653234) + +Filefrag has been fixed so its -v report prints the correct expected +block number (previously there had been an off-by-one error). In +addition, it will now display the number of contiguous extents when -v +is not specified. This makes it consistent with the number of extents +printed when the -v option was specified. In addition, the number of +contiguous extents is far more interesting/useful than the number of +physical extents for very large files. (Addresses Debian Bug: +#631498, #644792) + +Logsave's usage message has been fixed. (Addresses Debian Bug: +#619788) + +Avoid an infinite loop in ext2fs_find_block_device() if there are +symlink loops in /dev caused by a buggy udev. + +Added a useful "fallocate" program to the contrib directory. + +Fixed an ABI compatibility problem in libext2fs which broke the dump +program. Also added back some macros which dump needed so it could +compile against the latest version of ext2_fs.h (Addresses Debian Bug: +#636418) + +Fixed parsing of MNTOPT_ options for tune2fs and debugfs (Addresses +Debian Bug: #641667) + +Added internationalization support for libcom_err error table strings. + +Fixed various spelling mistakes found in various output strings found +by I18N translators. + +Update translations: French, Chinese, Germany, Indonesian, Swedish, +Vietnamese, Polish, Dutch, Czech. (Addresses Debian Bugs: #520985, +#620659) + +Fixed various Debian Packaging issues. (Addresses Debian Bugs: +#614662, #632169, #641838, #627535, #629355) + +Updated/clarified man pages. (Addresses Debian Bugs: #639411, +#642193, #634883) + +Programmer's Notes +------------------ + +Initial support for quota as an integrated feature, where the quota +files are hidden system files that are automatically maintained by +e2fsck is present, although disabled by default. It must be enabled +by using the configure option --enable-quota. + +Reserved the on-disk fields for the metadata checksum and snapshot +features, which are currently in development. + +The ext2fs library now has the new functions ext2fs_punch(), +ext2fs_get_memzero() and ext2fs_file_get_inode(). + +The ext2fs library now has support for calculating the crc32c checksum +(via the new functions ext2fs_crc32c_be and ext2fs_crc32c_le). + +The I/O manager now supports the discard operation. + +Reserved file system code points for new 1st class quota feature. + +Shortened the compilation lines by moving the autoconf defines to +a config.h header file. + +Fixed a potential free of an uninitialized pointer in +ext2fs_update_bb_inode(). + +Fixed miscellaneous gcc -Wall and coverity warnings. + +Fixed portability issues for Mac OS X, Hurd, and FreeBSD. + +Fixed a build failure when OMIT_COM_ERR is defined. + +Improved error checking and fixed memory leaks caused by error return +paths. + +Add ext2fs_flush2() and ext2fs_close2() which takes a flag to allow +the fsync() to be skipped. + +Added a test for extent-mapped journals by mke2fs and tune2fs. + +Added a test for creating a large (over 4GB) journal using mke2fs. + +Added a test to make sure the inode size remains constant. + +The regression test script now prints the list of which tests failed. + +The regression test system now uses /tmp for its scratch files, which +is often a tmpfs mounted file system and hence much faster. + +The i_e2image test was fixed so it works with valgrind. + +Tests that rely on debugfs are now skipped if debugfs wasn't built. + +Fixed the dependencies for "make check" so all required dependencies +are built before running the regression tests. + +A link to com_err.h is installed in $(includedir) during a "make install". + +The po/*.gmo files are automatically rebuilt if they are missing or +out of date. This helps out Debian packaging. + +Allow ext2fs_get_memalign() to compile on systems that don't have +posix_memalign(). + +Fixed a namespace leak in libext2fs (tdb_null). + diff --git a/doc/RelNotes/v1.43.0.txt b/doc/RelNotes/v1.43.0.txt new file mode 100644 index 0000000..cf0602e --- /dev/null +++ b/doc/RelNotes/v1.43.0.txt @@ -0,0 +1,234 @@ +E2fsprogs 1.43 (May 17, 2016) +============================= + +Add support for the ext4 metadata checksum, checksum seed, inline +data, encryption, project quota, and read-only features. + +Support for the very old, experimental, and never-added-to-mainline +compression feature has been removed. + +Mke2fs will now create file systems with the metadata_csum and 64bit +features enabled by default. + +The mke2fs program will now support multiple -O options (instead of +just ignoring all but the last -O option). + +Mke2fs will now correctly determine the size of a file system and +handle the discard operation correctly when the "-E offset=NNN" is +used. (Addresses Debian Bug: #803629) + +The tune2fs program will ask the user for confirmation before starting +dangerous operations if the terminal is available, and it will replay +the journal if necessary. + +Add an ext2/3/4 FUSE server + +Debugfs can now modify extended attributes and journal transactions. + +Debugfs now can properly display and set extended timestamps. + +E2fsck will offer to fix extended timestamps that were incorrectly +encoded by older kernels. + +Fix miscellaneous MMP bugs in debugfs. + +Fix sparse_super2 bugs in mke2fs and resize2fs. + +Fix or improve offset support in mke2fs, e2undo, and libext2fs. + +The resize2fs command can now convert file systems between 64-bit and +32-bit mode. + +Fix potential out-of-bounds memory access in resize2fs when doing a +large off-line file system grow operation. + +We now use a new e2undo file format which is much more efficient and +faster than the old tdb-based scheme. Since it so much faster, +e2fsck, tune2fs, debugfs, and resize2fs now also can support using +creating an undo file. + +The mke2fs command can now set the error behavior when initializing +the file system (so the administrator doesn't have to issue a separate +tune2fs -e command). + +Teach mke2fs to parse a human-readable argument for -i option. + +Teach mke2fs to automatically handle creating file systems > 500T by +automatically enable the meta_bg feature. + +Mke2fs will now prompt for user verification before rewriting a file +system's superblock using the -S option. + +Mke2fs no longer complains if the user tries to create a file system +using the entire block device (e.g., without using a partition). The +minor number convention is not used by all block devices, and it's +quite normal in some circumstances to create a file system on /dev/sdc +instead of /dev/sdc1. + +Fix an "mke2fs -d" bug which could create inodes with invalid +extended attribute blocks + +E2fsck is now much more paranoid about not freeing or corrupting +critical metadata blocks, such as inode table blocks, even if +corrupted indirect blocks or extent trees point at these blocks. + +E2fsck now prints block ranges in pass1b instead of listing all of the +blocks exhaustively. + +E2fsck will try to expand the root directory if the lost+found can't +be linked to the root directory. Also, offer to use the root +directory if lost+found can't be created. + +E2fsck is now more paranoid handling corrupted extent trees as well as +corrupted journals. + +E2fsck can now rebuild extent trees, either (a) to optimize them, (b) +to recover from a corrupted extent tree, or (c) to convert +block-mapped inodes to use extents. + +E2fsck now has a readahead mechanism which can significantly speed its +performance, especially on RAID arrays. + +E2fsck now has a "yes to all" option which the user can give if she is +tired of answering 'y' to a very large number of questions. + +E2fsck will now ignore the badblocks inode if the contents of the +badblocks inode indicate that the portion inode table containing the +badblocks inode is bad. (We must go deeper...) + +E2fsck can now correctly fix directory with holes on bigalloc file +systems. + +E2fsck will now check for extent mapped inodes with no extent header +and clear them if found. + +E2fsck now checks to make sure the extended attribute header doesn't +result in the xattr extending beyond the bounds of the inode + +Fixed a bug in e2fsck to avoid overrunning a buffer containing jbd2 +revoke records if the journal is corrupted. + +Fixed a bug in e2fsck which could cause it loop forever if a special +inode has too many invalid block mappings. + +Fixed a bug in e2fsck which could cause pass1b/c/d processing to get +confused if an attempt to allocate a block can't find any free space +in the file system. + +E2fsck will no longer try to force rewrite blocks located beyond the +file system. + +The e2fsck program will no longer update the quota inodes when it is +interrupted. + +Fix a bug which in rare cases would cause e2fsck -fD to corrupt an +extent-mapped directory. + +Fixed a bug in resize2fs which could lead to resize2fs crashing or a +corrupted file system if the file system is almost completely full +when trying grow a file system and we need to allocate blocks to grow +the block group descriptors. + +Fixed a bug in resize2fs which could cause it to get fooled trying to +determine the RAID array's stride when flex_bg is enabled. + +Fix resize2fs bug that could leave block allocation bitmaps +uninitialized. + +The dumpe2fs output has been improved so it is cleaner and always fits +within 80 columns. Also added a more easily machine-parsable output +of dumpe2fs. + +The mke2fs program can now pre-populate a file system from a directory +hierarchy using the -d option. + +The mke2fs program now skips zeroing inode table blocks if they were +already zeroed using the discard feature. + +Check to make sure file system features which can not be supported by +HURD are not enabled if the file system is created to be +HURD-compatible. + +Added a new e2fuzz command that will fuzz an ext4 image for testing +purposes. + +The debugfs logdump command can now deal with 64-bit revoke tables +correctly. Also, "logdump -O" will print the old log contents (before +the journal was replayed). + +The debugfs bmap command can now be used to set or allocate a physical +block. + +Fixed a bug so "filefrag -B -e -v" does not return a separate entry +for each block. + +The filefrag program now accounts for holes in sparse files created by +the file punch operation as an expected/optimal mapping. + +The file I/O functions now correctly handle inodes containing +uninitialized blocks. + +Fix a bug in tune2fs so that removing uninit_bg feature on a bigalloc +file system won't result in corrupted block bitmaps. + +Updated/fixed various man pages. (Addresses Debian Bug: #798425) + + +Programmer's Notes +------------------ + +Fixed coverity, sparse, gcc -Wall, and clang warnings/nits. + +Added Android build files so that e2fsprogs can be built in the +Android source tree. + +Reduce the use of libc functions in libext2fs that may not be present +in the boot loader environment, at least for those functions that are +needed by boot loaders such as yaboot. + +Developers can now override the debugging and optimization flags by +redefining the CFLAGS makefile macro. + +The libext2fs library now has support for fallocate. + +The mke2fs command will now ask the user for confirmation if block +device or image file contains an existing file system image, and +stdout and stdin are connected to a tty. + +The libext2fs library now picks a more intelligent goal block when +doing block allocations. + +The libext2fs library will now automatically set the BLOCK_UNINT flag +if all of the blocks in a block group are free, to speed up future +e2fsck and dumpe2fs operations on the file system. + +Add two new functions ext2fs_new_range() and ext2fs_alloc_range() to +libext2fs. + +The ext2fs_zero_blocks() command will use FALLOC_FL_ZERO_RANGE for +file-based images. + +The ext2fs_bmap() function supports new flags BMAP_UNINIT and +BMAP_ZERO. + +The ext2fs_new_block2() function will now call the alloc_block hook +before checking fs->block_map. + +Support for the MMP feature can now be disabled at compile time. + +Added support to manipulate extended attributes to libext2fs. + +Added a lot of new regression tests. + +Added endian annotations so it's possible to scan e2fsprogs for endian +problems using a static code analyzer. + +Fixed memory leaks in libext2fs. + +The e2fsck jbd2 handling code has been resynced with the 3.16 kernel. +There is now a script in the contrib directory which automates most of +the resync process. + +The build system will now run cppcheck (a static code analysis tool) +via "make C=1" + diff --git a/doc/RelNotes/v1.43.1.txt b/doc/RelNotes/v1.43.1.txt new file mode 100644 index 0000000..9c27c13 --- /dev/null +++ b/doc/RelNotes/v1.43.1.txt @@ -0,0 +1,80 @@ +E2fsprogs 1.43.1 (June 8, 2016) +=============================== + +Fixed e2fsck so that it would correctly update the project quota usage +when deleting a corrupted and inode, and fixed mke2fs so it wouldn't +dereference memory beyond the small inode structure (which was wrong, +but worked mostly by accident unless hardening or some security malloc +was in use). + +Fixed a large number of FreeBSD portability problems. (To build on +FreeBSD, however, we still need to use GNU Make and redirect dd to use +GNU dd.) + +The configure script now supports --enable-hardening, which enables +stack protection, fortify, read-only relocation tables, immediate +dynamic symbol binding, and text segment ASLR (if the kernel has +userspace ASLR support enabled) by enabling position independent +executable code. (Distributions who want to do their own special +thing can set CFLAGS, CFLAGS_SHLIB, CLFAGS_STLIB, LDFLAGS, +LDFLAGS_SHLIB and LDFLAGS_STATIC as appropriate.) + +The configure script now supports --disable-tdb since on 64-bit +systems, it's much faster to just enable additional swap space. The +scratch_files feature in e2fsck.conf is mostly only useful on 32-bit +systems. + +Fixed the Direct I/O fallback codepath in the Unix I/O manager so that +read/modify/write worked correctly. Fortunately in practice (with the +exception of the Undo handler when running on FreeBSD) used this buggy +codepath. so file systems weren't getting corrupted. + +Mke2fs will now warn if the user provides a label which is too long. +(Addresses Debian Bug: #791630) + +Debugfs's rdump command now works correctly when dumping the root +directory of a file system. (Addresses Debian Bug: #766125) + +Fixed a bug in debugfs so it would correctly calculate a block group's +checksum field field on 64-bit systems. + +E2fsck now has a much more understandable error message when the +journal superblock is corrupt and the user declines to fix it. +(Addresses Debian Bug: #768162) + +Fixed support of extended timestamps on 64-bit systems. + +Updated/fixed various man pages. (Addresses Debian Bugs: #766379, +#761144, #770750, #428361, #766127) + +Fixed various Debian Packaging Issues. (Addresses Debian Bug: #825868) + + +Programming notes +----------------- + +Fixed coverity, sparse, gcc -Wall, and clang warnings/nits. + +Fixed Android build makefiles (which was missing a newly added file in +lib/support). + +In general, checks on s_creator_os have been removed in favor of +feature flag specific checks; if there is something that can't be +checked via the presence of a feature flag, we will simply check +whether the creator OS is *not* EXT2_OS_HURD which is the one +operating system where there has been extensive abuse of the +s_creator_os flag. + +The libmagic library has been suppressed when running the regression +test suite to avoid false test failures caused by differences between +versions of libmagic (and/or the magic number database). + +The tests/test_script program now accepts the --failed option, which +will run those tests that had previously failed. + +Fixed tests build on those systems which require LDFLAGS to be set. + +Fixed the regression test suite so it will properly filter out version +numbers with two components (such as 1.43) from log files before +comparing them with the expected golden output. + diff --git a/doc/RelNotes/v1.43.2.txt b/doc/RelNotes/v1.43.2.txt new file mode 100644 index 0000000..dafc1f2 --- /dev/null +++ b/doc/RelNotes/v1.43.2.txt @@ -0,0 +1,72 @@ +E2fsprogs 1.43.2 (September 1, 2016) +==================================== + +Fix resize2fs so it will not crash if there is an extended attribute +block but it doesn't need to migrate any blocks during an off-line +resize + +Fix a crash when mke2fs or debugfs tries to copy in a directory +hierarchy containing an empty directory + +Mke2fs will now use a larger journal by default for filesystems +greater than 128 GB. (1GB instead of 128 MB.) + +Fix an alignment bug in e2fsck which caused sparc64 architectures to +crash when replaying the journal on file systems with a 64-bit block +number. + +Clarify the message printed by tune2fs message when the user needs to +run e2fsck so it's clear that the -f flag to e2fsck is needed to +force a full e2fsck scan. (Addresses Debian Bug: #828022) + +Fix a bug in e2fsck caused by a power failure during e2fsck's journal +replay could leave the file system in a state where if the file system +is mounted without doing a full e2fsck scan, the file system could get +corrupted + +Fix the logic in e2fsck which decides when to repair legacy negative +timestamp encodings. + +Add a command to debugfs to copy the inode structure from one inode to +another. + +Fix a typo in debugfs's stat command when printing out the dtime field +on file systems with an extended timestamp. + +Fix big endian bugs in the e2undo program. (Addresses Red Hat Bug +#1344636) + +Debugfs's logdump can now properly handle journals larger than 2GB. + +Avoid installing the man page for fuse2fs if it has not been built. + +Update the Catalan, Chinese, Danish, Dutch, French, German, Polish, +Swedish, Ukrainian translations and added new translations for +Hungarian and Serbian. + + +Programming notes +----------------- + +Fix portability problems in fuse2fs. Previously it wouldn't build on +systems with older glibc versions where clock_gettime() is only +available in the librt library, and if libintl is not bundled into the +C library. + +Remove complicated logic which caused a static code analyzer to flag a +false positive. (A static code analyzer also found a valid bug in +deciding when to repair a legacy negative timestamp encoding, so +eliminating false positives is important.) + +Fixed a bug where the ext2fs library cloud provoke when a +extfs2_zero_blocks() is used (via fallocation, initializing a file +system, uninitialized uninitialized inode table blocks) after a +different file system which also used ext2fs_zero_blocks(). + +Enable the unix_io manager in the ext2fs library so it can accept the +use of a file descriptor. This is helpful in cases where the file +descriptor comes from temporary file created using O_TMPFILE, or +passed in from a unix domain socket. + +Fix a Windows64 portability bug. + diff --git a/doc/RelNotes/v1.43.3.txt b/doc/RelNotes/v1.43.3.txt new file mode 100644 index 0000000..6b902cb --- /dev/null +++ b/doc/RelNotes/v1.43.3.txt @@ -0,0 +1,27 @@ +E2fsprogs 1.43.3 (September 4, 2016) +==================================== + +Fix e2fsck's handling of timestamps on 32-bit systems. + +E2fsck will now check, and if necessary repair the extra isize fields +in the inode and superblock. + +Fix crashes on architectures such as sparc64 that are sensitive to +unaligned pointer dereferences in the journal recovery code when +journal checksums are enabled. + +Programming notes +----------------- + +Support reproducible builds by not capturing the build directory into +the mk_cmds and compile_et scripts. Also fix debian build rules to +ensure build reproducibility. + +Fix debian build rules to ensure build reproducibility and to avoid +hiding the linker flags for e2fsck.static so the build hardening log +scanner can properly audit the build. + +Fix compatibility with FreeBSD's pmake and teach the configure script +to force the creation of pmake-compatible Makefiles if the +FORCE_NATIVE_MAKE environment variable is set to a non-empty value. + diff --git a/doc/RelNotes/v1.43.4.txt b/doc/RelNotes/v1.43.4.txt new file mode 100644 index 0000000..7b3f33d --- /dev/null +++ b/doc/RelNotes/v1.43.4.txt @@ -0,0 +1,71 @@ +E2fsprogs 1.43.4 (January 31, 2017) +=================================== + +Fix e2fsck to require that the system.data extended attribute is +always present even for files smaller than 60 bytes, to be consistent +with the kernel. + +Fix a bug which was causing mke2fs -d and fuse2fs to improperly handle +Posix ACL's. + +Fix a bug which could cause mke2fs -d to fail if there is an +zero-length file in source directory tree. + +Clarify the default for the "proceed?" question printed by mke2fs and +tune2fs. (Addresses Debian Bug: #852727) + +Debugfs will now display project quota information. + +Debugfs's do_set_xattr now uses C strings to parse extended attribute +values, and will print the extended attributes using either C strings +or hex bytes when using debugfs's do_get_xattr command. It will now +allow developers to see the contents of the system.data extended +attribute. + +Fix a bug in mke2fs where I/O errors weren't getting properly reported +to the user. + +Fix multiblock writes in the unaligned Direct I/O fallback code. +(Which is rarely needed on Linux systems, but which is required on +Freebsd systems.) + +Make sure the default mke2fs.conf file includes the uninit_bg feature +flag. (Which was accidentally dropped in v1.43). + +Fix a bug in resize2fs when operating on very large file systems which +have a block size different from the VM page size. + +If the reported device size is absurdly large, mke2fs will now report +an error instead looping forever or crashing. + +Fix various Coverity warnings and other memory leaks in fuse2fs and +extended attribute manipulation functions. + +Replace a test file but which had a "non-commercial use-only" +copyright permission file with a newer version from the Cyrus imapd +package which now has a 4-clause BSD license, which was making some +lawyers nervous, even though the test file in question was only used +in lib/et's regression testing and was never included in any compiled +binary. (Addresses Debian Bug: #840733) + +Stop installing mkfs.ext4dev and fsck.ext4dev + +Update Chinese, Czech, Polish, Serbian, and Spanish translations and +add the Finnish and Malay translation. (Addresses-Debian-Bug: #774379) + +Update various man pages (Addresses-Debian-Bug: #852726) + +Programming notes +----------------- + +Fix more FreeBSD-11 compatibility bugs, including some unmasked by +FreeBSD 11-rc2. + +Fix the Mac build. + +Fix build failure on RHEL 5.x systems caused by an old version of +libmagic. + +Fix a number of bugs reported by ASAN that can cause some (mostly +harmless) memory dereferences beyond allocated memory. + diff --git a/doc/RelNotes/v1.43.5.txt b/doc/RelNotes/v1.43.5.txt new file mode 100644 index 0000000..c8a5084 --- /dev/null +++ b/doc/RelNotes/v1.43.5.txt @@ -0,0 +1,133 @@ +E2fsprogs 1.43.5 (August 4, 2017) +================================= + +Fix a bug which could cause e2fsck to loop forever when rebuilding an +encrypted directory with entries with identical prefixes up to an +embedded NUL character. + +Fix build when configured with --disable-threads or --enable-profile. + +Fix ext2fs_sync_device() so it returns the proper error code if the +BLKFLSBUF ioctl fails for some reason. + +Fix a potential crash in tune2fs when enabling project quota when the +file system has no inodes by fixing error handling in the +quota_write_inode() in libsupport. + +Fix a bug in debugfs's "ls -p" handling which could cause it to print +garbage after a file name in a directory entry. + +Fix a number of bugs in debugfs, dumpe2fs, e2fsck, tune2fs, and +resize2fs where a carefully/maliciously corrupted file systems (found +by American Fuzzy Lop) could these programs to crash or hang. +(Addresses Debian Bug #868489) + +E2fsck no longer issues some harmless bitmap warnings caused by a +corrupted file system; since those corruptions will be fixed up by +e2fsck later, there's no point issuing these internal warnings. + +E2fsck will now notice invalid quota inode numbers, and offer to fix +them. + +Fix a regression introduced in e2fsprogs 1.43 which broke mke2fs's +hugefile creation so that they aren't contiguous. (Addresses Google +Bugs 62791459 and 638037607) + +Fix how backup superblocks are written in big endian systems so they +are all correctly byte swapped. + +Fixed tune2fs's support for enabling and disabling project quota. + +The badblock program now properly handles languages which have +multi-column wide character such as Chinese. (Addresses Debian Bug: +#860926) + +The mke2fs -U option now accepts "null", "clear", "random", or "time" +just as tune2fs's -U option. + +Fix e2fsck's -E bmap2extent feature (which converts a file to use +extents from indirect block maps) so that it handles sparse files correctly. + +Fix libext2fs to correctly handle accounting for an external xattr +block on bigalloc file systems. + +Fix e2fsck to correctly handle quota accounting when deleting files +that have multiply-claimed blocks pass 1b. + +Fix potential buffer overrun bug in e2fsck when using 128 byte inodes. +(Addresses Google Bug 37326362). + +E2fsck's extent tree optimization can now be disabled via an +command-line extended option or via an e2fsck.conf configuration +parameter. + +The e2fsck program now properly updates the quota accounting when +optimizing the extent tree. (Addresses Google Bug 36391645) + +Fix some error handling in e4crypt when operating on keyring ID's. + +Fix e2fsck's quota handling when the bigalloc feature is enabled. + +The libext2fs file system now uses readahead when opening file systems +to speed up opening very large file systems with the meta_bg option. + +If e2fsck logging is enabled, e2fsck will report the exit code in the +last line of the log file. + +Debugfs can now open file systems with a bad superblock checksum, and +the show_super_stats command will print the expected checksum. + +Fix a regression introduced in e2fsprogs 1.43.4 where tune2fs was not +able to correctly enable the quota feature. (Addresses Debian Bug +#855417) + +E2fsck will only return an exit status code of 1 if it has fixed a +file system corruption. If it only performed an optimal optimization +of internal file system metadata, it will now return 0. + +Fix e2fsck so it won't check inode fields of deleted inodes. This was +mostly harmless, but the addition of a check in 1.43.4 to enforce the +requirement that inline data inodes have a system.data attribute +caused a regression in xfstests generic/079. Fix this and a number of +other checks which could lead to false positive reports of file system +corruption. + +Removed a debugging printf in libsupport which could result to some +extraneous and confusing output if the user specifies a quota type. + +The debugfs logdump command now accepts a new -S option which will +cause it to print information about the journal superblock. + +Added a missing space in debugfs's ls -l output to separate the size +and date fields. + +Update the Czech, Danish, Dutch, French, Hungarian, Polish, Serbian, +Spanish, Swedish, Ukrainian, and Vietnamese translations. + +Update various man pages. (Addresses Debian Bugs #867895 and #865584) + +Fix various compiler and UBSAN warnings. + +Fixed various Debian Packaging Issues. (Addresses Debian Bugs +#864144 and #866623) + + +Programming notes +----------------- + +The blkid library can now recognize exfat file systems. + +Add new test, j_recover_csum3_64bit, which checks to make sure we +correctly recovering 64-bit journals using the v3 checksum format. + +Fix portability assumption in tests; don't depend on the existence of +/dev/stdin. + +Fix portability with newer versions of glibc and with Cygwin builds on +Windows 8 and Windows 10. + +Clean up the comments in problem.c match the message that will +actually be printed. + +Removed an unused an obsolete header file. + diff --git a/doc/RelNotes/v1.43.6.txt b/doc/RelNotes/v1.43.6.txt new file mode 100644 index 0000000..1050d5e --- /dev/null +++ b/doc/RelNotes/v1.43.6.txt @@ -0,0 +1,70 @@ +E2fsprogs 1.43.6 (August 29, 2017) +================================== + +Fix printing of quota inconsistency messages on 32-bit platforms in +e2fsck. Also fix a bug which cause project quota problems to be +labelled as group quota problems. + +Fix UI problems caused by fuzzy translations such that some messages +are in English and some are in the foreign language, and it's not +obvious to user how to answer yes/no questions. (Addresses Debian +Bug: #856586). + +Fix some out-of-bounds memory accesses in e2fsck caused by (usually +maliciously) corrupted file systems. (Addresses Debian Bugs: #871539, +#871540) + +Optimize CPU usage in e2fsck for very large, very fragmented sparse +files. + +Add an optional mode in e2fsck which trades off additional memory for +CPU time when processing file systems that are heavily hard-linked. +(This can be a very large amount of memory, so this feature is +disabled for now. How to automatically determine when it would be +helpful to enable this optimization, and when it is _safe_ to enable +this optimization is still a bit of a research problem.) + +The mke2fs program will automatically upsize the inode size to 256 if +it is not explicitly specified on command-line and the default inode +size is not large enough to support the project quota feature +requested by the user. If the inode size is explicitly specified to +be 128 bytes, and the project quota is enabled mke2fs will fail since +with an error explaining that project id's can't be supported when the +inode size is < 256 bytes. + +The tune2fs program will not allow the project feature or project +quotas to be enabled in the inode size is 128 bytes. + +The tune2fs program now prints a more understandable message explaining +that the file system needs to be checked using e2fsck -f before +running certain complex tune2fs operations. (Addresses Debian Bug: +#857336) + +If the proceed_delay option is enabled in /etc/e2fsck.conf, the message +indicating that user can wait N seconds to proceed was ambiguous. +That message has been made more clear. (Addresses Debian Bug: +#857336) + +Fix LFS bug which caused e2image to fail to create regular e2image +files which are larger than 2 GiB on 32-bit platforms. (Addresses +Debian Bug: #855246) + +Fix FreeBSD portability problem caused by the fact that they no longer +use block devices. (Disks are character mode devices.) + +Update the Czech, French, Polish, Swedish, and Vietnamese translations. + +Fixed various Debian Packaging Issues. + + +Programming notes +----------------- + +Avoid changing the blkid cache when running tests. (Normally the +blkid cache is not writable by the user running tests, but...) + +The tar file generation process will now create reproducible +artifacts. + +Removed legacy entries for ext4dev in the default mke2fs.conf file. + diff --git a/doc/RelNotes/v1.43.7.txt b/doc/RelNotes/v1.43.7.txt new file mode 100644 index 0000000..55e434f --- /dev/null +++ b/doc/RelNotes/v1.43.7.txt @@ -0,0 +1,29 @@ +E2fsprogs 1.43.7 (October 16, 2017) +=================================== + +Fix the error handling code in debugfs, fuse2fs and tune2fs so errors +trying to replay the journal won't accidentally result in a seg fault +if reopening the file system after the journal replay fails for some +reason. + +Fix resize2fs to avoid it from either failing or corrupting the file +system image in certain corner cases when doing an off-line resize. + +Fix many spelling mistakes in various man pages, code comments, and +program messages. + +Fix e2fsck and debugfs so that maliciously corrupted file systems will +not cause buffer overflows. (Addresses Debian Bugs: #873757, #878104) + +Update German translation. (Addresses Debian Bug: #833514) + +Fixed various Debian Packaging Issues. (Addresses Debian Bugs: +#873812, #873813, #876551) + +Programming notes +----------------- + +Test descritions have been shorted to fit in 80 columns. + +Fix various tests to avoid leaving temp files in /tmp. + diff --git a/doc/RelNotes/v1.43.8.txt b/doc/RelNotes/v1.43.8.txt new file mode 100644 index 0000000..cb26a16 --- /dev/null +++ b/doc/RelNotes/v1.43.8.txt @@ -0,0 +1,48 @@ +E2fsprogs 1.43.8 (January 1, 2018) +================================== + +Fix a bug where updated bitmap checks might not be written to disk. +(Addresses Debian Bug: #883869) + +Some newly added fields in the superblocks were not getting byte +swapped (which were not noticed since big endian systems are amazingly +unpopular). Fix them and compile-time checks to avoid this class of +bugs from happening in the future. (Lustre Bug #9309) + +Fix a potential use after free bug in e2fsck when fixing a corrupted +root node in directory hash tree. + +Fix a bug in e2fsck where a badly/maliciously corrupted superblock +(which is not fixed due to the -n option, for example) can cause a +floating point exception when printing the summary statistics. +(Addresses Debian Bug: #879220) + +Fix debugfs's ncheck command so that it correctly prints the inode +number when printing an error message. + +Fix a bug in e2freefrag where it could print an incorrect free blocks +count on a file system with the 64-bit block number feature. + +Update the German, Serbian, Spanish, and Ukrainian translations. + +Fix a bug where resize2fs's free blocks sanity check could fail with a +false positive and refuse to check a file system with the 64-bit block +number feature. + +Fix and clarify various man pages and documentations. Also fixed up +some random usage texts that were incorrect. (Addresses Debian Bugs: +#880483) + +Fixed various Debian Packaging Issues. (Addresses Debian Bugs: #880207, +#881408, #881590, #881591) + +Programming notes +----------------- + +Fix various compiler warnings. + +Clean up Makefile output. + +Fix compatibility problems with glibc 2.27 casued by a collision with +copy_file_range(). + diff --git a/doc/RelNotes/v1.43.9.txt b/doc/RelNotes/v1.43.9.txt new file mode 100644 index 0000000..6dbe0db --- /dev/null +++ b/doc/RelNotes/v1.43.9.txt @@ -0,0 +1,15 @@ +E2fsprogs 1.43.9 (February 8, 2018) +=================================== + +Remove the huge file flag from libe2p (and hence from chattr/lsattr), +since it was never made visible by the kernel. Remove the description +of some compression related flags, and add a description of the +encrypted file flag, and the project hierarchy flag. + +Remove a misplaced "MNP is unsupported" message from debugfs. + +Fix a build failure in lib/ext2fs/swapfs.c on big-endian systems. +(Addresses Debian Bug #886119) + +Fix various Debian packaging issues. (Addresses Debian Bug #269569). + diff --git a/doc/RelNotes/v1.44.0.txt b/doc/RelNotes/v1.44.0.txt new file mode 100644 index 0000000..59cd802 --- /dev/null +++ b/doc/RelNotes/v1.44.0.txt @@ -0,0 +1,82 @@ +E2fsprogs 1.44.0 (March 7, 2018) +================================ + +Updates/Fixes since v1.43.9: + +UI and Features +--------------- + +E2fsprogs now supports the large_dir (INCOMPAT_LARGEDIR) feature. This +feature allows larger directories to be created, both with directory +sizes over 2GB and and a maximum htree depth of 3 instead of the +current limit of 2. These features are needed in order to exceed +the currently limit of approximately 10M entries in a single +directory for 4KB blocksize (~100k for 1KB). + +E2fsprogs now supports the ea_inode (INCOMPAT_EA_INODE) feature, which +stores large extended attributes in an external inode instead of a +single data block. This is backwards compatible with a Lustre file +system feature, but it has been extended to support deduplicating +extended attribute values which are used in multiple inodes. + +The metadata_csum feature (RO_COMPAT_METADATA_CSUM) is now enabled by +default by mke2fs. + +The resize2fs program will no longer complain about resizing bigalloc +file systems as being dangerous when doing an on-line resize (since this +is purely a kernel feature). + +Debugfs's ls command will now print the high bits of the inode's mode +bits. + +Fixes +----- + +Fixed some potential buffer overrun bugs in the blkid library and in the +fsck program. + +There were some corner cases which tune2fs wouldn't correctly handle +when operating on a file system which was not cleanly mounted and thus +required running the journal because it could be modified. Tune2fs will +now run the journal before trying to change the superblock, and if the +file system needs to be checked after the journal has been replayed, it +will require it before proceeding. Also if the file system is busy (for +example, because it is in use by Lustre), but is not present in the +/proc/mounts or /etc/mtab, tune2fs will not try to replay the journal, +since this could do real damage if it the file system is being actively +modified by the kernel. + +The libss library (used by debugfs) now supports the version 7 of the +libreadline shared library. + +The e2freefrag program will use the GETFSMAP ioctl if it is available +and the file system is mounted, so that the free space statistics will +be more accurate. + +The consistency checks for symlinks (especially for encrypted and inline +data file sytems) in e2fsck are now much more careful/stringent. Also +fixed a bug where creating a symlink using ext2fs_symlink() which was +exactly 60 bytes long when inline data was enabled would result in a +missing system.data xattr. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Mke2fs now uses io_channel_flush() instead of sync() for the sync_kludge +feature. + +E2fsprogs now uses i_size as the primary way of determining whether a +symlink is a fast symlink. + +Fix various compiler and UBSAN warnings. + +Long running test are now skipped with "make check" and only run when +"make fullcheck". The test runner will warn when potentially long +running tests are being run via "make check". + +E2fsck is now much faster for bigalloc file systems when scanning +extents for bigalloc file systems. (Addresses Google Bug #36886699) + +Update Czech, Spanish, French, Malay, and Ukrainian translations. + diff --git a/doc/RelNotes/v1.44.1.txt b/doc/RelNotes/v1.44.1.txt new file mode 100644 index 0000000..4503c92 --- /dev/null +++ b/doc/RelNotes/v1.44.1.txt @@ -0,0 +1,48 @@ +E2fsprogs 1.44.1 (March 24, 2018) +================================ + +Updates/Fixes since v1.44.0: + +Fixes +----- + +E2fsprogs 1.44.0 introduced a regression introduced which caused e2fsck +to fail to support HTree directories on big-endian systems. Fix how we +read block numbers for internal htree nodes. + +Removed a potential memory leak from fsck. + +E2image now correctly creates e2image files for bigalloc file systems. + +Dumpe2fs and debugfs now correctly support e2image files for file +systems that have the meta_bg option enabled. + +E2fsck and debugfs now correctly handle delete inodes (including +processing the orphaned inode list in the case of e2fsck) for bigalloc +file systems. (Addresses Google Bug: #73795618) + +Portability fixes for GNU Hurd. (Addresses Debian Bug: #893590) + +Portability fixes for building in some cross-build environments. + +Portability fixes for MacOS 10.6.8. + +Add clarifications to chattr's man page. (Addresses Debian Bug: +#890390) + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Debugfs now reads allocation bitmaps much more efficiently when opening +a file system. + +Update Swedish translation file. + +Add Vcs-* fields to debian packaging. (Addresses Debian Bug: #887512) + +Fix some test failures on GNU Hurd caused by a different default block +size. + +Add new regression tests. + diff --git a/doc/RelNotes/v1.44.2.txt b/doc/RelNotes/v1.44.2.txt new file mode 100644 index 0000000..7b5c774 --- /dev/null +++ b/doc/RelNotes/v1.44.2.txt @@ -0,0 +1,53 @@ +E2fsprogs 1.44.2 (May 14, 2018) +=============================== + +Updates/Fixes since v1.44.1: + +Fixes +----- + +E2fsck now prints a warning message if broken_system_clock is set in +e2fsck.conf and this causes the check interval to be ignored so it is +clear to the user. + +Fix e2image handling of e2i files on big endian systems + +Add sanity checks for inodes containing xattr values to prevent +maliciously crafted file systems from causing crashes caused by infinite +recursion from causing e2fsck and debugfs to crash. + +Fix e2fsck so that quota usage is adjusted when clearing orphaned +inodes. + +Fix filefrag so that unknown flags returned by FIEMAP won't cause a +buffer overrun. + +Fix mke2fs to print a more useful/correct error message if +ext2fs_close_free() at the end of the file system creation process. + +Improve chattr's man page. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Demote e2fsprogs in debian packaging from Essential: yes to +XB-Important: yes (Addresses Debian Bug #474540) + +Fix intl/Makefile so it uses @AR@ instead of a hard-coded 'ar' (which +matters when cross compiling). + +Update Polish translation file. + +Fix the address of the FSF in various GPL/LGPL copyright licenses. + +Clean up the i_bitmaps test so it doesn't leave temporary files behind. + +Remove use of /dev/stdin in the regression tests since not all systems +have /dev/stdin. + +Fix the f_bigalloc_badinode and f_bigalloc_orphan_list regression tests +so they uses mke2fs and ebugfs from the build tree. They may not exist +in the users PATH, and if they not or if they are extremely +old/obsolete, those tests would fail. + diff --git a/doc/RelNotes/v1.44.3.txt b/doc/RelNotes/v1.44.3.txt new file mode 100644 index 0000000..e68032c --- /dev/null +++ b/doc/RelNotes/v1.44.3.txt @@ -0,0 +1,106 @@ +E2fsprogs 1.44.3 (July 10, 2018) +================================ + +Updates/Fixes since v1.44.2: + +UI and Features +--------------- + +The debugfs inode_dump command can now print a hex dump of the i_block +array and the extra space in the inode, as a convenience to someone +investigating a corrupted inode. + +The debugfs block_dump and inode_dump command can now print low-level +dump of extended attribute data structures in the block or inode. + +The dumpe2fs command can now print out information in the Multi-Mount +Protection (MMP) block. This is also available as e2mmpstatus command +for compatibility with the Lustre utilities. + +The debugfs command can now operate on some file systems with +corrupted superblocks so they can be fixed. This includes file +systems with a corrupted inodes count field and file systems where not +all of the allocation bitmaps have valid locations or are not +readable. + + +Fixes +----- + +The inode's project ID is now properly byte-swapped on big-endian +systems. + +E2fsprogs now ignores s_desc_size for file systems that do not have +the 64-bit feature set. This makes it more consistent with the +kernel, so it can now operate on file systems that the kernel is +willing to mount. + +E2fsck now considers device inodes with the extents flag as corrupt +and offer to clear them. + +E2fsck more properly handles cases where s_inodes_count is corrupted. + +E2fsck no longer spews large number of errors when the superblock +badly corrupted (restoring its behavior pre-1.43). + +E2fsck will now offer to set the dir_nlink feature if it is not set +and file system requires the dir_nlink feature because there are too +many subdirectories in a directory. + +E2fsck will no longer loop infinitely due to a maliciously crafted +file system which has a fully uninitialized inode table in the first +block group. + +E2fsck will no longer hang if the last block in the file system is a +fixed-metadata block. (Very rare, but could happen.) + +E2fsck no longer allows initialized blocks to exist past i_size. This +is something the Linux implementation of ext4 has never done (and should +never do). + +While replaying the journal in e2fsck, certain errors would previously +cause e2fsck to print a non-sensical error message (e.g., "Unknown code +____ 251 while recovering journal"). This has been fixed. + +In cases where more than 75% of the block group will be used for group +descriptor table, mke2fs would previously create an invalid file +system with both the meta_bg and resize_inode features enabled. It +will now disable the resize_inode feature. + +The mke2fs program now properly creates a file system which is exactly +1 << 32 blocks. Previously the s_inodes_count field would overflow, +and the file system would be created with a minimal number of inodes. + +Recent kernels will report errors on a file or block device which +occurred before the file or block device was opened via fsync() or +close(). This will cause e2fsck to incorrectly report a failure. Work +around this by calling fsync() immediately after the file or block +device is opened in the unix_io layer, and throwing away the error. + +Filefrag will no longer ignore errors returned by fsync. + +Debugfs will no longer print spurious checksum errors when failing to +open a file system for unrelated reasons. + +Updated/fixed various man pages. (Addresses Launchpad Bug: #1743553) + + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Synchronized changes from Android's AOSP e2fsprogs tree. + +Debugfs's mknod command now works correctly on some 32-bit systems where +previously it had a portability problem caused by some object files +being compiled with LFS, and some without. This fixes some regression +test failures on 32-bit MIPS (for example). + +Various clean ups, portability, and performance improvements to +e2fsprogs's regression test framework. + +Fixed Coverity, sparse, gcc -Wall, and clang warnings/nits. + +Update Czech, Dutch, Spanish, French, Polish, Swedish, Ukrainian, and +Vietnamese translations. + diff --git a/doc/RelNotes/v1.44.4.txt b/doc/RelNotes/v1.44.4.txt new file mode 100644 index 0000000..db130c6 --- /dev/null +++ b/doc/RelNotes/v1.44.4.txt @@ -0,0 +1,60 @@ +E2fsprogs 1.44.4 (August 18, 2018) +================================== + +Updates/Fixes since v1.44.3: + +UI and Features +--------------- + +Add basic support for the ext4 verity feature (aka fsverity). It is a +read-only compatibility feature which uses Merkle trees to add +functionality much like dm-verity on a per-file basis. For this release +we simply allow e2fsck to accept file systems with the verity feature +enable (no special handling is needed) and mke2fs to create file systems +with the verity feature. + + +Fixes +----- + +E2fsck will now properly repair a file system that has both the +resize_inode and meta_bg features enabled simultaneously (which is never +supposed to happen, but it could happen in versions of mke2fs before +1.44.3 when it was given parameters where more than 75% of the block +group was used for group descriptor tables). + +Avoid a floating point exception crash when libblkid tries probing a +maliciously corrupted HFS+ superblock. + +Debugfs's ncheck command now properly will handle inodes that have +multiple hard links. + +On platforms that don't supply strdup, the replacement function for +strdup() had a bug which would cause it to crash if it was used. +(Fortunately this only happens if the [scratch_files] feature in e2fsck +is used.) + +Fixed support for devices which have non-512 byte block sizes on Apple +Darwin. + +E2fsprogs 1.44.3 would fail to compile on very old versions of gcc. +This is now fixed. + +Update and clarify man pages. (Addresses Debian Bug: #757831) + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Synchronized changes from Android's AOSP e2fsprogs tree. + +Instead of building the subset e2fsprogs-libs tar file, add a new +configure option, --enable-subset. This along with other changes (such +as dropping obsolete files that aren't shipped as part of +e2fsprogs-X.YY.tar.gz) allows us to be able to build the tarball using +the "git archive" command. + +Fixed various debian packaging issues (Addresses Debian Bug: #905195) + +Update Danish, Spanish, and Swedish translations. + diff --git a/doc/RelNotes/v1.44.5.txt b/doc/RelNotes/v1.44.5.txt new file mode 100644 index 0000000..0cda992 --- /dev/null +++ b/doc/RelNotes/v1.44.5.txt @@ -0,0 +1,77 @@ +E2fsprogs 1.44.5 (December 15, 2018) +==================================== + +Updates/Fixes since v1.44.4: + +UI and Features +--------------- + +When e2fsck notices it could optimize an extent tree, it will now ask +"Optimize?" instead of "Fix?", which was confusing some users since it +implied that something was broken. + + +Fixes +----- + +Use 64-bit counters to track the number of files that are defragmented +using in e4defrag, to avoid overflows when more than 2**32 files are +defragmented. (Addresses Debian Bug: #888899) + +Correctly translate Posix ACL's. This was a regression introduced in +v1.44. (Addresses Launchpad Bug: #1807288) + +Use the online free block counts so e2freefrag's percentages are +correct. + +Fix a false warning that tune2fs will take long time to change a UUID if +the metadata_csum feature is not enabled. + +E2fsck will only offer to set the inline_data feature flag when the +inline flag is set on the inode, *and* the system.data xattr is present. + +E4defrag will handle the case where it is running as root and it can't +find the file system to open more gracefully. (Addresses Debian Bug: +#907634) + +Fix a bug where resize2fs was failing to update the extent tree +checksums in an corner case. (Addresses Launchpad Bug: #1798562) + +Fix fuse2fs's command line parsing when options are specified after the +target device/image. + +Fix a bug which could cause e2fsprogs tools to segfault on a corrupted +file system where the journal's s_nr_users is impossibly large. + +E2image now includes the mmp block (if needed) when creating a +metadata-only image. + +Fix various Verity handling bugs which made it completely unusable in +e2fsprogs 1.44.4. + +Fix a bug in tune2fs where it would dereference of freed memory after +replaying the journal. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Synchronized changes from Android's AOSP e2fsprogs tree. + +Fix groff formatting nits in various man pages. (Addresses Debian Bug: +#916188) + +Fixed various debian packaging issues (Addresses Debian Bug: #915942) + +Adjusted the copyright license for lib/blkid/version.c to be LGPL (and +consistent with the rest of files in that directory). + +Fix various clang warnings. + +Fix "make install" when configure was run with --enable-subset. + +Make sure the regression tests clean up their tmpfile if the test script +exits. + +Fix build failures on non-glibc systems. + diff --git a/doc/RelNotes/v1.44.6.txt b/doc/RelNotes/v1.44.6.txt new file mode 100644 index 0000000..39e9b95 --- /dev/null +++ b/doc/RelNotes/v1.44.6.txt @@ -0,0 +1,48 @@ +E2fsprogs 1.44.6 (March 5, 2019) +================================ + +Updates/Fixes since v1.44.5: + +Fixes +----- + +If files are created while e4defrag is running, it's quite possible for +succeed_cnt to be larger than total_count, in which case the number of +failures (calculated via total_count - succeed_cnt) will overflow and +become a very large unsigned number. (Addresses Debian Bug: #888899) + +Fix e2fsck so it can correctly handle directories > 2 GiB when the +largedir feature is enabled. + +Fix mke2fs's hugefile creation so that we correctly reserve enough +metadata blocks for a given file system size. Otherwise for certain +unfortunately sized disks/partitions, the hugefile creation would fail. +(Addresses Google Bug: 123239032) + +Fix the libext2fs library to be more robust against invalid block group +descriptors to prevent e2fsprogs from crashing (or possibly being +p0wned) by maliciously modified file systems. (Addresses Google Bugs: +119171089, 119929050) + +Fix mke2fs and debugfs so they can correctly copy in files > 2 GiB. + +Fix debugfs so its stat command can correctly display directory +sizes > 2 GiB. + +Fix memory leaks in debugfs, mke2fs, and e2freefrag. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Synchronized changes from Android's AOSP e2fsprogs tree. + +Avoid unnecessarily linking badblocks with the libblkid shared library. +(Addresses Debian Bug: #919958) + +Stop depending on the debugfs binary for test data, since depending on +the compiler, there might be sufficient aligned zero bytes that the +resulting file(s) created by test cases could have unexpected sparse +blocks, leading to test failures. (Addresses Google Bug: #122085761) + +Fixed various debian packaging issues. diff --git a/doc/RelNotes/v1.45.0.txt b/doc/RelNotes/v1.45.0.txt new file mode 100644 index 0000000..d92c11b --- /dev/null +++ b/doc/RelNotes/v1.45.0.txt @@ -0,0 +1,40 @@ +E2fsprogs 1.45.0 (March 6, 2019) +================================ + +Updates/Fixes since v1.44.6: + +UI and Features +--------------- + +Tune2fs can now set the file system error bit to force a check at the +next fsck by using the extended option "force_fsck". + +E2fsprogs now has an e2scrub script which will allow e2fsck to be run on +volumes that are mounted on an LVM device. The e2scrub_all will find +all ext* file systems and run them using e2scrub (if possible). + +Mke2fs will attempt to use ZERO_RANGE before PUNCH_HOLE so that we don't +lose allocated blocks in preallocated files. + +The fuse2fs command now supports a "fakeroot" option to allow an +unprivileged user to fuse2fs to modify rootfs images. + +Add initial support for setting the character set encoding and case +folding file system feature. We don't have support to validate file +names as being valid for a given character set encoding yet, but this +will allow compatibility for this feature when the kernel support +lands. This includes support in lsattr and chattr to understanding the +casefold attribute flag. + +Debugfs can now set the inode's checksum field to test support for +inodes with bad inode checksums. + +E2image now accepts the -b and -B options to allow the user to specify +the superblock location when creating a raw or qcow2 image. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Add support for building e2fsprogs using Link Time Optimization (LTO), +UBSAN, Address Sanitizer, or Thread Sanitizer. diff --git a/doc/RelNotes/v1.45.1.txt b/doc/RelNotes/v1.45.1.txt new file mode 100644 index 0000000..d8ae0bc --- /dev/null +++ b/doc/RelNotes/v1.45.1.txt @@ -0,0 +1,81 @@ +E2fsprogs 1.45.1 (May 12, 2019) +=============================== + +Updates/Fixes since v1.45.0: + +UI and Features +--------------- + +Teach the e2scrub and e2scub_all commands the -n option, which prints +what these commands would do. + +Finalize the casefold support so it is synchronized with what we +actually shipped in the kernel. This includes updating to Unicode 12.1, +dropping ASCII casefolding support, and switching from NFKD to NFD. The +the ext4 feature name also changed from fname_encoding to casefold. +Add support for casefold to dumpe2fs and debugfs. + +Debugfs now prints non-printable characters using C-style hex escape +sequences (e.g., "\xc1" instead of M-A). The old scheme printed +filenames in an ambiguous way, which complicated using debugfs for ext4 +encryption regression tests. + +E2fsck now checks to make sure that all unused bits in the block +allocation bitmaps are set; if there are some unset bits in the block +bitmaps for file systems where the blocks_per_group is less than +8*blocksize (not the default), this can confuse the kernel's multi-block +allocator and return a bogus free extent. E2fsprogs guarantees this +when it writes out the bitmap blocks, but it's possible that file system +blocks could have gotten corrupted since the last time e2fsprogs wrote +out the bitmap blocks. + +E2fsck now has support write out a problem code log which can provide +more debugging and monitoring information. This can be configured using +/etc/e2fsck.conf. + + +Fixes +----- + +Teach e2scrub and e2scrub to give more intelligible error messages when +the lvm2 and util-linux packages are not installed, or if the commands +are not run as root. + +Teach e2scrub_all to skip trying to run e2scrub on a logical volume if +its volume group did not have enough space to create a snapshot. +(Addresses Debian Bug: #924301) + +E2scrub will tag its snapshots with UDISK_IGNORE so they do not show up +in GUI's. (Addresses Debian Bug: #926112) + +Mark the e2scrub service files to indicate that CAP_SYS_ADMIN and +CAP_SYS_RAWIO are required. This avoids errors when e2scrub is run an +container where root does not have these capabilities. (Addresses +Debian Bug: #926138) + +Fix mke2fs's check for absurdly large disks. Previously check was 2^10 +too small, so mke2fs would fail when trying to format a 900TB file +system. + +Fixed debugfs so it correctly prints ea_in_inode xattr values. + +Fixed various casefold bugs. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Synchronized changes from Android's AOSP e2fsprogs tree. + +Fix autoheader warnings caused by a missing template in AC_CHECK_LIB. + +Fix the the "make install-strip" command. + +Dropped utf8_* and nls_* symbols from the libext2fs shared library, to +avoid namespace contamination. + +Fix the f_valid_ea_in_inode test so actually tests the ea_in_inode +feature. + +Fixed various debian packaging issues. (Addresses Debian Bug: #924275) + diff --git a/doc/RelNotes/v1.45.2.txt b/doc/RelNotes/v1.45.2.txt new file mode 100644 index 0000000..43126de --- /dev/null +++ b/doc/RelNotes/v1.45.2.txt @@ -0,0 +1,30 @@ +E2fsprogs 1.45.2 (May 27, 2019) +=============================== + +Updates/Fixes since v1.45.1: + +Fixes +----- + +Fixed various problems with how e2scrub_all is run from cron, when not +all of the required packages are installed, or there are no LVM devices +on the system. (Addresses Debian Bug: #929186, #929287, #928977) + +When mke2fs asks the user if she should proceed, fall back to the +English 'y' or 'Y' characters since there could be a missing translation +prompting the use of the English 'y' character. (Addresses Debian Bug: +#907034) + +Fix spurious complaint of blocks beyond i_size for verity files. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Fixed various debian packaging issues. + +Fixed "make install" failure when the cron.d directory does not exist. + +Update the Czech, Malay, Polish, Spanish, Swedish, and Ukarainian +translations. Add the new Portuguese translation. + diff --git a/doc/RelNotes/v1.45.3.txt b/doc/RelNotes/v1.45.3.txt new file mode 100644 index 0000000..8d34aad --- /dev/null +++ b/doc/RelNotes/v1.45.3.txt @@ -0,0 +1,65 @@ +E2fsprogs 1.45.3 (July 14, 2019) +================================ + +Updates/Fixes since v1.45.2: + +UI and Features +--------------- + +Whether or not automatic online scrubs will be run is now controlled by +a setting in /etc/e2scrub.conf. To enable automatic online scrubs, +uncomment out the line containing "periodic_e2scrub=1". + +The fuse2fs program is now installed in /usr/bin instead of /usr/sbin, +since it does not require root privileges. + +Fuse2fs now works with if fusermount from FUSE V3 is installed. +However, in order to provide this compatibility, if you are using a +fusermount from FUSE v2, and you want to mount on top of a non-empty +directory, you will need to specify -o nonempty explicitly. FUSE V3 +always allows mounting on top of non-empty directories, and will fail if +the user or fuse2fs passes the nonempty option. + + +Fixes +----- + +Fixed a bug which caused e2fsck to improperly handle file systems that +enabled both the large_dir and inline directories at the same time. + +E2scrub_all now correctly handles an encrypted (LUKS) ext[234] file +system stacked on top of an LVM volume. (Addresses Debian Bug: #931387) + +Fixed a bug in "E2scrub_all -r" where it was incorrectly specifying +which volume needed to have its e2scrub snapshot cleaned up. (Addresses +Debian Bug: #931679) + +Fixed the Czech, Dutch, German, and Vietnamese translations which +improperly used positional markers which broke a few translated e2fsck +problem descriptions. (Addresses Debian Bug: #892173) + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Fixed various debian packaging issues. (Addresses Debian Bug: #931266, +#923372) + +Fixed error checking for calls to posix_{memalign,fadvise}. + +Add regression test for checking a file system using fs-verity. + +Various regression test cleanups. + +Fixed various compiler warnings. + +Added xgettext markers to fix incorrectly marked strings in the +e2fsprogs translations template file as being c-style printf strings +when in fact they aren't. + +Added utility script which generates the release tarfile using git +archive. + +Update the Czech, Dutch, and Portuguese translations from the +Translation Project. + diff --git a/doc/RelNotes/v1.45.4.txt b/doc/RelNotes/v1.45.4.txt new file mode 100644 index 0000000..acdd361 --- /dev/null +++ b/doc/RelNotes/v1.45.4.txt @@ -0,0 +1,50 @@ +E2fsprogs 1.45.4 (September 23, 2019) +===================================== + +Updates/Fixes since v1.45.3: + +Fixes +----- + +A maliciously corrupted file systems can trigger buffer overruns in the +quota code used by e2fsck. (Addresses CVE-2019-5094) + +E2fsck now checks to make sure the casefold flag is only set on +directories, and only when the casefold feature is enabled. + +E2fsck will not disable the low dtime checks when using a backup +superblock where the last mount time is zero. This fixes a failure in +xfstests ext4/007. + +Fix e2fsck so that when it needs to recreate the root directory, the +quota counts are correctly updated. + +Fix e2scrub_all cron script so it checks to make sure e2scrub_all +exists, since the crontab and cron script might stick around after the +e2fsprogs package is removed. (Addresses Debian Bug: #932622) + +Fix e2scrub_all so that it works when the free space is exactly the +snapshot size. (Addresses Debian Bug: #935009) + +Avoid spurious lvm warnings when e2scrub_all is run out of cron on +non-systemd systems (Addresses Debian Bug: #940240) + +Update the man pages to document the new fsverity feature, and improve +the documentation for the casefold and encrypt features. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Fixed various debian packaging issues. (Addresses Debian Bug: #933247, +#932874, #932876, #932855, #932859, #932861, #932881, #932888) + +Fix false positive test failure in f_pre_1970_date_encoding on 32-bit +systems with a 64-bit time_t. (Addresses Debian Bug: #932906) + +Fixed various compiler warnings. (Addresses Google Bug #118836063) + +Update the Czech, Dutch, French, German, Malay, Polish, Portuguese, +Spanish, Swedish, Ukrainian, and Vietnamese translations from the +Translation Project. + diff --git a/doc/RelNotes/v1.45.5.txt b/doc/RelNotes/v1.45.5.txt new file mode 100644 index 0000000..70cef96 --- /dev/null +++ b/doc/RelNotes/v1.45.5.txt @@ -0,0 +1,88 @@ +E2fsprogs 1.45.5 (January 7, 2020) +================================== + +Updates/Fixes since v1.45.4: + +Fixes +----- + +E2fsck will no longer force a full file system check if time-based +forced checks are disabled and the last mount time or last write time in +the superblock are in the future. + +Fix a potential out of bounds write when checking a maliciously +corrupted file system. This is probably not exploitable on 64-bit +platforms, but may be exploitable on 32-bit binaries depending on how +the compiler lays out the stack variables. (Addresses CVE-2019-5188) + +Fixed spurious weekly e-mails when e2scrub_all is run via a cron job +on non-systemd systems. (Addresses Debian Bug: #944033) + +Remove an unnecessary sleep in e2scrub which could add up to an +additional two second delay during the boot up. Also, avoid trying +to reap aborted snapshots if it has been disabled via e2scrub.conf. +(Addresses Debian Bug: #948193) + +If a mischievous system administrator mounts a pseudo-file system such +as tmpfs with a device name that duplicates another mounted file system, +this could potentially confuse resize2fs when it needs to find the mount +point of a mounted file system. (Who would have guessed?) Add some +sanity checking so that we can make libext2fs more robust against such +insanity, at least on Linux. (GNU HURD doesn't support st_rdev.) + +Tune2fs now prohibits enabling or disabling uninit_bg if the file system +is mounted, since this could result in the file system getting +corrupted, and there is an unfortunate AskUbuntu article suggesting this +as a way to modify a file system's UUID on a live file system. (Ext4 +now has a way to do this safely, using the metadata_csum_seed feature, +which was added in the 4.4 Linux kernel.) + +Fix potential crash in e2fsck when rebuilding very large directories on +file systems which have the new large_dir feature enable. + +Fix support of 32-bit uid's and gid's in fuse2fs and in mke2fs -d. + +Fix mke2fs's setting bad blocks to bigalloc file systems. + +Fix a bug where fuse2fs would incorrectly report the i_blocks fields for +bigalloc file systems. + +Resize2fs's minimum size estimates (via resize2fs -M) estimates are now +more accurate when run on mounted file systems. + +Fixed potential memory leak in read_bitmap() in libext2fs. + +Fixed various UBsan failures found when fuzzing file system images. +(Addresses Google Bug: #128130353) + +Updated and clarified various man pages. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Speed up e2fsck on file systems with a very large number of inodes +caused by repeated calls to gettext(). + +The inode_io io_manager can now support files which are greater than +2GB. + +The ext2_off_t and ext2_off64_t are now signed types so that +ext2fs_file_lseek() and ext2fs_file_llseek() can work correctly. + +Reserve codepoint for the fast_commit feature. + +Fixed various Debian packaging issues. + +Fix portability problems for Illumous and on hurd/i386 (Addresses Debian +Bug: #944649) + +Always compile the ext2fs_swap_* functions even on little-endian +architectures, so that debian/libext2fs.symbols can be consistent across +architectures. + +Synchronized changes from Android's AOSP e2fsprogs tree. + +Updated config.guess and config.sub with newer versions from the FSF. + +Update the Chinese and Malay translations from the translation project. diff --git a/doc/RelNotes/v1.45.6.txt b/doc/RelNotes/v1.45.6.txt new file mode 100644 index 0000000..ac822bf --- /dev/null +++ b/doc/RelNotes/v1.45.6.txt @@ -0,0 +1,62 @@ +E2fsprogs 1.45.6 (March 20, 2020) +================================== + +Updates/Fixes since v1.45.5: + +UI and Features +--------------- + +Debugfs will ignore lines in its command files which start with a +comment character ("#"). + + +Fixes +----- + +Fixed a number of potential out of bounds memory accesses caused by +fuzzed / malicious file systems. (Addresses Google Bug: #147849134) + +Fix a spurious complaint from e2fsck when a directory which previously +had more than 32000 subdirectories has the number of subdirectories +drops below 32000. + +Fix an ismounted check when an LVM device is renamed while the device is +mounted. + +Mke2fs -d now correctly sets permission with files where the owner +permissions are not rwx. + +Improve e2fsck's ability to deal with file systems with very large +number of directories, such that various data structures take more than +2GiB of memory. Use better structure packing to improve the memory +efficiency of these data structures. + +Fix debugfs so it correctly prints inode numbers > 2**31. + +Filefrag now supports very large files (with > 4 billion blocks), as +well as block sizes up to 1 GiB. + +Updated and clarified various man pages. (Addresses Debian Bugs: +#953493, #953494, #951808) + + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Reserved the error code EXT2_ET_NO_GDESC (which will be used in +e2fsprogs v1.46+) + +Added a thread-safe variant of e2p_feature2string(), +e2p_feature_to_string() to the libe2p library. + +Fixed portability problems caused by gcc 10. + +Fixed portability problem in libcom_err with GNU Hurd. + +Fixed various Debian packaging issues. (Addresses-Debian-Bug: #953926) + +Synchronized changes from Android's AOSP e2fsprogs tree. + +Update the Malay translation from the translation project. + diff --git a/doc/RelNotes/v1.45.7.txt b/doc/RelNotes/v1.45.7.txt new file mode 100644 index 0000000..f3957b1 --- /dev/null +++ b/doc/RelNotes/v1.45.7.txt @@ -0,0 +1,96 @@ +E2fsprogs 1.45.7 (January 28, 2021) +================================== + +Updates/Fixes since v1.45.6: + +UI and Features +--------------- + +Mke2fs will now warn when creating a file system on a DAX-capable device +and the block size is incompatible with DAX. + +The chattr and lsattr programs now support using the 'x' attribute to +set/get dax support on a particular file. + +E2fsprogs now supports the gnu.* extended attribute namespace, which +allows mke2fs -d to import the gnu.translator extended attributes. + +Add support for the simultaneous enablement of the casefold and +encryption features, which ext4 supports starting with the v5.5 Linux +kernel. + + +Fixes +----- + +When trying to run debugfs on a mounted file system, it's possible for +the superblock to be read in an inconsistent state; debugfs will now +retry the open in the hopes that it will succeed. + +Fix an off-by-one error when validating the depth of an htree which +caused e2fsck to potentially fail to notice an invalid htree. + +Fix potential buffer overrun in e2fsck when scanning directory blocks in +pass 2. (Addresses Google Bug: #158564737) + +Fix tune2fs so that it unlocks the MMP block if it can't perform the +requested operation. + +Fix mke2fs so it can import the contents of a directory using the -d +option when it has inode numbers that are greater than 2**32. Also fix +an omission were the extended attributes on the top-level directory was +not getting copied to the root directory. + +Fix e4crypt so that the add_key operation uses the explicitly provided +salt if it is provided. + +Fix resize2fs to prevent it from overflowing the block group descriptors +from overflowing the first block group. (This can only happen when the +block size is 1k and the file system is very large.) + +Fix debugfs's set_super_value command so it can set 64-bit integer +fields, such as s_kbytes_written. + +Fix filefrag so that it won't crash if the kernel returns zero for +statfs(2)'s device id or if it returns a blocksize of zero the device's +blocksize. This only happens with kernel bugs, but filefrag shouldn't +crash when the kernel returns an unexpected value. + +Fix a few bad error code returns in the unix and sparse I/O managers. +(These errors rarely happen in real life; these were find thanks to a +static code checker.) + +E2fsck will no longer try to fix duplicate file names in an encrypted +directory by mutating the file name since that will cause the decrypted +file name to be gibberish, or to contain invalid characters. + +Updated and clarified various man pages. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +The misc/mke2fs.conf.in script now properly escaping of double quotes +when incorporating the mke2fs.conf into the default_profile.c file. The +upstream version of the mke2fs.conf.in file doesn't have any double +quotes, but this allows a customized distribution of e2fsprogs to have +double quotes in its default mke2fs profile. + +Speeded up mkfs.ext3 by batching calls to ext2fs_zero_blocks when +zeroing the blocks for an indirect-block mapped journal inode. + +Fixed portability problem for implementations of grep which don't +support extended regexp's without the -E option. + +Fix various compiler and Coverity warnings. + +Fixed portability issue which caused a build failure when mkdir -p is +not thread safe; in that case, the Makefiles would not find the +install_sh replacement script. + +Fixed various Debian packaging issues. + +Synchronized changes from Android's AOSP e2fsprogs tree. + +Update the Dutch, Malay, and Serbian translations from the translation +project. diff --git a/doc/RelNotes/v1.46.0.txt b/doc/RelNotes/v1.46.0.txt new file mode 100644 index 0000000..8fb5222 --- /dev/null +++ b/doc/RelNotes/v1.46.0.txt @@ -0,0 +1,108 @@ +E2fsprogs 1.46.0 (January 29, 2021) +=================================== + +Updates/Fixes since v1.45.7: + +UI and Features +--------------- + +E2fsprogs now supports the fast_commit (COMPAT_FAST_COMMIT) feature. +This feature, first available in Linux version 5.10, adds a fine-grained +journalling which improves the latency of the fsync(2) system call. It +should also improve the performance of ext4 file systems exported via +NFS. + +E2fsprogs now supports the stable_inodes (COMPAT_STABLE_INODES) feature. +This needed to support fscrypt siphash algorithm, which calculates the +initial vector (IV) for encryption based on the UUID and the inode +number. This means that we can't renumber inodes (for example, when +shrinking a file system) and the UUID can't be changed without breaking +the ability to decrypt the encryption. + +E2fsprogs now supports file systems which have both file system +encryption and the casefold feature enabled. This is used in some +Android handsets, but has not yet landed upstream yet. + +E2fsck now will check file names on file systems with case folding +enabled to make sure the characters are valid UTF-8 characters. This is +done for file systems which enforce strict encodings, and optionally if +the extended "check_encoding" option is requested. + +The fuse2fs program now supports the "-o norecovery" option, which will +suppress any journal replay that might be necessary, and mounts the file +system read-only. + +E2fsck will now find and fix file system corruptions when the encrypted +files have a different policy from their containing directory. + +The "htree" command in debugfs now displays the metadata checksums for +hash tree index blocks. + +Dumpe2fs will print the error code that Linux kernels newer than v5.6 +will save to indicate the class of error which triggered the ext4_error +event. + +E2fsprogs programs (in particular, fuse2fs) can now update htree +directories without clearing the htree index. + +Mke2fs now sets the s_overhead_cluster field, so that the kernel doesn't +need to calculate it at mount time. This speeds up mounting very large +file systems. + + +Fixes +----- + +E2fsck will properly handle checking for duplicated file names when case +folding is enabled. + +Fix various bugs where a maliciously corrupted file systems could case +e2fsck and other e2fsprogs programs to crash. + +Tune2fs will properly recalculate directory block checksums when +clearing the dir_index feature. + +Fix a bug in e2fsck directory rehashing which could fail with ENOSPC +because it doesn't take into account the space needed for the metadata +checksum, and doesn't create a sufficiently deep index tree. + +Clarify the e2fsck messages when it resets the directory link count when +it is set to the overflow value but it is no longer needed. + +The filefrag program can now request the kernel to display the extent +status cache by using "filefrag -E". (This requires Linux version 5.4 +or newer.) + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Speed up mke2fs when creating large bigalloc file systems by optimizing +ext2fs_convert_subcluster_bitmap(). + +Bitmap blocks are now read using multiple threads (for systems with +pthread support). This speeds up dumpe2fs, e2fsck, and debugfs for very +large file systems. + +The dumpe2fs and tune2fs will now avoiding to read the block group +descriptors when they are not needed, which speeds up these program when +operating on very large file systems. + +Drop use of the sysctl(2) system call, which is deprecated in Linux. + +Add support for "configure --enable-developer-features" which enables +features only meant for developer. The first such feature is "e2fsck -E +clear_all_uninit_bits", which clears the uninitialized bit on all +extents for all inodes. Note that this can end up exposing uninitialized +data to userspace, and should only used in very specialized situations. + +The e2fsck/revoke.c and e2fsck/recovery.c files are now kept idential +with the fs/jbd2 versions of these files in the kernel. + +Fix various compiler and Coverity warnings. + +Update to use gettext 0.19.8. This also removes the built-in "intl" +directory as this is now considered deprecated by gettext. This means +that if the system doesn't have gettext installed on the build system, +we will simply disable NLS support. + diff --git a/doc/RelNotes/v1.46.1.txt b/doc/RelNotes/v1.46.1.txt new file mode 100644 index 0000000..7026e5f --- /dev/null +++ b/doc/RelNotes/v1.46.1.txt @@ -0,0 +1,41 @@ +E2fsprogs 1.46.1 (February 9, 2021) +=================================== + +Updates/Fixes since v1.46.0: + +Fixes +----- + +Fix a bug in libext2fs and debugfs when trying to set an extended +attribute will result in a seg fault. + +Fix e2fsck so it properly accepts large_dir directories which are +greater than 4GB in size. + +Fix fast commit support on big endian architectures. Also avoid potential +crash on an error handling case. + +Fix mke2fs -d so it correctly handles important a directory or small +file which is stored using inline_data and contains an ACL or extended +attribute. (Addresses-Debian-Bug: #971014) + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Fix build failure on systems with pthread && without FUSE support. + +Fix various compiler warnings. + +Fix portability problems by not depending on the glibc specific qsort_r +function. + +Change configure.ac to use AS_HELP_STRING instead of the deprecated +AC_HELP_STRING, and explicitly declare that the configure.ac requires +autoconf 2.69. + +Fixed/improved various Debian packaging issues. (Addresses-Debian-Bug: +#966686) + +Update the Czech, French, Malay, Polish, Portuguese, Swedish, and +Ukranian translations from the translation project. diff --git a/doc/RelNotes/v1.46.2.txt b/doc/RelNotes/v1.46.2.txt new file mode 100644 index 0000000..8f15738 --- /dev/null +++ b/doc/RelNotes/v1.46.2.txt @@ -0,0 +1,64 @@ +E2fsprogs 1.46.2 (February 28, 2021) +=================================== + +Updates/Fixes since v1.46.1: + +UI and Features +--------------- + +Teach the tune2fs program to support "random" as an argument to the -c +option, which sets the maximum mount count. (Addresses Debian Bug: +#926293) + +Add support for the FS_NOCOMP_FL flag to chattr and lsattr. + + +Fixes +----- + +When resizing a small file systems to a super-large file system size, +avoid issuing some scary bitmap operation warnings. (Addresses Github +issue https://github.com/tytso/e2fsprogs/issues/60) + +Fix the debugfs rdump and ls commands so they will work correctly for +uid's and gid's => 65536. (Addresses Github issue issue +https://github.com/tytso/e2fsprogs/issues/63) + +Fix the debugfs write and symlink commands so they support targets which +contain a pathname (instead of only working when writing a file or +creating a symlink in the current directory). (Addresses Github issue +https://github.com/tytso/e2fsprogs/issues/61) + +Fix Direct I/O support on block devices where the logical block size is +greater 1k. (This includes Advanced Format HDD's, where the sector size +is 4k, and IBM Mainframe DASD's, where the sector size is 2k.) + +Fix debugfs's logdump so it works on file systems whose block size is +greater than 8k. + +Fix a where e2fsck could a crash when there is error while e2fsck is +trying to open the file system, and e2fsck calls ext2fs_mmp_stop() +before MMP has been initialized. (Addresses Debian Bug: #696609) + +Improved error checking in the fast commit replay code in e2fsck. + +Updated and clarified the chattr man page. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Fix various compiler and Coverity warnings. + +Update the Spanish translation from the translation project. + +Update the e2fsck/iscan.c test program so that it builds again. + +Fix an environmental dependency bug for the m_rootdir_acl regression +test. + +Avoid the use of loff_t, which is not available for all compilers / +system include files. + +Fix failure of the t_mmp_fail test when running on a device with a 4k +logical sector size. diff --git a/doc/RelNotes/v1.46.3.txt b/doc/RelNotes/v1.46.3.txt new file mode 100644 index 0000000..b0e4d8b --- /dev/null +++ b/doc/RelNotes/v1.46.3.txt @@ -0,0 +1,77 @@ +E2fsprogs 1.46.3 (July 27, 2021) +================================ + +Updates/Fixes since v1.46.2: + +UI and Features +--------------- + +Teach the filefrag program the -V option, which will print the version +of the tool, or if -V option is specified twice, will print the list of +supported FIEMAP flags. + + +Fixes +----- + +Fix bug in resize2fs where growing a file system with MMP enabled and +there aren't any (or sufficient) reserved block group descriptors, +resize2fs could potentially overwrite the MMP block, leading to file +system corruption. (Addresses Debian Bug: #984472) + +Fix fast_commit portability problems on sparc64 and arm64 architectures +(the latter when running e2fsprogs compiled for arm32). (Addresses +Debian Bug: #987641) + +Fix missing mutex unlock in an error path in the Unix I/O manager. + +Fix Direct I/O support in the Unix I/O manager (this was a regression +that was introduced in v1.46.2). + +Fix mke2fs to avoid discarding blocks beyond the end of the file system +to be created when creating a file system which is smaller than 16MB and +the file system size was explicitly specified and smaller than the size +of the block device. (Addresses Debian Bug: #989630) + +Teach mke2fs to avoid giving a spurious warning about a pre-existing +partition table and it is creating a file system at a non-zero offset +(so the partition table wouldn't be overwritten in any case). +(Addresses Debian Bug: #989612) + +Fix e2image -Q to prevent a multiplication overflow could corrupt the +generated QCOW2 output file for very large file systems. + +When e2fsck repairs '.' and '..' entries in corrupted directories, set +the file type in the directory entry to be EXT2_FT_DIR and do not leave +the file type as EXT2_FT_UNKNOWN. + +Fix e2fsck so that the if the s_interval is zero, and the last mount or +write time is in the future, it will fix invalid last mount/write +timestamps in the superblock. (This was a regression introduced in +v1.45.5.) + +Fix potential memory leaks and seg faults when memory allocations fail. + +Fix lsattr and chattr to avoid opening or calling EXT2_IOC_[GS]ETFLAGS +on devices, since this can cause some devices to react badly as a +result. (Thix fixes a regression introduced in v1.46.2 and addresses +Debian Bug: #986332) + +Updated and clarified the e2image and filefrag man pages. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Avoid forking an unnecessary thread in ext2fs_rw_bitmaps(). + +Avoid unnecessary stat(2) calls on mountpoints when checking if a file +system is mounted. + +Add more modern support for Windows I/O. + +Fix various compiler and valgrind warnings. + +Synchronized changes from Android's AOSP e2fsprogs tree. + +Update Dutch, Malay, and Serbian translations. diff --git a/doc/RelNotes/v1.46.4.txt b/doc/RelNotes/v1.46.4.txt new file mode 100644 index 0000000..5e39745 --- /dev/null +++ b/doc/RelNotes/v1.46.4.txt @@ -0,0 +1,69 @@ +E2fsprogs 1.46.4 (August 18, 2021) +================================== + +Updates/Fixes since v1.46.3: + +UI and Features +--------------- + +The defaults for mke2fs now call for 256 byte inodes for all file +systems (with the exception of file systems for the GNU Hurd, which only +supports 128 byte inodes). Creating non-Hurd file systems with 128 byte +inodes will trigger a warning message to make sure users are aware of +the potential problems of using small/legacy inode sizes. + +The bigalloc feature is now considered supported if the cluster size no +more than 16 times the block size. So the mke2fs program has been +changes to only warn if the cluster size is larger than that. + + +Fixes +----- + +E2fsck now checks to make sure directory entries do not reference +internal quota inodes. + +E2image now includes the quota inodes when creating file system image, +since they are part of the file system metadata. + +E2fsck now properly accounts the quota usage of the project quota file. + +Fix a regression introduced in 1.64.3 where attempting to create a file +system image using mke2fs into a non-existent file would fail. +(Addresses Debian Bug: #992094) + +Fix mke2fs to correctly create Posix ACL's on big-endian systems when +copying files from a directory hierarchy. + +Updated and clarified the resize2fs man page. (Addresses Debian Bug: +#979411) + + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Improve various regression tests to be more portable and to reflect the +new default inode size of 256 byte inodes, even for small file systems. + +Fixed a GNU Hurd portability problem which was causing tests to fail. + +Fixed a test failure in f_baddotdir on big-endian systems. This wasn't +necessarily a bug per se in e2fsck, but rather e2fsck having different +behaviour on big-endian systems. (Addresses Debian Bug: #991922) + +Use WantedBy=multi-user.target in e2scrub_reap.service. (Addresses +Debian Bug: #991349) + +Synchronize e2fsck/recovery.c with the kernel's fs/jbd2/recovery.c + +Fix various Coverity and compiler warnings. + +Fix various error pathes to make sure we don't leak resources or +potentially use or try to free uninitialized pointers. + +Added a setup-schroot command for use on Debian porter boxes. + +Updated config.guess and config.sub with newer versions from the FSF. + +Update Czech, Dutch, French, Polish, Portuguese, and Swedish translations. diff --git a/doc/RelNotes/v1.46.5.txt b/doc/RelNotes/v1.46.5.txt new file mode 100644 index 0000000..1bd60c8 --- /dev/null +++ b/doc/RelNotes/v1.46.5.txt @@ -0,0 +1,82 @@ +E2fsprogs 1.46.5 (December 30, 2021) +==================================== + +Updates/Fixes since v1.46.4: + +UI and Features +--------------- + +When resizing a file system and the inode count exceeds the 2**32 +maximum, if resize2fs can successfully perform the resize by dropping +the last block group, resize2fs will do that in order to allow the file +system grow operation to succeed. For example, using the default inode +ratio size of 16k, this will allow a successful resize to 64TB - 128MB +when the storage device is 64TB. + + +Fixes +----- + +Avoid a potential infinite loop in resize2fs -P when the file system is +corrupted (introduced in e2fsprogs 1.45.5). (Addresses github issue +https://github.com/tytso/e2fsprogs/issues/94) + +E2fsck now updates the bg_checksum after fixing problems in the block +group descriptor, which eliminates some unnecessary messages printed or +asked of the system administrator. + +Fixed some potential deadlock problems in the unix_io handler in the case +of I/O errors. The fix should also improve the performance of parallel +bitmap loading. + +Fixed e2fsck's fast commit handling which could result it in crashing +when trying to merge extents when there were none available to be +merged. + +Fix e2fsck's support of quota limit data, which could sometimes get +dropped when the quota data needs to be regenerated, or when processing +the orphan list. + +Fix tune2fs to correctly transfer the quota limits when converting quota +files to the internal quota inodes. Also add support for tune2fs to +properly handle the older version 0 quota files. + +Fix debugfs's get_quota and list_quota commands so that the header of +the report printed by these commands correctly reflect that the units of +used space is in bytes instead of blocks. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Add some additional packages to the setup-schroot script to account for +the fact that the script can be run on older Debian distributions and so +the build dependencies might omit some packages needed to build +e2fsprogs on unstable version of Debian. + +Reduce resize2fs's CPU overhead when counting the number of blocks in +use which can reduce the wall clock time for very large file systems +by substantial amount. + +Teach libuuid to use getrandom() or getentropy() if available in favor +of reading from /dev/[u]random. + +Teach libss to use libreadline.so.8 if it is available. + +Update some test expect files to fix some regression tests that were +broken in e2fsprogs 1.46.4. + +If the PRINT_FAILED environment variable is set, failed tests will +display the diff output to make it easier to debug test failures on +autobuilders. + +Fix various compiler warnings. + +Update tst_getsize to use ext2fs_get_size2() to support testing devices +which are larger than 2**32 sectors. + +Fixed spelling mistakes in the mke2fs.conf man page. + +Update Chinese, Malay, Serbian, Spanish, Swedish, and Ukrainian +translations. + diff --git a/doc/RelNotes/v1.46.6.txt b/doc/RelNotes/v1.46.6.txt new file mode 100644 index 0000000..223a2e2 --- /dev/null +++ b/doc/RelNotes/v1.46.6.txt @@ -0,0 +1,164 @@ +E2fsprogs 1.46.6 (February 1, 2023) +===================================== + +Updates/Fixes since v1.46.5: + +UI and Features +--------------- + +Debugfs's ncheck command now allows the inode number to be surrounded by +angle brackets, to be consistent with other debugfs commands. + +Debugfs no longer prints a scary message when debugfs -c (which enables +"catastrophic mode") is used. This was intended to allow debugfs to +operate on very badly corrupted file systems, but it is now sometimes +used to suppress reading the block and inode bitmaps when they are not +needed. + +Resize2fs will round down the requested new file system size to the +nearest cluster boundary when resizing bigalloc file systems. + +Improve error messages issued by badblocks. + +Fuse2fs now supports an offset=<bytes> option which allows operating on +a file system image which is located starting at the specified offset +from the beginning of the image. + + + +Fixes +----- + +Pre-v6.2 Linux kernels had long-standing bug in how the extended +attribute hash was calculated when there were non-ASCII characters in +the xattr name, when the hash would be different depending on whether +the C 'char' type was signed or unsigned. To address this bug, starting +with e2fsprogs 1.46.6+ and Linux 6.2+, we will accept either the signed +or unsigned hash variant, but only set the unsigned hash variant. Since +extended attribute names are in practice composed of ASCII characters, +other than various tests (such as generic/454), most users will +hopefully not notice this change. + +Avoid triggering udev in dumpe2fs and "resize2fs -P" for file systems +with MMP enabled by opening the device read-only when reading the MMP +block. + +Fix MMP handling so it can notice when another writer has modify the MMP +block out from under it when stopping a MMP sessions. + +Fix tune2fs so it will detect another device stealing the MMP sessions +while rewriting metadata checksums. + +E2fsck will now check to make sure the journal inode does not have the +encrypt flag set. + +Fix a deadlock bug in e2fsck's error handler when there are errors +trying to write to the file system. + +Fix a bug where e2fsck could fail when specifying an undo file and an +explicit superblock number. + +Fix e2image so it won't potentially loop forever for certain invalid +file systems. + +Fix resize2fs to honor the E2FSPROGS_FAKE_TIME environment variable. +This allows embedded system builders who use resize2fs as part of their +image build process to create reproducible images. + +Fix tune2fs to avoid a crash if the journal replay fails and to make +sure its exit status is non-zero if there is some failure. + +Fix tune2fs, fuse2fs, and debugsfs to update j_tail_sequence when +replaying the journal. + +Add additional bullet-proofing for very badly corrupted file systems. +Try avoid UBSAN warnings, null pointer derferences, and other memory +bugs. (Addresses CVE-2022-1304) + +Don't fail when the source directory for mke2fs -d doesn't support +extended attributese. + +Check for and handle malloc() failures when computing the log filename +in e2fsck and in the libss library. + +Fix tune2fs and e2fsck to accept pathames which include '=' characters. +Previously arguments to tune2fs and e2fsck which included '=' characters +are presumed to be blkid specifiers such as UUID=xxx or LABEL=yyy. If a +specifier is both a valid pathname name and blkid tag name specifier, +priority is given to a blkid resolved pathname. + +Improve tune2fs's error messages. + +Fix a bug in tune2fs which could cause it to crash if device goes +off-line just as it being opened. + +Fix the fsck driver so if it is interrupted while running fsck -N it +doesn't end up kllling all processes on the system. + +Fix a crash in badblocks when the user specifies an overly large +number of blocks tested at a time in read/write or nondestructive +mode. + +Update and clarify's chattr's man page and usage message. Fix spelling +typo's in a variety of different man pages and comments. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Update to autoconf 2.71. + +Update flags used to create shared library on Darwin/MacOS. + +Speed up e2fsck's clonning of multiply-claimed blocks so it is +substantially faster on very large file systems. + +Add tests/fuzz directory with fuzzers from oss-fuzz. + +Add a Github Actions configuration file so that Github will run CI tests +on Linux, Windows and MacOS on a push to the e2fsprogs github repo. + +Make the mtab parsing in ext2fs_check_mount_point() more careful so it +won't get confused when a block device shows up in the mnt_name field +for a virtual file system. + +Fix the libss's Makefile to create the man page directory before trying +to install its man page. + +Fix various Coverity and compiler warnings. + +Make tests more portable on various different OS's and system +configurations (e.g., with SELinux enabled, MacOS, and Windows) + +Use mallinfo2() instead of mallinfo() where avilable, since mallinfo() +is deprecated on newer glibc versions. + +E2fsck will no longer do a full scan of disconnected directory when +trying to print the parent directory, which is pointless and can slow +down e2fsck if there are a large number of disconnected directories. + +Debugfs will now print the extended attribute's e_hash field. + +Fix the setup-schroot script to work on non-Linux platforms. + +Fix ext2fs_compare_generic_bmap() so it correctly compares all of the +bits in the bitmap, and so that it works correctly when comparing a +bitarray bitmap with a rbtree-based bitmap. (Fortunately, none of the +programs in e2fsprogs uses bitmap comparison functions.) + +Fix memory leaks on error paths. + +Add support for the configure option --enable-largefile so that +e2fsprogs can utilize largefile support for the MUSL C library. + +Add an note that the dict library code has been modified, as required by +the Kazlib license. + +Synchronized changes from Android's AOSP e2fsprogs tree. + +Updated config.guess and config.sub with newer versions from the FSF. + +Add Friulian translation. + +Update Chinese, Czech, Dutch, French, German, Malay, Polish, Serbian, +Spanish, Swedish, and Ukrainian translations. diff --git a/doc/RelNotes/v1.47.0.txt b/doc/RelNotes/v1.47.0.txt new file mode 100644 index 0000000..8af28b9 --- /dev/null +++ b/doc/RelNotes/v1.47.0.txt @@ -0,0 +1,53 @@ +E2fsprogs 1.47.0 (February 5, 2023) +=================================== + +Updates/Fixes since v1.46.6: + +UI and Features +--------------- + +Add support for the orphan_file feature, which speeds up workloads that +are deleting or truncating a large number files in parallel. This +compat feature was first supported in the v5.15 Linux kernel. + +The mke2fs program (via the mke2fs.conf file) now enables the +metadata_csum_seed and orphan_file features by default. The +metadata_csum_seed feature is an incompat feature which is first +supported in the Linux kernel starting in the 4.4 kernel and e2fsprogs +1.43. + +Mke2fs now supports the extended option "assume_storage_prezeroed" which +causes mke2fs to skip zeroing the journal and inode tables and to mark +the inode tables as zeroed. + +Add support to tune2fs and e2label to set the label and UUID for a +mounted file system using a ioctl, which is more reliable than modifying +the superblock via writing to the block device. The kernel support for +setting the label landed in v5.17, while the support for adding the UUID +landed in v6.0. If the ioctls are not supported, tune2fs and e2label +will fall back old strategy of directly modifying the superblock. + +Allow tune2fs to disable the casefold feature after scanning all of the +directories do not have the Casefold flag set. + + +Fixes +----- + +Fix a potential unbalanced mutex unlock when there is a short read while +using the bounce buffer when using direct I/O. + + +Performance, Internal Implementation, Development Support etc. +-------------------------------------------------------------- + +Fix various Coverity and compiler warnings. + +Add the new function ext2fs_xattrs_read_inode() which takes an in-memory +inode to avoid needing to reread an inode that was already read into +memory. + +Teach debugfs logdump command the -n option which forces printing a +specified number of transactions, even when a block missing a magic +number would have stopped the logdump. (This is for debugging +journalling problems.) diff --git a/doc/libblkid.txt b/doc/libblkid.txt new file mode 100644 index 0000000..4aea1b6 --- /dev/null +++ b/doc/libblkid.txt @@ -0,0 +1,78 @@ +libblkid - a library to handle device identification and token extraction + +Basic usage is as follows - there are two normal usage patterns: + +For cases where a program wants information about multiple devices, or +expects to be doing multiple token searches, the program should +directly initialize cache file via (second parameter is cache +filename, NULL = default): + + blkid_cache cache = NULL; + if (blkid_get_cache(&cache, NULL) < 0) + /* error reading the cache file, not really fatal */ + +Note that if no cache file exists, an empty cache struct is still +allocated. Usage of libblkid functions will use the cache to avoid +needless device scans. + +The model of the blkid cache is that each device has a number of +attributes that can be associated with it. Currently the attributes +which are supported (and set) by blkid are: + + TYPE filesystem type + UUID filesystem uuid + LABEL filesystem label + + +How to use libblkid? Normally, you either want to find a device with +a specific NAME=value token, or you want to output token(s) from a +device. To find a device that matches a following attribute, you +simply call the blkid_get_devname() function: + + if ((devname = blkid_get_devname(cache, attribute_name, value))) { + /* do something with devname */ + string_free(devname); + } + +The cache parameter is optional; if it is NULL, then the blkid library +will load the default blkid.tab cache file, and then release the cache +before function call returns. The return value is an allocated string +which holds the resulting device name (if it is found). If the value +is NULL, then attribute_name is parsed as if it were +"<attribute_name>=<value>"; if it cannot be so parsed, then the +original attribute_name is returned in a copied allocated string. +This is a convenience to allow user programs to want to translate user +input, whether it is of the form: "/dev/hda1", "LABEL=root", +"UUID=082D-26E3", and get back a device name that it can use. + +Alternatively, of course, the programmer can pass an attribute name of +"LABEL", and value of "root", if that is more convenient. + +Another common usage is to retrieve the value of a specific attribute +for a particular device. This can be used to determine the filesystem +type, or label, or uuid for a particular device: + + if ((value = blkid_get_tag_value(cache, attribute_name, devname))) { + /* do something with value */ + string_free(value); + } + +If a program needs to call multiple blkid functions, then passing in a +cache value of NULL is not recommended, since the /etc/blkid.tab file +will be repeatedly parsed over and over again, with memory allocated +and deallocated. To initialize the blkid cache, blkid_get_cache() +function is used: + + if (blkid_get_cache(&cache, NULL) < 0) + goto errout; + +The second parameter of blkid_get_cache (if non-zero) is the alternate +filename of the blkid cache file (where the default is +/etc/blkid.tab). Normally, programs should just pass in NULL. + +If you have called blkid_get_cache(), you should call blkid_put_cache() +when you are done using the blkid library functions. This will save the +cache to the blkid.tab file, if you have write access to the file. It +will also free all associated devices and tags: + + blkid_put_cache(cache); diff --git a/doc/libext2fs.texinfo b/doc/libext2fs.texinfo new file mode 100644 index 0000000..5d4b053 --- /dev/null +++ b/doc/libext2fs.texinfo @@ -0,0 +1,1374 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename libext2fs.info +@settitle The EXT2FS Library (version 1.47.0) +@synindex tp fn +@comment %**end of header + +@ifinfo +@dircategory Development +@direntry +* libext2fs: (libext2fs). The EXT2FS library. +@end direntry +@end ifinfo + +@c smallbook + +@iftex +@finalout +@end iftex + +@c Note: the edition number is listed in *three* places; please update +@c all three. Also, update the month and year where appropriate. + +@c ==> Update edition number for settitle and subtitle, and in the +@c ==> following paragraph; update date, too. + + +@ifinfo +This file documents the ext2fs library, a library for manipulating the +ext2 filesystem. + +Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, +2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 by Theodore Ts'o + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). + +@end ignore +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the author. +@end ifinfo + +@setchapternewpage on +@titlepage +@c use the new format for titles + +@title The EXT2FS Library +@subtitle The EXT2FS Library +@subtitle Version 1.47.0 +@subtitle February 2023 + +@author by Theodore Ts'o + +@c Include the Distribution inside the titlepage so +@c that headings are turned off. + +@tex +\global\parindent=0pt +\global\parskip=8pt +\global\baselineskip=13pt +@end tex + +@page +@vskip 0pt plus 1filll +Copyright @copyright{} 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Theodore Ts'o + +@sp 2 + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Foundation. +@end titlepage +@headings double + +@node Top, Introduction to the EXT2FS Library, (dir), (dir) + +@top The EXT2FS Library + +This manual documents the EXT2FS Library, version 1.47.0. + +@menu +* Introduction to the EXT2FS Library:: +* EXT2FS Library Functions:: +* Concept Index:: +* Function Index:: +@end menu + +@c ---------------------------------------------------------------------- + +@node Introduction to the EXT2FS Library, EXT2FS Library Functions, Top, Top +@comment node-name, next, previous, up +@chapter Introduction to the EXT2FS Library + +The EXT2FS library is designed to allow user-level programs to +manipulate an ext2 filesystem. + +@node EXT2FS Library Functions, Concept Index, Introduction to the EXT2FS Library, Top +@comment node-name, next, previous, up +@chapter EXT2FS Library Functions + +@menu +* Filesystem-level functions:: +* File I/O Functions:: +* Inode Functions:: +* Directory functions:: +* Bitmap Functions:: +* EXT2 data abstractions:: +* Byte-swapping functions:: +* Other functions:: +@end menu + +@c ---------------------------------------------------------------------- + +@node Filesystem-level functions, File I/O Functions, EXT2FS Library Functions, EXT2FS Library Functions +@comment node-name, next, previous, up +@section Filesystem-level functions + +The following functions operate on a filesystem handle. Most EXT2FS +Library functions require a filesystem handle as their first argument. +There are two functions which create a filesystem handle, +@code{ext2fs_open} and @code{ext2fs_initialize}. + +The filesystem can also be closed using @code{ext2fs_close}, and any +changes to the superblock and group descriptors can be written out to disk +using @code{ext2fs_flush}. + +@menu +* Opening an ext2 filesystem:: +* Closing and flushing out changes:: +* Initializing a filesystem:: +* Filesystem flag functions:: +@end menu + +@c ---------------------------------------------------------------------- + +@node Opening an ext2 filesystem, Closing and flushing out changes, Filesystem-level functions, Filesystem-level functions +@comment node-name, next, previous, up +@subsection Opening an ext2 filesystem + +Most libext2fs functions take a filesystem handle of type +@code{ext2_filsys}. A filesystem handle is created either by opening +an existing filesystem using @code{ext2fs_open}, or by initializing a new +filesystem using @code{ext2fs_initialize}. + +@deftypefun errcode_t ext2fs_open (const char *@var{name}, int @var{flags}, int @var{superblock}, int @var{block_size}, io_manager @var{manager}, ext2_filsys *@var{ret_fs}) + +Opens a filesystem named @var{name}, using the the io_manager +@var{manager} to define the input/output routines needed to read and +write the filesystem. In the case of the @code{unix_io} io_manager, +@var{name} is interpreted as the Unix filename of the filesystem image. +This is often a device file, such as @file{/dev/hda1}. + +The @var{superblock} parameter specifies the block number of the +superblock which should be used when opening the filesystem. +If @var{superblock} is zero, @code{ext2fs_open} will use the primary +superblock located at offset 1024 bytes from the start of the filesystem +image. + +The @var{block_size} parameter specifies the block size used by the +filesystem. Normally this is determined automatically from the +filesystem superblock. If @var{block_size} is non-zero, it must match +the block size found in the superblock, or the error +@code{EXT2_ET_UNEXPECTED_BLOCK_SIZE} will be returned. The +@var{block_size} parameter is also used to help find the superblock when +@var{superblock} is non-zero. + +The @var{flags} argument contains a bitmask of flags which control how +the filesystem open should be handled. + +@table @code +@item EXT2_FLAG_RW +Open the filesystem for reading and writing. Without this flag, the +filesystem is opened for reading only. + +@item EXT2_FLAG_FORCE +Open the filesystem regardless of the feature sets listed in the +superblock. + +@end table +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Closing and flushing out changes, Initializing a filesystem, Opening an ext2 filesystem, Filesystem-level functions +@comment node-name, next, previous, up +@subsection Closing and flushing out changes + +@deftypefun errcode_t ext2fs_flush (ext2_filsys @var{fs}) + +Write any changes to the high-level filesystem data structures in the +@var{fs} filesystem. The following data structures will be written out: + +@itemize @bullet +@item The filesystem superblock +@item The filesystem group descriptors +@item The filesystem bitmaps, if read in via @code{ext2fs_read_bitmaps}. +@end itemize + +@end deftypefun + +@deftypefun void ext2fs_free (ext2_filsys @var{fs}) + +Close the io_manager abstraction for @var{fs} and release all memory +associated with the filesystem handle. +@end deftypefun + +@deftypefun errcode_t ext2fs_close (ext2_filsys @var{fs}) + +Flush out any changes to the high-level filesystem data structures using +@code{ext2fs_flush} if the filesystem is marked dirty; then close and +free the filesystem using @code{ext2fs_free}. + +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Initializing a filesystem, Filesystem flag functions, Closing and flushing out changes, Filesystem-level functions +@comment node-name, next, previous, up +@subsection Initializing a filesystem + +An ext2 filesystem is initializing by the @code{mke2fs} program. The +two functions described here, @code{ext2fs_initialize} and +@code{ext2fs_allocate_tables} do much of the initial work for setting up +a filesystem. However, they don't do the whole job. @code{mke2fs} +calls @code{ext2fs_initialize} to set up the filesystem superblock, and +calls @code{ext2fs_allocate_tables} to allocate space for the inode +table, and the inode and block bitmaps. In addition, @code{mke2fs} must +also initialize the inode tables by clearing them with zeros, create the +root and lost+found directories, and reserve the reserved inodes. + +@deftypefun errcode_t ext2fs_initialize (const char *@var{name}, int @var{flags}, struct ext2_super_block *@var{param}, io_manager @var{manager}, ext2_filsys *@var{ret_fs}) + +This function is used by the @code{mke2fs} program to initialize a +filesystem. The @code{ext2fs_initialize} function creates a filesystem +handle which is returned in @var{ret_fs} that has been properly setup +for a filesystem to be located in @var{name}, using the io_manager +@var{manager}. The prototype superblock in @var{param} is used to +supply parameters such as the number of blocks in the filesystem, the +block size, etc. + +The @code{ext2fs_initialize} function does not actually do any I/O; that +will be done when the application program calls @code{ext2fs_close} or +@code{ext2fs_flush}. Also, this function only initializes the +superblock and group descriptor structures. It does not create the +inode table or the root directory. This must be done by the calling +application, such as @code{mke2fs}. + +The following values may be set in the @var{param} prototype superblock; +if a value of 0 is found in a field, @code{ext2fs_initialize} will use a +default value. The calling application should zero out the prototype +entire superblock, and then fill in any appropriate values. + +@table @code + +@item s_blocks_count +The number of blocks in the filesystem. This parameter is mandatory and +must be set by the calling application. + +@item s_inodes_count +The number of inodes in the filesystem. The +default value is determined by calculating the size of the filesystem, +and creating one inode for every 4096 bytes. + +@item s_r_blocks_count +The number of blocks which should be reserved for the superuser. The +default value is zero blocks. + +@item s_log_block_size +The blocksize of the filesystem. Valid values are 0 (1024 bytes), 1 +(2048 bytes), or 2 (4096 bytes). The default blocksize is 1024 bytes. + +@item s_log_frag_size +The size of fragments. The ext2 filesystem does not support fragments +(and may never support fragments). Currently this field must be the +same as @code{s_log_block_size}. + +@item s_first_data_block +The first data block for the filesystem. For filesystem with a +blocksize of 1024 bytes, this value must be at least 1, since the +superblock is located in block number 1. For filesystems with larger +blocksizes, the superblock is still located at an offset of 1024 bytes, +so the superblock is located in block number 0. By default, this value +is set to 1 for filesystems with a block size of 1024 bytes, or 0 for +filesystems with larger blocksizes. + +@item s_max_mnt_count +This field defines the number of times that the filesystem can be +mounted before it should be checked using @code{e2fsck}. When +@code{e2fsck} is run without the @samp{-f} option, @code{e2fsck} will +skip the filesystem check if the number of times that the filesystem has +been mounted is less than @code{s_max_mnt_count} and if the interval +between the last time a filesystem check was performed and the current +time is less than @code{s_checkinterval} (see below). The default value +of @code{s_max_mnt_count} is 20. + +@item s_checkinterval +This field defines the minimal interval between filesystem checks. See +the previous entry for a discussion of how this field is used by +@code{e2fsck}. The default value of this field is 180 days (six +months). + +@item s_errors +This field defines the behavior which should be used by the kernel of +errors are detected in the filesystem. Possible values include: + +@table @samp +@item EXT2_ERRORS_CONTINUE +Continue execution when errors are detected. + +@item EXT2_ERRORS_RO +Remount the filesystem read-only. + +@item EXT2_ERRORS_PANIC +Panic. + +@end table + +The default behavior is @samp{EXT2_ERRORS_CONTINUE}. + +@end table + +@end deftypefun + +@deftypefun errcode_t ext2fs_allocate_tables (ext2_filsys @var{fs}) +Allocate space for the inode table and the block and inode bitmaps. The +inode tables and block and inode bitmaps aren't actually initialized; +this function just allocates the space for them. +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Filesystem flag functions, , Initializing a filesystem, Filesystem-level functions +@comment node-name, next, previous, up +@subsection Filesystem flag functions + +The filesystem handle has a number of flags which can be manipulated +using the following function. Some of these flags affect how the +libext2fs filesystem behaves; others are provided solely for the +application's convenience. + +@deftypefun void ext2fs_mark_changed (ext2_filsys @var{fs}) +@deftypefunx int ext2fs_test_changed (ext2_filsys @var{fs}) +This flag indicates whether or not the filesystem has been changed. +It is not used by the ext2fs library. +@end deftypefun + +@deftypefun void ext2fs_mark_super_dirty (ext2_filsys @var{fs}) +Mark the filesystem @var{fs} as being dirty; this will cause +the superblock information to be flushed out when @code{ext2fs_close} is +called. @code{ext2fs_mark_super_dirty} will also set the filesystem +changed flag. The dirty flag is automatically cleared by +@code{ext2fs_flush} when the superblock is written to disk. +@end deftypefun + +@deftypefun void ext2fs_mark_valid (ext2_filsys @var{fs}) +@deftypefunx void ext2fs_unmark_valid (ext2_filsys @var{fs}) +@deftypefunx int ext2fs_test_valid (ext2_filsys @var{fs}) +This flag indicates whether or not the filesystem is free of errors. +It is not used by libext2fs, and is solely for the application's +convenience. +@end deftypefun + +@deftypefun void ext2fs_mark_ib_dirty (ext2_filsys @var{fs}) +@deftypefunx void ext2fs_mark_bb_dirty (ext2_filsys @var{fs}) +@deftypefunx int ext2fs_test_ib_dirty (ext2_filsys @var{fs}) +@deftypefunx int ext2fs_test_bb_dirty (ext2_filsys @var{fs}) +These flags indicate whether or not the inode or block bitmaps have been +modified. If the flag is set, it will cause the appropriate bitmap +to be written when the filesystem is closed or flushed. +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node File I/O Functions, Inode Functions, Filesystem-level functions, EXT2FS Library Functions +@comment node-name, next, previous, up +@section File I/O Functions + +The following functions provide a convenient abstraction to read or +write a file in an filesystem. The interface is similar in spirit to +the Linux/POSIX file I/O system calls. + +@menu +* File handle manipulation:: +* Reading and writing data:: +* Changing the file offset :: +* Getting the file size:: +@end menu + +@c ---------------------------------------------------------------------- + +@node File handle manipulation, Reading and writing data, File I/O Functions, File I/O Functions +@comment node-name, next, previous, up +@subsection File handle manipulation + +The file handle functions much like a file descriptor in the Linux/POSIX +file I/O system calls. Unlike the Linux/POSIX system calls, files are +opened via inode numbers instead of via pathnames. To resolve a +pathname to an inode number, use the function @code{ext2fs_namei} or to +create a new file, use @code{ext2fs_new_inode} and @code{ext2fs_link}. + +@deftypefun errcode_t ext2fs_file_open2 (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, struct ext2_inode *@var{inode}, int @var{flags}, ext2_file_t *@var{ret}) +@deftypefunx errcode_t ext2fs_file_open (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, int @var{flags}, ext2_file_t *@var{ret}) + +Opens a file identified by inode number @var{ino} in filesystem @var{fs} +and returns a file handle in @var{ret}. If an inode structure is +provided in @var{inode}, then it is used instead of reading the inode +from the filesystem. + +The @var{flags} argument contains a bitmask of flags which control how +the file should be opened. + +@table @code +@item EXT2_FILE_WRITE +Open the file for reading and writing. Without this flag, the file is +opened for writing only. + +@item EXT2_FILE_CREATE +Create the file if it is not already present. + +@end table +@end deftypefun + +@deftypefun ext2_filsys ext2fs_file_get_fs (ext2_file_t @var{file}) +Return the filesystem handle where the open file @var{file} was opened. +@end deftypefun + +@deftypefun errcode_t ext2fs_file_close (ext2_file_t @var{file}) +Close the file handle @var{file}. +@end deftypefun + +@deftypefun errcode_t ext2fs_file_flush (ext2_file_t @var{file}) +Force any data written via @code{ext2fs_file_write} to disk. +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Reading and writing data, Changing the file offset , File handle manipulation, File I/O Functions +@comment node-name, next, previous, up +@subsection Reading and writing data + +@deftypefun errcode_t ext2fs_file_read (ext2_file_t @var{file}, void *@var{buf}, unsigned int @var{wanted}, unsigned int *@var{got}) +Read @var{wanted} bytes of data from @var{file} store it in the buffer +@var{buf}. The number of bytes that was actually read is returned +via @var{got}. +@end deftypefun + +@deftypefun errcode_t ext2fs_file_write (ext2_file_t @var{file}, const void *@var{buf}, unsigned int @var{nbytes}, unsigned int *@var{written}) +Write @var{wanted} bytes of data from the buffer @var{buf} to the +current file position of @var{file}. The number of bytes that was +actually written is returned via @var{written}. +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Changing the file offset , Getting the file size, Reading and writing data, File I/O Functions +@comment node-name, next, previous, up +@subsection Changing the file offset + +@deftypefun errcode_t ext2fs_file_llseek (ext2_file_t @var{file}, __u64 @var{offset}, int @var{whence}, __u64 *@var{ret_pos}) +@deftypefunx errcode_t ext2fs_file_lseek (ext2_file_t @var{file}, ext2_off_t @var{offset}, int @var{whence}, ext2_off_t *@var{ret_pos}) +Change the current file position of @var{file} according to the +directive @var{whence} as follows: + +@table @code +@item EXT2_SEEK_SET +The file position is set to @var{offset} bytes from the beginning of the +file. + +@item EXT2_SEEK_CUR +The file position set to its current location plus @var{offset} bytes. + +@item EXT2_SEEK_END +The file position is set to the size of the file plus @var{offset} +bytes. +@end table + +The current offset is returned via @var{ret_pos}. +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Getting the file size, , Changing the file offset , File I/O Functions +@comment node-name, next, previous, up +@subsection Getting the file size + +@deftypefun errcode_t ext2fs_file_get_lsize (ext2_file_t @var{file}, __u64 *@var{ret_size}) +Return the size of the file @var{file} in @var{ret_size}. +@end deftypefun + +@deftypefun ext2_off_t ext2fs_file_get_size (ext2_file_t @var{file}) +Return the size of the file @var{file}. +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Inode Functions, Directory functions, File I/O Functions, EXT2FS Library Functions +@comment node-name, next, previous, up +@section Inode Functions + +@menu +* Reading and writing inodes:: +* Iterating over inodes in a filesystem:: +* Iterating over blocks in an inode:: +* Inode Convenience Functions:: +@end menu + +@c ---------------------------------------------------------------------- + +@node Reading and writing inodes, Iterating over inodes in a filesystem, Inode Functions, Inode Functions +@comment node-name, next, previous, up +@subsection Reading and writing inodes + +@deftypefun errcode_t ext2fs_read_inode (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, struct ext2_inode *@var{inode}) +Read the inode number @var{ino} into @var{inode}. +@end deftypefun + +@deftypefun errcode_t ext2fs_write_inode (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, struct ext2_inode *@var{inode}) +Write @var{inode} to inode @var{ino}. +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node Iterating over inodes in a filesystem, Iterating over blocks in an inode, Reading and writing inodes, Inode Functions +@comment node-name, next, previous, up +@subsection Iterating over inodes in a filesystem + +The inode_scan abstraction is useful for iterating over all the inodes +in a filesystem. + +@deftypefun errcode_t ext2fs_open_inode_scan (ext2_filsys @var{fs}, int @var{buffer_blocks}, ext2_inode_scan *@var{scan}) +Initialize the iteration variable @var{scan}. This variable is used by +@code{ext2fs_get_next_inode}. The @var{buffer_blocks} parameter +controls how many blocks of the inode table are read in at a time. A +large number of blocks requires more memory, but reduces the overhead in +seeking and reading from the disk. If @var{buffer_blocks} is zero, a +suitable default value will be used. +@end deftypefun + +@deftypefun void ext2fs_close_inode_scan (ext2_inode_scan @var{scan}) +Release the memory associated with @var{scan} and invalidate it. +@end deftypefun + +@deftypefun errcode_t ext2fs_get_next_inode (ext2_inode_scan @var{scan}, ext2_ino_t *@var{ino}, struct ext2_inode *@var{inode}) + +This function returns the next inode from the filesystem; the inode +number of the inode is stored in @var{ino}, and the inode is stored in +@var{inode}. + +If the inode is located in a block that has been marked as bad, +@code{ext2fs_get_next_inode} will return the error +@code{EXT2_ET_BAD_BLOCK_IN_INODE_TABLE}. +@end deftypefun + +@deftypefun errcode_t ext2fs_inode_scan_goto_blockgroup (ext2_inode_scan @var{scan}, int @var{group}) +Start the inode scan at a particular ext2 blockgroup, @var{group}. +This function may be safely called at any time while @var{scan} is valid. +@end deftypefun + +@deftypefun void ext2fs_set_inode_callback (ext2_inode_scan @var{scan}, errcode_t (*done_group)(ext2_filsys @var{fs}, ext2_inode_scan @var{scan}, dgrp_t @var{group}, void * @var{private}), void *@var{done_group_data}) +Register a callback function which will be called by +@code{ext2_get_next_inode} when all of the inodes in a block group have +been processed. +@end deftypefun + +@deftypefun int ext2fs_inode_scan_flags (ext2_inode_scan @var{scan}, int @var{set_flags}, int @var{clear_flags}) + +Set the scan_flags @var{set_flags} and clear the scan_flags @var{clear_flags}. +The following flags can be set using this interface: + +@table @samp + +@item EXT2_SF_SKIP_MISSING_ITABLE +When a block group is missing an inode table, skip it. If this flag is +not set @code{ext2fs_get_next_inode} will return the error +EXT2_ET_MISSING_INODE_TABLE. + +@end table + +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Iterating over blocks in an inode, Inode Convenience Functions, Iterating over inodes in a filesystem, Inode Functions +@comment node-name, next, previous, up +@subsection Iterating over blocks in an inode + +@deftypefun errcode_t ext2fs_block_iterate (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, int @var{flags}, char *block_buf, int (*func)(ext2_filsys @var{fs}, blk_t *@var{blocknr}, int @var{blockcnt}, void *@var{private}), void *@var{private}) + +Iterate over all of the blocks in inode number @var{ino} in filesystem +@var{fs}, by calling the function @var{func} for each block in the +inode. The @var{block_buf} parameter should either be NULL, or if the +@code{ext2fs_block_iterate} function is called repeatedly, the overhead +of allocating and freeing scratch memory can be avoided by passing a +pointer to a scratch buffer which must be at least as big as three times the +filesystem's blocksize. + +The @var{flags} parameter controls how the iterator will function: + +@table @samp + +@item BLOCK_FLAG_HOLE +This flag indicates that the iterator function should be called on +blocks where the block number is zero (also known as ``holes''.) It is +also known as BLOCK_FLAG_APPEND, since it is also used by functions +such as ext2fs_expand_dir() to add a new block to an inode. + +@item BLOCK_FLAG_DEPTH_TRAVERSE +This flag indicates that the iterator function for the +indirect, doubly indirect, etc. blocks should be called after all +of the blocks contained in the indirect blocks are processed. +This is useful if you are going to be deallocating blocks from an +inode. + +@item BLOCK_FLAG_DATA_ONLY +This flag indicates that the iterator function should be +called for data blocks only. + +@end table + +The callback function @var{func} is called with a number of parameters; +the @var{fs} and @var{private} parameters are self-explanatory, and +their values are taken from the parameters to +@code{ext2fs_block_iterate}. (The @var{private} data structure is +generally used by callers to @code{ext2fs_block_iterate} so that some +private data structure can be passed to the callback function. The +@var{blockcnt} parameter, if non-negative, indicates the logical block +number of a data block in the inode. If @var{blockcnt} is less than +zero, then @var{func} was called on a metadata block, and @var{blockcnt} +will be one of the following values: BLOCK_COUNT_IND, BLOCK_COUNT_DIND, +BLOCK_COUNT_TIND, or BLOCK_COUNT_TRANSLATOR. The @var{blocknr} is a +pointer to the inode or indirect block entry listing physical block +number. The callback function may modify the physical block number, if +it returns the @var{BLOCK_CHANGED} flag. + + +The callback function @var{func} returns a result code which is composed of +the logical OR of the following flags: + +@table @samp + +@item BLOCK_CHANGED + +This flag indicates that callback function has modified the physical +block number pointed to by @var{blocknr}. + +@item BLOCK_ABORT + +This flag requests that @code{ext2fs_block_iterate} to stop immediately +and return to the caller. + +@end table + +@end deftypefun + +@deftypefun errcode_t ext2fs_block_iterate2 (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, int @var{flags}, char *@var{block}_buf, int (*func)(ext2_filsys @var{fs}, blk_t *@var{blocknr}, e2_blkcnt_t @var{blockcnt}, blk_t @var{ref_blk}, int @var{ref_offset}, void *@var{private}), void *@var{private}) + +This function is much like @code{ext2fs_block_iterate}, except that the +@var{blockcnt} type is a 64-bit signed quantity, to support larger +files, and the addition of the @var{ref_blk} and @var{ref_offset} +arguments passed to the callback function, which identify the location +of the physical block pointed to by pointer @var{blocknr}. If +@var{ref_blk} is zero, then @var{ref_offset} contains the offset into +the @code{i_blocks} array. If @var{ref_blk} is non-zero, then the physical +block location is contained inside an indirect block group, and +@var{ref_offset} contains the offset into the indirect block. + +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Inode Convenience Functions, , Iterating over blocks in an inode, Inode Functions +@comment node-name, next, previous, up +@subsection Convenience functions for Inodes + +@deftypefun errcode_t ext2fs_get_blocks (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, blk_t *@var{blocks}) + +Returns an array of blocks corresponding to the direct, +indirect, doubly indirect, and triply indirect blocks as stored in the +inode structure. +@end deftypefun + +@deftypefun errcode_t ext2fs_check_directory (ext2_filsys @var{fs}, ext2_ino_t @var{ino}) +Returns 0 if @var{ino} is a directory, and @code{ENOTDIR} if it is not. +@end deftypefun + +@deftypefun int ext2fs_inode_has_valid_blocks (struct ext2_inode *@var{inode}) + +Returns 1 if the inode's block entries actually valid block entries, and +0 if not. Inodes which represent devices and fast symbolic links do not +contain valid block entries. +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Directory functions, Bitmap Functions, Inode Functions, EXT2FS Library Functions +@comment node-name, next, previous, up +@section Directory functions + +@menu +* Directory block functions:: +* Iterating over a directory:: +* Creating and expanding directories:: +* Creating and removing directory entries:: +* Looking up filenames:: +* Translating inode numbers to filenames:: +@end menu + +@c ---------------------------------------------------------------------- + +@node Directory block functions, Iterating over a directory, Directory functions, Directory functions +@comment node-name, next, previous, up +@subsection Directory block functions + +@deftypefun errcode_t ext2fs_read_dir_block (ext2_filsys @var{fs}, blk_t @var{block}, void *@var{buf}) + +This function reads a directory block, performing +byte swapping if necessary. +@end deftypefun + +@deftypefun errcode_t ext2fs_write_dir_block (ext2_filsys @var{fs}, blk_t @var{block}, void *@var{buf}) + +This function writes a directory block, performing +byte swapping if necessary. +@end deftypefun + +@deftypefun errcode_t ext2fs_new_dir_block (ext2_filsys @var{fs}, ext2_ino_t @var{dir_ino}, ext2_ino_t @var{parent_ino}, char **@var{block}) + +This function creates a new directory block in @var{block}. If +@var{dir_ino} is non-zero, then @var{dir_ino} and @var{parent_ino} are used +to initialize directory entries for @file{.} and @file{..}, respectively. +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Iterating over a directory, Creating and expanding directories, Directory block functions, Directory functions +@comment node-name, next, previous, up +@subsection Iterating over a directory + +@deftypefun errcode_t ext2fs_dir_iterate (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, int @var{flags}, char *@var{block_buf}, int (*@var{func})(struct ext2_dir_entry *@var{dirent}, int @var{offset}, int @var{blocksize}, char *@var{buf}, void *@var{private}), void *@var{private}) + +This function iterates over all of the directory entries in the +directory @var{dir}, calling the callback function @var{func} for each +directory entry in the directory. The @var{block_buf} parameter should +either be NULL, or if the @code{ext2fs_dir_iterate} function is +called repeatedly, the overhead of allocating and freeing +scratch memory can be avoided by passing a pointer to a scratch buffer +which must be at least as big as the filesystem's blocksize. + +The @var{flags} parameter controls how the iterator will function: + +@table @samp + +@item DIRENT_FLAG_INCLUDE_EMPTY + +This flag indicates that the callback function should be called even +for deleted or empty directory entries. + +@end table + +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Creating and expanding directories, Creating and removing directory entries, Iterating over a directory, Directory functions +@comment node-name, next, previous, up +@subsection Creating and expanding directories + +@deftypefun errcode_t ext2fs_mkdir (ext2_filsys @var{fs}, ext2_ino_t @var{parent}, ext2_ino_t @var{inum}, const char *@var{name}) + +This function creates a new directory. If @var{inum} is zero, then a +new inode will be allocated; otherwise, the directory will be created in +the inode specified by @var{inum}. If @var{name} specifies the name of +the new directory; if it is non-NULL, then the new directory will be +linked into the parent directory @var{parent}. +@end deftypefun + +@deftypefun errcode_t ext2fs_expand_dir (ext2_filsys @var{fs}, ext2_ino_t @var{dir}) + +This function adds a new empty directory block and appends it to +the directory @var{dir}. This allows functions such as +@code{ext2fs_link} to add new directory entries to a directory which is full. + +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Creating and removing directory entries, Looking up filenames, Creating and expanding directories, Directory functions +@comment node-name, next, previous, up +@subsection Creating and removing directory entries + +@deftypefun errcode_t ext2fs_link (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, const char *@var{name}, ext2_ino_t @var{ino}, int flags) + +This function adds a new directory entry to the directory @var{dir}, +with @var{name} and @var{ino} specifying the name and inode number in +the directory entry, respectively. + +The low 3 bits of the flags field is used to specify the file type of +inode: (No other flags are currently defined.) + +@table @samp + +@item EXT2_FT_UNKNOWN + +The file type is unknown. + +@item EXT2_FT_REG_FILE + +The file type is a normal file. + +@item EXT2_FT_DIR + +The file type is a directory. + +@item EXT2_FT_CHRDEV + +The file type is a character device. + +@item EXT2_FT_BLKDEV + +The file type is a block device. + +@item EXT2_FT_FIFO + +The file type is a named pipe. + +@item EXT2_FT_SOCK + +The file type is a unix domain socket. + +@item EXT2_FT_SYMLINK + +The file type is a symbolic link. +@end table + +@end deftypefun + +@deftypefun errcode_t ext2fs_unlink (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, const char *@var{name}, ext2_ino_t @var{ino}, int @var{flags}) + +This function removes a directory entry from @var{dir}. +The directory entry to be removed is the first one which is +matched by @var{name} and @var{ino}. If @var{name} is non-NULL, +the directory entry's name must match @var{name}. If @var{ino} is +non-zero, the directory entry's inode number must match @var{ino}. +No flags are currently defined for @code{ext2fs_unlink}; callers should +pass in zero to this parameter. + +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Looking up filenames, Translating inode numbers to filenames, Creating and removing directory entries, Directory functions +@comment node-name, next, previous, up +@subsection Looking up filenames + +@deftypefun errcode_t ext2fs_lookup (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, const char *@var{name}, int @var{namelen}, char *@var{buf}, ext2_ino_t *@var{inode}) +@end deftypefun + +@deftypefun errcode_t ext2fs_namei (ext2_filsys @var{fs}, ext2_ino_t @var{root}, ext2_ino_t @var{cwd}, const char *@var{name}, ext2_ino_t *@var{inode}) +@end deftypefun + +@deftypefun errcode_t ext2fs_namei_follow (ext2_filsys @var{fs}, ext2_ino_t @var{root}, ext2_ino_t @var{cwd}, const char *@var{name}, ext2_ino_t *@var{inode}) +@end deftypefun + +@deftypefun errcode_t ext2fs_follow_link (ext2_filsys @var{fs}, ext2_ino_t @var{root}, ext2_ino_t @var{cwd}, ext2_ino_t @var{inode}, ext2_ino_t *@var{res}_inode) +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Translating inode numbers to filenames, , Looking up filenames, Directory functions +@comment node-name, next, previous, up +@subsection Translating inode numbers to filenames + +@deftypefun errcode_t ext2fs_get_pathname (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, ext2_ino_t @var{ino}, char **@var{name}) +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node Bitmap Functions, EXT2 data abstractions, Directory functions, EXT2FS Library Functions +@comment node-name, next, previous, up +@section Bitmap Functions + +@menu +* Reading and Writing Bitmaps:: +* Allocating Bitmaps:: +* Free bitmaps:: +* Bitmap Operations:: +* Comparing bitmaps:: +* Modifying Bitmaps:: +* Resizing Bitmaps:: +* Clearing Bitmaps:: +@end menu + +@c ---------------------------------------------------------------------- + +@node Reading and Writing Bitmaps, Allocating Bitmaps, Bitmap Functions, Bitmap Functions +@comment node-name, next, previous, up +@subsection Reading and Writing Bitmaps + +@deftypefun errcode_t ext2fs_write_inode_bitmap (ext2_filsys @var{fs}) +@end deftypefun + +@deftypefun errcode_t ext2fs_write_block_bitmap (ext2_filsys @var{fs}) +@end deftypefun + +@deftypefun errcode_t ext2fs_read_inode_bitmap (ext2_filsys @var{fs}) +@end deftypefun + +@deftypefun errcode_t ext2fs_read_block_bitmap (ext2_filsys @var{fs}) +@end deftypefun + +@deftypefun errcode_t ext2fs_read_bitmaps (ext2_filsys @var{fs}) +@end deftypefun + +@deftypefun errcode_t ext2fs_write_bitmaps (ext2_filsys @var{fs}) +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Allocating Bitmaps, Free bitmaps, Reading and Writing Bitmaps, Bitmap Functions +@comment node-name, next, previous, up +@subsection Allocating Bitmaps + +@deftypefun errcode_t ext2fs_allocate_generic_bitmap (__u32 @var{start}, __u32 @var{end}, _u32 @var{real_end}, const char *@var{descr}, ext2fs_generic_bitmap *@var{ret}) +@end deftypefun + +@deftypefun errcode_t ext2fs_allocate_block_bitmap (ext2_filsys @var{fs}, const char *@var{descr}, ext2fs_block_bitmap *@var{ret}) +@end deftypefun + +@deftypefun errcode_t ext2fs_allocate_inode_bitmap (ext2_filsys @var{fs}, const char *@var{descr}, ext2fs_inode_bitmap *@var{ret}) +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Free bitmaps, Bitmap Operations, Allocating Bitmaps, Bitmap Functions +@comment node-name, next, previous, up +@subsection Freeing bitmaps + + +@deftypefun void ext2fs_free_generic_bitmap (ext2fs_inode_bitmap @var{bitmap}) +@end deftypefun + +@deftypefun void ext2fs_free_block_bitmap (ext2fs_block_bitmap @var{bitmap}) +@end deftypefun + +@deftypefun void ext2fs_free_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}) +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node Bitmap Operations, Comparing bitmaps, Free bitmaps, Bitmap Functions +@comment node-name, next, previous, up +@subsection Bitmap Operations + +@deftypefun void ext2fs_mark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) + +@deftypefunx void ext2fs_unmark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) + +@deftypefunx int ext2fs_test_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) + +These functions set, clear, and test bits in a block bitmap @var{bitmap}. +@end deftypefun + + +@deftypefun void ext2fs_mark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode}) + +@deftypefunx void ext2fs_unmark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode}) + +@deftypefunx int ext2fs_test_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode}) + +These functions set, clear, and test bits in an inode bitmap @var{bitmap}. +@end deftypefun + +@deftypefun void ext2fs_fast_mark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) + +@deftypefunx void ext2fs_fast_unmark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) + +@deftypefunx int ext2fs_fast_test_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) + +@deftypefunx void ext2fs_fast_mark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode}) + +@deftypefunx void ext2fs_fast_unmark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode}) + +@deftypefunx int ext2fs_fast_test_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode}) + +These ``fast'' functions are like their normal counterparts; however, +they are implemented as inline functions and do not perform bounds +checks on the inode number or block number; they are assumed to be +correct. They should only be used in speed-critical applications, where +the inode or block number has already been validated by other means. +@end deftypefun + +@deftypefun blk_t ext2fs_get_block_bitmap_start (ext2fs_block_bitmap @var{bitmap}) +@deftypefunx ext2_ino_t ext2fs_get_inode_bitmap_start (ext2fs_inode_bitmap @var{bitmap}) +Return the first inode or block which is stored in the bitmap. +@end deftypefun + +@deftypefun blk_t ext2fs_get_block_bitmap_end (ext2fs_block_bitmap @var{bitmap}) +@deftypefunx ext2_ino_t ext2fs_get_inode_bitmap_end (ext2fs_inode_bitmap @var{bitmap}) + +Return the last inode or block which is stored in the bitmap. +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node Comparing bitmaps, Modifying Bitmaps, Bitmap Operations, Bitmap Functions +@comment node-name, next, previous, up +@subsection Comparing bitmaps + +@deftypefun errcode_t ext2fs_compare_block_bitmap (ext2fs_block_bitmap @var{bm1}, ext2fs_block_bitmap @var{bm2}) +@end deftypefun + +@deftypefun errcode_t ext2fs_compare_inode_bitmap (ext2fs_inode_bitmap @var{bm1}, ext2fs_inode_bitmap @var{bm2}) +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node Modifying Bitmaps, Resizing Bitmaps, Comparing bitmaps, Bitmap Functions +@comment node-name, next, previous, up +@subsection Modifying Bitmaps + +@deftypefun errcode_t ext2fs_fudge_inode_bitmap_end (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{end}, ext2_ino_t *@var{oend}) +@end deftypefun + +@deftypefun errcode_t ext2fs_fudge_block_bitmap_end (ext2fs_block_bitmap @var{bitmap}, blk_t @var{end}, blk_t *@var{oend}) +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Resizing Bitmaps, Clearing Bitmaps, Modifying Bitmaps, Bitmap Functions +@comment node-name, next, previous, up +@subsection Resizing Bitmaps + +@deftypefun errcode_t ext2fs_resize_generic_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_generic_bitmap @var{bmap}) +@end deftypefun + +@deftypefun errcode_t ext2fs_resize_inode_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_inode_bitmap @var{bmap}) +@end deftypefun + +@deftypefun errcode_t ext2fs_resize_block_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_block_bitmap @var{bmap}) +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node Clearing Bitmaps, , Resizing Bitmaps, Bitmap Functions +@comment node-name, next, previous, up +@subsection Clearing Bitmaps + +@deftypefun void ext2fs_clear_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}) + +This function sets all of the bits in the inode bitmap @var{bitmap} to +be zero. + +@end deftypefun + +@deftypefun void ext2fs_clear_block_bitmap (ext2fs_block_bitmap @var{bitmap}) + +This function sets all of the bits in the block bitmap @var{bitmap} to +be zero. +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node EXT2 data abstractions, Byte-swapping functions, Bitmap Functions, EXT2FS Library Functions +@comment node-name, next, previous, up +@section EXT2 data abstractions + +The ext2 library has a number of abstractions which are useful for ext2 +utility programs. + +@menu +* Badblocks list management:: +* Directory-block list management:: +* Inode count functions:: +@end menu + +@c ---------------------------------------------------------------------- + +@node Badblocks list management, Directory-block list management, EXT2 data abstractions, EXT2 data abstractions +@comment node-name, next, previous, up +@subsection Badblocks list management + + +@deftypefun errcode_t ext2fs_badblocks_list_create (ext2_badblocks_list *@var{ret}, int @var{size}) +@end deftypefun + +@deftypefun void ext2fs_badblocks_list_free (ext2_badblocks_list @var{bb}) +@end deftypefun + +@deftypefun errcode_t ext2fs_badblocks_list_add (ext2_badblocks_list @var{bb}, blk_t @var{blk}) +@end deftypefun + +@deftypefun int ext2fs_badblocks_list_test (ext2_badblocks_list @var{bb}, blk_t @var{blk}) +@end deftypefun + +@deftypefun errcode_t ext2fs_badblocks_list_iterate_begin (ext2_badblocks_list @var{bb}, ext2_badblocks_iterate *@var{ret}) +@end deftypefun + +@deftypefun int ext2fs_badblocks_list_iterate (ext2_badblocks_iterate iter, blk_t *@var{blk}) +@end deftypefun + +@deftypefun void ext2fs_badblocks_list_iterate_end (ext2_badblocks_iterate @var{iter}) +@end deftypefun + +@deftypefun errcode_t ext2fs_update_bb_inode (ext2_filsys @var{fs}, ext2_badblocks_list @var{bb_list}) +@end deftypefun + +@deftypefun errcode_t ext2fs_read_bb_inode (ext2_filsys @var{fs}, ext2_badblocks_list *@var{bb_list}) +@end deftypefun + +@deftypefun errcode_t ext2fs_read_bb_FILE (ext2_filsys @var{fs}, FILE *f, ext2_badblocks_list *@var{bb_list}, void (*invalid)(ext2_filsys @var{fs}, blk_t @var{blk})) +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node Directory-block list management, Inode count functions, Badblocks list management, EXT2 data abstractions +@comment node-name, next, previous, up +@subsection Directory-block list management + +The dblist abstraction stores a list of blocks belonging to +directories. This list can be useful when a program needs to iterate +over all directory entries in a filesystem; @code{e2fsck} does this in +pass 2 of its operations, and @code{debugfs} needs to do this when it is +trying to turn an inode number into a pathname. + +@deftypefun errcode_t ext2fs_init_dblist (ext2_filsys @var{fs}, ext2_dblist *@var{ret_dblist}) + +Creates a dblist data structure and returns it in @var{ret_dblist}. +@end deftypefun + +@deftypefun void ext2fs_free_dblist (ext2_dblist @var{dblist}) + +Free a dblist data structure. +@end deftypefun + +@deftypefun errcode_t ext2fs_add_dir_block (ext2_dblist @var{dblist}, ext2_ino_t @var{ino}, blk_t @var{blk}, int @var{blockcnt}) + +Add an entry to the dblist data structure. This call records the fact +that block number @var{blockcnt} of directory inode @var{ino} is stored +in block @var{blk}. +@end deftypefun + +@deftypefun errcode_t ext2fs_set_dir_block (ext2_dblist @var{dblist}, ext2_ino_t @var{ino}, blk_t @var{blk}, int @var{blockcnt}) + +Change an entry in the dblist data structure; this changes the location +of block number @var{blockcnt} of directory inode @var{ino} to be block +@var{blk}. +@end deftypefun + +@deftypefun errcode_t ext2fs_dblist_iterate (ext2_dblist @var{dblist}, int (*func)(ext2_filsys @var{fs}, struct ext2_db_entry *@var{db_info}, void *@var{private}), void *@var{private}) + +This iterator calls @var{func} for every entry in the dblist data structure. +@end deftypefun + +@deftypefun errcode_t ext2fs_dblist_dir_iterate (ext2_dblist @var{dblist}, int flags, char *@var{block_buf}, int (*func)(ext2_ino_t @var{dir}, int @var{entry}, struct ext2_dir_entry *@var{dirent}, int @var{offset}, int @var{blocksize}, char *@var{buf}, void *@var{private}), void *@var{private}) + +This iterator takes reads in the directory block indicated in each +dblist entry, and calls @var{func} for each directory entry in each +directory block. If @var{dblist} contains all the directory blocks in a +filesystem, this function provides a convenient way to iterate over all +directory entries for that filesystem. +@end deftypefun + +@c ---------------------------------------------------------------------- + +@node Inode count functions, , Directory-block list management, EXT2 data abstractions +@comment node-name, next, previous, up +@subsection Inode count functions + +The icount abstraction is a specialized data type used by @code{e2fsck} +to store how many times a particular inode is referenced by the +filesystem. This is used twice; once to store the actual number of times +that the inode is reference; and once to store the claimed number of times +the inode is referenced according to the inode structure. + +This abstraction is designed to be extremely efficient for storing this +sort of information, by taking advantage of the following properties of +inode counts, namely (1) inode counts are very often zero (because +the inode is currently not in use), and (2) many files have a inode +count of 1 (because they are a file which has no additional hard links). + +@deftypefun errcode_t ext2fs_create_icount2 (ext2_filsys @var{fs}, int @var{flags}, int @var{size}, ext2_icount_t @var{hint}, ext2_icount_t *@var{ret}) + +Creates an icount structure for a filesystem @var{fs}, with initial space +for @var{size} inodes whose count is greater than 1. The @var{flags} +parameter is either 0 or @code{EXT2_ICOUNT_OPT_INCREMENT}, which +indicates that icount structure should be able to increment inode counts +quickly. The icount structure is returned in @var{ret}. The returned +icount structure initially has a count of zero for all inodes. + +The @var{hint} parameter allows the caller to optionally pass in another +icount structure which is used to initialize the array of inodes whose +count is greater than 1. It is used purely as a speed optimization so +that the icount structure can determine in advance which inodes are +likely to contain a count grater than 1. +@end deftypefun + +@deftypefun void ext2fs_free_icount (ext2_icount_t @var{icount}) + +Frees an icount structure. +@end deftypefun + +@deftypefun errcode_t ext2fs_icount_fetch (ext2_icount_t @var{icount}, ext2_ino_t @var{ino}, __u16 *@var{ret}) + +Returns in @var{ret} the count for a particular inode @var{ino}. +@end deftypefun + +@deftypefun errcode_t ext2fs_icount_increment (ext2_icount_t @var{icount}, ext2_ino_t @var{ino}, __u16 *@var{ret}) + +Increments the ref count for inode @var{ino}. +@end deftypefun + +@deftypefun errcode_t ext2fs_icount_decrement (ext2_icount_t @var{icount}, ext2_ino_t @var{ino}, __u16 *@var{ret}) + +Decrements the ref count for inode @var{ino}. +@end deftypefun + +@deftypefun errcode_t ext2fs_icount_store (ext2_icount_t @var{icount}, ext2_ino_t @var{ino}, __u16 @var{count}) + +Sets the reference count for inode @var{ino} to be @var{count}. +@end deftypefun + +@deftypefun ext2_ino_t ext2fs_get_icount_size (ext2_icount_t @var{icount}) + +Returns the current number of inodes in @var{icount} which has a count +greater than 1. +@end deftypefun + +@deftypefun errcode_t ext2fs_icount_validate (ext2_icount_t @var{icount}, FILE *@var{f}) + +Validates the internal rep invariant of @var{icount}; if there are any +problems, print out debugging information to @var{f}. This function is +intended for debugging and testing use only. +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node Byte-swapping functions, Other functions, EXT2 data abstractions, EXT2FS Library Functions +@comment node-name, next, previous, up +@section Byte-swapping functions + +@deftypefun void ext2fs_swap_super (struct ext2_super_block * @var{super}) +@end deftypefun + +@deftypefun void ext2fs_swap_group_desc (struct ext2_group_desc *@var{gdp}) +@end deftypefun + +@deftypefun void ext2fs_swap_inode (ext2_filsys @var{fs}, struct ext2_inode *@var{to}, struct ext2_inode *@var{from}, int @var{hostorder}) +@end deftypefun + +@deftypefun int ext2fs_native_flag (void) +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node Other functions, , Byte-swapping functions, EXT2FS Library Functions +@comment node-name, next, previous, up +@section Other functions + +/* alloc.c */ +@deftypefun errcode_t ext2fs_new_inode (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, int @var{mode}, ext2fs_inode_bitmap @var{map}, ext2_ino_t *@var{ret}) +@end deftypefun + +@deftypefun errcode_t ext2fs_new_block (ext2_filsys @var{fs}, blk_t @var{goal}, ext2fs_block_bitmap @var{map}, blk_t *@var{ret}) +@end deftypefun + +@deftypefun errcode_t ext2fs_get_free_blocks (ext2_filsys @var{fs}, blk_t @var{start}, blk_t @var{finish}, int @var{num}, ext2fs_block_bitmap @var{map}, blk_t *@var{ret}) +@end deftypefun + +/* check_desc.c */ +@deftypefun errcode_t ext2fs_check_desc (ext2_filsys @var{fs}) +@end deftypefun + +@deftypefun errcode_t ext2fs_get_num_dirs (ext2_filsys @var{fs}, ext2_ino_t *@var{ret_num_dirs}) +@end deftypefun + + +/* getsize.c */ +@deftypefun errcode_t ext2fs_get_device_size (const char *@var{file}, int @var{blocksize}, blk_t *@var{retblocks}) +@end deftypefun + + +/* ismounted.c */ +@deftypefun errcode_t ext2fs_check_if_mounted (const char *@var{file}, int *@var{mount_flags}) +@end deftypefun + +/* version.c */ + +@deftypefun int ext2fs_get_library_version (const char **@var{ver_string}, const char **@var{date_string}) + +This function returns the current version of the ext2 library. The +return value contains an integer version code, which consists of the +major version number of the library multiplied by 100, plus the minor +version number of the library. Hence, if the library version is 1.08, +the returned value will be 108. + +If @var{ver_string} and/or @var{date_string} are non-NULL, they will be +set to point at a constant string containing the library version and/or +release date, respectively. +@end deftypefun + +@deftypefun int ext2fs_parse_version_string (const char *@var{ver_string}) + +This function takes a version string which may included in an +application and returns a version code using the same algorithm used by +@code{ext2fs_get_library_version}. It can be used by programs included +in the @code{e2fsprogs} distribution to assure that they are using an +up-to-date ext2 shared library. +@end deftypefun + +/* inline functions */ +@deftypefun int ext2fs_group_of_blk (ext2_filsys @var{fs}, blk_t @var{blk}) + +This function returns the block group which contains the block @var{blk}. + +@end deftypefun + +@deftypefun int ext2fs_group_of_ino (ext2_filsys @var{fs}, ext2_ino_t @var{ino}) + +This function returns the block group which contains the inode @var{ino}. +@end deftypefun + + +@c ---------------------------------------------------------------------- + +@node Concept Index, Function Index, EXT2FS Library Functions, Top +@comment node-name, next, previous, up +@unnumbered Concept Index +@printindex cp + +@c ---------------------------------------------------------------------- + +@node Function Index, , Concept Index, Top +@comment node-name, next, previous, up +@unnumbered Function and Type Index +@printindex fn + + +@contents +@bye diff --git a/doc/texinfo.tex b/doc/texinfo.tex new file mode 100644 index 0000000..dd52615 --- /dev/null +++ b/doc/texinfo.tex @@ -0,0 +1,7226 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2006-02-13.16} +% +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free +% Software Foundation, Inc. +% +% This texinfo.tex file is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2, or (at +% your option) any later version. +% +% This texinfo.tex file is distributed in the hope that it will be +% useful, but WITHOUT ANY WARRANTY; without even the implied warranty +% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this texinfo.tex file; see the file COPYING. If not, write +% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +% Boston, MA 02110-1301, USA. +% +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. (This has been our intent since Texinfo was invented.) +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% ftp://tug.org/tex/texinfo.tex +% (and all CTAN mirrors, see http://www.ctan.org). +% The texinfo.tex in any given distribution could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + +\message{Basics,} +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ +\let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert +\let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexrbrace=\} +\let\ptexslash=\/ +\let\ptexstar=\* +\let\ptext=\t + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} + +% Ignore a token. +% +\def\gobble#1{} + +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 +}% + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% For @cropmarks command. +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingxxx.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 2\baselineskip + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \indexdummies + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1 \unvbox#1 +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\next{#2}% + \begingroup + \obeylines + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. +} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + \argremovecomment #1\comment\ArgTerm% + }% +} + +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} + +% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., +% @end itemize @c foo +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % We cannot use \next here, as it holds the macro to run; + % thus we reuse \temp. + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm +} + +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \next. +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. +% +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ + \obeyspaces + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as environments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At runtime, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp + \else + \badenverr + \fi +} + +% Environment mismatch, #1 expected: +\def\badenverr{% + \errhelp = \EMsimple + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + out of any environment% + \else + in environment \expandafter\string#1% + \fi +} + +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi +} + +\newhelp\EMsimple{Press RETURN to continue.} + + +%% Simple single-character @ commands + +% @@ prints an @ +% Kludge this until the fonts are right (grr). +\def\@{{\tt\char64}} + +% This is turned off because it was never documented +% and you can use @w{...} around a quote to suppress ligatures. +%% Define @` and @' to be the same as ` and ' +%% but suppressing ligatures. +%\def\`{{`}} +%\def\'{{'}} + +% Used to generate quoted braces. +\def\mylbrace {{\tt\char123}} +\def\myrbrace {{\tt\char125}} +\let\{=\mylbrace +\let\}=\myrbrace +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \c +\let\dotaccent = \. +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \t +\let\ubaraccent = \b +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ptexi + \else\ifx\temp\jmacro \j + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% + \kern-.15em + \TeX +} + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=\endofsentencespacefactor\space} + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=\endofsentencespacefactor\space} + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=\endofsentencespacefactor\space} + +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \plainfrenchspacing + \else\ifx\temp\offword \plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \fi\fi +} + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + \startsavinginserts + % + \setbox\groupbox = \vtop\bgroup + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +% Old definition--didn't work. +%\parseargdef\need{\par % +%% This method tries to make TeX break the page naturally +%% if the depth of the box does not fit. +%{\baselineskip=0pt% +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak +%\prevdepth=-1000pt +%}} + +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break (and is undocumented). + +\let\br = \par + +% @page forces the start of a new page. +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} + +% This defn is used inside nofill environments such as @example. +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @include file insert text of that file as input. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable + \def\temp{\input #1 }% + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} + +\def\thisfile{} + +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + +% @sp n outputs n lines of vertical space + +\parseargdef\sp{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment + +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} + +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a \ character. +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but +% this is not advertised and we don't care. Texinfo does not +% otherwise define @\. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + } +} + +% @bullet and @minus need the same treatment as @math, just above. +\def\bullet{$\ptexbullet$} +\def\minus{$-$} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in a typewriter +% font as three actual period characters. +% +\def\dots{% + \leavevmode + \hbox to 1.5em{% + \hskip 0pt plus 0.25fil + .\hfil.\hfil.% + \hskip 0pt plus 0.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @comma{} is so commas can be inserted into text without messing up +% Texinfo's parsing. +% +\let\comma = , + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as \undefined, +% borrowed from ifpdf.sty. +\ifx\pdfoutput\undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi + +% PDF uses PostScript string constants for the names of xref targets, +% for display in the outlines, and in other places. Thus, we have to +% double any backslashes. Otherwise, a name like "\node" will be +% interpreted as a newline (\n), followed by o, d, e. Not good. +% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html +% (and related messages, the final outcome is that it is up to the TeX +% user to double the backslashes and otherwise make the string valid, so +% that's what we do). + +% double active backslashes. +% +{\catcode`\@=0 \catcode`\\=\active + @gdef@activebackslashdouble{% + @catcode`@\=@active + @let\=@doublebackslash} +} + +% To handle parens, we must adopt a different approach, since parens are +% not active characters. hyperref.dtx (which has the same problem as +% us) handles it with this amazing macro to replace tokens. I've +% tinkered with it a little for texinfo, but it's definitely from there. +% +% #1 is the tokens to replace. +% #2 is the replacement. +% #3 is the control sequence with the string. +% +\def\HyPsdSubst#1#2#3{% + \def\HyPsdReplace##1#1##2\END{% + ##1% + \ifx\\##2\\% + \else + #2% + \HyReturnAfterFi{% + \HyPsdReplace##2\END + }% + \fi + }% + \xdef#3{\expandafter\HyPsdReplace#3#1\END}% +} +\long\def\HyReturnAfterFi#1\fi{\fi#1} + +% #1 is a control sequence in which to do the replacements. +\def\backslashparens#1{% + \xdef#1{#1}% redefine it as its expansion; the definition is simply + % \lastnode when called from \setref -> \pdfmkdest. + \HyPsdSubst{(}{\realbackslash(}{#1}% + \HyPsdSubst{)}{\realbackslash)}{#1}% +} + +\ifpdf + \input pdfcolor + \pdfcatalog{/PageMode /UseOutlines}% + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}% + \def\imageheight{#3}% + % without \immediate, pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifx\empty\imagewidth\else width \imagewidth \fi + \ifx\empty\imageheight\else height \imageheight \fi + \ifnum\pdftexversion<13 + #1.pdf% + \else + {#1.pdf}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \atdummies + \activebackslashdouble + \def\pdfdestname{#1}% + \backslashparens\pdfdestname + \pdfdest name{\pdfdestname} xyz% + }}% + % + % used to mark target names; must be expandable. + \def\pdfmkpgn#1{#1}% + % + \let\linkcolor = \Blue % was Cyan, but that seems light? + \def\endlink{\Black\pdfendlink} + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text, which is what will be displayed in the + % outline by the pdf viewer. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node text, + % which might be empty if this toc entry had no corresponding node. + % #4 is the page number + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worth the trouble, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty + \def\pdfoutlinedest{#4}% + \else + % Doubled backslashes in the name. + {\activebackslashdouble \xdef\pdfoutlinedest{#3}% + \backslashparens\pdfoutlinedest}% + \fi + % + % Also double the backslashes in the display string. + {\activebackslashdouble \xdef\pdfoutlinetext{#1}% + \backslashparens\pdfoutlinetext}% + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \readdatafile{toc}% + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. + \indexnofonts + \setupdatafile + \catcode`\\=\active \otherbackslash + \input \jobname.toc + \endgroup + } + % + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + % make a live url in pdf output. + \def\pdfurl#1{% + \begingroup + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty + \makevalueexpandable + \leavevmode\Red + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \linkcolor #1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\linkcolor = \relax + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +\def\setleading#1{% + \normalbaselineskip = #1\relax + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% Set the font macro #1 to the font named #2, adding on the +% specified font prefix (normally `cm'). +% #3 is the font's design size, #4 is a scale factor +\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\undefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} %where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep} +\setfont\texttt\ttshape{10}{\mainmagstep} +\setfont\textbf\bfshape{10}{\mainmagstep} +\setfont\textit\itshape{10}{\mainmagstep} +\setfont\textsl\slshape{10}{\mainmagstep} +\setfont\textsf\sfshape{10}{\mainmagstep} +\setfont\textsc\scshape{10}{\mainmagstep} +\setfont\textttsl\ttslshape{10}{\mainmagstep} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1} +\setfont\deftt\ttshape{10}{\magstep1} +\setfont\defttsl\ttslshape{10}{\magstep1} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000} +\setfont\smalltt\ttshape{9}{1000} +\setfont\smallbf\bfshape{10}{900} +\setfont\smallit\itshape{9}{1000} +\setfont\smallsl\slshape{9}{1000} +\setfont\smallsf\sfshape{9}{1000} +\setfont\smallsc\scshape{10}{900} +\setfont\smallttsl\ttslshape{10}{900} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000} +\setfont\smallertt\ttshape{8}{1000} +\setfont\smallerbf\bfshape{10}{800} +\setfont\smallerit\itshape{8}{1000} +\setfont\smallersl\slshape{8}{1000} +\setfont\smallersf\sfshape{8}{1000} +\setfont\smallersc\scshape{10}{800} +\setfont\smallerttsl\ttslshape{10}{800} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3} +\setfont\titleit\itbshape{10}{\magstep4} +\setfont\titlesl\slbshape{10}{\magstep4} +\setfont\titlett\ttbshape{12}{\magstep3} +\setfont\titlettsl\ttslshape{10}{\magstep4} +\setfont\titlesf\sfbshape{17}{\magstep1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} +\def\authortt{\sectt} + +% Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2} +\setfont\chapit\itbshape{10}{\magstep3} +\setfont\chapsl\slbshape{10}{\magstep3} +\setfont\chaptt\ttbshape{12}{\magstep2} +\setfont\chapttsl\ttslshape{10}{\magstep3} +\setfont\chapsf\sfbshape{17}{1000} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 + +% Section fonts (14.4pt). +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1} +\setfont\secit\itbshape{10}{\magstep2} +\setfont\secsl\slbshape{10}{\magstep2} +\setfont\sectt\ttbshape{12}{\magstep1} +\setfont\secttsl\ttslshape{10}{\magstep2} +\setfont\secsf\sfbshape{12}{\magstep1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 + +% Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf} +\setfont\ssecit\itbshape{10}{1315} +\setfont\ssecsl\slbshape{10}{1315} +\setfont\ssectt\ttbshape{12}{\magstephalf} +\setfont\ssecttsl\ttslshape{10}{1315} +\setfont\ssecsf\sfbshape{12}{\magstephalf} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1315} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000} +\setfont\reducedtt\ttshape{10}{1000} +\setfont\reducedbf\bfshape{10}{1000} +\setfont\reducedit\itshape{10}{1000} +\setfont\reducedsl\slshape{10}{1000} +\setfont\reducedsf\sfshape{10}{1000} +\setfont\reducedsc\scshape{10}{1000} +\setfont\reducedttsl\ttslshape{10}{1000} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf +} + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{25pt}} +\def\titlefont#1{{\titlefonts\rm #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish the USA used A4 paper. +% --karl, 24jan03. + + +% Set up the default fonts, so we can use them for creating boxes. +% +\textfonts \rm + +% Define these so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000} +\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000} +\setfont\shortconttt\ttshape{12}{1000} + +%% Add scribe-like font environments, plus @l for inline lisp (usually sans +%% serif) and @ii for TeX italic + +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction +% unless the following character is such as not to need one. +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else + \ptexslash\fi\fi\fi} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally uses \ttsl. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} + +\let\i=\smartitalic +\let\slanted=\smartslanted +\let\var=\smartslanted +\let\dfn=\smartslanted +\let\emph=\smartitalic + +% @b, explicit bold. +\def\b#1{{\bf #1}} +\let\strong=\b + +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\questChar = `\? +\chardef\semiChar = `\; +% +\catcode`@=11 + \def\plainfrenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \def\endofsentencespacefactor{1000}% for @. and friends + } + \def\plainnonfrenchspacing{% + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends + } +\catcode`@=\other +\def\endofsentencespacefactor{3000}% default + +\def\t#1{% + {\tt \rawbackslash \plainfrenchspacing #1}% + \null +} +\def\samp#1{`\tclose{#1}'\null} +\setfont\keyrm\rmshape{8}{1000} +\font\keysy=cmsy9 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% + \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% + \vbox{\hrule\kern-0.4pt + \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% + \kern-0.4pt\hrule}% + \kern-.06em\raise0.4pt\hbox{\angleright}}}} +% The old definition, with no lozenge: +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @file, @option are the same as @samp. +\let\file=\samp +\let\option=\samp + +% @code is a modification of @t, +% which makes spaces the same size as normal in the surrounding text. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \plainfrenchspacing + #1% + }% + \null +} + +% We *must* turn on hyphenation at `-' and `_' in @code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active + \catcode`\_=\active + % + \global\def\code{\begingroup + \catcode`\-=\active \catcode`\_=\active + \ifallowcodebreaks + \let-\codedash + \let_\codeunder + \else + \let-\realdash + \let_\realunder + \fi + \codex + } +} + +\def\realdash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} +\def\codex #1{\tclose{#1}\endgroup} + +% An additional complication: the above will allow breaks after, e.g., +% each of the four underscores in __typeof__. This is undesirable in +% some manuals, especially if they don't have long identifiers in +% general. @allowcodebreaks provides a way to control this. +% +\newif\ifallowcodebreaks \allowcodebreakstrue + +\def\keywordtrue{true} +\def\keywordfalse{false} + +\parseargdef\allowcodebreaks{% + \def\txiarg{#1}% + \ifx\txiarg\keywordtrue + \allowcodebreakstrue + \else\ifx\txiarg\keywordfalse + \allowcodebreaksfalse + \else + \errhelp = \EMsimple + \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \fi\fi +} + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle option `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct.' +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\look}}\fi +\else{\tclose{\kbdfont\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. Perhaps eventually put in +% a hypertex \special here. +% +\def\uref#1{\douref #1,,,\finish} +\def\douref#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\plainfrenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% +\def\pounds{{\it\$}} + +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\undefined +\def\Orb{\mathhexbox20D} +\fi + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \let\page = \oldpage + \page + \null + }% +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +%%% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rm #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\authorfont \leftline{#1}}% + \fi +} + + +%%% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make TeX use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + + +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -\baselineskip + \global\advance\vsize by -\baselineskip +} + +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\HEADINGSoff{% +\global\evenheadline={\hfil} \global\evenfootline={\hfil} +\global\oddheadline={\hfil} \global\oddfootline={\hfil}} +\HEADINGSoff +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemindicate{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} + +% @table, @ftable, @vtable. +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\envdef\itemize{\parsearg\doitemize} + +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + \def\itemcontents{#1}% + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + \let\item=\itemizeitem +} + +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a <number>. + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call \doitemize, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \doitemize{#1.}\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. Note that \everycr resets \everytab. +\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + +% @multitable ... @end multitable definitions: +% +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% + \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +%% Test to see if parskip is larger than space between lines of +%% table. If not, do nothing. +%% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi} + + +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \obeylines + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M@end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% + % + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% +} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \undefined + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname\donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% +\def\indexdummies{% + \escapechar = `\\ % use backslash in output files. + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % Do the redefinitions. + \commondummies +} + +% For the aux and toc files, @ is the escape character. So we want to +% redefine everything using @ as the escape character (instead of +% \realbackslash, still used for index files). When everything uses @, +% this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % Do the redefinitions. + \commondummies + \otherbackslash +} + +% Called from \indexdummies and \atdummies. +% +\def\commondummies{% + % + % \definedummyword defines \#1 as \string\#1\space, thus effectively + % preventing its expansion. This is used only for control% words, + % not control letters, because the \space would be incorrect for + % control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword ##1{\def##1{\string##1\space}}% + \def\definedummyletter##1{\def##1{\string##1}}% + \let\definedummyaccent\definedummyletter + % + \commondummiesnofonts + % + \definedummyletter\_% + % + % Non-English letters. + \definedummyword\AA + \definedummyword\AE + \definedummyword\L + \definedummyword\OE + \definedummyword\O + \definedummyword\aa + \definedummyword\ae + \definedummyword\l + \definedummyword\oe + \definedummyword\o + \definedummyword\ss + \definedummyword\exclamdown + \definedummyword\questiondown + \definedummyword\ordf + \definedummyword\ordm + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword\bf + \definedummyword\gtr + \definedummyword\hat + \definedummyword\less + \definedummyword\sf + \definedummyword\sl + \definedummyword\tclose + \definedummyword\tt + % + \definedummyword\LaTeX + \definedummyword\TeX + % + % Assorted special characters. + \definedummyword\bullet + \definedummyword\comma + \definedummyword\copyright + \definedummyword\registeredsymbol + \definedummyword\dots + \definedummyword\enddots + \definedummyword\equiv + \definedummyword\error + \definedummyword\euro + \definedummyword\expansion + \definedummyword\minus + \definedummyword\pounds + \definedummyword\point + \definedummyword\print + \definedummyword\result + % + % We want to disable all macros so that they are not expanded by \write. + \macrolist + % + \normalturnoffactive + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sc + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\acronym + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% +\def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{\let##1\asis}% + % We can just ignore other control letters. + \def\definedummyletter##1{\let##1\empty}% + % Hopefully, all control words can become @asis. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\registeredsymbol{R}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\result{=>}% + % + % We need to get rid of all macros, leaving only the arguments (if present). + % Of course this is not nearly correct, but it is the best we can do for now. + % makeinfo does not expand macros in the argument to @deffn, which ends up + % writing an index entry, and texindex isn't prepared for an index sort entry + % that starts with \. + % + % Since macro invocations are followed by braces, we can just redefine them + % to take a single TeX argument. The case of a macro invocation that + % goes to end-of-line is not handled. + % + \macrolist +} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% Most index entries go through here, but \dosubind is the general case. +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% +\def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \ifvmode + \dosubindsanitize + \else + \dosubindwrite + \fi + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% + \fi + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write will make \lastskip zero. The result is that sequences +% like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +% ..., ready, GO: +% +\def\dosubindsanitize{% + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \skip0 = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \count255 = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\skip0 glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\skip0 + \fi + % + \dosubindwrite + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\count255>9999 \penalty\count255 \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\skip0 + \fi +} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\parseargdef\printindex{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \everypar = {}% don't want the \kern\-parindent from indentation suppression. + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + % Do our best not to break after the initial. + \nobreak + \vskip .33\baselineskip plus .1\baselineskip +}} + +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this frozes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \def\tempa{{\rm }}% + \def\tempb{#1}% + \edef\tempc{\tempa}% + \edef\tempd{\tempb}% + \ifx\tempc\tempd + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} + +% Like \dotfill except takes at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines this as the name of the chapter. +% page headings and footings can use it. @section does likewise. +% However, they are not reliable, because we don't use marks. +\def\thischapter{} +\def\thissection{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achieve this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unmlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 + \else + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi + \fi + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unmlevel + \def\headtype{U}% + \else + \chardef\unmlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + \message{\putwordChapter\space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + \def\appendixnum{\putwordAppendix\space \appendixletter}% + \message{\appendixnum}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the<toks register> to achieve this: TeX expands \the<toks> only once, + % simply yielding the contents of <toks register>. (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + +% Sections. +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% +} + +% Subsections. +\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% +} + +% Subsubsections. +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +% NOTE on use of \vbox for chapter headings, section headings, and such: +% 1) We use \vbox rather than the earlier \line to permit +% overlong headings to fold. +% 2) \hyphenpenalty is set to 10000 because hyphenation in a +% heading is obnoxious; this forbids it. +% 3) Likewise, headings look best if no \parindent is used, and +% if justification is not attempted. Hence \raggedright. + + +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} + +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} + +% @heading, @subheading, @subsubheading. +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +%%% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +%%% Define plain chapter starts, and page on/off switching for it +% Parameter controlling skip before chapter headings (if needed) + +\newskip\chapheadingskip + +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{% +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + \pchapsepmacro + {% + \chapfonts \rm + % + % Have to define \thissection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \gdef\thischapter{#1}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \gdef\thischapter{}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. And we don't + % use \thissection because that changes with each section. + % + \xdef\thischapter{\putwordAppendix{} \appendixletter: + \noexpand\thischaptername}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \xdef\thischapter{\putwordChapter{} \the\chapno: + \noexpand\thischaptername}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} + + +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% +\def\unnchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\nobreak +} +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} +\def\centerchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt + \hfill {\rm #1}\hfill}}\bigskip \par\nobreak +} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} + + +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} + +% Subsection titles. +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} + +% Subsubsection titles. +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} + + +% Print any size, any type, section title. +% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\sectionheading#1#2#3#4{% + {% + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rm + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Only insert the space after the number if we have a section number. + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\thissection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \thissection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\thissection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\thissection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chapmacro. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chapmacro. + \donoderef{#3}% + % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% + }% + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This is purely so the last item on the list is a known \penalty > + % 10000. This is so \startdefun can avoid allowing breakpoints after + % section headings. Otherwise, it would insert a valid breakpoint between: + % + % @section sec-whatever + % @deffn def-whatever + \penalty 10001 +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% +\newif\iftocfileopened +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + {\atdummies + \edef\temp{% + \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% + \temp + }% + \fi + \fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + + +% These characters do not print properly in the Computer Modern roman +% fonts, so we must take special care. This is more or less redundant +% with the Texinfo input format setup at the end of this file. +% +\def\activecatcodes{% + \catcode`\"=\active + \catcode`\$=\active + \catcode`\<=\active + \catcode`\>=\active + \catcode`\\=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\|=\active + \catcode`\~=\active +} + + +% Read the toc file, which is essentially Texinfo input. +\def\readtocfile{% + \setupdatafile + \activecatcodes + \input \jobname.toc +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Prepare to read what we've written to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund <tege@matematik.su.se> + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \def\thischapter{}% + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi +} + + +% Normal (long) toc. +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \jobname.toc + \ifeof 1 \else + \readtocfile + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \jobname.toc + \ifeof 1 \else + \readtocfile + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} + +% Sections. +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} + +% Subsections. +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} + +% And subsubsections. +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} + +% This parameter controls the indentation of the various levels. +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} + + +\message{environments,} +% @foo ... @end foo. + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, it should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @tex ... @end tex escapes into raw Tex temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain tex @ character. + +\envdef\tex{% + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie + \catcode `\%=14 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \escapechar=`\\ + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\/=\ptexslash + \let\*=\ptexstar + \let\t=\ptext + \let\frenchspacing=\plainfrenchspacing + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +} +% There is no need to define \Etex. + +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will +% also clear it, so that its embedded environments do the narrowing again. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing = t% + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} +\def\Ecartouche{% + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\def\nonfillstart{% + \aboveenvbreak + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + \parindent = 0pt + \emergencystretch = 0pt % don't try to avoid overfull boxes + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \let\exdent=\nofillexdent +} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \smallexamplefonts \rm + \fi +} + +% We often define two environments, @foo and @smallfoo. +% Let's do it by one command: +\def\makedispenv #1#2{ + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} + +% Define two synonyms: +\def\maketwodispenvs #1#2#3{ + \makedispenv{#1}{#3} + \makedispenv{#2}{#3} +} + +% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvs {lisp}{example}{% + \nonfillstart + \tt + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} + +% @display/@smalldisplay: same as @lisp except keep current font. +% +\makedispenv {display}{% + \nonfillstart + \gobble +} + +% @format/@smallformat: same as @display except don't narrow margins. +% +\makedispenv{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} + +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak + +% @flushright. +% +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. +% +\envdef\quotation{% + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \parindent=0pt + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \advance\rightskip by \lispnarrowing + \exdentamount = \lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\undefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + + +% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} +% If we want to allow any <char> as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% [Knuth] pp. 380,381,391 +% Disable Spanish ligatures ?` and !` of \tt font +\begingroup + \catcode`\`=\active\gdef`{\relax\lq} +\endgroup +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \catcode`\`=\active + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } +\endgroup +\def\setupverbatim{% + \let\nonarrowing = t% + \nonfillstart + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \catcode`\`=\active + \tabexpand + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'<char>#1<char>'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} + +\message{defuns,} +% @defun etc. + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \defargscommonending, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remainnig is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +%%% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +%%% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % How we'll format the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % (plain.tex says that \dimen1 should be used only as global.) + \parshape 2 0in \dimen0 \defargsindent \dimen2 + % + % Put the type name to the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% return value type + \ifx\temp\empty\else \tclose{\temp} \fi + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \let\var=\ttslanted + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +\def\badparencount{% + \errmessage{Unbalanced parentheses in @def}% + \global\parencount=0 +} +\def\badbrackcount{% + \errmessage{Unbalanced square braces in @def}% + \global\brackcount=0 +} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\undefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } +\fi + +\def\scanmacro#1{% + \begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % ... and \example + \spaceisspace + % + % Append \endinput to make sure that TeX does not see the ending newline. + % + % I've verified that it is necessary both for e-TeX and for ordinary TeX + % --kasal, 29nov03 + \scantokens{#1\endinput}% + \endgroup +} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? + +% List of all defined macros in the form +% \definedummyword\macro1\definedummyword\macro2... +% Currently is also contains all @aliases; the list can be split +% if there is a need. +\def\macrolist{} + +% Add the macro to \macrolist +\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} +\def\addtomacrolistxxx#1{% + \toks0 = \expandafter{\macrolist\definedummyword#1}% + \xdef\macrolist{\the\toks0}% +} + +% Utility routines. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% +\def\cslet#1#2{% + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=\other \catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \. + +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. + +\def\scanctxt{% + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other +} + +\def\scanargctxt{% + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% + \scanctxt + \catcode`\\=\other +} + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. + +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0% + \else + \expandafter\parsemargdef \argl;% + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + \addtomacrolist{\the\macname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\definedummyword\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx #1\relax + % remove this + \else + \noexpand\definedummyword \noexpand#1% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% <parameter list> is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.blah for each blah +% in the params list, to be ##N where N is the position in that list. +% That gets used by \mbodybackslash (above). + +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. + +\def\parsemargdef#1;{\paramno=0\def\paramlist{}% + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1% + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) + +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% + +% This defines the macro itself. There are six cases: recursive and +% nonrecursive macros of zero, one, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \fi + \fi} + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg) +\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \next} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Just make them active and then expand them all to nothing. +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \addtomacrolist{#1}% + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + + +\message{cross references,} + +\newwrite\auxfile + +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + +\let\nwnode=\node +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty + \fi +} + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \thissection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\thissection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \writexrdef{pg}{\folio}% will be written later, during \shipout + }% + \fi +} + +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + \def\printedmanual{\ignorespaces #5}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% + \ifdim \wd0 = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax + % Use the node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% + \else + % Use the actual chapter/section title appear inside + % the square brackets. Use the real section title if we have it. + \ifdim \wd1 > 0pt + % It is in another manual, so we don't have it. + \def\printedrefname{\ignorespaces #1}% + \else + \ifhavexrefs + % We know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printedrefname{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % Make link in pdf output. + \ifpdf + \leavevmode + \getfilename{#4}% + {\turnoffactive + % See comments at \activebackslashdouble. + {\activebackslashdouble \xdef\pdfxrefdest{#1}% + \backslashparens\pdfxrefdest}% + % + \ifnum\filenamelength>0 + \startlink attr{/Border [0 0 0]}% + goto file{\the\filename.pdf} name{\pdfxrefdest}% + \else + \startlink attr{/Border [0 0 0]}% + goto name{\pdfmkpgn{\pdfxrefdest}}% + \fi + }% + \linkcolor + \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}{}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi + \fi + \endlink +\endgroup} + +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% +\def\refx#1#2{% + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + \message{\linenumber Undefined cross reference `#1'.}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \thisrefX + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR#1\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \fi +} + +% Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readdatafile{aux}% + \global\havexrefstrue + \fi + \closein 1 +} + +\def\setupdatafile{% + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`\%=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. + {% + \count1=128 + \def\loop{% + \catcode\count1=\other + \advance\count1 by 1 + \ifnum \count1<256 \loop \fi + }% + }% + % + % @ is our escape character in .aux files, and we need braces. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\@=0 +} + +\def\readdatafile#1{% +\begingroup + \setupdatafile + \input\jobname.#1 +\endgroup} + +\message{insertions,} +% including footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for info output only. +\let\footnotestyle=\comment + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \dofootnote +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\gdef\dofootnote{% + \insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \hsize=\pagewidth + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + \futurelet\next\fo@t +} +}%end \catcode `\@=11 + +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarly, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. +% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi +} + +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. +% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +\closein 1 +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\undefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \nobreak\bigskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \line\bgroup + \fi + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode \egroup \bigbreak \fi % space after the image +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \thissection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\thissection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies + % + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \thissection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + +\message{localization,} +% and i18n. + +% @documentlanguage is usually given very early, just after +% @setfilename. If done too late, it may not override everything +% properly. Single argument is the language abbreviation. +% It would be nice if we could set up a hyphenation file here. +% +\parseargdef\documentlanguage{% + \tex % read txi-??.tex file in plain TeX. + % Read the file if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 + \endgroup +} +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? In the current directory +should work if nowhere else does.} + + +% @documentencoding should change something in TeX eventually, most +% likely, but for now just recognize it. +\let\documentencoding = \comment + + +% Page size parameters. +% +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be so finicky about underfull hboxes, either. +\hbadness = 2000 + +% Following George Bush, just get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; +% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; +% 7) physical page height; 8) physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + \fi + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{46\baselineskip}{6in}% + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% +}} + +% Use @smallbook to reset parameters for 7x9.25 trim size. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5in}% + {\voffset}{.25in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .5cm +}} + +% Use @smallerbook to reset parameters for 6x9 trim size. +% (Just testing, parameters still in flux.) +\def\smallerbook{{\globaldefs = 1 + \parskip = 1.5pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.4in}{4.8in}% + {-.2in}{-.4in}% + {0pt}{14pt}% + {9in}{6in}% + % + \lispnarrowing = 0.25in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .4cm +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{51\baselineskip}{160mm} + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% + % + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 + \afourpaper + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + % + % Must explicitly reset to 0 because we call \afourpaper. + \globaldefs = 0 +}} + +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 + \afourpaper + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \dimen0 = #1 + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other +\catcode`\~=\other +\catcode`\^=\other +\catcode`\_=\other +\catcode`\|=\other +\catcode`\<=\other +\catcode`\>=\other +\catcode`\+=\other +\catcode`\$=\other +\def\normaldoublequote{"} +\def\normaltilde{~} +\def\normalcaret{^} +\def\normalunderscore{_} +\def\normalverticalbar{|} +\def\normalless{<} +\def\normalgreater{>} +\def\normalplus{+} +\def\normaldollar{$}%$ font-lock fix + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +\let\realunder=_ +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash +} + +\catcode`\@=0 + +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \realbackslash is an actual character `\' with catcode other, and +% \doublebackslash is two of them (for the pdf outlines). +{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} + +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. +\catcode`\\=\active +@def@normalbackslash{{@tt@backslashcurfont}} +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash + +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. +@gdef@rawbackslash{@let\=@backslashcurfont} +@gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. +% +@def@normalturnoffactive{% + @let\=@normalbackslash + @let"=@normaldoublequote + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix + @unsepspaces +} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\' in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also turn back on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other +@catcode`@# = @other +@catcode`@% = @other + + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore |