Commit Graph

130 Commits

Author SHA1 Message Date
Ed Schouten
c76f604ee9 Make code compile when basename() is POSIX compliant.
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
2016-05-19 20:03:01 +00:00
Bryan Drewery
bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
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
2016-02-24 17:20:11 +00:00
Bryan Drewery
bd9302d862 Check archive_entry_new() result.
Coverity CID:	1331341
2015-10-29 19:28:21 +00:00
Ed Maste
a84c4d189b ar: Deobfuscate a while loop 2015-08-31 18:07:17 +00:00
Ed Maste
a64a36e280 ar: fix deterministic mode when running as ranlib
This was broken by r286024.

PR:		202741
Submitted by:	fk@fabiankeil.de
Obtained from:	ElectroBSD
2015-08-31 12:28:13 +00:00
Ed Maste
a80ac30b2d ar: Fix deterministic mode default with options other than -q or -r
Reported by:	jhibbits
Reviewed by:	jhibbits
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3237
2015-07-29 17:34:26 +00:00
Ed Maste
fc964cbf4e ar: enable deterministic mode by default
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
2015-07-29 13:36:17 +00:00
Ed Maste
7072861cd0 ar: add -U (unique) option to disable -D (deterministic) mode
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
2015-07-24 17:46:43 +00:00
Ed Maste
01715d8cd1 speed up ar(1) on UFS file systems
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
2015-06-29 13:48:44 +00:00
Simon J. Gerraty
2ef6d5a7b9 new depends 2015-06-16 23:37:19 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
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
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Ed Maste
0f9b4b57c1 Avoid escaping EOL for line continuation
Reported by:	kib
2015-04-09 15:08:39 +00:00
Ed Maste
56ad941995 ar: Disallow directory traversal
Set ARCHIVE_EXTRACT_SECURE_SYMLINKS and ARCHIVE_EXTRACT_SECURE_NODOTDOT
as in bsdtar to prevent extraction of archive entries whose pathnames
contain .. or whose target directory would be altered by a symlink.
Also disallow absolute pathnames.

We don't currently provide an option to disable this behaviour (as
bsdtar's -P does). It is unlikely to be a problem in practice for ar(1),
but the -P option is not currently used and available if we want to
consider it for this purpose.

Differential Revision:	https://reviews.freebsd.org/D1524
Reported by:	Alexander Cherepanov <cherepan@mccme.ru>
Approved by:	delphij
Obtained from:	ELF tool chain ar, Ticket #474
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2015-04-09 13:45:17 +00:00
Ed Maste
63bf16a1c4 ar: Avoid null pointer deref while reading corrupt archives
ELF Tool Chain ticket #467

Reported by:	Alexander Cherepanov <cherepan@mccme.ru>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2015-01-07 01:51:02 +00:00
Baptiste Daroussin
3e11bd9e2a Convert to usr.bin/ to LIBADD
Reduce overlinking
2014-11-25 14:29:10 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin
2b7af31cf5 use .Mt to mark up email addresses consistently (part3)
PR:		191174
Submitted by:	Franco Fichtner  <franco at lastsummer.de>
2014-06-23 08:23:05 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Jung-uk Kim
9c5a52cf88 Work around build breakages with GCC 4.2.
Reported by:	tinderbox
2013-05-23 05:42:35 +00:00
Jung-uk Kim
a7880d59c9 Improve compatibility with recent flex from flex.sourceforge.net. 2013-05-03 23:51:32 +00:00
Ed Schouten
7e659f9491 Add the Clang specific -Wmissing-variable-declarations to WARNS=6.
This compiler flag enforces that that people either mark variables
static or use an external declarations for the variable, similar to how
-Wmissing-prototypes works for functions.

Due to the fact that Yacc/Lex generate code that cannot trivially be
changed to not warn because of this (lots of yy* variables), add a
NO_WMISSING_VARIABLE_DECLARATIONS that can be used to turn off this
specific compiler warning.

Announced on:	toolchain@
2013-04-19 19:45:00 +00:00
Simon J. Gerraty
89e0f621b2 New/updated dependencies 2013-04-14 01:22:39 +00:00
Simon J. Gerraty
69e6d7b75e sync from head 2013-04-12 20:48:55 +00:00
Martin Matuska
acc60b03c1 MFV r248590,248594:
Update libarchive to 3.1.2

Some of new features:
  - support for lrzip and grzip compression
  - support for writing tar v7 format
  - b64encode and uuencode filters
  - support for __MACOSX directory in Zip archives
  - support for lzop compresion (external utility)
2013-03-22 13:36:03 +00:00
Martin Matuska
ebb8fc42be Replace deprecated (or remove obsolete) libarchive 2.8 functions
with libarchive 3.0 counterparts
2013-03-22 10:17:42 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Eitan Adler
5d08632eba Mark bsdar_errc as __dead2 to help code analysis tools.
PR:		bin/172636
Submitted by:	Erik Cederstrand <erik@cederstrand.dk>
Approved by:	cperciva
MFC after:	3 days
2012-10-22 02:12:06 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Baptiste Daroussin
5e2a209a27 Fix world after byacc import:
- old yacc(1) use to magicially append stdlib.h, while new one don't
- new yacc(1) do declare yyparse by itself, fix redundant declaration of
  'yyparse'

