From d2e015a718edb00dfe35d641354c5adb85fb5a49 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 28 Jan 2022 08:35:59 -0800 Subject: [PATCH 1/4] Remove trailing white space and empty lines --- ChangeLog.cvs | 140 ++++++++++++++++----------------- NEWS | 8 +- README-alpha | 3 - README-hacking | 8 +- TODO | 23 +++--- am/ax_compile_check_rettype.m4 | 2 +- am/pack.m4 | 2 +- doc/Makefile.am | 2 +- doc/cpio.1 | 9 +-- doc/cpio.texi | 28 +++---- doc/mt.1 | 31 ++++---- lib/Makefile.am | 2 +- po/POTFILES.in | 2 - src/Makefile.am | 1 - src/copyin.c | 71 +++++++++-------- src/copyout.c | 54 ++++++------- src/copypass.c | 30 +++---- src/dstring.c | 2 +- src/dstring.h | 1 - src/extern.h | 7 +- src/fatal.c | 1 - src/filemode.c | 1 - src/global.c | 1 - src/main.c | 90 ++++++++++----------- src/makepath.c | 8 +- src/mt.c | 9 +-- src/tar.c | 6 +- src/util.c | 52 ++++++------ sysdep.m4 | 1 - tests/CVE-2015-1197.at | 1 - tests/CVE-2019-14866.at | 2 +- tests/Makefile.am | 1 - tests/atlocal.in | 1 - tests/big-block-size.at | 4 +- tests/inout.at | 2 +- tests/interdir.at | 10 +-- tests/setstat01.at | 2 - tests/setstat02.at | 2 - tests/setstat03.at | 2 - tests/setstat04.at | 2 - tests/setstat05.at | 2 - tests/symlink-bad-length.at | 2 +- tests/version.at | 1 - 43 files changed, 296 insertions(+), 333 deletions(-) diff --git a/ChangeLog.cvs b/ChangeLog.cvs index 51ae5f8..4bc8ed8 100644 --- a/ChangeLog.cvs +++ b/ChangeLog.cvs @@ -10,17 +10,17 @@ * NEWS, configure.ac: Raise the patchlevel number. * THANKS: Update - + * doc/cpio.texi: Fix a typo. * src/extern.h (warn_if_file_changed): Fix type of the 2nd argument. * src/tar.c (write_out_tar_header): Stylistic change. * src/util.c (copy_files_disk_to_disk): Fix types of automatic - variables. + variables. (warn_if_file_changed): Fix type of the 2nd argument. - + Patches supplied by Ladislav Michnovic. - + 2008-02-08 Sergey Poznyakoff * po/POTFILES.in: Add missing files. @@ -34,7 +34,7 @@ 2007-12-05 Sergey Poznyakoff Fix mingw build. Thanks to Robert Millan. - + * NEWS, THANKS: Update. * bootstrap: Create lib/system.c, m4/sysdep.m4, update lib/system.h. * mingw.m4, sysdep.m4: New files. @@ -56,7 +56,7 @@ 2007-06-28 Sergey Poznyakoff * bootstrap: Update for the change of the TP URL - + * NEWS: Update * src/extern.h, src/makepath.c (make_path): Remove mode argument. All callers updated. @@ -70,7 +70,7 @@ * src/extern.h (newdir_umask): New global (delay_set_stat,repair_delayed_set_stat) (apply_delayed_set_stat): New functions - + * src/global.c (newdir_umask): New global * src/idcache.c: Include xalloc.h * src/main.c: New warning control option -W interdir @@ -107,12 +107,12 @@ * src/copyin.c, src/copyout.c, src/copypass.c: Update calls to set_perms. * src/makepath.c: Remove useless includes. - + * src/util.c (set_perms, stat_to_cpio): Use CPIO_UID and CPIO_GID macros to set uid and gid * src/main.c (process_args): Allow to use --owner in copy-out mode. * THANKS: Add Mike Frysinger - + 2007-05-18 Sergey Poznyakoff * bootstrap: Update from tar repository @@ -138,7 +138,7 @@ * src/Makefile.am: Update * src/main.c, src/mt.c: Include rmt-command.h instead of localedir.h * .cvsignore, doc/.cvsignore: Sort - + * src/util.c (sparse_write): Static. Provide a forward declaration. Define enum sparse_write_states inside the function. @@ -193,7 +193,7 @@ * src/copyin.c, src/copyout.c, src/copypass.c, src/cpio.h, src/cpiohdr.h, src/defer.c, src/defer.h, src/extern.h, src/global.c, src/main.c, src/makepath.c, src/tar.c, - src/util.c: Update copyright year. + src/util.c: Update copyright year. 2006-07-04 Sergey Poznyakoff @@ -203,7 +203,7 @@ Start rewriting using a better suited internal representation for the file meta-data. - + * src/cpiohdr.h (struct old_cpio_header): Remove unused fields c_mtime, c_filesize and c_name. (struct old_ascii_header): New data type @@ -261,17 +261,17 @@ readable, prepend its contents to the command line. Fix Debian bug 335580: - + * src/copyout.c (read_for_checksum,write_out_header): CRC is a 32-bit unsigned value. Patch proposed by Jim Castleberry and - Peter Vrabec. + Peter Vrabec. * src/extern.h (crc): Change declaration * src/global.c: Likewise * src/tar.c (tar_checksum): Return unsigned int * THANKS: Add Jim Castleberry * NEWS: Updated - + 2005-09-30 Sergey Poznyakoff * src/copyout.c (process_copy_out): Discern between original and @@ -300,7 +300,7 @@ the trailer file name. * src/util.c (cpio_safer_name_suffix): New function (add_cdf_double_slashes): Add FIXME warning. - + * lib/fatal.c: New file * lib/Makefile.tmpl (libcpio_a_SOURCES): Add fatal.c * src/copyout.c: Use error reporting functions from paxlib @@ -320,9 +320,9 @@ * bootstrap (copy_files): Create destination directory if it does not exist. - Preserve longlong.m4 as longlong_gl.m4 + Preserve longlong.m4 as longlong_gl.m4 * src/main.c: Include paxlib.h - + 2005-05-22 Sergey Poznyakoff * lib/.cvsignore: Updated @@ -336,7 +336,7 @@ * src/main.c (parse_opt): Handle new --absolute-filenames option. (process_args): Updated * src/util.c: Rewrite inode lookup/insertion functions using hash - module. + module. u2005-05-20 Sergey Poznyakoff @@ -432,7 +432,7 @@ u2005-05-20 Sergey Poznyakoff * src/copypass.c (process_copy_pass): Set umask 0 * src/copyin.c (process_copy_in): Likewise * src/util.c (open_archive): Use MODE_RW. - + 2005-01-11 Sergey Poznyakoff * doc/gendocs_template: Template file for gendocs.sh. @@ -448,7 +448,7 @@ u2005-05-20 Sergey Poznyakoff * src/tar.c: Likewise. * src/util.c: Likewise. (write_nuls_to_file): Made extern. All callers updated - + * src/copyout.c: Likewise. Use write_nuls_to_file instead of explicitely accessing zeros_512 * src/userspec.c: Likewise. @@ -457,7 +457,7 @@ u2005-05-20 Sergey Poznyakoff * src/extern.h (zeros_512): Removed (write_nuls_to_file): New function * src/global.c (zeros_512): Removed - + 2005-01-06 Sergey Poznyakoff * bootstrap: Add 'fileblocks' gnulib module @@ -500,7 +500,7 @@ u2005-05-20 Sergey Poznyakoff * src/tar.c: Fixed deviations from POSIX.1-1988: Properly split long file names. Fill in octal fields with zeros, not spaces. Save only protection modes, not the whole mode. - + * NEWS: Updated 2004-09-08 Sergey Poznyakoff @@ -530,7 +530,7 @@ u2005-05-20 Sergey Poznyakoff * tests/inout.at: New file * tests/version.at: New file * tests/atlocal.in: New file - + 2004-09-07 Sergey Poznyakoff * src/main.c (process_args): Bugfix. Allow extra arguments @@ -545,7 +545,7 @@ u2005-05-20 Sergey Poznyakoff Started merging with tar into paxutils. Sources before this point are tagged alpha-2_50_90. - + * bootstrap: New file * autogen.sh: Removed * Makefile.am: Updated @@ -585,7 +585,7 @@ u2005-05-20 Sergey Poznyakoff * src/rmt.c: Likewise * src/rtapelib.c: Likewise * src/strerror.c: Likewise - + * src/copyin.c: Switched to ANSI C (sigh) * src/copyout.c: Likewise * src/copypass.c: Likewise @@ -610,7 +610,7 @@ u2005-05-20 Sergey Poznyakoff * lib/mkdir.c: Likewise. * lib/strdup.c: Likewise. * lib/strerror.c: Likewise. - + 2004-08-30 Sergey Poznyakoff * Makefile.am: Added headers to SUBDIRS. @@ -642,7 +642,7 @@ u2005-05-20 Sergey Poznyakoff * headers/argp.h: New file * headers/fnmatch.h: New file * headers/.cvsignore: New file - + 2004-03-02 Sergey Poznyakoff * src/util.c (copy_files_disk_to_disk): Bugfix. If a file @@ -654,19 +654,19 @@ u2005-05-20 Sergey Poznyakoff 2004-02-27 Sergey Poznyakoff * src/makepath.c: Remove unneded typedefs - + * src/copyin.c: Remove __MSDOS__ conditionals * src/copyout.c: Likewise * src/copypass.c: Likewise * src/main.c: Likewise * src/tar.c: Likewise * src/util.c: Likewise - + 2004-02-27 Sergey Poznyakoff - + Changed from flat to deep package layout. Added the framework for NLS support. - + * .cvsignore: Updated * Makefile.am: Updated * configure.ac: Updated @@ -675,7 +675,7 @@ u2005-05-20 Sergey Poznyakoff * THANKS: Updated * autogen.sh: New file - + * alloca.c: Moved to src * argmatch.c: Likewise * bcopy.c: Likewise @@ -786,7 +786,7 @@ u2005-05-20 Sergey Poznyakoff * po/LINGUAS: New file * po/Makevars: New file * po/POTFILES.in: New file - + 2003-11-28 Sergey Poznyakoff * configure.ac: Added various checks @@ -805,7 +805,7 @@ u2005-05-20 Sergey Poznyakoff * mt.c: Likewise * util.c: Likewise * rtapelib.c: Likewise - + 2003-11-28 Sergey Poznyakoff * TODO: New file @@ -816,7 +816,7 @@ u2005-05-20 Sergey Poznyakoff * main.c (main): Call setlocale. Thanks Mitsuru Chinen for the patch. * THANKS: Updated - + 2003-11-21 Sergey Poznyakoff * configure.ac: Added to the repository @@ -825,12 +825,12 @@ u2005-05-20 Sergey Poznyakoff * README: Likewise * AUTHORS: Likewise * .cvsignore: Likewise - + * configure.in: Removed * Makefile.in: Removed * makefile.pc: Removed * configure: Removed - + * alloca.c: Added to the repository * argmatch.c: Likewise * bcopy.c: Likewise @@ -861,7 +861,7 @@ u2005-05-20 Sergey Poznyakoff * tarhdr.h: Likewise * xmalloc.c: Likewise * xstrdup.c: Likewise - + * makepath.c: Updated * mt.c: Likewise. * rmt.c: Likewise. @@ -871,7 +871,7 @@ u2005-05-20 Sergey Poznyakoff * copypass.c: Likewise. * global.c: Likewise. * main.c: Likewise. - + Thu Jun 13 20:14:48 2002 John Oleynick (juo@gnu.org) * copyin.c: Strip leading / on absolute filenames after comparing to the list of files specified on the command line @@ -887,7 +887,7 @@ Sun Jan 13 18:45:02 2002 John Oleynick (juo@gnu.org) * copyin.c: Fixed a problem skipping files with multiple links in a newc or CRC format archive. If the file with the shared copy of the data was skipped, but other links were not skipped, the - other links were created as empty files. Bug reported by + other links were created as empty files. Bug reported by Hendrik-Jan Thomassen. Thu Dec 6 20:05:10 2001 John Oleynick (juo@gnu.org) @@ -914,7 +914,7 @@ Tue Jan 9 23:19:37 1996 John Oleynick (juo@wombat.gnu.ai.mit.edu) Mon Jan 8 16:49:01 1996 John Oleynick (juo@wombat.gnu.ai.mit.edu) * copyout.c, copypass.c: Use result of readlink() as length - of link name instead of size from lstat(). On some OS's lstat() + of link name instead of size from lstat(). On some OS's lstat() doesn't return the true length in size. Bug reported by Robert Joop (rj@rainbow.IN-berlin.DE). @@ -989,7 +989,7 @@ Thu Sep 29 11:21:31 1994 John Oleynick (juo@wombat.gnu.ai.mit.edu) * mt.c: Need to open tape WR_ONLY for erase command (and probably others?). Reported by robert@hst.e.technik.uni-kl.de (Robert Vogelgesan). Accept `eject' as a synonym for `offline'. Accept - `-t' as a synonym for `-f' (to be compatible with HPUX mt, which + `-t' as a synonym for `-f' (to be compatible with HPUX mt, which only accepts `-t'). Wed Sep 28 12:01:55 1994 John Oleynick (juo@wombat.gnu.ai.mit.edu) @@ -1004,12 +1004,12 @@ Wed Aug 24 12:55:38 1994 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) with equivalent code, since those macros are going away. Sun Feb 13 00:56:48 1994 John Oleynick (juo@goldman.gnu.ai.mit.edu) - * extern.h, global.c, main.c, util.c: Added code to - tape_buffered_peek() to properly handle large, corrutped + * extern.h, global.c, main.c, util.c: Added code to + tape_buffered_peek() to properly handle large, corrutped archives, without overrunning the allocated buffer and - dumping core. Also changed the way the input and output + dumping core. Also changed the way the input and output buffers are allocated in initialize_buffers(). - + Tue Jan 25 01:04:32 1994 John Oleynick (juo@goldman.gnu.ai.mit.edu) * copyin.c, copyout.c, copypass.c, extern.h, main.c, tar.c, util.c: Redid i/o buffer code. Previously, the same routines buffered input and @@ -1042,13 +1042,13 @@ Tue Jan 25 01:04:32 1994 John Oleynick (juo@goldman.gnu.ai.mit.edu) writing sparse files. Tue Dec 28 23:01:36 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu) - * util.c, system.h, makepath.c, extern.h: don't define chown() + * util.c, system.h, makepath.c, extern.h: don't define chown() and don't typedef uid_t and gid_t if we are being compiled by DJGPP. * copyin.c, extern.h, global.c, main.c: Added support for --rename-batch-file. - + * copyin.c, copyout.c, extern.h: Cleaned up to pass gcc -Wall. Wed Dec 22 02:17:44 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu) @@ -1062,10 +1062,10 @@ Wed Dec 22 02:17:44 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu) * mt.c: Added "eject" as a synonym for "offline". * util.c: Slight modification to when we lseek with - BROKEN_LONG_TAPE_DRIVER (do it every 1Gb, instead + BROKEN_LONG_TAPE_DRIVER (do it every 1Gb, instead of every 2Gb). - * copyin.c, global.c, extern.h: Added --no-absolute-paths option, + * copyin.c, global.c, extern.h: Added --no-absolute-paths option, to ignore absolute paths in archives. Tue Dec 21 01:30:59 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu) @@ -1088,7 +1088,7 @@ Mon Jul 19 23:01:00 1993 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) Thu Jul 8 19:43:39 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) * Makefile.in: Add rules for remaking Makefile, configure, - config.status. + config.status. Mon Jul 5 14:54:08 1993 John Oleynick (juo@spiff.gnu.ai.mit.edu) @@ -1125,8 +1125,8 @@ Wed Apr 28 10:36:53 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu) * util.c: Added code to try and work around broken tape drivers that have problems with tapes > 2Gb. - * copyout.c (process_copy_out): Pass file_hdr to - writeout_other_defers() and add_link_defer() by reference, + * copyout.c (process_copy_out): Pass file_hdr to + writeout_other_defers() and add_link_defer() by reference, not by value. * copyin.c (process_copy_in): Pass file_hdr to defer_copyin() @@ -1136,7 +1136,7 @@ Wed Apr 28 10:36:53 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu) Fri Apr 16 18:01:17 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu) - * mt.c, util.c: Include if HAVE_SYS_MTIO_H is + * mt.c, util.c: Include if HAVE_SYS_MTIO_H is defined, not HAVE_MTIO_H. Wed Apr 14 17:37:46 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu) @@ -1180,7 +1180,7 @@ Mon Mar 29 17:04:06 1993 John Oleynick (juo@hal.gnu.ai.mit.edu) symlink(). * copyout.c: fixes to properly handle multiple links in newc - and crc format archives (new routines last_link(), + and crc format archives (new routines last_link(), count_defered_links_to_dev_ino(), add_link_defer(), writeout_other_defers(), writeout_final_defers(), writeout_defered_file()); support for new arf_hpbinary and @@ -1205,7 +1205,7 @@ Mon Mar 29 17:04:06 1993 John Oleynick (juo@hal.gnu.ai.mit.edu) * system.h: new macro UMASKED_SYMLINK - * tar.c: minor changes to read (slightly broken?) System V.4 posix + * tar.c: minor changes to read (slightly broken?) System V.4 posix tar archives and HPUX posix tar archives. * util.c: HPUX CDF support (including new routines @@ -1503,13 +1503,13 @@ Tue Jun 11 16:40:02 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu) Makefile from Makefile.in. * copyin.c (process_copy_in): Use POSIX.2 fnmatch instead of - glob_match. + glob_match. Mon Jun 10 22:11:19 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu) * global.c, extern.h: New variable, name_end. * main.c (process_args, usage): Add -0 +null option to set it. - * copypass.c (process_copy_pass), copyout.c (process_copy_out): + * copypass.c (process_copy_pass), copyout.c (process_copy_out): Use it. * dstring.c (ds_fgetstr): New function made from ds_fgets. @@ -1605,7 +1605,7 @@ Sat Jul 7 14:48:35 1990 David J. MacKenzie (dave at edfmd) High short-word of `mtime' and `filesize' always comes first. * (read_in_ascii, read_in_binary): New functions, from code in - read_in_header. + read_in_header. (read_in_header): Search for valid magic number, then fill in rest of header using read_in_ascii and read_in_binary. * global.c, extern.h: New variable, `binary_flag'. @@ -1619,7 +1619,7 @@ Wed Jul 4 00:40:58 1990 David J. MacKenzie (djm at apple-gunkies) * copyin.c (process_copy_in), util.c (toss_input, create_all_directories, add_inode): Don't use `index' as a - variable name. + variable name. Tue Jul 3 02:33:36 1990 David J. MacKenzie (djm at apple-gunkies) @@ -1665,7 +1665,7 @@ Mon Jul 2 03:57:41 1990 David J. MacKenzie (dave at edfmd) copypass.c (process_copy_pass): Set `output_is_seekable' correctly and call finish_output_file. * main.c (initialize_buffers): Allocate space for sentinel in - `output_buffer'. + `output_buffer'. * global.c, extern.h: New variable `numeric_uid'. * main.c (process_args): Accept -n +numeric-uid-gid option, like ls. @@ -1687,10 +1687,10 @@ Sat Jun 30 12:44:47 1990 David J. MacKenzie (dave at edfmd) * global.c, extern.h, copyin.c, copyout.c, util.c: Rename `{input,output}_is_regular' to `{input,output}_is_special' and - reverse the truth value. + reverse the truth value. * global.c, extern.h: New variable `input_is_seekable' to - control whether to skip data with lseek or read. + control whether to skip data with lseek or read. * copyin.c (process_copy_in): Set it. * util.c (toss_input): Use it. @@ -1705,7 +1705,7 @@ Sat Jun 30 12:44:47 1990 David J. MacKenzie (dave at edfmd) Sat Jun 30 01:53:12 1990 David J. MacKenzie (dave at edfmd) * dstring.c (ds_init): Return void because return value was - never used. + never used. (ds_resize): Ditto, and free old value instead of new one. * util.c (empty_output_buffer, fill_input_buffer, @@ -1738,10 +1738,10 @@ Thu Jun 28 16:07:15 1990 David J. MacKenzie (dave at edfmd) Sat Jun 23 22:50:45 1990 David J. MacKenzie (dave at edfmd) * main.c (main): Set umask to 0 so permissions of created - files are preserved. + files are preserved. * copyin.c, copyout.c, copypass.c, util.c: Pass file - descriptors as ints, not pointers to ints. + descriptors as ints, not pointers to ints. Cast file timestamps and sizes to long *, not int *, for 16 bit machines. Use lstat instead of stat, if available. @@ -1777,7 +1777,7 @@ Thu May 31 20:51:43 1990 David J. MacKenzie (djm at albert.ai.mit.edu) Sat Apr 14 02:31:01 1990 David J. MacKenzie (djm at albert.ai.mit.edu) * cpio.h (struct cpio_header): Make inode, mode, uid, gid - fields unsigned. + fields unsigned. * util.c (getgroup): New function. * copyin.c (long_format): Print group name of files. @@ -1793,7 +1793,7 @@ Sat Apr 14 02:31:01 1990 David J. MacKenzie (djm at albert.ai.mit.edu) * copyin.c (process_copy_in), copypass.c (process_copy_pass): Don't complain in chown fails because the user doesn't have - permission. + permission. Fri Apr 13 13:53:20 1990 David J. MacKenzie (djm at albert.ai.mit.edu) @@ -1862,7 +1862,7 @@ Sat Dec 2 13:22:37 1989 David J. MacKenzie (djm at hobbes.ai.mit.edu) * main.c: Change +copy-pass option to +pass, +copy-in to +in, +copy-out to +out, and +mkdir to +make-directories, and add null option to terminate table. - (process_args): Use the same code to handle long and short named + (process_args): Use the same code to handle long and short named options. (usage): Mention long options in message. diff --git a/NEWS b/NEWS index 2c7ad06..1a2a0da 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -GNU cpio NEWS -- history of user-visible changes. 2021-01-08 +GNU cpio NEWS -- history of user-visible changes. 2022-01-28 Copyright (C) 2003-2007, 2009-2010, 2014-2015, 2017, 2020-2022 Free Software Foundation, Inc. See the end of file for copying conditions. @@ -27,7 +27,7 @@ number. Renumber inodes when storing them in the archive. ** --device-independent or --reproducible -Create reproducible archives. This is equivalent to +Create reproducible archives. This is equivalent to --ignore-devno --renumber-inodes. Version 2.11 - Sergey Poznyakoff, 2010-03-10 @@ -109,7 +109,7 @@ default. See below. * New option --to-stdout extracts files to standard output. * The output of `cpio --help' is largely improved. - + * Bugfixes: ** If a file grew n bytes in copy-pass mode, these n bytes got prepended to the contents of all subsequent files. @@ -135,7 +135,7 @@ Major changes in version 2.3: * in newc and crc format archives, only store 1 copy of multiply linked files * handle multiply linked devices properly -* handle multiply linked files with cpio -pl even when the source and +* handle multiply linked files with cpio -pl even when the source and destination are on different file systems * support HPUX Context Dependent Files * read and write HPUX cpio archives diff --git a/README-alpha b/README-alpha index 13232bd..4b9dd38 100644 --- a/README-alpha +++ b/README-alpha @@ -67,6 +67,3 @@ mode: outline paragraph-separate: "[ ]*$" version-control: never End: - - - diff --git a/README-hacking b/README-hacking index 2636355..19669b1 100644 --- a/README-hacking +++ b/README-hacking @@ -6,7 +6,7 @@ this package. You need the following packages to build the Git version of GNU cpio. We do not make any efforts to accommodate older versions of these packages, so please make sure that you have the latest stable -version. +version. - Automake - Autoconf @@ -18,7 +18,7 @@ version. Obviously, if you are reading these notes, you did manage to clone cpio from Git. The next step is to get other files needed to build, -which are extracted from other source packages: +which are extracted from other source packages: 1. Change to the source tree directory @@ -26,7 +26,7 @@ which are extracted from other source packages: 2. Run - ./bootstrap + ./bootstrap Once done, proceed as described in the file README (section INSTALLATION). @@ -58,5 +58,3 @@ mode: outline paragraph-separate: "[ ^L]*$" version-control: never End: - - diff --git a/TODO b/TODO index a483a3b..0c16a8b 100644 --- a/TODO +++ b/TODO @@ -15,8 +15,8 @@ into two parts, the messages are in somehow arbitrary order. patch, please verify the problem and the patch-code. I'm not sure, if the pr /archive/html/bug-gnu-utils/2002-08/msg00122.html (4,518 bytes) - -** These two seem to be related: + +** These two seem to be related: *** cpio copy-in and multiply-linked files (score: 35) Author: Chris Jaeger Date: Tue, 07 Aug 2001 23:46:04 -0700 @@ -25,7 +25,7 @@ into two parts, the messages are in somehow arbitrary order. of files all of size 0 if the last linked file is not copied in due to th /archive/html/bug-gnu-utils/2001-08/msg00074.html (4,142 bytes) - + *** (no subject) (score: 2) Author: brian@debian.org (Brian Mays) Date: Sat, 07 Jul 2001 16:35:13 -0400 @@ -34,7 +34,7 @@ into two parts, the messages are in somehow arbitrary order. all archived as hard links to each other in the archive. When the same set of fil /archive/html/bug-gnu-utils/2001-07/msg00080.html (5,666 bytes) - + ** These too: *** Re: minor problems with slackware-current (score: 7) @@ -43,7 +43,7 @@ into two parts, the messages are in somehow arbitrary order. "cpio --sparse" corrupts data. A fix attached. C.S. Attachment: cpio-2.4.2-sparse.diff Description: Text document /archive/html/bug-gnu-utils/2001-08/msg00000.html (3,989 bytes) - + *** cpio --sparse (score: 34) Author: Cezary Sliwa Date: Mon, 26 Mar 2001 10:43:34 +0200 (CEST) @@ -60,7 +60,7 @@ into two parts, the messages are in somehow arbitrary order. archived, it and all files following it in the archive are corrupted. The crc do /archive/html/bug-gnu-utils/2001-02/msg00062.html (4,297 bytes) - + *** cpio pass-through can corrupt files (score: 36) Author: "Parrott, Jeff" Date: Mon, 16 Oct 2000 13:32:57 -0400 @@ -69,7 +69,7 @@ into two parts, the messages are in somehow arbitrary order. active/in-use (and growing) files are being copied. The problem is that the file size has /archive/html/bug-gnu-utils/2000-10/msg00087.html (4,974 bytes) - + ** cpio 2.4.2 unconditionally takes the tape drive offline (score: 39) Author: Scott Larson @@ -79,7 +79,7 @@ into two parts, the messages are in somehow arbitrary order. support this since it takes the tape offline (i.e. ejects the tape) after rea /archive/html/bug-gnu-utils/2001-01/msg00087.html (4,264 bytes) - + ** cpio -t can see international filenames, find -ls also suffers (score: 35) Author: "Dan Jacobson" @@ -89,7 +89,7 @@ into two parts, the messages are in somehow arbitrary order. happens with find . -print vs. find . -ls -- http://www.geocities.com/jidanni /archive/html/bug-gnu-utils/2000-12/msg00143.html (4,084 bytes) - + * Suggestions ------------- @@ -101,7 +101,7 @@ into two parts, the messages are in somehow arbitrary order. is started automatically in the middle of the night. To chase away all users we d /archive/html/bug-gnu-utils/2001-12/msg00244.html (7,474 bytes) - + ** cpio suggestion + patch (score: 38) Author: Taylor Gautier Date: Fri, 20 Apr 2001 09:40:05 -0700 @@ -111,7 +111,7 @@ into two parts, the messages are in somehow arbitrary order. gaurantee atomicity /archive/html/bug-gnu-utils/2001-04/msg00169.html (10,674 bytes) - + ** [cpio] man page enhancement: a Example section ? (score: 5) Author: Yannick Patois Date: Wed, 24 Oct 2001 12:48:33 +0200 (CEST) @@ -129,4 +129,3 @@ into two parts, the messages are in somehow arbitrary order. through a tape or simply for debuging. The patch along with a Debian packag /archive/html/bug-gnu-utils/2001-10/msg00083.html (4,548 bytes) - diff --git a/am/ax_compile_check_rettype.m4 b/am/ax_compile_check_rettype.m4 index 0e22b69..1771d36 100644 --- a/am/ax_compile_check_rettype.m4 +++ b/am/ax_compile_check_rettype.m4 @@ -68,7 +68,7 @@ changequote([, ])dnl AC_MSG_CHECKING(return type of $1()) AC_CACHE_VAL(AC_CV_NAME, [for ac_type in char short int long "long long" $4 - do + do AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include $3 diff --git a/am/pack.m4 b/am/pack.m4 index c03c948..6a83438 100644 --- a/am/pack.m4 +++ b/am/pack.m4 @@ -31,7 +31,7 @@ AC_DEFUN([CPIO_PACKED_STRUCTS],[ AC_CACHE_VAL(cpio_cv_have_pragma_pack,[ AC_TRY_RUN(CPIO_FLUSHLEFT([ int main(int argc, char **argv) { - #pragma pack(1) + #pragma pack(1) struct { char c; long l; } s; return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ]), [have_pragma_pack=yes], diff --git a/doc/Makefile.am b/doc/Makefile.am index 718e684..6fb5d1f 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -32,7 +32,7 @@ EXTRA_DIST = gendocs.sh gendocs_template mt.1 rmt.8 GENDOCS=$(srcdir)/gendocs.sh TEXI2DVI=texi2dvi -E -# Make sure you set TEXINPUT +# Make sure you set TEXINPUT manual: rm -rf manual TEXINPUTS=$(srcdir):$(top_srcdir)/scripts:$$TEXINPUTS \ diff --git a/doc/cpio.1 b/doc/cpio.1 index eda3a0f..b3d77ef 100644 --- a/doc/cpio.1 +++ b/doc/cpio.1 @@ -13,7 +13,7 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with GNU cpio. If not, see . -.TH CPIO 1 "September 18, 2020" "CPIO" "GNU CPIO" +.TH CPIO 1 "January 28, 2022" "CPIO" "GNU CPIO" .SH NAME cpio \- copy files to and from archives .SH SYNOPSIS @@ -108,7 +108,7 @@ supplied with the \fB\-\-file\fR option) and extract files from it, or (if the \fB\-t\fR option is given) list its contents to the standard output. If one or more \fIpattern\fRs are supplied, read or list only files matching these patterns. The \fB\-t\fR option alone implies -\fB\-i\fR. +\fB\-i\fR. .TP .BR \-p ", " \-\-pass\-through Pass-through. Read a list of file names from the standard input and @@ -229,7 +229,7 @@ Print \fISTRING\fR when the end of a volume of the backup media is reached. .TP .BR \-b ", " \-\-swap Swap both halfwords of words and bytes of halfwords in the data. -Equivalent to \fB\-sS\fR. +Equivalent to \fB\-sS\fR. .TP .BR \-f ", " \-\-nonmatching Only copy files that do not match any of the given patterns. @@ -300,7 +300,7 @@ newlines. .TP .BR \-a ", " \-\-reset\-access\-time Reset the access times of files after reading them. -.TP +.TP \fB\-I\fR [[\fIUSER\fB@\fR]\fIHOST\fB:\fR]\fIARCHIVE-NAME\fR Use \fIARCHIVE-NAME\fR instead of standard input. Optional \fIUSER\fR and \fIHOST\fR specify the user and host names in case of a remote @@ -353,4 +353,3 @@ There is NO WARRANTY, to the extent permitted by law. .\" time-stamp-end: "\"" .\" time-stamp-line-limit: 20 .\" end: - diff --git a/doc/cpio.texi b/doc/cpio.texi index 8293ef7..a35770e 100644 --- a/doc/cpio.texi +++ b/doc/cpio.texi @@ -61,7 +61,7 @@ documentation and is consistent with @value{VERSION}. @end ifnottex @menu -* Introduction:: +* Introduction:: * Tutorial:: Getting started. * Invoking cpio:: How to invoke @command{cpio}. * Media:: Using tapes and other archive media. @@ -73,10 +73,10 @@ documentation and is consistent with @value{VERSION}. Invoking cpio -* Copy-out mode:: -* Copy-in mode:: -* Copy-pass mode:: -* Options:: +* Copy-out mode:: +* Copy-in mode:: +* Copy-pass mode:: +* Options:: @end detailmenu @end menu @@ -220,10 +220,10 @@ the directory @file{new-dir}. @cindex command line options @menu -* Copy-out mode:: -* Copy-in mode:: -* Copy-pass mode:: -* Options:: +* Copy-out mode:: +* Copy-in mode:: +* Copy-pass mode:: +* Options:: @end menu @node Copy-out mode @@ -698,7 +698,7 @@ to automatically detect the archive format, and in copy-out mode is @samp{bin}. @table @samp -@item bin +@item bin The obsolete binary format. (2147483647 bytes) @item odc @@ -768,7 +768,7 @@ current volume number (starting at 1). @item -n @itemx --numeric-uid-gid -[@ref{copy-in}] +[@ref{copy-in}] @*Show numeric UID and GID instead of translating them into names when using the @option{--verbose} option. @@ -824,7 +824,7 @@ Run in copy-pass mode. @*In copy-in and copy-pass mode, set the ownership of all files created to the specified @var{owner} (this operation is allowed only for the super-user). In copy-out mode, store the supplied owner information in -the archive. +the archive. The argument can be either the user name or the user name and group name, separated by a dot or a colon, or the group name, @@ -859,7 +859,7 @@ cpio --owner :+0 @noindent If the group is omitted but the @samp{:} or @samp{.} separator is given, as in the second example. the given user's login group will be -used. +used. @item --rsh-command=@var{command} [@ref{copy-in},@ref{copy-out},@ref{copy-pass}] @@ -968,7 +968,7 @@ information when reporting a bug. The information needed is: @item Version of the package you are using. @item Compilation options used when configuring the package. @item Conditions under which the bug appears. -@end itemize +@end itemize Send your report to @email{bug-cpio@@gnu.org}. This is a public mailing list; all correspondence sent to it is archived and is available at diff --git a/doc/mt.1 b/doc/mt.1 index f44c76e..a837005 100644 --- a/doc/mt.1 +++ b/doc/mt.1 @@ -13,7 +13,7 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with GNU cpio. If not, see . -.TH MT 1 "January 28, 2014" "MT" "GNU CPIO" +.TH MT 1 "January 28, 2022" "MT" "GNU CPIO" .SH NAME mt \- control magnetic tape drive operation .SH SYNOPSIS @@ -57,70 +57,70 @@ after the operation name and defaults to 1. Write .I count EOF marks at current position. -.TP +.TP .B fsf Forward space .I count files. The tape is positioned on the first block of the next file. -.TP +.TP .B bsf Backward space .I count files. The tape is positioned on the first block of the next file. -.TP +.TP .B fsr Forward space .I count records. -.TP +.TP .B bsr Backward space .I count records. -.TP +.TP .B bsfm Backward space .I count file marks. The tape is positioned on the beginning-of-the-tape side of the file mark. -.TP +.TP .B fsfm Forward space .I count file marks. The tape is positioned on the beginning-of-the-tape side of the file mark. -.TP +.TP .B asf Absolute space to file number .IR count . Equivalent to rewind followed by fsf .IR count . -.TP +.TP .B seek Seek to block number .IR count . -.TP +.TP .B eom Space to the end of the recorded media on the tape (for appending files onto tapes). -.TP +.TP .B rewind Rewind the tape. -.TP +.TP .BR offline ", " rewoffl Rewind the tape and, if applicable, unload the tape. -.TP +.TP .B status Print status information about the tape unit. -.TP +.TP .B retension Rewind the tape, then wind it to the end of the reel, then rewind it again. -.TP +.TP .B erase Erase the tape. .PP @@ -172,4 +172,3 @@ There is NO WARRANTY, to the extent permitted by law. .\" time-stamp-end: "\"" .\" time-stamp-line-limit: 20 .\" end: - diff --git a/lib/Makefile.am b/lib/Makefile.am index 31b8faf..28a5490 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -26,7 +26,7 @@ rmt-command.h : Makefile $(AM_V_at)mv $@-t $@ BUILT_SOURCES = rmt-command.h CLEANFILES = rmt-command.h rmt-command.h-t -AM_CPPFLAGS = -I$(top_srcdir)/gnu -I../ -I../gnu +AM_CPPFLAGS = -I$(top_srcdir)/gnu -I../ -I../gnu noinst_HEADERS = system.h system-ioctl.h rmt.h paxlib.h libpax_a_SOURCES = \ diff --git a/po/POTFILES.in b/po/POTFILES.in index 54ae568..8509826 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -46,5 +46,3 @@ src/userspec.c src/util.c tests/genfile.c - - diff --git a/src/Makefile.am b/src/Makefile.am index 4a2bd1e..30eba8b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -54,4 +54,3 @@ noinst_HEADERS =\ safe-stat.h LDADD=../lib/libpax.a ../gnu/libgnu.a @INTLLIBS@ - diff --git a/src/copyin.c b/src/copyin.c index 7ad797a..fb30cf6 100644 --- a/src/copyin.c +++ b/src/copyin.c @@ -109,7 +109,7 @@ static char * get_link_name (struct cpio_file_stat *file_hdr, int in_file_des) { char *link_name; - + if (file_hdr->c_filesize < 0 || file_hdr->c_filesize > SIZE_MAX-1) { error (0, 0, _("%s: stored filename length is out of range"), @@ -204,7 +204,7 @@ try_existing_file (struct cpio_file_stat* file_hdr, int in_file_des, tape_skip_padding (in_file_des, file_hdr->c_filesize); return -1; /* Go to the next file. */ } - else if (S_ISDIR (file_stat.st_mode) + else if (S_ISDIR (file_stat.st_mode) ? rmdir (file_hdr->c_name) : unlink (file_hdr->c_name)) { @@ -218,10 +218,10 @@ try_existing_file (struct cpio_file_stat* file_hdr, int in_file_des, return 0; } -/* The newc and crc formats store multiply linked copies of the same file - in the archive only once. The actual data is attached to the last link - in the archive, and the other links all have a filesize of 0. When a - file in the archive has multiple links and a filesize of 0, its data is +/* The newc and crc formats store multiply linked copies of the same file + in the archive only once. The actual data is attached to the last link + in the archive, and the other links all have a filesize of 0. When a + file in the archive has multiple links and a filesize of 0, its data is probably "attatched" to another file in the archive, so we can't create it right away. We have to "defer" creating it until we have created the file that has the data "attatched" to it. We keep a list of the @@ -357,7 +357,7 @@ create_final_defers () /* Debian hack: This was reported by Horst Knobloch. This bug has been reported to "bug-gnu-utils@prep.ai.mit.edu". (99/1/6) -BEM */ - link_res = link_to_maj_min_ino (d->header.c_name, + link_res = link_to_maj_min_ino (d->header.c_name, d->header.c_dev_maj, d->header.c_dev_min, d->header.c_ino); if (link_res == 0) @@ -429,7 +429,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des) the archive was created and later appeneded to). */ /* Debian hack: (97/1/2) This was reported by Ronald F. Guilmette to the upstream maintainers. -BEM */ - link_res = link_to_maj_min_ino (file_hdr->c_name, + link_res = link_to_maj_min_ino (file_hdr->c_name, file_hdr->c_dev_maj, file_hdr->c_dev_min, file_hdr->c_ino); if (link_res == 0) @@ -446,7 +446,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des) int link_res; /* Debian hack: (97/1/2) This was reported by Ronald F. Guilmette to the upstream maintainers. -BEM */ - link_res = link_to_maj_min_ino (file_hdr->c_name, + link_res = link_to_maj_min_ino (file_hdr->c_name, file_hdr->c_dev_maj, file_hdr->c_dev_min, file_hdr->c_ino); @@ -470,11 +470,11 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des) } return; } - + /* If not linked, copy the contents of the file. */ out_file_des = open (file_hdr->c_name, O_CREAT | O_WRONLY | O_BINARY, 0600); - + if (out_file_des < 0 && create_dir_flag) { create_all_directories (file_hdr->c_name); @@ -482,7 +482,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des) O_CREAT | O_WRONLY | O_BINARY, 0600); } - + if (out_file_des < 0) { open_error (file_hdr->c_name); @@ -491,7 +491,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des) return; } } - + crc = 0; if (swap_halfwords_flag) { @@ -511,7 +511,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des) } copy_files_tape_to_disk (in_file_des, out_file_des, file_hdr->c_filesize); disk_empty_output_buffer (out_file_des, true); - + if (to_stdout_option) { if (archive_format == arf_crcascii) @@ -523,7 +523,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des) tape_skip_padding (in_file_des, file_hdr->c_filesize); return; } - + set_perms (out_file_des, file_hdr); if (close (out_file_des) < 0) @@ -540,8 +540,8 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des) if (file_hdr->c_nlink > 1 && (archive_format == arf_newascii || archive_format == arf_crcascii) ) { - /* (see comment above for how the newc and crc formats - store multiple links). Now that we have the data + /* (see comment above for how the newc and crc formats + store multiple links). Now that we have the data for this file, create any other links to it which we defered. */ create_defered_links (file_hdr); @@ -563,7 +563,7 @@ copyin_device (struct cpio_file_stat* file_hdr) /* Debian hack: This was reported by Horst Knobloch. This bug has been reported to "bug-gnu-utils@prep.ai.mit.edu". (99/1/6) -BEM */ - link_res = link_to_maj_min_ino (file_hdr->c_name, + link_res = link_to_maj_min_ino (file_hdr->c_name, file_hdr->c_dev_maj, file_hdr->c_dev_min, file_hdr->c_ino); if (link_res == 0) @@ -572,7 +572,7 @@ copyin_device (struct cpio_file_stat* file_hdr) } } else if (archive_format == arf_ustar && - file_hdr->c_tar_linkname && + file_hdr->c_tar_linkname && file_hdr->c_tar_linkname [0] != '\0') { int link_res; @@ -591,7 +591,7 @@ copyin_device (struct cpio_file_stat* file_hdr) } return; } - + res = mknod (file_hdr->c_name, file_hdr->c_mode, makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min)); if (res < 0 && create_dir_flag) @@ -647,7 +647,7 @@ copyin_link (struct cpio_file_stat *file_hdr, int in_file_des) } cpio_safer_name_suffix (link_name, true, !no_abs_paths_flag, false); - + res = UMASKED_SYMLINK (link_name, file_hdr->c_name, file_hdr->c_mode); if (res < 0 && create_dir_flag) @@ -810,7 +810,7 @@ read_pattern_file (void) } ds_free (&pattern_name); - + if (ferror (pattern_fp) || fclose (pattern_fp) == EOF) close_error (pattern_file_name); @@ -842,14 +842,14 @@ from_ascii (char const *where, size_t digs, unsigned logbase) while (1) { unsigned d; - + char *p = strchr (codetab, toupper (*buf)); if (!p) { error (0, 0, _("Malformed number %.*s"), (int) digs, where); break; } - + d = p - codetab; if ((d >> logbase) > 1) { @@ -1224,13 +1224,13 @@ process_copy_in (void) newdir_umask = umask (0); /* Reset umask to preserve modes of created files */ - + /* Initialize the copy in. */ if (pattern_file_name) { read_pattern_file (); } - + if (rename_batch_file) { rename_in = fopen (rename_batch_file, "r"); @@ -1281,7 +1281,7 @@ process_copy_in (void) output_is_seekable = true; change_dir (); - + /* While there is more input in the collection, process the input. */ while (1) { @@ -1295,18 +1295,18 @@ process_copy_in (void) { struct cpio_file_stat *h; h = &file_hdr; - fprintf (stderr, + fprintf (stderr, "magic = 0%o, ino = %ld, mode = 0%o, uid = %d, gid = %d\n", h->c_magic, (long)h->c_ino, h->c_mode, h->c_uid, h->c_gid); - fprintf (stderr, + fprintf (stderr, "nlink = %d, mtime = %d, filesize = %d, dev_maj = 0x%x\n", h->c_nlink, h->c_mtime, h->c_filesize, h->c_dev_maj); - fprintf (stderr, + fprintf (stderr, "dev_min = 0x%x, rdev_maj = 0x%x, rdev_min = 0x%x, namesize = %d\n", h->c_dev_min, h->c_rdev_maj, h->c_rdev_min, h->c_namesize); - fprintf (stderr, + fprintf (stderr, "chksum = %d, name = \"%s\", tar_linkname = \"%s\"\n", - h->c_chksum, h->c_name, + h->c_chksum, h->c_name, h->c_tar_linkname ? h->c_tar_linkname : "(null)" ); } @@ -1321,7 +1321,7 @@ process_copy_in (void) cpio_safer_name_suffix (file_hdr.c_name, false, !no_abs_paths_flag, false); - + /* Does the file name match one of the given patterns? */ if (num_patterns <= 0) skip_file = false; @@ -1336,7 +1336,7 @@ process_copy_in (void) } } } - + if (skip_file) { /* If we're skipping a file with links, there might be other @@ -1429,7 +1429,7 @@ process_copy_in (void) apply_delayed_set_stat (); cpio_file_stat_free (&file_hdr); - + if (append_flag) return; @@ -1447,4 +1447,3 @@ process_copy_in (void) (unsigned long) blocks); } } - diff --git a/src/copyout.c b/src/copyout.c index a49ad4b..7a87c83 100644 --- a/src/copyout.c +++ b/src/copyout.c @@ -68,7 +68,7 @@ read_for_checksum (int in_file_des, int file_size, char *file_name) static void tape_clear_rest_of_block (int out_file_des) { - write_nuls_to_file (io_block_size - output_size, out_file_des, + write_nuls_to_file (io_block_size - output_size, out_file_des, tape_buffered_write); } @@ -238,7 +238,7 @@ writeout_defered_file (struct cpio_file_stat *header, int out_file_des) /* When writing newc and crc format archives we defer multiply linked files until we have seen all of the links to the file. If a file has links to it that aren't going into the archive, then we will - never see the "last" link to the file, so at the end we just write + never see the "last" link to the file, so at the end we just write all of the leftover defered files into the archive. */ static void @@ -311,7 +311,7 @@ to_ascii_or_warn (char *where, uintmax_t n, size_t digits, { if (to_ascii (where, n, digits, logbase, false)) field_width_warning (filename, fieldname); -} +} int to_ascii_or_error (char *where, uintmax_t n, size_t digits, @@ -324,7 +324,7 @@ to_ascii_or_error (char *where, uintmax_t n, size_t digits, return 1; } return 0; -} +} int @@ -385,7 +385,7 @@ write_out_new_ascii_header (const char *magic_string, tape_buffered_write (file_hdr->c_name, out_des, (long) file_hdr->c_namesize); tape_pad_output (out_des, file_hdr->c_namesize + sizeof ascii_header); return 0; -} +} int write_out_old_ascii_header (dev_t dev, dev_t rdev, @@ -393,7 +393,7 @@ write_out_old_ascii_header (dev_t dev, dev_t rdev, { char ascii_header[76]; char *p = ascii_header; - + to_ascii (p, file_hdr->c_magic, 6, LG_8, false); p += 6; to_ascii_or_warn (p, dev, 6, LG_8, file_hdr->c_name, _("device number")); @@ -474,23 +474,23 @@ write_out_binary_header (dev_t rdev, short_hdr.c_ino = file_hdr->c_ino & 0xFFFF; if (short_hdr.c_ino != file_hdr->c_ino) field_width_warning (file_hdr->c_name, _("inode number")); - + short_hdr.c_mode = file_hdr->c_mode & 0xFFFF; if (short_hdr.c_mode != file_hdr->c_mode) field_width_warning (file_hdr->c_name, _("file mode")); - + short_hdr.c_uid = file_hdr->c_uid & 0xFFFF; if (short_hdr.c_uid != file_hdr->c_uid) field_width_warning (file_hdr->c_name, _("uid")); - + short_hdr.c_gid = file_hdr->c_gid & 0xFFFF; if (short_hdr.c_gid != file_hdr->c_gid) field_width_warning (file_hdr->c_name, _("gid")); - + short_hdr.c_nlink = file_hdr->c_nlink & 0xFFFF; if (short_hdr.c_nlink != file_hdr->c_nlink) field_width_warning (file_hdr->c_name, _("number of links")); - + short_hdr.c_rdev = rdev; short_hdr.c_mtimes[0] = file_hdr->c_mtime >> 16; short_hdr.c_mtimes[1] = file_hdr->c_mtime & 0xFFFF; @@ -504,7 +504,7 @@ write_out_binary_header (dev_t rdev, STRINGIFY_BIGINT (file_hdr->c_namesize, maxbuf), 0xFFFFu); return 1; } - + short_hdr.c_filesizes[0] = file_hdr->c_filesize >> 16; short_hdr.c_filesizes[1] = file_hdr->c_filesize & 0xFFFF; @@ -517,7 +517,7 @@ write_out_binary_header (dev_t rdev, STRINGIFY_BIGINT (file_hdr->c_namesize, maxbuf), 0xFFFFFFFFlu); return 1; } - + /* Output the file header. */ tape_buffered_write ((char *) &short_hdr, out_des, 26); @@ -532,31 +532,31 @@ write_out_binary_header (dev_t rdev, /* Write out header FILE_HDR, including the file name, to file descriptor OUT_DES. */ -int +int write_out_header (struct cpio_file_stat *file_hdr, int out_des) { dev_t dev; dev_t rdev; - + switch (archive_format) { case arf_newascii: return write_out_new_ascii_header ("070701", file_hdr, out_des); - + case arf_crcascii: return write_out_new_ascii_header ("070702", file_hdr, out_des); - + case arf_oldascii: return write_out_old_ascii_header (makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min), makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min), file_hdr, out_des); - + case arf_hpoldascii: hp_compute_dev (file_hdr, &dev, &rdev); return write_out_old_ascii_header (dev, rdev, file_hdr, out_des); - + case arf_tar: case arf_ustar: if (is_tar_filename_too_long (file_hdr->c_name)) @@ -628,7 +628,7 @@ process_copy_out (void) } change_dir (); - + if (append_flag) { process_copy_in (); @@ -652,7 +652,7 @@ process_copy_out (void) { /* Set values in output header. */ stat_to_cpio (&file_hdr, &file_stat); - + if (archive_format == arf_tar || archive_format == arf_ustar) { if (file_hdr.c_mode & CP_IFDIR) @@ -662,7 +662,7 @@ process_copy_out (void) ds_append (&input_name, '/'); } } - + assign_string (&orig_file_name, input_name.ds_string); cpio_safer_name_suffix (input_name.ds_string, false, !no_abs_paths_flag, true); @@ -760,7 +760,7 @@ process_copy_out (void) file_hdr.c_dev_maj, file_hdr.c_dev_min))) { - /* This file is linked to another file already in the + /* This file is linked to another file already in the archive, so write it out as a hard link. */ file_hdr.c_mode = (file_stat.st_mode & 07777); file_hdr.c_mode |= CP_IFREG; @@ -769,7 +769,7 @@ process_copy_out (void) continue; break; } - add_inode (file_hdr.c_ino, orig_file_name, + add_inode (file_hdr.c_ino, orig_file_name, file_hdr.c_dev_maj, file_hdr.c_dev_min); } file_hdr.c_filesize = 0; @@ -826,7 +826,7 @@ process_copy_out (void) default: error (0, 0, _("%s: unknown file type"), orig_file_name); } - + if (verbose_flag) fprintf (stderr, "%s\n", orig_file_name); if (dot_flag) @@ -835,7 +835,7 @@ process_copy_out (void) } free (orig_file_name); - + writeout_final_defers(out_file_des); /* The collection is complete; append the trailer. */ file_hdr.c_ino = 0; @@ -872,5 +872,3 @@ process_copy_out (void) cpio_file_stat_free (&file_hdr); ds_free (&input_name); } - - diff --git a/src/copypass.c b/src/copypass.c index d24b857..87f04b3 100644 --- a/src/copypass.c +++ b/src/copypass.c @@ -67,12 +67,12 @@ process_copy_pass (void) created files */ /* Initialize the copy pass. */ - + dirname_len = strlen (directory_name); if (change_directory_option && !ISSLASH (directory_name[0])) { char *pwd = xgetcwd (); - + ds_concat (&output_name, pwd); ds_append (&output_name, '/'); } @@ -82,7 +82,7 @@ process_copy_pass (void) output_is_seekable = true; change_dir (); - + /* Copy files with names read from stdin. */ while (ds_fgetstr (stdin, &input_name, name_end) != NULL) { @@ -150,12 +150,12 @@ process_copy_pass (void) /* User said to link it if possible. Try and link to the original copy. If that fails we'll still try and link to a copy we've already made. */ - link_res = link_to_name (output_name.ds_string, + link_res = link_to_name (output_name.ds_string, input_name.ds_string); if ( (link_res < 0) && (in_file_stat.st_nlink > 1) ) - link_res = link_to_maj_min_ino (output_name.ds_string, - major (in_file_stat.st_dev), - minor (in_file_stat.st_dev), + link_res = link_to_maj_min_ino (output_name.ds_string, + major (in_file_stat.st_dev), + minor (in_file_stat.st_dev), in_file_stat.st_ino); /* If the file was not linked, copy contents of file. */ @@ -185,7 +185,7 @@ process_copy_pass (void) copy_files_disk_to_disk (in_file_des, out_file_des, in_file_stat.st_size, input_name.ds_string); disk_empty_output_buffer (out_file_des, true); - + set_copypass_perms (out_file_des, output_name.ds_string, &in_file_stat); @@ -199,7 +199,7 @@ process_copy_pass (void) output_name.ds_string, in_file_stat.st_atime, in_file_stat.st_mtime); - } + } if (close (in_file_des) < 0) close_error (input_name.ds_string); @@ -214,7 +214,7 @@ process_copy_pass (void) else if (S_ISDIR (in_file_stat.st_mode)) { struct cpio_file_stat file_stat; - + stat_to_cpio (&file_stat, &in_file_stat); file_stat.c_name = output_name.ds_string; cpio_create_dir (&file_stat, existing_dir); @@ -233,10 +233,10 @@ process_copy_pass (void) Set link_name to the original file name. */ if (link_flag) /* User said to link it if possible. */ - link_res = link_to_name (output_name.ds_string, + link_res = link_to_name (output_name.ds_string, input_name.ds_string); if ( (link_res < 0) && (in_file_stat.st_nlink > 1) ) - link_res = link_to_maj_min_ino (output_name.ds_string, + link_res = link_to_maj_min_ino (output_name.ds_string, major (in_file_stat.st_dev), minor (in_file_stat.st_dev), in_file_stat.st_ino); @@ -319,7 +319,7 @@ process_copy_pass (void) fputc ('\n', stderr); apply_delayed_set_stat (); - + if (!quiet_flag) { size_t blocks = (output_bytes + io_block_size - 1) / io_block_size; @@ -333,7 +333,7 @@ process_copy_pass (void) ds_free (&output_name); } -/* Try and create a hard link from FILE_NAME to another file +/* Try and create a hard link from FILE_NAME to another file with the given major/minor device number and inode. If no other file with the same major/minor/inode numbers is known, add this file to the list of known files and associated major/minor/inode numbers @@ -362,7 +362,7 @@ link_to_maj_min_ino (char *file_name, int st_dev_maj, int st_dev_min, } /* Try and create a hard link from LINK_NAME to LINK_TARGET. If - `create_dir_flag' is set, any non-existent (parent) directories + `create_dir_flag' is set, any non-existent (parent) directories needed by LINK_NAME will be created. If the link is successfully created and `verbose_flag' is set, print "LINK_TARGET linked to LINK_NAME\n". If the link can not be created and `link_flag' is set, print diff --git a/src/dstring.c b/src/dstring.c index 3ff844f..977c534 100644 --- a/src/dstring.c +++ b/src/dstring.c @@ -107,7 +107,7 @@ ds_append (dynamic_string *s, int c) s->ds_idx++; ds_resize (s, 0); s->ds_string[s->ds_idx] = 0; - } + } } void diff --git a/src/dstring.h b/src/dstring.h index 9ee19bc..0ece49a 100644 --- a/src/dstring.h +++ b/src/dstring.h @@ -47,4 +47,3 @@ void ds_concat (dynamic_string *s, char const *str); #define ds_len(s) ((s)->ds_idx) int ds_endswith (dynamic_string *s, int c); - diff --git a/src/extern.h b/src/extern.h index 46ca708..a83cb97 100644 --- a/src/extern.h +++ b/src/extern.h @@ -123,7 +123,7 @@ void field_width_error (const char *filename, const char *fieldname, /* copypass.c */ void process_copy_pass (void); -int link_to_maj_min_ino (char *file_name, int st_dev_maj, +int link_to_maj_min_ino (char *file_name, int st_dev_maj, int st_dev_min, ino_t st_ino); int link_to_name (char const *link_name, char const *link_target); @@ -185,7 +185,7 @@ void set_new_media_message (char *message); #ifdef HPUX_CDF char *add_cdf_double_slashes (char *filename); #endif -void write_nuls_to_file (off_t num_bytes, int out_des, +void write_nuls_to_file (off_t num_bytes, int out_des, void (*writer) (char *in_buf, int out_des, off_t num_bytes)); #define DISK_IO_BLOCK_SIZE 512 @@ -229,6 +229,5 @@ void delay_set_stat (char const *file_name, struct stat *st, mode_t invert_permissions); int repair_delayed_set_stat (struct cpio_file_stat *file_hdr); void apply_delayed_set_stat (void); - -int arf_stores_inode_p (enum archive_format arf); +int arf_stores_inode_p (enum archive_format arf); diff --git a/src/fatal.c b/src/fatal.c index a11bebf..74184bc 100644 --- a/src/fatal.c +++ b/src/fatal.c @@ -25,4 +25,3 @@ fatal_exit () { exit (PAXEXIT_FAILURE); } - diff --git a/src/filemode.c b/src/filemode.c index 5754c48..0a7c5ca 100644 --- a/src/filemode.c +++ b/src/filemode.c @@ -241,4 +241,3 @@ filemodestring (struct stat *statp, char *str) { mode_string (statp->st_mode, str); } - diff --git a/src/global.c b/src/global.c index b2e0ef5..8542243 100644 --- a/src/global.c +++ b/src/global.c @@ -195,4 +195,3 @@ char *change_directory_option; int renumber_inodes_option; int ignore_devno_option; - diff --git a/src/main.c b/src/main.c index 7eb93cb..8033783 100644 --- a/src/main.c +++ b/src/main.c @@ -48,15 +48,15 @@ enum cpio_options { NO_ABSOLUTE_FILENAMES_OPTION=256, ABSOLUTE_FILENAMES_OPTION, - NO_PRESERVE_OWNER_OPTION, - ONLY_VERIFY_CRC_OPTION, - RENAME_BATCH_FILE_OPTION, - RSH_COMMAND_OPTION, - QUIET_OPTION, - SPARSE_OPTION, - FORCE_LOCAL_OPTION, - DEBUG_OPTION, - BLOCK_SIZE_OPTION, + NO_PRESERVE_OWNER_OPTION, + ONLY_VERIFY_CRC_OPTION, + RENAME_BATCH_FILE_OPTION, + RSH_COMMAND_OPTION, + QUIET_OPTION, + SPARSE_OPTION, + FORCE_LOCAL_OPTION, + DEBUG_OPTION, + BLOCK_SIZE_OPTION, TO_STDOUT_OPTION, RENUMBER_INODES_OPTION, IGNORE_DEVNO_OPTION, @@ -71,7 +71,7 @@ const char *program_authors[] = "Sergey Poznyakoff", NULL }; - + const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">"; static char doc[] = N_("GNU `cpio' copies files to and from archives\n\ \n\ @@ -105,15 +105,15 @@ static struct argp_option options[] = { {"list", 't', 0, 0, N_("Print a table of contents of the input"), GRID }, #undef GRID - + /* ********** */ -#define GRID 100 +#define GRID 100 {NULL, 0, NULL, 0, N_("Operation modifiers valid in any mode:"), GRID }, {"directory", 'D', N_("DIR"), 0, N_("Change to directory DIR"), GRID+1 }, - + {"force-local", FORCE_LOCAL_OPTION, 0, 0, N_("Archive file is local, even if its name contains colons"), GRID+1 }, {"format", 'H', N_("FORMAT"), 0, @@ -124,7 +124,7 @@ static struct argp_option options[] = { N_("Set the I/O block size to BLOCK-SIZE * 512 bytes"), GRID+1 }, {NULL, 'c', NULL, 0, N_("Use the old portable (ASCII) archive format"), GRID+1 }, - {"dot", 'V', NULL, 0, + {"dot", 'V', NULL, 0, N_("Print a \".\" for each file processed"), GRID+1 }, {"io-size", 'C', N_("NUMBER"), 0, N_("Set the I/O block size to the given NUMBER of bytes"), GRID+1 }, @@ -153,9 +153,9 @@ static struct argp_option options[] = { {"rsh-command", RSH_COMMAND_OPTION, N_("COMMAND"), 0, N_("Use COMMAND instead of rsh"), GRID+1 }, #undef GRID - + /* ********** */ -#define GRID 200 +#define GRID 200 {NULL, 0, NULL, 0, N_("Operation modifiers valid only in copy-in mode:"), GRID }, {"nonmatching", 'f', 0, 0, @@ -182,7 +182,7 @@ static struct argp_option options[] = { N_("Extract files to standard output"), GRID+1 }, {NULL, 'I', N_("[[USER@]HOST:]FILE-NAME"), 0, N_("Archive filename to use instead of standard input. Optional USER and HOST specify the user and host names in case of a remote archive"), GRID+1 }, -#undef GRID +#undef GRID /* ********** */ #define GRID 300 @@ -200,7 +200,7 @@ static struct argp_option options[] = { N_("Create device-independent (reproducible) archives") }, {"reproducible", 0, NULL, OPTION_ALIAS }, #undef GRID - + /* ********** */ #define GRID 400 {NULL, 0, NULL, 0, @@ -209,7 +209,7 @@ static struct argp_option options[] = { N_("Link files instead of copying them, when possible"), GRID+1 }, #undef GRID - + /* ********** */ #define GRID 500 {NULL, 0, NULL, 0, @@ -219,7 +219,7 @@ static struct argp_option options[] = { GRID+1 }, {"no-absolute-filenames", NO_ABSOLUTE_FILENAMES_OPTION, 0, 0, N_("Create all files relative to the current directory"), GRID+1 }, -#undef GRID +#undef GRID /* ********** */ #define GRID 600 {NULL, 0, NULL, 0, @@ -231,7 +231,7 @@ static struct argp_option options[] = { {"reset-access-time", 'a', NULL, 0, N_("Reset the access times of files after reading them"), GRID+1 }, -#undef GRID +#undef GRID /* ********** */ #define GRID 700 {NULL, 0, NULL, 0, @@ -247,7 +247,7 @@ static struct argp_option options[] = { {"sparse", SPARSE_OPTION, NULL, 0, N_("Write files with large blocks of zeros as sparse files"), GRID+1 }, #undef GRID - + {0, 0, 0, 0} }; @@ -275,10 +275,10 @@ warn_control (char *arg) warn_option = 0; return 0; } - + if (strlen (arg) > 2 && memcmp (arg, "no-", 3) == 0) offset = 3; - + for (wt = warn_tab; wt->name; wt++) if (strcmp (arg + offset, wt->name) == 0) { @@ -348,7 +348,7 @@ parse_opt (int key, char *arg, struct argp_state *state) case 'D': change_directory_option = arg; break; - + case 'f': /* Only copy files not matching patterns. */ copy_matching_files = false; break; @@ -385,7 +385,7 @@ parse_opt (int key, char *arg, struct argp_state *state) invalid archive format `%s'; valid formats are:\n\ crc newc odc bin ustar tar (all-caps also recognized)"), arg)); break; - + case 'i': /* Copy-in mode. */ if (copy_function != 0) USAGE_ERROR ((0, 0, _("Mode already defined"))); @@ -423,10 +423,10 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg)); case ABSOLUTE_FILENAMES_OPTION: /* --absolute-filenames */ no_abs_paths_flag = false; break; - + case NO_PRESERVE_OWNER_OPTION: /* --no-preserve-owner */ if (set_owner_flag || set_group_flag) - USAGE_ERROR ((0, 0, + USAGE_ERROR ((0, 0, _("--no-preserve-owner cannot be used with --owner"))); no_chown_flag = true; break; @@ -454,7 +454,7 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg)); case IGNORE_DEVNO_OPTION: ignore_devno_option = 1; break; - + case RENUMBER_INODES_OPTION: renumber_inodes_option = 1; break; @@ -462,7 +462,7 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg)); case DEVICE_INDEPENDENT_OPTION: ignore_devno_option = renumber_inodes_option = 1; break; - + case RSH_COMMAND_OPTION: rsh_command_option = arg; break; @@ -481,12 +481,12 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg)); case 'R': /* Set the owner. */ if (no_chown_flag) - USAGE_ERROR ((0, 0, + USAGE_ERROR ((0, 0, _("--owner cannot be used with --no-preserve-owner"))); else { char *e, *u, *g; - + e = parse_user_spec (arg, &set_owner, &set_group, &u, &g); if (e) USAGE_ERROR ((0, 0, "%s: %s", arg, e)); @@ -531,7 +531,7 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg)); if (warn_control (arg)) USAGE_ERROR ((0, 0, _("Invalid value for --warning option: %s"), arg)); break; - + case SPARSE_OPTION: sparse_flag = true; break; @@ -585,7 +585,7 @@ process_args (int argc, char *argv[]) xstat = lstat; if (argp_parse (&argp, argc, argv, ARGP_IN_ORDER, &index, NULL)) - exit (PAXEXIT_FAILURE); + exit (PAXEXIT_FAILURE); /* Do error checking and look at other args. */ @@ -618,9 +618,9 @@ process_args (int argc, char *argv[]) CHECK_USAGE (retain_time_flag, "--preserve-modification-time", "--to-stdout"); } - + if (archive_name && input_archive_name) - USAGE_ERROR ((0, 0, + USAGE_ERROR ((0, 0, _("Both -I and -F are used in copy-in mode"))); if (archive_format == arf_crcascii) @@ -649,16 +649,16 @@ process_args (int argc, char *argv[]) CHECK_USAGE (swap_halfwords_flag, "--swap-halfwords (--swap)", "--create"); CHECK_USAGE (to_stdout_option, "--to-stdout", "--create"); - + if (append_flag && !(archive_name || output_archive_name)) - USAGE_ERROR ((0, 0, + USAGE_ERROR ((0, 0, _("--append is used but no archive file name " "is given (use -F or -O options)"))); CHECK_USAGE (rename_batch_file, "--rename-batch-file", "--create"); CHECK_USAGE (input_archive_name, "-I", "--create"); if (archive_name && output_archive_name) - USAGE_ERROR ((0, 0, + USAGE_ERROR ((0, 0, _("Both -O and -F are used in copy-out mode"))); if (archive_format == arf_unknown) @@ -678,7 +678,7 @@ process_args (int argc, char *argv[]) USAGE_ERROR ((0, 0, _("Not enough arguments"))); if (archive_format != arf_unknown) - USAGE_ERROR ((0, 0, + USAGE_ERROR ((0, 0, _("Archive format is not specified in copy-pass mode " "(use --format option)"))); @@ -697,21 +697,21 @@ process_args (int argc, char *argv[]) CHECK_USAGE (renumber_inodes_option, "--renumber-inodes", "--pass-through"); CHECK_USAGE (ignore_devno_option, "--ignore-devno", "--pass-through"); - + directory_name = argv[index]; } if (archive_name) { if (copy_function != process_copy_in && copy_function != process_copy_out) - error (PAXEXIT_FAILURE, 0, + error (PAXEXIT_FAILURE, 0, _("-F can be used only with --create or --extract")); archive_des = open_archive (archive_name); if (archive_des < 0) - error (PAXEXIT_FAILURE, errno, _("Cannot open %s"), + error (PAXEXIT_FAILURE, errno, _("Cannot open %s"), quotearg_colon (archive_name)); } - + /* Prevent SysV non-root users from giving away files inadvertantly. This happens automatically on BSD, where only root can give away files. */ @@ -774,7 +774,7 @@ main (int argc, char *argv[]) set_program_name (argv[0]); argp_version_setup ("cpio", program_authors); process_args (argc, argv); - + initialize_buffers (); (*copy_function) (); diff --git a/src/makepath.c b/src/makepath.c index be54df8..fa98b45 100644 --- a/src/makepath.c +++ b/src/makepath.c @@ -95,7 +95,7 @@ make_path (char const *argpath, stats.st_uid = owner; if (group != -1) stats.st_gid = group; - + delay_set_stat (dirpath, &stats, invert_permissions); } } @@ -119,7 +119,7 @@ make_path (char const *argpath, if (mkdir (dirpath, tmpmode ^ invert_permissions)) { - /* In some cases, if the final component in dirpath was `.' then we + /* In some cases, if the final component in dirpath was `.' then we just got an EEXIST error from that last mkdir(). If that's the case, ignore it. */ if ( (errno != EEXIST) || @@ -138,10 +138,10 @@ make_path (char const *argpath, stats.st_uid = owner; if (group != -1) stats.st_gid = group; - + delay_set_stat (dirpath, &stats, invert_permissions); } - + if (verbose_fmt_string != NULL) error (0, 0, verbose_fmt_string, dirpath); diff --git a/src/mt.c b/src/mt.c index 6a6b472..199690d 100644 --- a/src/mt.c +++ b/src/mt.c @@ -186,7 +186,7 @@ static struct argp_option options[] = { char *tapedev; /* tape device */ char *rsh_command_option = NULL; /* rsh command */ -short operation; /* operation code */ +short operation; /* operation code */ int count = 1; /* count */ int argcnt = 0; /* number of command line arguments @@ -232,7 +232,7 @@ parse_opt (int key, char *arg, struct argp_state *state) #endif } break; - + case 'f': case 't': tapedev = arg; @@ -319,7 +319,7 @@ main (int argc, char **argv) setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - + set_program_name (argv[0]); argp_version_setup ("mt", program_authors); argmatch_die = fatal_exit; @@ -339,7 +339,7 @@ main (int argc, char **argv) default: tapedesc = rmtopen (tapedev, O_RDONLY, 0, rsh_command_option); } - + if (tapedesc == -1) error (MT_EXIT_INVOP, errno, _("%s: rmtopen failed"), tapedev); check_type (tapedev, tapedesc); @@ -358,4 +358,3 @@ main (int argc, char **argv) exit (MT_EXIT_SUCCESS); } - diff --git a/src/tar.c b/src/tar.c index 218f005..ffbef9c 100644 --- a/src/tar.c +++ b/src/tar.c @@ -42,7 +42,7 @@ stash_tar_linkname (char *linkname) /* Try to split a long file name into prefix and suffix parts separated by a slash. Return the length of the prefix (not counting the slash). */ - + static size_t split_long_name (const char *name, size_t length) { @@ -353,14 +353,14 @@ read_in_tar_header (struct cpio_file_stat *file_hdr, int in_des) /* If a POSIX tar header has a valid linkname it's always supposed to set typeflag to be LNKTYPE. System V.4 tar seems to be broken, and for device files with multiple links it - puts the name of the link into linkname, but leaves typeflag + puts the name of the link into linkname, but leaves typeflag as CHRTYPE, BLKTYPE, FIFOTYPE, etc. */ file_hdr->c_tar_linkname = stash_tar_linkname (tar_hdr->linkname); /* Does POSIX say that the filesize must be 0 for devices? We assume so, but HPUX's POSIX tar sets it to be 1 which causes us problems (when reading an archive we assume we can always - skip to the next file by skipping filesize bytes). For + skip to the next file by skipping filesize bytes). For now at least, it's easier to clear filesize for devices, rather than check everywhere we skip in copyin.c. */ file_hdr->c_filesize = 0; diff --git a/src/util.c b/src/util.c index aacf2bf..f5762f6 100644 --- a/src/util.c +++ b/src/util.c @@ -60,8 +60,8 @@ tape_empty_output_buffer (int out_des) static long output_bytes_before_lseek = 0; /* Some tape drivers seem to have a signed internal seek pointer and - they lose if it overflows and becomes negative (e.g. when writing - tapes > 2Gb). Doing an lseek (des, 0, SEEK_SET) seems to reset the + they lose if it overflows and becomes negative (e.g. when writing + tapes > 2Gb). Doing an lseek (des, 0, SEEK_SET) seems to reset the seek pointer and prevent it from overflowing. */ if (output_is_special && ( (output_bytes_before_lseek += output_size) >= 1073741824L) ) @@ -105,7 +105,7 @@ static ssize_t sparse_write (int fildes, char *buf, size_t nbyte, bool flush); descriptor OUT_DES and reset `output_size' and `out_buff'. If `swapping_halfwords' or `swapping_bytes' is set, do the appropriate swapping first. Our callers have - to make sure to only set these flags if `output_size' + to make sure to only set these flags if `output_size' is appropriate (a multiple of 4 for `swapping_halfwords', 2 for `swapping_bytes'). The fact that DISK_IO_BLOCK_SIZE must always be a multiple of 4 helps us (and our callers) @@ -187,8 +187,8 @@ tape_fill_input_buffer (int in_des, int num_bytes) { #ifdef BROKEN_LONG_TAPE_DRIVER /* Some tape drivers seem to have a signed internal seek pointer and - they lose if it overflows and becomes negative (e.g. when writing - tapes > 4Gb). Doing an lseek (des, 0, SEEK_SET) seems to reset the + they lose if it overflows and becomes negative (e.g. when writing + tapes > 4Gb). Doing an lseek (des, 0, SEEK_SET) seems to reset the seek pointer and prevent it from overflowing. */ if (input_is_special && ( (input_bytes_before_lseek += num_bytes) >= 1073741824L) ) @@ -331,8 +331,8 @@ tape_buffered_peek (char *peek_buf, int in_des, int num_bytes) #ifdef BROKEN_LONG_TAPE_DRIVER /* Some tape drivers seem to have a signed internal seek pointer and - they lose if it overflows and becomes negative (e.g. when writing - tapes > 4Gb). Doing an lseek (des, 0, SEEK_SET) seems to reset the + they lose if it overflows and becomes negative (e.g. when writing + tapes > 4Gb). Doing an lseek (des, 0, SEEK_SET) seems to reset the seek pointer and prevent it from overflowing. */ if (input_is_special && ( (input_bytes_before_lseek += num_bytes) >= 1073741824L) ) @@ -415,14 +415,14 @@ tape_toss_input (int in_des, off_t num_bytes) } void -write_nuls_to_file (off_t num_bytes, int out_des, +write_nuls_to_file (off_t num_bytes, int out_des, void (*writer) (char *in_buf, int out_des, off_t num_bytes)) { off_t blocks; off_t extra_bytes; off_t i; static char zeros_512[512]; - + blocks = num_bytes / sizeof zeros_512; extra_bytes = num_bytes % sizeof zeros_512; for (i = 0; i < blocks; ++i) @@ -602,7 +602,7 @@ create_all_directories (char const *name) char *dir; dir = dir_name (name); - + if (dir == NULL) error (PAXEXIT_FAILURE, 0, _("virtual memory exhausted")); @@ -705,10 +705,10 @@ find_inode_val (ino_t node_num, unsigned long major_num, unsigned long minor_num) { struct inode_val sample; - + if (!hash_table) return NULL; - + sample.inode = node_num; sample.major_num = major_num; sample.minor_num = minor_num; @@ -733,7 +733,7 @@ add_inode (ino_t node_num, char *file_name, unsigned long major_num, { struct inode_val *temp; struct inode_val *e = NULL; - + /* Create new inode record. */ temp = (struct inode_val *) xmalloc (sizeof (struct inode_val)); temp->inode = node_num; @@ -1004,7 +1004,7 @@ buf_all_zeros (char *buf, int bufsize) /* Write NBYTE bytes from BUF to file descriptor FILDES, trying to create holes instead of writing blockfuls of zeros. - + Return the number of bytes written (including bytes in zero regions) on success, -1 on error. @@ -1024,7 +1024,7 @@ sparse_write (int fildes, char *buf, size_t nbytes, bool flush) enum { begin, in_zeros, not_in_zeros } state = delayed_seek_count ? in_zeros : begin; - + while (nbytes) { size_t rest = nbytes; @@ -1039,7 +1039,7 @@ sparse_write (int fildes, char *buf, size_t nbytes, bool flush) if (state == not_in_zeros) { ssize_t bytes = buf - start_ptr + rest; - + n = write (fildes, start_ptr, bytes); if (n == -1) return -1; @@ -1088,8 +1088,8 @@ sparse_write (int fildes, char *buf, size_t nbytes, bool flush) if (n != 1) return n; delayed_seek_count = 0; - } - + } + return nwritten + seek_count; } @@ -1227,7 +1227,7 @@ set_perms (int fd, struct cpio_file_stat *header) if (!no_chown_flag) { uid_t uid = CPIO_UID (header->c_uid); - gid_t gid = CPIO_GID (header->c_gid); + gid_t gid = CPIO_GID (header->c_gid); if ((fchown_or_chown (fd, header->c_name, uid, gid) < 0) && errno != EPERM) chown_error_details (header->c_name, uid, gid); @@ -1244,13 +1244,13 @@ set_file_times (int fd, const char *name, unsigned long atime, unsigned long mtime) { struct timespec ts[2]; - + memset (&ts, 0, sizeof ts); ts[0].tv_sec = atime; ts[1].tv_sec = mtime; - /* Silently ignore EROFS because reading the file won't have upset its + /* Silently ignore EROFS because reading the file won't have upset its timestamp if it's on a read-only filesystem. */ if (fdutimens (fd, name, ts) < 0 && errno != EROFS) utime_error (name); @@ -1302,7 +1302,7 @@ cpio_safer_name_suffix (char *name, bool link_target, bool absolute_names, /* This is a simplified form of delayed set_stat used by GNU tar. With the time, both forms will merge and pass to paxutils - + List of directories whose statuses we need to extract after we've finished extracting their subsidiary files. If you consider each contiguous subsequence of elements of the form [D]?[^D]*, where [D] @@ -1420,7 +1420,7 @@ cpio_mkdir (struct cpio_file_stat *file_hdr, int *setstat_delayed) { int rc; mode_t mode = file_hdr->c_mode; - + if (!(file_hdr->c_mode & S_IWUSR)) { rc = mkdir (file_hdr->c_name, mode | S_IWUSR); @@ -1443,10 +1443,10 @@ cpio_create_dir (struct cpio_file_stat *file_hdr, int existing_dir) { int res; /* Result of various function calls. */ int setstat_delayed = 0; - + if (to_stdout_option) return 0; - + /* Strip any trailing `/'s off the filename; tar puts them on. We might as well do it here in case anybody else does too, since they cause strange things to happen. */ @@ -1535,7 +1535,7 @@ arf_stores_inode_p (enum archive_format arf) } return 1; } - + void cpio_file_stat_init (struct cpio_file_stat *file_hdr) { diff --git a/sysdep.m4 b/sysdep.m4 index 47dfef1..878f5f8 100644 --- a/sysdep.m4 +++ b/sysdep.m4 @@ -83,4 +83,3 @@ define(`INTRETVAL',-1)dnl divert(0)dnl ROHEADER ') - diff --git a/tests/CVE-2015-1197.at b/tests/CVE-2015-1197.at index 3c63cbe..5290f46 100644 --- a/tests/CVE-2015-1197.at +++ b/tests/CVE-2015-1197.at @@ -40,4 +40,3 @@ dir/file 1 block ]) AT_CLEANUP - diff --git a/tests/CVE-2019-14866.at b/tests/CVE-2019-14866.at index 4b4e7a6..00bdb61 100644 --- a/tests/CVE-2019-14866.at +++ b/tests/CVE-2019-14866.at @@ -25,7 +25,7 @@ if genfile -s 16G -f file; then exit $? else AT_SKIP_TEST -fi +fi ], [0], [], diff --git a/tests/Makefile.am b/tests/Makefile.am index c412ac3..7ae04db 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -94,4 +94,3 @@ AM_CPPFLAGS = \ -DLOCALEDIR=\"$(localedir)\" LDADD=../gnu/libgnu.a @LIB_CLOCK_GETTIME@ @INTLLIBS@ - diff --git a/tests/atlocal.in b/tests/atlocal.in index 50b0a38..8d758da 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -4,4 +4,3 @@ # Foundation, Inc. PATH=@abs_builddir@:@abs_top_builddir@/src:$top_srcdir:$srcdir:$PATH - diff --git a/tests/big-block-size.at b/tests/big-block-size.at index 07b64eb..0ab6ac9 100644 --- a/tests/big-block-size.at +++ b/tests/big-block-size.at @@ -20,7 +20,7 @@ AT_KEYWORDS([block integer overflow]) # Description: Cpio versions up to 2.12 did not check the size of the # value supplied to the --block-size argument. This could result in -# a signed integer overflow. +# a signed integer overflow. AT_CHECK([ echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" > file @@ -34,5 +34,3 @@ cpio: invalid block size Try 'cpio --help' or 'cpio --usage' for more information.] ) AT_CLEANUP - - diff --git a/tests/inout.at b/tests/inout.at index 94ffaee..6ec8c81 100644 --- a/tests/inout.at +++ b/tests/inout.at @@ -20,7 +20,7 @@ AT_SETUP([basic functionality: copyin/copyout]) AT_KEYWORDS([copyin copyout]) -AT_DATA([filelist],[a 18 +AT_DATA([filelist],[a 18 b 1024 c 356 d 20000 diff --git a/tests/interdir.at b/tests/interdir.at index 8816b09..4c027fc 100644 --- a/tests/interdir.at +++ b/tests/interdir.at @@ -37,11 +37,11 @@ genfile --file dir/file echo Copying the hierarchy cpio -pdvm en/to/tre < filelist 2>&1 echo Results -genfile --stat=name,mode.777 en -genfile --stat=name,mode.777 en/to -genfile --stat=name,mode.777 en/to/tre -genfile --stat=name,mode.777 en/to/tre/dir -genfile --stat=name,mode.777 en/to/tre/dir/file +genfile --stat=name,mode.777 en +genfile --stat=name,mode.777 en/to +genfile --stat=name,mode.777 en/to/tre +genfile --stat=name,mode.777 en/to/tre/dir +genfile --stat=name,mode.777 en/to/tre/dir/file ], [0], [Copying the hierarchy diff --git a/tests/setstat01.at b/tests/setstat01.at index 6b36d2b..b99617a 100644 --- a/tests/setstat01.at +++ b/tests/setstat01.at @@ -41,5 +41,3 @@ genfile --stat=mode.777 dir ]) AT_CLEANUP - - diff --git a/tests/setstat02.at b/tests/setstat02.at index 5ee912f..e2222fe 100644 --- a/tests/setstat02.at +++ b/tests/setstat02.at @@ -46,5 +46,3 @@ genfile --stat=mode.777 dir ]) AT_CLEANUP - - diff --git a/tests/setstat03.at b/tests/setstat03.at index 7e92505..750efeb 100644 --- a/tests/setstat03.at +++ b/tests/setstat03.at @@ -43,5 +43,3 @@ genfile --stat=mode.777 newdir/dir ]) AT_CLEANUP - - diff --git a/tests/setstat04.at b/tests/setstat04.at index a6d5623..cff51c0 100644 --- a/tests/setstat04.at +++ b/tests/setstat04.at @@ -47,5 +47,3 @@ genfile --stat=mode.777 dir ]) AT_CLEANUP - - diff --git a/tests/setstat05.at b/tests/setstat05.at index ac93138..0335d6a 100644 --- a/tests/setstat05.at +++ b/tests/setstat05.at @@ -44,5 +44,3 @@ genfile --stat=mode.777 newdir/dir ]) AT_CLEANUP - - diff --git a/tests/symlink-bad-length.at b/tests/symlink-bad-length.at index 8af0b5b..d33cbcf 100644 --- a/tests/symlink-bad-length.at +++ b/tests/symlink-bad-length.at @@ -46,7 +46,7 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= AT_CHECK([ base64 -d ARCHIVE.base64 > ARCHIVE || AT_SKIP_TEST -TZ=UTC cpio -ntv < ARCHIVE 2>stderr +TZ=UTC cpio -ntv < ARCHIVE 2>stderr cat stderr | grep -v \ -e 'stored filename length is out of range' \ -e 'premature end of file' \ diff --git a/tests/version.at b/tests/version.at index bc760ce..d1f3fcf 100644 --- a/tests/version.at +++ b/tests/version.at @@ -32,4 +32,3 @@ echo '==============================================================' ]) AT_CLEANUP - -- 2.32.0