History log of /freebsd-10-stable/usr.sbin/pkg_install/lib/
Revision Date Author Comments
256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


252363 29-Jun-2013 obrien

sysconf(3) returns a long, not an int.


252348 28-Jun-2013 obrien

sysconf(3) returns a long, not an int.


245837 23-Jan-2013 jasone

Fix compilation errors.


245828 22-Jan-2013 bapt

Use snprintf instead of strc* functions and add bounds checking when creating
pkgngpath

Submitted by: sbz, gahr


243554 26-Nov-2012 eadler

Provide an option to users to shoot themselves in the foot.

Reviewed by: bapt
Approved by: cperciva
MFC after: 1 month


243553 26-Nov-2012 eadler

Use modern license instead of being consistent with the other pkg_ tools
Use a more informative message
Fix some style(9) nits.
Bump version number
In pkg_add only warn users after the chroot is performed.

Submitted by: gavin, jilles
Reviewed by: beat, bapt
Approved by: cperciva
MFC after: 1 month


241830 22-Oct-2012 eadler

Warn users when using pkg tools if it looks like they
be be pkgng users.

Reviewed by: bapt (earlier version)
Reviewed by: kwm
Approved by: cperciva
MFC after: 3 days


241021 28-Sep-2012 kevlo

Make sure that each va_start has one and only one matching va_end,
especially in error cases.


240682 18-Sep-2012 bapt

if a file in plist starts with / then do not prefix it with "prefix" [1]
pkg info -g returns 1 if a file mismatch [2]
flush stdout in pkg info -g [3]
clean up quiet mode (-q | --quiet) output of pkg_version(1) [4]
fix missing error call in uname check added to pkg_version(1) [5]
fix pkg_add(1) fails to install with -C from bad path [6]
only resolve path from pkg_add(1) -p if the given prefix do not start with a '/' [7]

PR: bin/13128 [1]
bin/139015 [2]
bin/113702 [3]
bin/142570 [4]
bin/146857 [5]
bin/157543 [6]
Submitted by: cy [1]
Anton Yuzhaninov <citrin@citrin.ru> [2]
Ighighi <ighighi@gmail.com> [3]
"N.J. Mann" <njm@njm.me.uk> [4]
gcooper [5]
David Naylor <naylor.b.david@gmail.com> [6]
netchild [7]
MFC after: 2 weeks


240476 14-Sep-2012 jkim

Do not change owner, group, or mode when package database directory and
its contents are created with pkg_add(1). It may happen when the packing
list contains @owner, @group, or @mode.

Reported by: Donald Bostrom (dbostrom at niksun dot com)
Reviewed by: portmgr (bapt)


236336 30-May-2012 jpaetzel

Bump PKG_INSTALL_VERSION which should've been done in r236233

MFC after: 3 days
Pointed out by: bapt


236333 30-May-2012 jpaetzel

Let pkg_add use the ENV variable PACKAGESUFFIX. This
can be used to override the default .tbz package extension to
.txz .tgz or .tar

Submitted by: kmoore
Obtained from: PC-BSD
Sponsored by: iXsystems
MFC after: 3 days


236213 29-May-2012 kevlo

Make sure that each va_start has one and only one matching va_end,
especially in error cases.


235276 11-May-2012 beat

- Print package name in case an empty pkgdep line is found.

PR: bin/164378
Submitted by: Yuri <yuri AT tsoft.com> and many others
Approved by: flz
MFC after: 2 weeks


229655 05-Jan-2012 uqs

Touch up some more small typos missed in the previous round.

Reported by: Ben Kaduk <minimarmot@gmail.com> et al.


228990 30-Dec-2011 uqs

Spelling fixes for usr.sbin/


227458 11-Nov-2011 eadler

- add a missing "be" and "in"
- fix other errors introduced when committing r226436
- add 'function' to a sentence where it makes sense

Submitted by: delphij
Submitted by: dougb
Submitted by: jhb
Approved by: dougb
Approved by: jhb


226436 16-Oct-2011 eadler

- change "is is" to "is" or "it is"
- change "the the" to "the"

Approved by: lstewart
Approved by: sahil (mentor)
MFC after: 3 days


222035 17-May-2011 flz

Backout libinstall.a -> libpkg commit.

Discussed with: erwin, brooks, bapt


206133 03-Apr-2010 flz

Bump PKG_INSTALL_VERSION to 20100403.


206132 03-Apr-2010 flz

Fix pkg_delete, check if the file we're trying to delete is a
symlink before complaining that it doesn't exist. Typical case
would be a leftover library symlink that's left over after the
actual library has been removed.

Reported by: tabthorpe


206043 01-Apr-2010 flz

Various fixes.

- Replace hardcoded INDEX version. [1]
- Fix a buffer overlap. [2]
- Remove empty package when fetching fails and -K is used. [3]
- Remove useless chmod2() after mkdtemp(3). [4]
- Replace mkdir(1) call with mkdir(2). [5]
- Get rid of some vsystem() calls.
- Switch from lstat(2) to open(2) in fexists().
- Try rename(2) in move_file() first.
- Bump PKG_INSTALL_VERSION to 20100401.

PR: bin/145101 [1], bin/139492 [2], bin/144919 [3]
bin/144920 [4], bin/144921 [5]
Submitted by: gcooper [1,2,3,4,5]


202844 22-Jan-2010 flz

- Add support for UPDATING remote fetching.
- Reorganize EXAMPLES section in pkg_updating(1).
- Style fixes.
- Bump PKG_INSTALL_VERSION to 20100122.

Submitted by: beat
MFC after: 1 week


196766 02-Sep-2009 flz

- Bump PKG_INSTALL_VERSION to 20090902 after dougb's changes.
- Change the comment to say that version must be changed when a
non-cosmetic change is made.


