summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright yearPaul Eggert2023-01-065-6/+5
| | | | | | | UPDATE_COPYRIGHT_USE_INTERVALS=1 \ UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79 \ gnulib/build-aux/update-copyright \ $(git ls-files | sed -e '/^gnulib$/d; /^COPYING$/d')
* Exploit recent Gnulib stdbool changesPaul Eggert2022-09-101-1/+0
| | | | | * lib/system.h: Do not include <stdbool.h>, as the Gnulib stdbool module now emulates C23.
* Modernize integer handlingPaul Eggert2022-09-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | It’s now safe to assume C99 sprintf %jd, etc. * am/system.m4 (PU_SYSTEM): Do not require gl_INTTOSTR. * gnulib.modules, paxlib.modules: Remove inttostr. Add strtoimax, strtoumax. * lib/system.h (UINTMAX_STRSIZE_BOUND): Remove. * paxlib/error.c (chown_error_details, read_error_details) (read_warn_details, read_fatal_details, seek_error_details) (seek_warn_details, write_error_details): * paxlib/rtape.c (rmt_read, rmt_write, rmt_lseek, rmt_ioctl): * rmt/rmt.c (rmt_reply): * tests/genfile.c (verify_file, print_stat): Use C99 printf formats instead of doing it by hand. * paxlib/paxlib.h, rmt/rmt.c, tests/genfile.c: Do not include inttostr.h. * paxlib/paxlib.h (STRINGIFY_BIGINT): Remove. * tests/argcv.c (xtonum): Use strtol for signed int, not strtoul. * tests/genfile.c (checkpoint, verify_file, parse_opt) (exec_checkpoint, process_checkpoint, exec_command): Prefer uintmax_t to size_t for counters unrelated to object size. (PRINT_INT): New macro. (print_stat): Prefer uintmax_t to unsigned for modes.
* Ignore-file cleanupPaul Eggert2022-06-121-75/+0
| | | | | Remove .cvsignore files, as we don’t use CVS any more. Update one .gitignore file to bootstrap-preferred form.
* Modernize to current gettext, gnulibPaul Eggert2022-06-122-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .gitignore, po/.gitignore: Revamp to match current source. * README: Fix typo in file name. * am/rmt.m4 (PU_RMT): Modernize to use AC_PREPROC_IFELSE instead of AC_TRY_CPP. * am/rmt.m4 (PU_RMT): * configure.ac: Modernize to use AS_HELP_STRING instead of AC_HELP_STRING. * am/system.m4 (PU_SYSTEM): * configure.ac: Remove obsolescent AC_HEADER_STDC. Use AC_CHECK_MEMBERS([struct stat.st_blksize]) instead of AC_STRUCT_ST_BLKSIZE. * am/system.m4 (PU_SYSTEM): Use AC_CHECK_HEADERS_ONCE([sys/time.h]) instead of obsolescent AC_HEADER_TIME. * bootstrap: Sync from Gnulib. * build-aux/bootstrap: Remove. * bootstrap.conf: Simplify. Don’t make m4, $source_base. (bootstrap_post_import_hook): New function, replacing a direct write. * configure.ac: Remove calls to no-longer-needed macros AC_ISC_POSIX, AM_STDBOOL_H, AC_HEADER_STDC, AC_TYPE_SIGNAL. Modernize to use AC_COMPILE_ELSE instead of AC_TRY_COMPILE. Remove MU_DEBUG_MODE, paxutils_GNULIB (not sure what those were from). Fix quoting in warning Remove Iconv code, as the iconv module should do this now. Update Gettext version from 0.12.1 (2003) to 0.21 (2020). Use AC_CONFIG_FILES. All uses of corresponding C macros changed. * gnulib.modules, paxlib.modules: Switch from gettext to gettext-h. * paxlib.modules: Add iconv.
* Don’t overallocate rtapelib sprintf buffersPaul Eggert2021-09-171-3/+3
| | | | | | | | | * lib/rtapelib.c (rmt_lseek__, rmt_ioctl__): Don’t promote arguments of INT_STRLEN_BOUND, as that might over-allocate the resulting buffers. This is not an efficiency problem because any overallocations are tiny. However, it is confusing (to me, at least) to have code that unnecessarily overallocates, as that makes it harder to reason about integer or buffer overflow.
* Move sys_reset_uid_gid to libraryPaul Eggert2021-02-282-18/+23
| | | | | | | | | | | This fixes a problem where ‘gcc -fanalyzer -flto’ (GCC 10) complained that sys_reset_uid_gid was defined but not used in some modules. This function belonged in a .c file anyway. * lib/rtapelib.c (sys_reset_uid_gid): * paxlib/rtape.c (sys_reset_uid_gid): Move here from system.h. The code is now duplicated, but so is most of the rest of this file anyway. * lib/system.h (sys_reset_uid_gid): Remove.
* Use unsigned long int for ioctl opsPaul Eggert2021-02-282-3/+2
| | | | | | | | | | * lib/rtapelib.c (rmt_ioctl__): * paxlib/rtape.c (rmt_ioctl): Arg is now of type unsigned long int, not int. This works better on GNU/Linux, where some ioctl values used by this code do not fit in int. FreeBSD ioctl also has unsigned long int here, and old hosts where it’s int should still work when this is unsigned long int. Problem reported by clang.
* Omit ‘inline’Paul Eggert2021-02-281-1/+1
| | | | | | | | | | | | With today’s compilers ‘inline’ is typically not needed for performance (at least the way GNU Tar uses it) and it gets in the way of portability. Some compilers ignore ‘inline’ and some inline even without ‘inline’, and when inlining is haphazard GNU Tar can link on your GNU/Linux host but not link on Solaris. Better to have it not link everywhere so these problems are caught before porting. * configure.ac: Omit AC_C_INLINE; no longer needed here. * lib/system.h (sys_reset_uid_gid): No longer inline.
* Avoid linking problem in sys_reset_uid_gidPaul Eggert2021-02-282-17/+13
| | | | | | | | * lib/system.h (sys_reset_uid_gid) [!MSDOS]: On failure, instead of invoking FATAL_ERROR set errno and return the name of the syscall that failed, so that the caller can decide what to do. This avoids some GNU Tar linking problems on compilers that do not inline this function. All callers changed.
* Port better to non-GCC compilersPaul Eggert2021-02-271-8/+1
| | | | | | | | | Gnulib now defines _Noreturn for us on pre-C11 compilers, so use that instead of the less-portable __attribute__ ((noreturn)). * lib/system.h (__attribute__): Remove; no longer used. * paxlib/paxlib.h: Use _Noreturn instead of __attribute__ ((noreturn)). * paxtest/paxtest.c (dump): First arg is char *, not unsigned char *, to avoid type mismatch.
* Pacify rtapelib.c for GCC 10 and fix a bug or twoPaul Eggert2021-02-272-39/+27
| | | | | | | | | | | | | | | This patch assumes C99, but that’s OK nowadays. * lib/rtapelib.c: Include verify.h. (rmt_open__): Tell GCC that remote_file must be nonnull. (rmt_read__, rmt_write__, rmt_lseek__, rmt_ioctl__): Properly size outgoing command buffers instead of guessing 64. Simplify by using C99 printf formats like %zu, as that’s a safe assumption nowadays. (rmt_ioctl__): 3rd arg is now void * not char *, to pacify gcc -Wcast-align. Fix unlikely bug with short reads: ARGUMENT was being incremented, whereas later code wanted the original ARGUMENT. * paxlib.modules: Add ‘verify’.
* Minor changeSergey Poznyakoff2021-02-131-1/+1
|
* Fix sys_reset_uid_gid; minor changes in genfile.cSergey Poznyakoff2021-02-131-7/+25
| | | | | | | | | * lib/system.h (ERRNO_IS_EACCES): Remove. Not used anymore. (sys_reset_uid_gid): Re-initialize supplementary groups when switching privileges. Fix ordering of setgid and setuid calls. * tests/genfile.c (EXIT_USAGE) (EXIT_UNAVAILABLE): New exit codes. Use them as appropriate.
* paxutils: support --sparse with tiny files on Netapp filersPaul Eggert2013-10-281-1/+8
| | | | | | | * lib/system.h (ST_IS_SPARSE): Port to NFS + Netapp filers, where a tiny file can have zero blocks but nonzero size. Problem reported by Andrew J. Schorr in <http://lists.gnu.org/archive/html/bug-tar/2013-10/msg00030.html>.
* maint: remove lint uncovered by tar's new use of manywarningsPaul Eggert2012-12-183-15/+19
| | | | | | | | | | | | | | * lib/rmt.h, lib/rtapelib.c (rmt_command, rmt_dev_name__): Now pointer to const. * lib/rtapelib.c (rmt_open__): Check return codes from dup2, close. Don't mishandle the case when 'pipe' allocates file descriptor 0. * lib/system.h (sys_reset_uid_gid): Check return codes from setuid, setgid. * tests/genfile.c (mkhole, exec_checkpoint): Check return code from ftruncate. (mkhole): Don't call fseek twice. (exec_checkpoint): Check return code from system. (exec_command): Check return code from pipe.
* Remove some lint, found by gcc -W etc.Paul Eggert2010-06-161-4/+4
| | | | | | | | | | | | | | * lib/rtapelib.c (do_command, rmt_write__): Use function prototypes instead of old-style decls. * paxlib/error.c (write_fatal): Remove unused and undeclared function. * paxlib/paxlib.h (stat_fatal, pax_exit): Add noreturn attribute. (write_error_details): New decl. * rmt/rmt.c (rmt_read, rmt_write, rmt_reply, rmt_error_message): (rmt_error, xlat_kw, skip_ws, decode_open_flag, close_device): (lseek_device, read_device, write_device, iocop_device, status_device): Declare as static, since they're not exported. Use function prototypes (void) instead of old-style decls ().
* Bugfixes in rtapelibSergey Poznyakoff2010-03-012-2/+9
| | | | | | | * lib/rmt.h (rmtcreat): Use fcntl O_ macros insead of their hardcoded values. * lib/rtapelib.c (rmt_read__,rmt_ioctl__): Prevent potential overflow.
* Minor fix.Sergey Poznyakoff2009-06-181-1/+4
| | | | | * lib/rtapelib.c (rmt_open__): Return appropriate diagnostics if the host name cannot be resolved.
* Changes needed for cpio mingw build:Sergey Poznyakoff2007-12-051-2/+7
| | | | | | * lib/system.h: Include pwd.h and grp.h if the corresponding HAVE_ preprocessor symbols are defined. * m4/system.m4 (AC_CHECK_HEADERS_ONCE): Add pwd.h and grp.h.
* Use last_component instead of base_name. Patch by Eric Blake.Sergey Poznyakoff2007-08-121-1/+1
|
* Relicense under GPLv3Sergey Poznyakoff2007-06-275-11/+11
|
* * lib/rtapelib.c: Include <rmt-command.h> rather than <localedir.h>,Paul Eggert2006-11-291-1/+1
| | | | | | | | | to accommodate recent changes to gnulib and tar. * rmt/rmt.c: Likewise. * rmt/Makefile.am (rmt.o): Depend on configmake.h, not localedir.h. * m4/system.m4 (PU_SUSTEM): Put AC_REQUIRE wrappers around AC_HEADER_STDC, etc. This avoids a warning from automake, with the latest gnulib.
* * lib/system.h: Include <inttypes.h> unconditionally.Paul Eggert2006-08-071-10/+1
| | | | | | | The latest gnulib lets us do this. * m4/system.m4 (PU_SYSTEM): Don't check for inttypes.h. Don't require gl_AC_TYPE_UINTMAX_T. Require gl_INTTYPES_H, gl_STDINT_H.
* (ST_IS_SPARSE): New macroSergey Poznyakoff2006-06-251-1/+5
|
* (HAVE_DECL_VALLOC) [WITH_DMALLOC]: Remove #undef, since this symbolPaul Eggert2006-03-081-1/+0
| | | | is no longer used.
* * configure.ac (AC_CHECK_HEADERS): Don't check for sys/time.h,Paul Eggert2006-03-081-7/+2
| | | | | | | | | | | | | | since we no longer use HAVE_SYS_TIME_H. (AC_CHECK_DECLS): Don't check for 'time', since we assume C89 or better. * lib/system.h: Include <unistd.h> unconditionally, since we now assume the unistd module. (time): Remove decl; not needed, since we assume C89 or better. Don't bother checking for HAVE_SYS_TIME_H when deciding whether to include <sys/time.h>, since TIME_WITH_SYS_TIME implies sys/time.h exists. * m4/system.m4 (PU_SYSTEM): Don't check for unistd.h or sys/time.h, or for time or valloc.
* * lib/DISTFILES: Add system-ioctl.h.Paul Eggert2006-02-204-42/+62
| | | | | | | | | | * lib/system.h: Move the MTIO* stuff into.... * lib/system-ioctl.h: New file. That way, the symbols defined by these includes won't collide with the symbols defined by <sys/filio.h> on Solaris when compiling misc.c. * lib/rtapelib.c: Include system-ioctl.h. * paxlib/rtape.c: Likewise. * rmt/rmt.c: Likewise.
* * lib/rtapelib.c (encode_oflag): Simplify code, since O_NONBLOCKPaul Eggert2005-11-292-7/+14
| | | | | | | | | | is always defined now. * paxlib/rtape.c (encode_oflag): Likewise. * lib/system.h (O_DIRCTORY, O_NOATIME, O_NONBLOCK): Define to 0 if not already defined. * paxlib/error.c (rmdir_error): New function. * paxlib/error.h (rmdir_error): New decl. * rmt/rmt.c (decode_oflag): Use '#if O_NONBLOCK", not ifdef.
* * lib/system.h (strtoimax, strtoumax): Declare if the systemPaul Eggert2005-11-061-0/+7
| | | | headers don't.
* Improve support for time stamps and other wide integers.Paul Eggert2005-06-221-23/+4
| | | | | | | | | | | | | | | | | | | | * gnulib.modules: Add inttostr, quote, quotearg. * lib/system.h (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove. (INT_STRLEN_BOUND): Remove. Include "intprops.h" instead. (UINTMAX_STRSIZE_BOUND): Define in terms of INT_BUFSIZE_BOUND, not INT_STRLEN_BOUND. [HAVE_UTIME_H]: Don't include utime.h. * paxlib/DISTFILES: Remove convert.c. * paxlib/convert.c: Remove. * paxlib/error.c: Include quote.h, quotearg.h. * paxlib/paxlib.h: Include inttostr.h. (STRINGIFY_BIGINT): Define in terms of umaxtostr. (stringify_uintmax_t_backwards): Remove decl. * tests/genfile.c: Include <utimens.h> instead of rolling our own. (exec_checkpoint): Use utimens instead of rolling our own. Don't pass extra args to error. (main): Wrap message inside _().
* Update FSF postal mail address.Paul Eggert2005-05-154-5/+5
|
* New fileSergey Poznyakoff2005-05-142-0/+107
|
* Moved to paxlib and updatedSergey Poznyakoff2005-05-142-344/+0
|
* If mkdev is defined, use it as makedev. Proposed by Todd Vierling.Sergey Poznyakoff2005-05-121-0/+3
|
* PAX buffer routinesSergey Poznyakoff2005-02-072-0/+344
|
* Initial revisionSergey Poznyakoff2004-09-064-0/+1366