summaryrefslogtreecommitdiff
path: root/src/arscan.c
Commit message (Collapse)AuthorAgeFilesLines
* Adjust output strings to be alignedPaul Smith2023-04-021-2/+2
| | | | | | | | Change error and fatal messages to start with lowercase and not end with a period. Note a few very common messages were left as-is, just in case some other tools parse them. Also modify the test known-good-output to satisfy the messages.
* Clean up some preprocessor operationsPaul Smith2023-01-161-3/+3
|
* Rename WINDOWS32 macro to MK_OS_W32Paul Smith2023-01-151-2/+2
| | | | | | | | | | * configure.ac: Set MK_OS_W32 to 1 if we're on Windows32. * src/config.h.W32: Ditto. * mk/Windows32.mk: Ditto. * src/makeint.h: Convert #if refs to WINDOWS32, to use MK_OS_W32. * src/*: Ditto. * src/w32/*: Ditto. * gl/lib/*: Ditto.
* Rename VMS macro to MK_OS_VMSPaul Smith2023-01-151-6/+6
| | | | | | * src/makeint.h: Set MK_OS_VMS to 1 if we're on VMS. * src/*: Convert all #if references to VMS, to use MK_OS_VMS. * gl/lib/*: Ditto.
* [SV 62654] Support GNU Make on z/OSPaul Smith2023-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original patches provided by Igor Todorovski <itodorov@ca.ibm.com> Reworked by Paul Smith <psmith@gnu.org>. Thanks to IBM for providing a test system. * NEWS: Announce support. * AUTHORS: Ditto. * README.zOS: Provide details on building GNU Make on z/OS. * build.sh (get_mk_var): z/OS sh has a strange bug which causes it to generate extra lines of output: rework the function to print output as we compute it instead of collecting it into a variable, which works around this bug. * src/makeint.h: Declare MK_OS_ZOS if we're building for z/OS. * src/arscan.c: Don't include <ar.h> on z/OS. * src/job.c: We can't change environ in ASCII mode on z/OS. * src/main.c: Ditto. Also we can't use pselect() on z/OS. * src/posixos.c: pselect() seems to hang on z/OS: don't use it. * tests/run_make_tests.pl: Handle different exit codes on z/OS. * tests/test_driver.pl: Preserve some special z/OS env.vars. Add special checks to output comparisons when on z/OS. * tests/scripts/features/archives: Don't validate names. Don't try to compile empty files as IBM compilers complain. * tests/scripts/features/shell_assignment: Fix octal value of #. * tests/scripts/features/temp_stdin: Don't print "term". * tests/scripts/functions/shell: Handle shell exit codes. * tests/scripts/targets/ONESHELL: Ditto. * tests/scripts/targets/POSIX: sh -x prints differently. * tests/scripts/variables/SHELL: Ditto.
* Update the copyright year on all filesPaul Smith2023-01-011-1/+1
|
* Update URLs to use https rather than httpPaul Smith2022-10-181-1/+1
| | | | | * (all): Change http:// to https:// * README.W32: Remove invalid link to mingw.org.
* Clean up some warnings on Windows buildsPaul Smith2022-10-031-14/+33
| | | | | | | | | | | | | | * src/arscan.c (parse_int): Avoid conversion from int to char and check for overflow given a max value. (ar_scan): Check intmax sizes then cast to the proper type. (ar_member_touch): Get proper return type from ar_scan and cast it to off_t. * src/function.c (a_word_hash_cmp): Don't cast from size_t to int. (func_filter_filterout): Count using unsigned long to avoid casts. (construct_include_path): Explicitly cast to void*. * src/shuffle.c (reverse_shuffle_array): Use size_t index. * src/w32/subproc/sub_proc.c (process_wait_for_multiple_objects): Initialize the return value in case the count is 0.
* * src/arscan.c (ar_scan): Avoid sign comparison warningsPaul Smith2022-10-031-2/+2
| | | | | | Pacify 12.2.1 20220819 (Red Hat 12.2.1-2) -Wsign-compare by checking the readbuf() return explicitly for errors then casting from ssize_t. Initial patch provided by Paul Eggert <eggert@cs.ucla.edu>.
* Support systems with 32-bit long and 64-bit time_tPaul Eggert2022-10-031-20/+24
| | | | | | | | | | | | | | | | | | | | | | | | | Don't assume that time_t fits in long, as some hosts (e.g., glibc x86 -D_TIME_BITS=64) have 32-bit long and 64-bit time_t. * bootstrap.conf (gnulib_modules): Add largefile, to support files with timestamps after Y2038 on hosts with 32-bit long. * configure.ac: Do not call AC_SYS_LARGEFILE, as the largefile module does that for us. * src/makeint.h (PRIdMAX, PRIuMAX, SCNdMAX): Define if not already defined (taken from gnulib). * src/ar.c: Include intprops.h, for TYPE_MAXIMUM, as INTEGER_TYPE_MAXIMUM does not work on time_t without issuing a bunch of warnings. (ar_member_date): Check that result is in time_t range. (ar_member_date_1): Use intmax_t to hold the date. (ar_glob_match): Ditto. * src/arscan.c (VMS_function, VMS_function_ret, ar_scan) (parse_int, ar_scan, ar_member_pos, ar_member_touch) (describe_member): Convert long int to intmax_t. * src/file.c (file_timestamp_sprintf): Use intmax_t/uintmax_t instead of long/unsigned long for values that might be time_t. * src/arscan.c (ar_member_touch): Fix buffer overrun if the timestamp is too large.
* * src/misc.c (make_toui): Parse a string into an unsigned intPaul Smith2022-06-041-7/+9
| | | | | | | | | * src/makeint.h: Declare it. * src/arscan.c (ar_scan): Replace atoi() calls with make_toui(). Modify some integral types to be more correct. * src/job.c (load_too_high): Replace atoi() calls with make_toui(). * src/main.c (main): Ditto. (decode_switches): Ditto.
* * <all>: Update copyright notices.Paul Smith2022-02-101-1/+1
|
* Avoid some valgrind warningsPaul Smith2020-11-291-5/+32
| | | | | | | | | | | Using sscanf() to parse archive header values (struct ar_hdr) can lead to valgrind warnings which are probably bogus but are annoying. To be safer, create a local method to convert the ASCII integer strings into integers. * src/arscan.c (parse_int): Turn integer strings into integers. (ar_scan): Initialize struct ar_hdr memory. Call parse_int() rather than sscanf/atol.
* Update copyright statements for 2020Paul Smith2020-01-031-1/+1
|
* * src/arscan.c (ar_scan): Restrict length for sscanf of ar_mode.Paul Smith2019-09-211-1/+1
|
* Pacify Oracle Studio 12.6Paul Eggert2019-09-021-1/+1
| | | | | | | | * src/arscan.c [VMS]: Use ‘#if !defined LBR$_HDRTRUNC’ instead of ‘#ifndef LBR$_HDRTRUNC’ to pacify Oracle Studio 12.6, which looks inside unused #if branches for preprocessor syntax errors. Without this patch it complains ‘"src/arscan.c", line 43: warning: tokens ignored at end of directive line’.
* Fix MS-Windows MinGW buildEli Zaretskii2019-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/w32/subproc/sub_proc.c (process_wait_for_multiple_objects): Fix format specifier for GetLastError's value. * src/job.c (reap_children): Define the 'remote_status_lose' label only for Posix platforms, to avoid compiler warning. * build_w32.bat (LNKOUT): New variable, using forward slashes. Use forward slashes in calls to :Compile, so that linking with GNU ld works. * src/makeint.h [!HAVE_UMASK]: Prototype for 'umask'. (UMASK, MODE_T): Don't define. * src/misc.c (get_tmpfile): Don't call UMASK, call umask, to avoid compilation warning on !HAVE_UMASK platforms. * src/output.c (output_tmpfd): Likewise. * src/misc.c (umask) [!HAVE_UMASK]: New no-op function. * src/config.h.W32.template (__USE_MINGW_ANSI_STDIO) [__MINGW32__]: Define to 1, to force Make use ANSI-compatible stdio functions, which also support the non-standard 'Id' and 'Ix' specifiers. (HAVE_UMASK) [__MINGW32__]: Define to 1. * src/arscan.c (ar_member_touch): Type-cast argument of strlen to avoid compiler warnings.
* Update copyright statements for 2019Paul Smith2019-05-191-1/+1
|
* * src/arscan.c (ar_member_touch): [SV 54533] Stop \0 in archive headersPaul Smith2018-09-161-3/+1
|
* Change output_write() to writebuf(), add readbuf() helper.Paul Smith2018-09-161-22/+15
| | | | | | | | | | | | | * src/misc.c (writebuf, readbuf): Create helper functions that will reliably write a buffer to a file descriptor in the face of EINTR causing short writes, and read from a file descriptor into a buffer in the face of EINTR causing short reads. * src/makeint.h: Declare these functions. * src/output.c: Remove output_write() and replace with writebuf(). (_outputs, out_of_memory): Call writebuf(), not output_write(). * src/arscan.c (ar_scan): Call readbuf() instead of read(2). (ar_member_touch): Remove duplicate header write, call writebuf() instead of output_write(), and readbuf() instead of read(2).
* * src/arscan.c (ar_scan): [SV 54395] Allow long names in archives.Ben Hutchings2018-08-041-3/+14
| | | | | | | | | | | | | | | Commit bc9d72beb0cb "Resolve issues discovered by static code analysis." added range checks on archive member name length. However, on non-AIX systems it also checked BSD-style long names against the short name limits and and checked the *offset* for GNU-style long names against the short name limits. This caused valid long names to be rejected. * Record the size of the GNU name map and validate offsets against it * Ensure that the last entry in the name map is null-terminated * Apply a maximum length of INT_MAX for element sizes Reported-by: Philipp Wolski <philipp.wolski@kisters.de>
* * all: Update Copyright statements for 2018Paul Smith2018-07-011-1/+1
|
* Rework directory structure to use GNU-recommended "src" directory.Paul Smith2017-11-191-0/+959
Move the source code (other than glob) into the "src" subdirectory. Update all scripting and recommendations to support this change. * *.c, *.h, w32/*: Move to src/ * configure.ac, Makefile.am, maintMakefile: Locate new source files. * Basic.mk.template, mk/*: Update for new source file locations. * NEWS, README.DOS.template: Update for new locations. * build.template, build_w32.bat, builddos.bat: Ditto. * po/POTFILES.in: Ditto * tests/run_make_tests.pl, tests/scripts/features/load*: Ditto. * make.1: Move to doc. * mk/VMS.mk: Add support for building on VMS (hopefully). * makefile.vms, prepare_w32.bat: Remove. * SCOPTIONS: Update to define HAVE_CONFIG_H