196706 31-Aug-2009 dougb

Add support for INDEX-9 [1]

While I'm here, strip off support for FreeBSD 5.x.

Submitted by: Alexey Shuvaev <shuvaev@physik.uni-wuerzburg.de> [1]


195212 30-Jun-2009 brian

Don't imply that only FTP urls are supported when we can't fetch
a package.

Approved by: re (kib)
MFC after: 3 weeks


194497 19-Jun-2009 brian

When running pkg_add -r, check & install our dependencies for each
package rather than expecting our top level package to get all of
the dependencies correct.

Previously, the code depended on the top level package having all
of the pkgdep lines in +CONTENTS correct and in the right order,
but that doesn't always happen due to code such as this (in
security/gnutls/Makefile):

.if (defined(WITH_LZO) || exists(${LOCALBASE}/lib/liblzo2.so)) && !defined(WITHOUT_LZO)
LIB_DEPENDS+= lzo2:${PORTSDIR}/archivers/lzo2
....

With such conditional dependencies, my 'sophox-packages' package won't
install. The dependency tree looks like this:

sophox-packages
...
x11/gnome2
x11/gnome-applets
net/libgweather
devel/libsoup
security/gnutls
security/libgcrypt
security/libgpg-error
...
x11/gnome2
archivers/file-roller
archivers/gtar
archivers/lzop
archivers/lzo2
...

gnutls doesn't depend on lzo2 initially, but lzo2 is dragged into the
mix via other dependencies and is built by the initial 'make'. The
subsequent package generation for gnutls adds a pkgdep line for lzo2
to gnutls' +CONTENTS but the pkgdeps in sophox-packages' +CONTENTS
has gnutls *before* lzo2.

As a result, sophox-packages cannot install; gnutls fails because lzo2
is missing, 82 more packages fail because gnutls is missing and the
whole thing spirals into a super-confusing mess!

MFC after: 3 weeks


192382 19-May-2009 flz

Skip @pkgdep if there's no argument.

Submitted by: pav
MFC after: 1 week


186835 06-Jan-2009 flz

- Backout latest changes (follow symlinks: r186496, r186518).
- Bump PKG_INSTALL_VER to 20090106.


186518 27-Dec-2008 flz

Fix memory leaks introduced in last commit.
Bump version to 20081227.

Reported by: gcooper
Submitted by: Andrea Barberio <insomniac@slackware.it>
MFC after: 1 month


186496 25-Dec-2008 flz

Follow symlinks when deleting directories.
Bump PKG_INSTALL_VER to 20081225 (Merry Christmas \o/).

PR: bin/54446
Submitted by: Andrea Barberio <insomniac@slackware.it>
MFC after: 1 month


181376 07-Aug-2008 phk

Use humanize_number to report pen-sizes so people don't have to count
the digits when trying to install openoffice.


180361 08-Jul-2008 keramida

Enable the -n option of pkg_create(1).

The changes to make the option work are already in place, but I missed
the patch hunk that adds it to the getopt() option-handling loop.

Pointy hat: keramida
Approved by: flz
MFC after: 1 week


179835 16-Jun-2008 flz

Remove support for RELENG_4 (__FreeBSD_version < 500039).

MFC after: 1 day


179760 12-Jun-2008 flz

- add: Keep dependent packages too if -K is specified.
- updating: terminating '\n' is not part of the package origin.
- bump PKG_INSTALL_VERSION to 20080612.

PR: bin/119368 [1], bin/124459 [2]
Submitted by: gcooper [1], Beat Gatzi <beat@chruetertee.ch> [2]
MFC after: 3 days


179433 30-May-2008 flz

- Add long options to pkg_install.
- Remove check for '-?' as it's not listed in authorized options.
- Bump PKG_INSTALL_VERSION to 20080530.


179373 28-May-2008 flz

Bump PKG_INSTALL_VERSION to 20080528.

X-MFC after: latest HEAD changes have been MFC'ed to RELENG_[67]


178753 03-May-2008 pav

- Restore functionality broken in previous commit; we need to be able to report
multiple installed packages with the same PKGORIGIN.

Reported by: marcus
MFC after: 1 month


178103 11-Apr-2008 pav

Optimize package registration/deregistration. Previously, when looking up the
package name for the origin of a dependency, all entries in /var/db/pkg were
traversed for each dependency of added/removed package. Now, gather all the
origins first, then do the lookup in a single pass over /var/db/pkg.

This should provide a major speedup for packages with hundreds of dependencies.

Submitted by: rdivacky (earlier version)
MFC after: 1 month


173514 10-Nov-2007 krion

Some code cleanups, including removing of stale getopt argument and
hardcoded +CONTENTS defines.

PR: bin/117855
Submitted by: Beat Gaetzi <beat@chruetertee.ch>
MFC after: 14 days


173291 02-Nov-2007 krion

Momoize the results of isinstalledpkg()

PR: bin/116452
Submitted by: wollmann
MFC after: 7 days


172723 17-Oct-2007 krion

Add whitespace.


172722 17-Oct-2007 krion

Update for INDEX-8 support.


170947 18-Jun-2007 pav

- Replace rather inefficient bubble sort with a recursive depth-first search.
This speeds up registration of packages considerably.
- style(9) police welcome!

PR: bin/112630
Submitted by: Stephen Montgomery-Smith <stephen@cauchy.math.missouri.edu>
Tested by: bento i386 experimental run
MFC after: 14 days


167972 28-Mar-2007 njl

Make consistent with style(msmith). 4 spaces indent, tab for each 2 indents.


167270 06-Mar-2007 ru

Invoke tar(1) with the -p option when installing a package
from an URL (i.e., do it the same way as when installing
from a file). This fixes the lossage of the setuid bits.
It wasn't a problem before because GNU tar(1) implied the
-p option for root, but BSD tar(1) doesn't do that.

