aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/ar
Commit message (Collapse)AuthorAgeFilesLines
* ar(1): Fix grammar error in write.cLO WEN-CHIEN2024-02-131-1/+1
| | | | | Event: Advanced UNIX Programming Course (Fall’23) at NTHU Pull Request: https://github.com/freebsd/freebsd-src/pull/1013
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-166-12/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* retire SHARED_TOOLCHAIN knobEd Maste2023-08-021-3/+0
| | | | | | | | | | | | | Toolchain components were historically statically linked. They became normal dynamically linked executables in commit 6ab18ea64d19. There is no need to keep a special case build option for the toolchain; users who want statically linked toolchain (or any other) components can use the existing NO_SHARED knob. Reviewed by: dim, sjg Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41266
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-126-6/+6
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-7/+0
|
* ar: Avoid overwriting the stdout file stream pointerMark Johnston2022-01-274-19/+17
| | | | | | | | | | | | This doesn't work with musl, which defines stdout as FILE * const. Instead, explicitly pass the desired output stream to ar_read_archive(). No functional change intended. Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34064
* ar: accept but ignore 'T' optionEd Maste2022-01-032-5/+3
| | | | | | | | | | | | | | | | | | | In previous versions of BSD ar -T was an alias for -f -- use only the first 15 characters of archive member names. In GNU ar and LLVM ar -T creates a thin archive. The -f / old BSD ar -T functionality is not particularly useful, and ignoring -T still results in a usable and compatible (but not thin) archive. An exp-run found a few ports invoking ar -T but they all expect thin archives. In addition, -T will be used to specify thin archives after a migration to LLVM-ar. PR: 260523 [exp-run] Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33553
* ar: deprecate -T optionEd Maste2021-12-292-6/+14
| | | | | | | | | | | | | | | | | | Other ar implementations (GNU, LLVM) use -T to mean thin archive rather than use only the first fifteen characters of the archive member name. We support both -T and -f for this, with -f documented as an alias of -T. An exp-run showed that the ports invoking `ar -T` expect thin archives, not truncated names. Switch -f to be the documented flag for this behaviour, and emit a warning when -T is used. The warning will be changed to an error in the future (in main), once ports no longer use -T. PR: 260523 [exp-run] MFC after: 1 week Sponsored by: The FreeBSD Foundation
* ar: remove duplicate function declaration in headerEd Maste2021-08-131-1/+0
| | | | Sponsored by: The FreeBSD Foundation
* ar: diff reduction against ELF Tool ChainEd Maste2021-08-135-108/+28
| | | | | | | | | | | | | Remove ar_mode_* wrappers and call ar_read_archive / ar_write_archive directly. (This was originally committed in d20e9e02db3d but reverted due to a regression, now fixed with an update from cy@.) Obtained from: ELF Tool Chain Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31496
* ar: diff reduction against ELF Tool ChainEd Maste2021-08-136-75/+59
| | | | | | | | | | Drop exit status from bsdar_errc. ELF Tool Chain always returns EXIT_FAILURE in bsdar_errc. Recommit of one part of d20e9e02db3d / review D31496. Obtained from: ELF Tool Chain Sponsored by: The FreeBSD Foundation
* Revert "ar: diff reduction against ELF Tool Chain"Ed Maste2021-08-126-85/+182
| | | | | | | This reverts commit d20e9e02db3dde383c3de1ce8cec3a8c35b3eee6. It caused port build failures. Reported by: cy
* ar: diff reduction against ELF Tool ChainEd Maste2021-08-116-182/+85
| | | | | | | | | | | | | - Drop exit status from bsdar_errc. ELF Tool Chain always returns EXIT_FAILURE in bsdar_errc. - Remove ar_mode_* wrappers and call ar_read_archive / ar_write_archive directly. Obtained from: ELF Tool Chain Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31496
* ar: remove invalid extra param in bsdar_warnc callsEd Maste2021-08-111-6/+6
| | | | | | | | A number of warnings passed an exit status code to bsdar_warnc, but it does not take exit status (as a warning, it does not exit). MFC after: 1 week Sponsored by: The FreeBSD Foundation
* ar: provide error exit status upon failureEd Maste2021-08-106-77/+100
| | | | | | | | | | | | | | | Previously ar and ranlib returned with exit status 0 (success) in the case of a missing file or other error. Update to use error handling similar to that added by ELF Tool Chain after that project forked FreeBSD's ar. PR: PR257599 [exp-run] Reported by: Shawn Webb, gehmehgeh (on HardenedBSD IRC) Reviewed by: markj Obtained from: elftoolchain MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31402
* Fix some common typos in commentsGordon Bergling2021-03-131-2/+2
| | | | | | | | | | | - occured -> occurred - normaly -> normally - controling -> controlling - fileds -> fields - insterted -> inserted - outputing -> outputting MFC after: 1 week
* ar: use more correct size_t type for loop indexEd Maste2019-09-011-3/+3
| | | | | | | | Submitted by: cem MFC after: 1 week Notes: svn path=/head/; revision=351663
* ar: shuffle symbol offsets during conversion for 32-bit ar archivesEd Maste2019-04-221-19/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | During processing we maintain symbol offsets in the 64-bit s_so array, and when writing the archive convert to 32-bit if no offsets are greater than 4GB. However, this was somewhat inefficient as we looped over the array twice: first, converting to big endian and second, writing each 32-bit value one at a time (and incorrectly so on big-endian platforms). Instead, when writing a 32-bit archive shuffle convert symbol data to big endian (as required by the ar format) and shuffle to the beginning of the allocation at the same time. Also correct emission of the symbol count on big endian platforms. Further changes are planned, but this should fix powerpc64. Reported by: jhibbits, mlinimon Reviewed by: jhibbits, Gerald Aryeetey (earlier) Tested by: jhibbits MFC after: 10 days MFC with: r346079 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20007 Notes: svn path=/head/; revision=346582
* ar: use array notation to access s_soEd Maste2019-04-221-4/+4
| | | | | | | | | | | This is somewhat more readable than pointer arithmetic. Also remove an unnecessary cast while here. MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=346569
* ar: test for writing 64-bit format only if symbol count is nonzeroEd Maste2019-04-221-3/+0
| | | | | | | | | | | This is a minor simplification; if we do not have any symbols the empty symbol table can be in 32-bit format. MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=346568
* ar: implement support for /SYM64/ 64-bit archivesEd Maste2019-04-103-21/+51
| | | | | | | | | | | | PR: 234454 Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com> Reviewed by: imp (earlier) MFC after: 3 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18793 Notes: svn path=/head/; revision=346079
* ar: detect and error out on 32-bit symbol table overflowEd Maste2018-12-281-0/+3
| | | | | | | | | | | | | | | | | BSD ar currently does not support the /SYM64/ 64-bit symbol table, and previously truncated to 32-bits, silently producing corrupted archives larger than 4GB. This is another overflow case in addtion to r342575. PR: 234454 Reported by: Aijaz Baig, imp MFC after: 2 weeks MFC with: r342575 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=342580
* ar: detect and error out on 32-bit symbol table overflowEd Maste2018-12-281-1/+5
| | | | | | | | | | | | | | | | BSD ar currently does not support the /SYM64/ 64-bit symbol table, and previously truncated to 32-bits, silently producing corrupted archives larger than 4GB. Note that this is only a partial fix; additional checks will come. PR: 234454 Reported by: Aijaz Baig, imp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=342575
* ar: report errno on warning/errorEd Maste2018-10-234-12/+15
| | | | | | | | | | | | | | Previously ar would report an error like "ar: fatal: Write error" without including additional errno information. Change warnings and errors to include archive_errno() so that the user may have some idea of the reason for the failure. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17650 Notes: svn path=/head/; revision=339648
* usr.bin/ar: use standard 2-Clause FreeBSD licenseEd Maste2018-06-203-36/+42
| | | | | | | | | | | | | | Many licenses on ar files contained small variations from the standard FreeBSD license text. To avoid license proliferation switch to the usual 2-clause FreeBSD license after obtaining permission from all copyright holders. Approved by: jkoshy, kaiw, kientzle Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14561 Notes: svn path=/head/; revision=335454
* usr.bin/ar: remove incorrect SPDX tagsEd Maste2018-06-193-6/+0
| | | | | | | | | | Three ar files have a non-standard variation of the BSD license, so remove their SPDX tags. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=335377
* usr.bin/ar: use standard 2-Clause FreeBSD licenseEd Maste2018-06-194-48/+48
| | | | | | | | | | | | | Many licenses on ar files contained small variations from the standard FreeBSD license text. To avoid license proliferation switch to the usual standard 2-clause FreeBSD license for those files where I have obtained permission from all of the listed copyright holders. Approved by: jkoshy, kaiw Differential Revision: https://reviews.freebsd.org/D14561 Notes: svn path=/head/; revision=335376
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-276-0/+12
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* ar: handle partial writes from archive_write_dataEd Maste2017-07-241-3/+10
| | | | | | | | | | | | | libarchive may limit a single archive_write_data call to handling 0x7fffffff bytes. Add a loop to handle partial writes. Reviewed by: kib, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D11715 Notes: svn path=/head/; revision=321436
* ar: enable reproducible output by default when invoked as 'ar -s'Ed Maste2016-06-162-3/+9
| | | | | | | | | | | | | | | | ar output is already deterministic by default for ar -q and ar -r, and when invoked as ranlib. Make ar -s equivalent to ranlib and enable deterministic output by default in that case too. PR: 210330 Reviewed by: bdrewery Approved by: re (gjb) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6871 Notes: svn path=/head/; revision=301974
* Make code compile when basename() is POSIX compliant.Ed Schouten2016-05-261-1/+6
| | | | | | | | | | | | | In addition to the previous change I made to ar.c, pull in another basename() related fix. This change is similar to the one made to the ELF Toolchain version of ar, with the difference that the ELF Toolchain version lacks error handling for the strdup() call. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D6467 Notes: svn path=/head/; revision=300741
* Make code compile when basename() is POSIX compliant.Ed Schouten2016-05-191-2/+2
| | | | | | | | | | | | If basename() uses "char *", we shouldn't do the intermediate assignment, as that field is of type "const char *". Simply call basename() on the command line argument directly. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D6463 Notes: svn path=/head/; revision=300227
* DIRDEPS_BUILD: Regenerate without local dependencies.Bryan Drewery2016-02-241-6/+0
| | | | | | | | | | | These are no longer needed after the recent 'beforebuild: depend' changes and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports skipping 'make depend'. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=295989
* Check archive_entry_new() result.Bryan Drewery2015-10-291-0/+9
| | | | | | | Coverity CID: 1331341 Notes: svn path=/head/; revision=290157
* ar: Deobfuscate a while loopEd Maste2015-08-311-1/+1
| | | | Notes: svn path=/head/; revision=287327
* ar: fix deterministic mode when running as ranlibEd Maste2015-08-311-0/+3
| | | | | | | | | | | This was broken by r286024. PR: 202741 Submitted by: fk@fabiankeil.de Obtained from: ElectroBSD Notes: svn path=/head/; revision=287324
* ar: Fix deterministic mode default with options other than -q or -rEd Maste2015-07-291-8/+18
| | | | | | | | | | Reported by: jhibbits Reviewed by: jhibbits Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3237 Notes: svn path=/head/; revision=286024
* ar: enable deterministic mode by defaultEd Maste2015-07-292-0/+3
| | | | | | | | | | | | | | | Ar cannot handle UIDs with more than 6 digits, and storing the mtime, uid, gid and mode provides little to negative value anyhow for ar's uses. Turn on deterministic (-D) mode by default; it can be disabled by the user with -U. PR: 196929 Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3190 Notes: svn path=/head/; revision=286010
* ar: add -U (unique) option to disable -D (deterministic) modeEd Maste2015-07-242-7/+34
| | | | | | | | | | | | | | | | This is required in order for us to support deterministic mode by default. If multiple -D or -U options are specified on the command line, the final one takes precedence. GNU ar also uses -U for this. An equivalent change will be applied to ELF Tool Chain's version of ar. PR: 196929 MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3175 Notes: svn path=/head/; revision=285844
* speed up ar(1) on UFS file systemsEd Maste2015-06-291-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fault in the buffer prior to writing to workaround poor performance due to interaction with kernel fs deadlock avoidance code. See the comment prior to vn_io_fault_doio() in sys/kern/vfs_vnops.c for details of the issue. On my stable/10 desktop with a 16MB obj.o and "ar r out.a obj.o" I see the following run times (seconds): x ar.r284891 + ar.patched +----------------------------------------------------------------------+ |+ | |+ x| |+ xx| |A |A| +----------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 1.307 1.321 1.315 1.3143333 0.0070237692 + 3 0.020 0.023 0.022 0.021666667 0.0015275252 Difference at 95.0% confidence -1.29267 +/- 0.0115203 -98.3515% +/- 0.876513% (Student's t, pooled s = 0.00508265) Thanks to kib for diagnosing and explaining the issue and suggesting the workaround. Reviewed by: eadler, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2933 Notes: svn path=/head/; revision=284928
* new dependsSimon J. Gerraty2015-06-161-0/+1
| | | | Notes: svn path=/head/; revision=284481
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+32
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-273-4/+18
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Merge head from 7/28Simon J. Gerraty2014-08-191-1/+1
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=270164