Approved by:	des (mentor)
2012-05-22 16:33:10 +00:00
Konstantin Belousov
4f20e4f263 Add src.conf option WITH_SHARED_TOOLCHAIN to enable building the
toolchain binaries as dynamically linked.  Option is disabled by
default.

Reviewed by:	ru (previous version)
MFC after:	2 weeks
2012-04-29 09:32:44 +00:00
Martin Matuska
6c95142e79 Update libarchive to 3.0.3
Some of new features:
  - New readers: RAR, LHA/LZH, CAB reader, 7-Zip
  - New writers: ISO9660, XAR
  - Improvements to many formats, especially including ISO9660 and Zip
  - Stackable write filters to write, e.g., tar.gz.uu in a single pass
  - Exploit seekable input; new "seekable" Zip reader can exploit the Zip
    Central Directory when it's available; the old "streamable" Zip reader
    is still fully supported for cases where seeking is not possible.

Full release notes available at:
	https://github.com/libarchive/libarchive/wiki/ReleaseNotes
2012-02-25 10:58:02 +00:00
Glen Barber
0f13c0f4a8 Whitespace cleanup:
ar/ar.1:
 - Remove trailing whitespace

Reported by:		igor
MFC after:		1 week
X-MFC-With:		r228823
2011-12-23 00:31:26 +00:00
Glen Barber
dce762dd44 Formatting fixes:
hexdump/od.1:
 - Enclose tabbed content in quotes [1]

ar/ar.1:
 - Enclose tabbed content in quotes [1]

rctl/rctl.8:
 - Enclose tabbed content in quotes [1]
 - Start a sentence on a newline [2]

Reported by:		manlint [1], igor [2]
MFC after:		1 week
X-MFC-after:		9.0-RELEASE
2011-12-23 00:29:01 +00:00
Ed Maste
cf933f5bf9 Don't try to free() an address returned by mmap(). This appears to be
triggered by the same .o being included twice on the command line.

Found by:	Nima Misaghian at Sandvine
Reviewed by:	kientzle, kaiw
Approved by:	re
MFC after:	1 week
2011-08-04 14:18:09 +00:00
Benedict Reuschling
6bef5d2865 Correct typos in comments, no functional changes.
Found by:	codespell
Reviewed by:	kaiw
MFC after:	1 week
2011-05-20 11:29:09 +00:00
Kai Wang
b60d416b6b Document the syntax accepted by the -M option.
Obtained from:	elftoolchain
2010-12-26 18:15:32 +00:00
Kai Wang
da9c9ea458 Improve the description of the -q option.
Obtained from:	elftoolchain
2010-12-26 18:12:13 +00:00
Kai Wang
3a870f82fc * Add mention of the -f, -q, -S, and -V options in the synopsis
section.
* Document the `-l`, `-M` and `-S` options.
* Improve the text describing the behavior of the `-r` option.
* Start a section on standard compliance.
* Indicate in the synopsis that the `-S` and `-s` options are mutually
  exclusive.

Obtained from:	elftoolchain
2010-12-26 18:10:39 +00:00
Kai Wang
773810fb45 Add option -D for ranlib(1). When -D is speicified, ranlib(1) will generate
a deterministic archive symbol table (i.e. timestamp for the symbol table
member header is set to 0).

Submitted by: 	 Erik Cederstrand
2010-11-28 18:53:57 +00:00
Rebecca Cran
1161d4202c Fix some more warnings found by clang. 2010-11-22 20:10:48 +00:00
Tim Kientzle
0e479ac8f7 Add -D (deterministic) option to ar.
When set, it forces all timestamps and owners to zero and
modes to 0644.  Useful for producing libraries that are
bitwise identical across multiple build runs.

Submitted by:	Erik Cederstrand
Reviewed by:	Kai Wang
2010-10-09 05:31:08 +00:00
Ulrich Spörlein
32ba16b6e6 Fix a couple of typos.
PR:		docs/148891
Submitted by:	olgeni
MFC after:	1 week
2010-07-30 11:58:18 +00:00
Kai Wang
5dfab45b42 Removed ar(1)'s support for compressed archives. This change removes
ar(1)'s dependencies on compressor libraries -lz, -lbz2 and -llzma and
fixes building HEAD on some versions of FreeBSD[78]. Option -j and -z
is now accepted but ignored.

Compressed ar(1) archives are not useful without a ld(1) that can read
them. Also, the current ar(1) compression scheme prevents random
access of archive members and needs to be redesigned anyway.

Submitted by:	kientzle (original patch)
Reviewed by:	delphij
Discussed on:	-current mailing list
2010-05-17 09:37:59 +00:00