Discussed with: tobez and some advanced users :)


161212 11-Aug-2006 des

Cosmetic: fix indentation.


160178 08-Jul-2006 des

Turn on libfetch debugging if -v was specified on the command line.

MFC after: 2 weeks


159554 12-Jun-2006 obrien

Allow variable amounts of verbosity.


157809 17-Apr-2006 krion

Add INDEX-7 and remove trailing spaces.

MFC after: 5 days


154145 09-Jan-2006 flz

Add -K option to pkg_add and pkg_info.
This option saves packages to PKGDIR (if defined or current directory by default)
as they are downloaded.
Silent a warning when -n is used and package has a +DISPLAY file.

Approved by: krion
MFC after: 1 week


154102 07-Jan-2006 krion

When using @cwd %%FOO%%, we must ensure to return in the original
prefix later, but doing so with @cwd %%OLDPREFIX%% (having
PLIST_SUB+="OLDPREFIX=${PREFIX}") hardcodes the value in the packing
list. That's not really a problem when dealing with ports but that's
a problem with packages since pkg_add -p option only overrides the
first @cwd occurrence.

This patch allow us to use @cwd without any argument. If no
directory argument is given, it will set current working directory
to the first prefix given by the @cwd command.

PR: bin/77212
Submitted by: flz


150530 24-Sep-2005 krion

Do not bitch about bsdpan modules not having origin.

Based on PR: bin/82269
Submitted by: Steven Hartland <killing at multiplay dot co dot uk>
MFC after: 3 days


147632 27-Jun-2005 jmg

remove a few uses of the word `really'

Reviewed by: hrs
Approved by: re (scottl)
MFC after: 1 week


147381 14-Jun-2005 krion

Implement @noinst field which has at the moment the same meaning and
function as @comment has. But will be valid only for files and not
for md5 sums, rcsid's and comments in the future.

Submitted by: flz
Approved by: re@ (scottl)


139676 04-Jan-2005 paul

Use INDEX-6 for versions of FreeBSD > 600000


136910 24-Oct-2004 ru

For variables that are only checked with defined(), don't provide
any fake value.


136643 18-Oct-2004 obrien

Add a -q flag to pkg_version. It suppresses the output of <,=,>.
This makes it possible to "portupgrade `pkg_version -q -l '<'`".


133596 12-Aug-2004 ru

Don't put DEBUG to CFLAGS, we have the standard DEBUG_FLAGS for this.


132799 28-Jul-2004 stefanf

Use the length modifier 'll' instead of 'q' to print long longs.


132789 28-Jul-2004 kan

Downgrade WARNS level to more tolerable value. Attempt to fix
casts as lvalue usage whenever possible.


131285 29-Jun-2004 eik

- pkg_add spawns itself as argv[0] when installing dependent packages, to
enable the use as a port on older systems

- use absolute paths in all calls to external programs, to account for strange
PATH settings

- use INDEX or INDEX-5 depending on FreeBSD version, to enable the use on
FreeBSD 4.x as a port.

- conditionalize all 4.x/5.x differences on __FreeBSD_version, so that the
pkg_install tools can be kept in sync on 4.x and 5.x

- Bump PKG_INSTALL_VERSION

Reviewed by: portmgr (bento run)
MFC after: 4 weeks


131280 29-Jun-2004 eik

- pkg_info: flag -r: (show packages this packages depends on (documentation change))

- pkg_info: new flag -j (show the requirements script)

- pkg_info: fix verbose output when used on packages

- better handling of corrupt entries in /var/db/pkg

- differ between corrupt entires and packages not installed

- various small fixes

PR: 56989, 57016, 57029, 26468


131275 29-Jun-2004 eik

- match package version numbers with relational operators

- use glob patterns when matching packages by origin

- csh-style {...} choices in glob matching

- pkg_info: new flag -E (list matching package names only)

- pkg_version: new flag -T (test if a given name matches a pattern)

- new flag -X (interpret pattern as an extended regular expression)

PR: 56961


131274 29-Jun-2004 eik

- complete rewrite of the version number parsing code, restoring compatibiliy of 5.x with 4.x and portupgrade

- parse version numbers of ports containing an underscore followed by a number correctly

- handle special strings pl, alpha, beta, pre and rc

PR: 56961


128026 08-Apr-2004 kientzle

When invoking tar, make sure the mode option (-x) is first.


123770 23-Dec-2003 schweikh

Fix a case of undefined behavior due to overlapping buf objects in
snprintf (buf, size, fmt, buf, etc). This only works by chance with our
libc, but fails (with a truncated string) on e.g. glibc.

Okayed by: sobomax
MFC after: 1 week


118410 04-Aug-2003 bmilekic

Backout 1.14, it seems to be causing problems with libxml build
and I don't have time to investigate this code in much detail right
now.


118313 01-Aug-2003 bmilekic

Use strncmp() and not strcmp() here to properly match
installed ports.

Submitted by: Harold Gutch <logix@foobar.franken.de>


115325 26-May-2003 lioux

pkg_create incorrectly does not add trailing '\n' when it receives
either COMMENT or DESCR from the command line. When a port is
installed, one gets both +COMMENT and +DESCR files with a trailing
'\n' character. However, +COMMENT does not contain a trailing '\n'
when it is installed from a package due to this behavior of pkg_create.

Therefore, make sure it behaves exactly the same regardless of
where got its information; either command line or files. The modified
functions are used by pkg_create.

PR: 52097
Reviewed by: bento, kris,
portmgr, re,
Michael Nottebrock <michaelnottebrock@gmx.net>,
Martin Horcicka <horcicka@FreeBSD.cz>
Approved by: re (scottl)
MFC after: 1 week


113594 17-Apr-2003 kris

* Add explicit conflict-checking to the package tools. Packages can
register a list of other packages with which they conflict (via the
-C option to pkg_create), and they will refuse to install (unless -f is
specified) if one of the listed packages is already present.

* Update documentation for the new feature as well as fleshing out some
existing documentation.

* Bump PKG_INSTALL_VERSION so this feature can be tested for.

Submitted by: Sergey Matveychuk <sem@ciam.ru>
PR: bin/47145
MFC after: 2 weeks


113587 17-Apr-2003 rwatson

Revert url.c:1.2: there was a race condition between when I produced
the fix and when I committed it -- in between the two, DES committed
a different fix, rendering this fix unneeded.

Requested by: des


112722 27-Mar-2003 rwatson

Don't pass NULL in as a flags argument to libfetch's fetchGetURL()
as this can result in a NULL pointer deference when parsing the
flags later. This change fixes "pkg_add -r" on 5.0-CURRENT for
me; not quite clear how the problem was introduced.


108778 06-Jan-2003 jkh

Prevent buffer overflow in format_cmd() by properly tracking maximum
buffer size.
Reported by: Lionnel CHAPTAL <Lionnel.Chaptal@IPricot.com>
MFC after: 1 week


106923 14-Nov-2002 bmah

Assume that packages passed on stdin are in bzip2 format, not gzip.
(sysinstall depends on this feature for package addition.)

Comment on hard-coded bzip2 usage in the spirit of rev. 1.58.


106492 06-Nov-2002 obrien

Clean up a little. Don't need to include fetch.h any more, and I can't
find any consumers of HOSTNAME_MAX.


106491 06-Nov-2002 obrien

Break fileGetURL() out into its own file so that pkg_install/lib consumers
pkg_{create,delete} don't need to needlessly link with libfetch.


106136 29-Oct-2002 des

Whitespace cleanup


103726 21-Sep-2002 wollman

Make the threatened fts(3) ABI fix. FTSENT now avoids the use of the struct
hack, thereby allowing future extensions to the structure (e.g., for extended
attributes) without rebreaking the ABI. FTSENT now contains a pointer to the
parent stream, which fts_compar() can then take advantage of, avoiding the
undefined behavior previously warned about. As a consequence of this change,
the prototype of the comparison function passed to fts_open() has changed
to reflect the required amount of constness for its use. All callers in the
tree are updated to use the correct prototype.

Comparison functions can now make use of the new parent pointer to access
the new stream-specific private data pointer, which is intended to assist
creation of reentrant library routines which use fts(3) internally.

Not objected to in spirit by: -arch


103162 09-Sep-2002 sobomax

Sigh, finally activate pkgwrap.c.

Big pointy hat to: sobomax (who apparently needs some sleep)
Submitted by: walt <wa1ter@hotmail.com>


103149 09-Sep-2002 sobomax

Introduce notion of the package tools revision and allow to wrap all tools
included into pkg_install according to the content of /var/db/pkg_install.conf
file, which specifies version and alternative location of the tools. Format
of the said file is very simple: one line which specifies revision of the
alternative version of the tools and their location separated by space,
i.e.:

20030102 /usr/local/sbin

This would allow bsd.port.mk to install and use up to date version of tools
on older system from ports.

Also add new `-P' flag to pkg_info, which causes it to report currently
installed version of package tools.

Discussed with: will


102732 31-Aug-2002 kris

Don't treat unknown commands as fatal errors: they are probably just
the signature of out-of-date pkg_tools and newer packages.

Reviewed by: jkh
MFC after: 3 days


102430 26-Aug-2002 obrien

Grrr.... mumble.... a linger gzip'ism still existed.

Submitted by: Craig Rodrigues <rodrigc@attbi.com>


102383 25-Aug-2002 obrien

Find remaining hardcoded gzip bits and change to bzip2 bits.
Mark with XXX so someone that cares about being able to handle either
bziped or gziped packages knows where the remaining nits are.


102375 24-Aug-2002 lioux

Preserve suid/gid permissions when extracting packages remotelly
fetched with -r option

Reviewed by: will
Approved by: will


101740 12-Aug-2002 sobomax

Ensure that origin field in the packing list structure is initialised. This
fixes problem when there are origin-less packages installed on a system

Reported by: Mark Knight <markk@knigma.org>
MFC after: 3 days


101677 11-Aug-2002 schweikh

Fix typos; each file has at least one s/seperat/separat/
(I skipped those in contrib/, gnu/ and crypto/)
While I was at it, fixed a lot more found by ispell that I
could identify with certainty to be errors. All of these
were in comments or text, not in actual code.

Suggested by: bde
MFC after: 3 days


101339 04-Aug-2002 knu

Another .tbz2 -> .tbz leftover. Properly look for pkgname.tbz.

MFC after: 1 day


98766 24-Jun-2002 markm

C replacement for the Perl5 code.

Submitted by: reg


97097 22-May-2002 sobomax

Eliminate free'ing already freed chunks.

MFC after: 1 week


96613 14-May-2002 sobomax

- Make use of DEPOROGINs (if there are any) when installing package;
- fix few bogosities here and there;
- move some common routines into the library.

MFC after: 2 weeks


96514 13-May-2002 ru

Mark all internal libraries with INTERNALLIB.


96392 11-May-2002 alfred

replace __FUNCTION__ with standardized __func__.

Requested by: jhb


96388 11-May-2002 alfred

fix build:
you may not use string concatination with __FUNCTION__, replace all occurances
of:
__FUNCTION__ ": error string"
with:
"%s: error string"


96076 05-May-2002 sobomax

New feature: allow origins of all dependencies be recorded into package list
using new `@comment DEPORIGIN:...' directive. This would allow us to make
many neat things including:

- easier binary upgrades;
- source upgrades without using external tools by simply extending
bsd.port.mk and pkg_install tools;
- mixed-mode upgrades (source + binary);
- depreciate and deorbit silly +REQUIRED_BY files in the near future.

This feature is no-op until appropriate bsd.port.mk patch is committed, and
even when it is already committed packages generated will remain 100%
compatible with old set of pkg_install tools (module all those neat
features, of course).

MFC after: 6 days


96065 05-May-2002 sobomax

Handle PLIST_ORIGIN properly.

Poked by: kris
Pointy hat grabbed by: sobomax
MFC after: 6 days


96030 04-May-2002 sobomax

Add ability to query installed packages based on origin.


93520 01-Apr-2002 obrien

Fix SCM ID's.


90987 20-Feb-2002 sobomax

Make sortdeps() working with dependency lists containing one or no elements.

Submitted by: roam
MFC in: 1 week


86757 22-Nov-2001 jkh

Choose more paranoid modes for the temporary directory so the user can't
easily browse its contents.

Noted by: Antoine


86402 15-Nov-2001 sobomax

Improve recently committed fix for -t bug.

Submitted by: "Andrew L. Neporada" <andr@dgap.mipt.ru>
MFC after: 3 days


84795 11-Oct-2001 sobomax

Make `-t' flag in pkg_*(1) tools actually working.

PR: 30843
Submitted by: Vladimir B. Grebenschikov <vova@express.ru>
MFC after: 2 weeks


84750 10-Oct-2001 sobomax

- Introduce a notion of `packing list format version'. This allows making
non-backward compatible changes in the format of packing list and handle
them gracefully;
- fix a longstanding issue with symlinks handling. Instead of recording
checksum for the file symlink points to, record checksum for the value
returned by readlink(2). For backward compatibility increase packing list
format minor version number and provide a fallback to a previous behaviour,
if package in question was created with older version of pkg_* tools;

Submitted by: Alec Wolman <wolman@cs.washington.edu>, sobomax

- don't record MD5 checksum for device nodes, fifo's and other non-regular
files.

Submitted by: nbm
MFC in: 2 weeks


84745 10-Oct-2001 sobomax

WARNS=2 cleanup.

Tested on: i386, alpha
MFC after: 2 weeks


83663 19-Sep-2001 sobomax

Various fixes and improvements:
- fix harmless compiler's warnings (unused variables and missed prototype);
- before refusing to delete package because "there are packages installed
that require this package" check that packages in question is actually
installed;
- add new `-r' option to pkg_delete(8), which instructs it to delete not only
packages specified at command line, but all packages that depend on
specified packages as well.

MFC after: 2 weeks


81571 13-Aug-2001 obrien

Reduce private "lesser known" function redirection to improve clarity.

Approved by: jkh


81058 02-Aug-2001 jon

fix for pkg_add to symlinked prefix directories that are more than 1 link deep.

PR: bin/28274
Submitted by: John Hein <jhein@timing.com>
MFC after: 1 month


81049 02-Aug-2001 sobomax

Cosmetics: replace dozen instances of "(tmp = getenv(PKG_DBDIR) ? tmp : DEF_LOG_DIR)"
with macro.

MFC after: 1 month


81048 02-Aug-2001 sobomax

Cosmetics: kill blank lines at the end of file.

MFC after: 1 month


81046 02-Aug-2001 sobomax

Usability tweak:

Use '' quotes instead of `' to delimit names of files and packages in
warning and error messages, because it is easier to cut-n-paste name in
question that way (single click) without confusing the shell. And yes,
I know that it is less eye-candy...

MFC after: 1 month


81044 02-Aug-2001 sobomax

When there is a file that can't be deleted due to checksum mismatch print name
of that file to stdout to simplify debugging. IMO it was a mistake to print
this warning only when `verbose' mode is on.

MFC after: 1 month


80472 28-Jul-2001 obrien

The security officer requested this be backed out for discussion.


80463 28-Jul-2001 obrien

Remove s_strl*(). I am not sure what was thought they accomplished.

When reading the code I had to stop, say "ok, what does *these*
modifications of strl*() do? Pull out grep. Oh, not in add/, maybe above
in ../lib/? Yep. So what do they do? Comments above them are misleading,
guess I'll have to read the code. Oh, they just test strl* against the
size and return the result of the test. Now I can continue to read the
code I was.

The uses of s_strl*() then test that result and errx()'s.
Lets think about the "optimized" code I am removing:

In general the compiler pushes the three args to strl* onto the stack and calls
s_strl*. s_strl* has to indirectly access 3 args from the stack. Then push
them on the stack a 2nd time for the real strl* call. s_strl* then pops the
return from strl* off the stack; or moves it from the register it was returned
in, to the register where tests can happen. s_strl* then pops the three
arguments to strl*. Perform the test, push the result of the test, or move it
from the result register to the return value register. The caller to s_strl*
now has to either pop the return value of s_strl* or move it from the return
value register to the test register. The caller then pops the three args to
s_strl* off the stack (the same args that s_strl* itself had to pop off after
the real call to strl*). The s_strl* caller then performs a simular test to
what has already been done, and conditionally jumps. By doing things this way, we've given the compiler optimizer less to work with.

Also, please don't forget the that call to s_strl* has possibly jumped to code
not in the cache due to being far away from the calling code, thus causing a
pipeline stall.

So where is the "optimization" from s_strl*?
It isn't code clarity.
It isn't code execution speed. It isn't code size either.


80042 20-Jul-2001 sobomax

Use reallocf(3) to increase size of malloc'ed buffer instead of
malloc()+memcpy()+free().


80029 20-Jul-2001 obrien

Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.


79452 09-Jul-2001 brian

Fix the type of the NULL arg to execl()

Idea from: Theo de Raadt <deraadt@openbsd.org>


78162 13-Jun-2001 des

Use getdtablesize() instead of OPEN_MAX.

Submitted by: bde


78072 11-Jun-2001 des

Pass on the verbose option to fetchGetURL().
In the child that's set up to run tar(1), close all file descriptors except
stdin, stdout and stderr.

PR: bin/27760


76739 17-May-2001 sobomax

Style policy: reformat multiline comments to conform to style(9).


76504 12-May-2001 kris

Clean up some of the evil string handling in this code, replace
warnx()+exit() with errx() and replace a big if..then..else construct
to determine the package download directory with a lookup table.

Reviewed by: jkh
MFC after: 2 weeks


74699 23-Mar-2001 sobomax

- Add which(1)-like functionality into pkg_info;
- fix a harmless bug in match_installed() function introduced in my last
commit;
- uniformely reorder includes across files.

Submitted by: Garrett Rooney <rooneg@electricjellyfish.net>
Not objected by: jkh, -ports


74295 15-Mar-2001 sobomax

When creating a package sort dependencies in such a way that if dependency
A depends on dependency B then dependency A will be in all cases listed
before B, so ``pkg_add -r'' will fetch/install packages in the correct order.

Previously dependencies were sorted just by its names, which is why
``pkg_add -r'' never actually worked properly.

To be usefull, hovewer, this fix requires that all packages have been
rebuilt, so it will take some time until users would be able to feel
posititive improvements. For the same reasons it is desirable to propagate
these changes to the 4-stable package building cluster *before* 4.3 ports
freeze, so packages for 4.3-RELEASE would be properly prepared.

Prompted by: kris
Insanely appreciated by: obrien
Silently approved by: jkh, -ports


74258 14-Mar-2001 sobomax

When matching installed packages against glob keep track of which patterns
actually triggered a match and which did not, and add patterns that didn't
into resulting list, so caller will have a chance to notify user that package
isn't installed. This should fix current, POLA-breaking behaviour when user
doesn't receive a notification if he specifies several packages, some of which
aren't installed.


73144 27-Feb-2001 sobomax

Properly detect and report malloc(3) failures.


73134 27-Feb-2001 sobomax

- Merge recently added into pkg_info(1) regex/glob matching functionality into
pkg_delete(1) as well;
- add a new `-a' option for pkg_delete(1) to delete all installed packages;
- add a new `-i' option for pkg_delete(1) to request simple rm(1)-like
interactive confirmation before attempting to delete each package.

Silently approved by: jkh, -ports


71373 22-Jan-2001 sobomax

- Add ability to handle bzip2-compressed packages;
- fix cosmetics to shut-up compiler in -pedantic mode (axe several unused vars
and provide default clause in several switch() statements).

No response from: -ports


69793 09-Dec-2000 obrien

Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.


67886 29-Oct-2000 des

Insetad of using fileno(ftp) as stdin for tar, use a pipe and have the
parent pass the data received from the server to the child.


67429 22-Oct-2000 jkh

Cause fatal error messages to be a little more helpful to the programmer
concerning where they're taking place.

Switch from [r]index() to str[r]chr() functions, which are more ISO
compliant.

Prompted by: Edward Welbourne <eddy@vortigen.demon.co.uk>


66021 18-Sep-2000 sobomax

Fix symlink-to-a-dir handling in pkg_delete.

Reviewed by: -ports
Tested by: bento


62154 27-Jun-2000 des

Use libfetch instead of libftpio. This adds support for http and IPv6.


58092 15-Mar-2000 sheldonh

Do not preserve UIDs, permissions nor flags of package system files in
tar files. This fixes clean-up problems during package creation and
does not affect the actual files to be included in the package.

The fix submitted on the attributed PR was identical to the one
obtained from NetBSD.

PR: 17386
Reported by: Adrian Filipi-Martin <adrian@ubergeeks.com>
Obtained from: NetBSD


57331 19-Feb-2000 jkh

1. If checking for directory-ness, check "dir" and "dir/" to catch
the case where we have a symlink pointing at a dir.

2. Restore stomped character before returning in make_hierarchy()


57034 08-Feb-2000 obrien

Use lstat(2) rather than stat(2) in isdir(), so that a symlink to a
directory is not considered a directory. I have a feeling all the other
stat(2) calls should instead be lstat(2) calls, but I have not suffiently
determined that the current behavior [especially in isfile()] isn't
depended upon by someone.

Ok'ed by: JKH


55395 04-Jan-2000 jkh

Deal with package filenames which contain spaces.

Submitted by: Ming-I Hsieh <mihs@wm28.csie.ncu.edu.tw>
PR: 15667


50479 28-Aug-1999 peter

$Id$ -> $FreeBSD$


49637 11-Aug-1999 billf

-Wall fixes. Ambigious if/elses, uninitialized values, missing headers,
missing prototypes, and empty format strings.


47039 12-May-1999 jkh

Revive the PKG_ADD_BASE stuff a bit.


41866 16-Dec-1998 jkh

Make it possible to have separate install scripts as well as have
an on-delete script.

Submitted by: Rajesh Vaidheeswarran <rv@fore.com>


41530 05-Dec-1998 asami

Fix support for uncompressed (".tar") package types. It's not completely
fixed (chained dependency checking for pkg_add is broken, for one thing)
but at least you can now create one package and use it.


40354 14-Oct-1998 jkh

Revert 1.33; lstat() is indeed the wrong thing to do here. I'll
revisit this after release.


40085 09-Oct-1998 jkh

Use lstat() rather than stat in determining whether a file exists,
otherwise we'll miss the "symlink exists but points nowhere" case.
Submitted by: asami and/or possibly <ru@ucb.crimea.ua>


39068 11-Sep-1998 jkh

correct usage of cleanup() everywhere - this became bogus when the warnx/errx
stuff was added and nobody seems to have noticed. :)
Noticed by: Josh MacDonald <jmacd@paris.CS.Berkeley.EDU>


38942 08-Sep-1998 jkh

o Set paths internally for pkg_add for tools we might want to invoke.
o Fix bogus suffix handling.
o Tell user when an FTP url is being xferred rather than being silent.
This sort of violates "the unix way" but it stops people from whacking
^C when they think it's hung, too. Sometimes visual indication of
success is important. Doesn't spit out anything if not on a TTY.


38723 01-Sep-1998 jkh

Silence potentially bogus warning.


37900 28-Jul-1998 nectar

Paranoia: use mkdtemp instead of mktemp
PR: bin/3212
Reviewed by: jkh@FreeBSD.ORG


37744 18-Jul-1998 hoek

Clarify "Cannot delete file as directory" errmessage.

PR: bin/1985


35160 12-Apr-1998 jkh

Fix dependent-package loading when pkg_adding with an FTP URL. I broke
this when I changed the playpen code to disallow recursion. I know
this fixes a PR someplace but I can't seem to find it with the GNATs
search tool.


33427 16-Feb-1998 jkh

Eliminate the idea of nested "playpens" entirely - it just obfuscated
the code and, in at least one case, made it more dangerous to no gain.


32371 09-Jan-1998 jkh

MF22: Additional paranoia in cleanup.


30533 18-Oct-1997 jkh

- do string-magic on the right variable when trying
to find dependent packages on the local disk (i.e. package given as
filename, not URL)
- document $PKG_PATH
- use -v on pkg_add for dependent packages

Submitted by: hubertf@NetBSD.ORG
Obtained from: NetBSD


30387 13-Oct-1997 jkh

Don't return from cleanup() - if it's removed the playpen then very
bad things will happen if we return to unsuspecting code.
Noted to my great dismay by: Tim Vanderhoek <hoek@hwcn.org>


30221 08-Oct-1997 charnier

Use err(3). Cosmetics in usage string and man page.


29032 02-Sep-1997 jkh

Eliminate an annoying message.


27137 01-Jul-1997 jkh

Change the naming conventions for preserve'd files and also document
the option in pkg_create. Now preserved files start with a . and are
named .<filename>.<pkgname>.backup so that their purpose is more clear.

Note that just using the preserve option without proper pkg_deps
is also foolish since packages being deleted in the incorrect order with
preserve on can generate some odd results.


27092 30-Jun-1997 jkh

YAMF22 - deletes and preserve option fixes.


27056 29-Jun-1997 jkh

Add support for @option preserve - moves existing files out of the way
before replacing them (using pkgname to make this hopefully unique).
Delete also moves them back, if they exist, resulting in a package
which can be "backed out" with reasonable safety.


22997 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


19733 14-Nov-1996 ache

Use new ftpGetURL interface, as result, report FTP error
via ftpErrString or net error via hstrerror(h_errno)


18929 14-Oct-1996 jkh

Fix PR#1557 - chained package dependencies using URLs didn't work.


17378 01-Aug-1996 jkh

Put verbosity in the right place.


17338 30-Jul-1996 jkh

Add MD5 checksums to packing list for all files during pkg_create and use
later at pkg_delete time to verify that you're deleting what you added.
This, of course, does NOT cover the case where a file you still need
hasn't changed! That's a tougher problem to solve, and this provides
only the minimal amount of safety belt. MD5 checksums are stored in comment
fields, so packages produced with these tools are backwards compatible with
the older ones.


16549 20-Jun-1996 jkh

Make pkg_install understand and use libftpio instead of its own
copies of the ftp support routines. Also some cosmetic and minor
bug fixes I've been meaning to incorporate for awhile.


16179 08-Jun-1996 alex

Change min_free to return free space as an off_t instead of a size_t.


14582 12-Mar-1996 jkh

Fix a couple of miscellaneous bugs and make pkg_add also support reading
from stdin.


14155 19-Feb-1996 mpp

Initialize the argument list in the unpack() routine to zero.
This prevents a core dump due to the stack being trashed if pkg_add
is asked to process something that really isn't a package file.


13994 09-Feb-1996 jkh

Fix to catch a stupid oversight on my part which allowed this thing
to remove the current directory under certain circumstances.
Submitted by: Richard J Kuhns <rjk@watson.grauel.com>


12219 12-Nov-1995 jkh

Bring my pkg_install improvements forward from 2.1.


11971 31-Oct-1995 jkh

Fix the `pkg_add relative to .' bug. Thank you, Ville!
Submitted by: Ville Eerola <ville@vlsi.fi>


11780 25-Oct-1995 jkh

Bring forward my changes from 2.1


10388 28-Aug-1995 jkh

Don't be needlessly verbose in the pkg_create.


10339 26-Aug-1995 jkh

Make the play-pen searching routine even more agile in trying
to create a /usr/tmp dir if it makes sense to do so.


10309 26-Aug-1995 jkh

Use size_t properly in all fs size ops. This kills a bug
encountered by someone who had his /tmp on a partition with 3.7GB of
free space!
Spotted by: Francisco Rosich Viana <rosich@power.ci.uv.es>


10085 17-Aug-1995 jkh

Some fixes to make this "TMPDIR agile".
Submitted by: jmacd + some of my own fixes.


9953 06-Aug-1995 jkh

Make "out of space in ${PKG_TMPDIR}" handling a bit more robust.
Print the right thing, do the right thing. Back to you, Satoshi!


9838 01-Aug-1995 jkh

Round this out. Now seems to transfer packages properly over ftp
as it was supposed to. PKG_PATH more sorely needed than ever now..
Hmmmm.


9837 01-Aug-1995 jkh

Argh! I hate my life! I can't seem to do anything right here today.
This should restore functionality to the pkg_install suite.


9808 31-Jul-1995 asami

Sync this up with ftp.c.


9807 31-Jul-1995 jkh

Remove dependency on sysinstall.


9806 31-Jul-1995 jkh

Add ftp.c to makefile - that might make it work better. Sheesh!


9789 30-Jul-1995 jkh

Change the environment variable this looks for from FTP_PASSIVE to
FTP_PASSIVE_MODE. It would be really nice if we could standardise on
this name so that all tools (like ncftp) that offer passive/active
ftp selection would work seamlessly with one user environment variable
setting.


9787 30-Jul-1995 jkh

Totally eliminate the dependency on libftp (which will be removed from the
FreeBSD source tree) and switch to the internal ftp routines developed
by Poul-Henning and used in sysinstall.


9782 30-Jul-1995 ache

You can run pkg_info everywhere expect /var/db/pkg directory :-)
Running there you got any kind of strange errors from tar caused
by treating directories as tar files!
Fix it by adding new isfile(name) (check for reg. files) to simple fexists(name) calls.


9743 28-Jul-1995 ache

Fix coredump for -v flag
Submitted by: Thomas Gellekum <thomas@ghpc8.ihf.rwth-aachen.de>
Obtained from:


9291 24-Jun-1995 asami

Use lstat() instead of access() for checking file existence. It works
for symlinks too, and according to Rod, access() is evil anyway.

Reviewed by: jkh


8857 30-May-1995 rgrimes

Remove trailing whitespace.


8424 10-May-1995 jkh

Fix a long-standing bug that broke pkg_info utterly and probably made
pkg_add a little wiggy too.


8087 26-Apr-1995 jkh

Add code for dealing with URLs.


8075 26-Apr-1995 jkh

Check dependencies BEFORE doing final extraction of package.
Fix a bug where direct-extract mode would have still invoked the
packing list reordering commands.


7999 22-Apr-1995 jkh

Export the min_free() function.


7996 22-Apr-1995 jkh

1. Add an new @option directive. You'll understand it better in a moment.
2. Fix a long-standing bug in pkg_add where the failure of one package in
a multipackage installation (pkg_add *.tgz) would blow you right out of
the water. Ick.


7989 22-Apr-1995 jkh

Some patches to make deletions of non-existent files and directories slightly
less fatal (so that the database entry is subsequently removed anyway).
Submitted by: Edward Wang <edward@edcom.com>


7972 21-Apr-1995 jkh

Correct a bogusly formatted printf().


7937 19-Apr-1995 jkh

Add support for the ${PKG_DBDIR} environment variable. /var/db/pkg is the
default, and probably not something you'd ever change, but now it's
possible to do so for local/custom installations.


7926 18-Apr-1995 jkh

Use a more nicely formatted message when we run out of space.


6501 16-Feb-1995 jkh

Rename TMPDIR to PKG_TMPDIR, just to make Jeff happy.. :-)


6418 15-Feb-1995 jkh

Make pkg_install use /var/tmp instead of /tmp
Suggested by: hsu


4997 06-Dec-1994 jkh

More changes from John T. Kohl. Man pages, mostly.
Submitted by: jtkohl


4996 06-Dec-1994 jkh

Many of John T. Kohl's patches from NetBSD. Thanks, John!
Submitted by: jkohl


4546 17-Nov-1994 jkh

Add a new basename_of() function.


3578 14-Oct-1994 jkh

Print a better verbose message when creating packages.


3575 14-Oct-1994 jkh

Fix bug in home directory calculation that I introduced with the free space
checking code. Fix the free space checking code, while I'm at it! ;)
Thanks to Garrett for spotting the home dir problem.


3445 08-Oct-1994 jkh

Be optionally verbose about free-space checking. I need this to ascertian
whether or not this always works.


3364 04-Oct-1994 jkh

Add the ability to verify that a package won't extract in the space
available. Thanks to Michael Elbel for pushing me in the right direction.


3198 29-Sep-1994 jkh

Don't let pkg_delete remove the recorded location until everything has
absolutely, positively been successfully removed.
Reviewed by:
Submitted by:
Obtained from:


2331 28-Aug-1994 jkh

Add @srcdir option for customizing creation of packages.
Submitted by: jkh


1793 11-Jul-1994 jkh

Argh! What a boneheaded bug! Finally fix the blank-line-in-packing list
problem! I am pond scum!


1666 01-Jun-1994 asami

Close /dev/tty that is opened in y_or_n()...this is called many times
so it will run out of ptys if not properly closed.


1550 25-May-1994 asami

The environment variable PKG_PREFIX is set to the first @cwd command
in the packing list, or the argument to -p if it is specified, before
the requirements/installation/deinstallation scripts are called. This
enables the scripts to be written to work on the final installation
destination, even if the user uses -p to override the package's default.


1547 25-May-1994 jkh

Add new find_plist() function.


1338 05-Apr-1994 jkh

Make y_or_n() pay attention to AutoAnswer global.


479 18-Sep-1993 jkh

Added code for doing % sequence expansion, added new @unexec command.


446 12-Sep-1993 jkh

Fixed an embarassing bug with @owner, @mode & @group


404 06-Sep-1993 jkh

Fixed bug in copying script files from absolute locations


383 05-Sep-1993 jkh

Made staging area configurable rather than assuming /tmp (-t)


379 03-Sep-1993 jkh

Lots of misc tweaks, support for arbitrary separators in pkg_info, more
intelligent name handling in pkg_create. Most of these files are changed
because of rcsid's being different in my cvs tree and freefall's (foo).


357 30-Aug-1993 jkh

Removed annoying -Wall


328 26-Aug-1993 jkh

This commit was generated by cvs2svn to compensate for changes in r327,
which included commits to RCS files with non-trunk default branches.