History log of /openbsd-current/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.42 13-Jun-2023 espie

move to use v5.36;
tested by me over the last few weeks, and tb@
also fixed a "manual install" bug properly reported by tb@

aside that there should be *no functional change*.
If you see any message like "hey, the number of params is wrong"
it is a fringe case I didn't run into and should be easy to fix.


# 1.41 27-May-2023 espie

restore documentation: explain what ArcCheck does


# 1.40 16-May-2023 espie

explicitly rename internal methods with an _


# 1.39 16-May-2023 espie

clean visible interface a bit: Ustar does not use errsay (but ArcCheck does)
and having a forwarder for system for ONE use is a bit much !


# 1.38 16-May-2023 espie

cleaner documentation of what's going on


Revision tags: OPENBSD_7_2_BASE OPENBSD_7_3_BASE
# 1.37 06-Jun-2022 espie

expand on the mismatches between the tarball and the packing-list


Revision tags: OPENBSD_7_1_BASE
# 1.36 07-Feb-2022 espie

systematically remove setuid/setgid from files before archiving AND
during extractions. Those bits belong in a museum^Win the packing-list.

thx naddy@ for checking this thru a bulk.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.35 26-May-2019 espie

adjust comment. ArcCheck hasn't dealt with long names ever since
OpenBSD::Ustar gained support for xhdr.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.34 14-May-2016 espie

use twice the same code for prepare_long and verify_modes so that it can't
diverge.

tested for a few days and okay aja@


# 1.33 08-May-2016 espie

allow root files to be root-writable.

common work with aja@, okay aja@


# 1.32 02-Apr-2016 espie

streamline the code that checks meta information before extracting files
- verify_modes should only verify modes
- put the whole checking code in one single routine in validate_meta, makes
the size checking code more obvious
- document what's going on
- prevent PkgCreate from creating impossible packages, only a few Ustar
objects are actually usable.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.31 23-Dec-2014 espie

tweak meta-info checking a bit.
- remove IsLink tests, there's no reason to treat them specially.
- files are forced to root, no need to allow for bin anymore.

- force libraries to be not executable, if there's no explicit @mode
annotation


# 1.30 30-Nov-2014 espie

much simpler checks, always enforce root/bin (or root/wheel for symlinks)
for files without @owner/@group annotations, independently of who you are.

This should fix building-as-root for good, even without twiddling
FAKE_AS_ROOT.


# 1.29 16-Sep-2014 espie

if a @ts annotation is detected, wipe tarball timestamp. Archives will
look as if all files were born in 1970. The useful side-effect is that
meta-data for content-identical files WILL be identical as well.


# 1.28 09-Sep-2014 espie

register @newuser/@newgroup so that we try creating tarballs with the correct
users (which doesn't really matter all that much, as the owner/group in
the plist are what matters)

Otherwise, if we're not root, dismiss user id and groups, replace
with root/bin (significant fix from previous version: this interprets $(
correctly). Should help with FAKE_AS_ROOT=No


# 1.27 01-Sep-2014 espie

be a wee bit more paranoid about file sizes.


# 1.26 10-Aug-2014 espie

if pkg_create is run as non-root, restory correct group/owner to root/bin.

also, remove write permissions without explicit modes. Allows fake installs
to keep directories/files writable while producing correct package.


Revision tags: OPENBSD_5_6_BASE
# 1.25 22-Apr-2014 espie

turns out there are exactly 3 ports that actually use longnames:

eclipse-plugins-wtp-sdk
openclipart
qt4-html

so switch to pax extended headers now, the transition period is not
really needed. :)


Revision tags: OPENBSD_5_5_BASE
# 1.24 25-Jan-2014 espie

more ArcCheck nits: don't allow a file to be u-r/g-r without an explicit
@mode annotation.

This mostly fixes packaging bugs (like documentation only readable by root
and such nonsense), and also force *actual* mode settings for security
reasons to be apparent in the packing-list.


# 1.23 17-Jan-2014 espie

make ArcCheck less confusing, don't archive stuff that WON'T survive
extraction anyways (those metadatas ARE in the packing-list anyways).


# 1.22 23-Dec-2013 espie

get rid of "copy_long", we don't really need to recheck names while copying
a package contents.

Allow -o/-S for output/signature dirs for batch operations.
Fix copying of packages while signing, add progressmeter.


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.21 02-Jan-2011 espie

create formatted manpages as temporary files we remove after the fact.


# 1.20 24-Dec-2010 espie

handle failures from ports tree with more care.
this does avoid infinite loops in case of wrong plists.
necessary since print-plist-with-depends CAN fail...


# 1.19 02-Oct-2010 espie

whitespace


Revision tags: OPENBSD_4_8_BASE
# 1.18 28-Jul-2010 espie

pass state to Ustar objects, use it to display those pesky error and
fatal messages.

zap $opt_x from pkg_mklocated, do things like other commands do.


# 1.17 30-Jun-2010 espie

allow say and errsay to work without parameters, as it's ways common.
create verbose_system up in state, because it makes sense without verbose.


# 1.16 30-Jun-2010 espie

whitespace cleanup


# 1.15 10-May-2010 espie

whitespace fixes


Revision tags: OPENBSD_4_7_BASE
# 1.14 11-Nov-2009 espie

remove extra warnings


# 1.13 10-Nov-2009 espie

bad espie: use strict/warnings consistently, and fix two nits and two
actual errors !


Revision tags: OPENBSD_4_6_BASE
# 1.12 22-Apr-2009 naddy

fix creating packages with long names in plist; from espie@


# 1.11 19-Apr-2009 espie

synch with my new style search/location changes
It's likely there will be some fallout, but it's getting a bit too large
to keep around.
This does kill a few very old oddities as well.


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.10 12-Jun-2007 espie

tidy error messages: uses $! more consistently, do not append \n on die,
do append \n on warn.

Fix the two cases where the temp dir vanished too soon: not copying +DESC
should have been apparent. Not finding a +DISPLAY file is not a reason for
burping all over the place.


# 1.9 04-Jun-2007 espie

some minor systematic changes.
- mark all regexps I can with /o if they can be compiled once.
- turn $o->method() into $o->method
- remove unneeded prototypes
- reduce split /re/ into split "string" where possible.


# 1.8 25-May-2007 espie

until people finally fix their @group issues in packages, at least refuse
flat-out to write packages with no @group annotations on fishy stuff
(writable directories, setuid/setgid stuff)


# 1.7 25-May-2007 espie

move the mode checker code from pkg_create into ArcCheck, so that pkg_add
can reuse it.


# 1.6 02-May-2007 espie

$o->method() becomes $o->method


# 1.5 15-Apr-2007 espie

update copyright years, standardize licence.
reword the introduction to the stuff originally from FreeBSD to clarify
slightly.


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.4 31-Jul-2006 espie

cosmetic: comments, and better method name.


Revision tags: OPENBSD_3_9_BASE
# 1.3 24-Sep-2005 espie

pass actual items to prepare_long and check_name so that we can also
verify that modes/groups/owners are correct (code to come)


# 1.2 24-Sep-2005 espie

move uname/gname existence check into ArcCheck: Ustar archives deal with
this differently. Namely, use specific variables that default to the
numeric value if the uid/gid don't exist in mkheader.
Since the entry fields are not filled, ArcCheck gets all it needs for
the package check.


Revision tags: OPENBSD_3_8_BASE
# 1.1 07-Aug-2005 espie

wrapper around Ustar that replaces long names/links with LongName#/LongLink#.

The archive will unpack correctly with tar, except that those names won't
be preserved.

The wrapper checks names against the packing-list to restore the correct names
on the fly.

Put into a separate file, as it is an extension of Ustar proper, and we're
going to do more archive checking in the future.

Lots of tests by Bernd Ahlers. Comments by Tom Cosgrove.


# 1.37 06-Jun-2022 espie

expand on the mismatches between the tarball and the packing-list


Revision tags: OPENBSD_7_1_BASE
# 1.36 07-Feb-2022 espie

systematically remove setuid/setgid from files before archiving AND
during extractions. Those bits belong in a museum^Win the packing-list.

thx naddy@ for checking this thru a bulk.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.35 26-May-2019 espie

adjust comment. ArcCheck hasn't dealt with long names ever since
OpenBSD::Ustar gained support for xhdr.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.34 14-May-2016 espie

use twice the same code for prepare_long and verify_modes so that it can't
diverge.

tested for a few days and okay aja@


# 1.33 08-May-2016 espie

allow root files to be root-writable.

common work with aja@, okay aja@


# 1.32 02-Apr-2016 espie

streamline the code that checks meta information before extracting files
- verify_modes should only verify modes
- put the whole checking code in one single routine in validate_meta, makes
the size checking code more obvious
- document what's going on
- prevent PkgCreate from creating impossible packages, only a few Ustar
objects are actually usable.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.31 23-Dec-2014 espie

tweak meta-info checking a bit.
- remove IsLink tests, there's no reason to treat them specially.
- files are forced to root, no need to allow for bin anymore.

- force libraries to be not executable, if there's no explicit @mode
annotation


# 1.30 30-Nov-2014 espie

much simpler checks, always enforce root/bin (or root/wheel for symlinks)
for files without @owner/@group annotations, independently of who you are.

This should fix building-as-root for good, even without twiddling
FAKE_AS_ROOT.


# 1.29 16-Sep-2014 espie

if a @ts annotation is detected, wipe tarball timestamp. Archives will
look as if all files were born in 1970. The useful side-effect is that
meta-data for content-identical files WILL be identical as well.


# 1.28 09-Sep-2014 espie

register @newuser/@newgroup so that we try creating tarballs with the correct
users (which doesn't really matter all that much, as the owner/group in
the plist are what matters)

Otherwise, if we're not root, dismiss user id and groups, replace
with root/bin (significant fix from previous version: this interprets $(
correctly). Should help with FAKE_AS_ROOT=No


# 1.27 01-Sep-2014 espie

be a wee bit more paranoid about file sizes.


# 1.26 10-Aug-2014 espie

if pkg_create is run as non-root, restory correct group/owner to root/bin.

also, remove write permissions without explicit modes. Allows fake installs
to keep directories/files writable while producing correct package.


Revision tags: OPENBSD_5_6_BASE
# 1.25 22-Apr-2014 espie

turns out there are exactly 3 ports that actually use longnames:

eclipse-plugins-wtp-sdk
openclipart
qt4-html

so switch to pax extended headers now, the transition period is not
really needed. :)


Revision tags: OPENBSD_5_5_BASE
# 1.24 25-Jan-2014 espie

more ArcCheck nits: don't allow a file to be u-r/g-r without an explicit
@mode annotation.

This mostly fixes packaging bugs (like documentation only readable by root
and such nonsense), and also force *actual* mode settings for security
reasons to be apparent in the packing-list.


# 1.23 17-Jan-2014 espie

make ArcCheck less confusing, don't archive stuff that WON'T survive
extraction anyways (those metadatas ARE in the packing-list anyways).


# 1.22 23-Dec-2013 espie

get rid of "copy_long", we don't really need to recheck names while copying
a package contents.

Allow -o/-S for output/signature dirs for batch operations.
Fix copying of packages while signing, add progressmeter.


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.21 02-Jan-2011 espie

create formatted manpages as temporary files we remove after the fact.


# 1.20 24-Dec-2010 espie

handle failures from ports tree with more care.
this does avoid infinite loops in case of wrong plists.
necessary since print-plist-with-depends CAN fail...


# 1.19 02-Oct-2010 espie

whitespace


Revision tags: OPENBSD_4_8_BASE
# 1.18 28-Jul-2010 espie

pass state to Ustar objects, use it to display those pesky error and
fatal messages.

zap $opt_x from pkg_mklocated, do things like other commands do.


# 1.17 30-Jun-2010 espie

allow say and errsay to work without parameters, as it's ways common.
create verbose_system up in state, because it makes sense without verbose.


# 1.16 30-Jun-2010 espie

whitespace cleanup


# 1.15 10-May-2010 espie

whitespace fixes


Revision tags: OPENBSD_4_7_BASE
# 1.14 11-Nov-2009 espie

remove extra warnings


# 1.13 10-Nov-2009 espie

bad espie: use strict/warnings consistently, and fix two nits and two
actual errors !


Revision tags: OPENBSD_4_6_BASE
# 1.12 22-Apr-2009 naddy

fix creating packages with long names in plist; from espie@


# 1.11 19-Apr-2009 espie

synch with my new style search/location changes
It's likely there will be some fallout, but it's getting a bit too large
to keep around.
This does kill a few very old oddities as well.


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.10 12-Jun-2007 espie

tidy error messages: uses $! more consistently, do not append \n on die,
do append \n on warn.

Fix the two cases where the temp dir vanished too soon: not copying +DESC
should have been apparent. Not finding a +DISPLAY file is not a reason for
burping all over the place.


# 1.9 04-Jun-2007 espie

some minor systematic changes.
- mark all regexps I can with /o if they can be compiled once.
- turn $o->method() into $o->method
- remove unneeded prototypes
- reduce split /re/ into split "string" where possible.


# 1.8 25-May-2007 espie

until people finally fix their @group issues in packages, at least refuse
flat-out to write packages with no @group annotations on fishy stuff
(writable directories, setuid/setgid stuff)


# 1.7 25-May-2007 espie

move the mode checker code from pkg_create into ArcCheck, so that pkg_add
can reuse it.


# 1.6 02-May-2007 espie

$o->method() becomes $o->method


# 1.5 15-Apr-2007 espie

update copyright years, standardize licence.
reword the introduction to the stuff originally from FreeBSD to clarify
slightly.


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.4 31-Jul-2006 espie

cosmetic: comments, and better method name.


Revision tags: OPENBSD_3_9_BASE
# 1.3 24-Sep-2005 espie

pass actual items to prepare_long and check_name so that we can also
verify that modes/groups/owners are correct (code to come)


# 1.2 24-Sep-2005 espie

move uname/gname existence check into ArcCheck: Ustar archives deal with
this differently. Namely, use specific variables that default to the
numeric value if the uid/gid don't exist in mkheader.
Since the entry fields are not filled, ArcCheck gets all it needs for
the package check.


Revision tags: OPENBSD_3_8_BASE
# 1.1 07-Aug-2005 espie

wrapper around Ustar that replaces long names/links with LongName#/LongLink#.

The archive will unpack correctly with tar, except that those names won't
be preserved.

The wrapper checks names against the packing-list to restore the correct names
on the fly.

Put into a separate file, as it is an extension of Ustar proper, and we're
going to do more archive checking in the future.

Lots of tests by Bernd Ahlers. Comments by Tom Cosgrove.


# 1.36 07-Feb-2022 espie

systematically remove setuid/setgid from files before archiving AND
during extractions. Those bits belong in a museum^Win the packing-list.

thx naddy@ for checking this thru a bulk.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.35 26-May-2019 espie

adjust comment. ArcCheck hasn't dealt with long names ever since
OpenBSD::Ustar gained support for xhdr.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.34 14-May-2016 espie

use twice the same code for prepare_long and verify_modes so that it can't
diverge.

tested for a few days and okay aja@


# 1.33 08-May-2016 espie

allow root files to be root-writable.

common work with aja@, okay aja@


# 1.32 02-Apr-2016 espie

streamline the code that checks meta information before extracting files
- verify_modes should only verify modes
- put the whole checking code in one single routine in validate_meta, makes
the size checking code more obvious
- document what's going on
- prevent PkgCreate from creating impossible packages, only a few Ustar
objects are actually usable.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.31 23-Dec-2014 espie

tweak meta-info checking a bit.
- remove IsLink tests, there's no reason to treat them specially.
- files are forced to root, no need to allow for bin anymore.

- force libraries to be not executable, if there's no explicit @mode
annotation


# 1.30 30-Nov-2014 espie

much simpler checks, always enforce root/bin (or root/wheel for symlinks)
for files without @owner/@group annotations, independently of who you are.

This should fix building-as-root for good, even without twiddling
FAKE_AS_ROOT.


# 1.29 16-Sep-2014 espie

if a @ts annotation is detected, wipe tarball timestamp. Archives will
look as if all files were born in 1970. The useful side-effect is that
meta-data for content-identical files WILL be identical as well.


# 1.28 09-Sep-2014 espie

register @newuser/@newgroup so that we try creating tarballs with the correct
users (which doesn't really matter all that much, as the owner/group in
the plist are what matters)

Otherwise, if we're not root, dismiss user id and groups, replace
with root/bin (significant fix from previous version: this interprets $(
correctly). Should help with FAKE_AS_ROOT=No


# 1.27 01-Sep-2014 espie

be a wee bit more paranoid about file sizes.


# 1.26 10-Aug-2014 espie

if pkg_create is run as non-root, restory correct group/owner to root/bin.

also, remove write permissions without explicit modes. Allows fake installs
to keep directories/files writable while producing correct package.


Revision tags: OPENBSD_5_6_BASE
# 1.25 22-Apr-2014 espie

turns out there are exactly 3 ports that actually use longnames:

eclipse-plugins-wtp-sdk
openclipart
qt4-html

so switch to pax extended headers now, the transition period is not
really needed. :)


Revision tags: OPENBSD_5_5_BASE
# 1.24 25-Jan-2014 espie

more ArcCheck nits: don't allow a file to be u-r/g-r without an explicit
@mode annotation.

This mostly fixes packaging bugs (like documentation only readable by root
and such nonsense), and also force *actual* mode settings for security
reasons to be apparent in the packing-list.


# 1.23 17-Jan-2014 espie

make ArcCheck less confusing, don't archive stuff that WON'T survive
extraction anyways (those metadatas ARE in the packing-list anyways).


# 1.22 23-Dec-2013 espie

get rid of "copy_long", we don't really need to recheck names while copying
a package contents.

Allow -o/-S for output/signature dirs for batch operations.
Fix copying of packages while signing, add progressmeter.


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.21 02-Jan-2011 espie

create formatted manpages as temporary files we remove after the fact.


# 1.20 24-Dec-2010 espie

handle failures from ports tree with more care.
this does avoid infinite loops in case of wrong plists.
necessary since print-plist-with-depends CAN fail...


# 1.19 02-Oct-2010 espie

whitespace


Revision tags: OPENBSD_4_8_BASE
# 1.18 28-Jul-2010 espie

pass state to Ustar objects, use it to display those pesky error and
fatal messages.

zap $opt_x from pkg_mklocated, do things like other commands do.


# 1.17 30-Jun-2010 espie

allow say and errsay to work without parameters, as it's ways common.
create verbose_system up in state, because it makes sense without verbose.


# 1.16 30-Jun-2010 espie

whitespace cleanup


# 1.15 10-May-2010 espie

whitespace fixes


Revision tags: OPENBSD_4_7_BASE
# 1.14 11-Nov-2009 espie

remove extra warnings


# 1.13 10-Nov-2009 espie

bad espie: use strict/warnings consistently, and fix two nits and two
actual errors !


Revision tags: OPENBSD_4_6_BASE
# 1.12 22-Apr-2009 naddy

fix creating packages with long names in plist; from espie@


# 1.11 19-Apr-2009 espie

synch with my new style search/location changes
It's likely there will be some fallout, but it's getting a bit too large
to keep around.
This does kill a few very old oddities as well.


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.10 12-Jun-2007 espie

tidy error messages: uses $! more consistently, do not append \n on die,
do append \n on warn.

Fix the two cases where the temp dir vanished too soon: not copying +DESC
should have been apparent. Not finding a +DISPLAY file is not a reason for
burping all over the place.


# 1.9 04-Jun-2007 espie

some minor systematic changes.
- mark all regexps I can with /o if they can be compiled once.
- turn $o->method() into $o->method
- remove unneeded prototypes
- reduce split /re/ into split "string" where possible.


# 1.8 25-May-2007 espie

until people finally fix their @group issues in packages, at least refuse
flat-out to write packages with no @group annotations on fishy stuff
(writable directories, setuid/setgid stuff)


# 1.7 25-May-2007 espie

move the mode checker code from pkg_create into ArcCheck, so that pkg_add
can reuse it.


# 1.6 02-May-2007 espie

$o->method() becomes $o->method


# 1.5 15-Apr-2007 espie

update copyright years, standardize licence.
reword the introduction to the stuff originally from FreeBSD to clarify
slightly.


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.4 31-Jul-2006 espie

cosmetic: comments, and better method name.


Revision tags: OPENBSD_3_9_BASE
# 1.3 24-Sep-2005 espie

pass actual items to prepare_long and check_name so that we can also
verify that modes/groups/owners are correct (code to come)


# 1.2 24-Sep-2005 espie

move uname/gname existence check into ArcCheck: Ustar archives deal with
this differently. Namely, use specific variables that default to the
numeric value if the uid/gid don't exist in mkheader.
Since the entry fields are not filled, ArcCheck gets all it needs for
the package check.


Revision tags: OPENBSD_3_8_BASE
# 1.1 07-Aug-2005 espie

wrapper around Ustar that replaces long names/links with LongName#/LongLink#.

The archive will unpack correctly with tar, except that those names won't
be preserved.

The wrapper checks names against the packing-list to restore the correct names
on the fly.

Put into a separate file, as it is an extension of Ustar proper, and we're
going to do more archive checking in the future.

Lots of tests by Bernd Ahlers. Comments by Tom Cosgrove.


# 1.35 26-May-2019 espie

adjust comment. ArcCheck hasn't dealt with long names ever since
OpenBSD::Ustar gained support for xhdr.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.34 14-May-2016 espie

use twice the same code for prepare_long and verify_modes so that it can't
diverge.

tested for a few days and okay aja@


# 1.33 08-May-2016 espie

allow root files to be root-writable.

common work with aja@, okay aja@


# 1.32 02-Apr-2016 espie

streamline the code that checks meta information before extracting files
- verify_modes should only verify modes
- put the whole checking code in one single routine in validate_meta, makes
the size checking code more obvious
- document what's going on
- prevent PkgCreate from creating impossible packages, only a few Ustar
objects are actually usable.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.31 23-Dec-2014 espie

tweak meta-info checking a bit.
- remove IsLink tests, there's no reason to treat them specially.
- files are forced to root, no need to allow for bin anymore.

- force libraries to be not executable, if there's no explicit @mode
annotation


# 1.30 30-Nov-2014 espie

much simpler checks, always enforce root/bin (or root/wheel for symlinks)
for files without @owner/@group annotations, independently of who you are.

This should fix building-as-root for good, even without twiddling
FAKE_AS_ROOT.


# 1.29 16-Sep-2014 espie

if a @ts annotation is detected, wipe tarball timestamp. Archives will
look as if all files were born in 1970. The useful side-effect is that
meta-data for content-identical files WILL be identical as well.


# 1.28 09-Sep-2014 espie

register @newuser/@newgroup so that we try creating tarballs with the correct
users (which doesn't really matter all that much, as the owner/group in
the plist are what matters)

Otherwise, if we're not root, dismiss user id and groups, replace
with root/bin (significant fix from previous version: this interprets $(
correctly). Should help with FAKE_AS_ROOT=No


# 1.27 01-Sep-2014 espie

be a wee bit more paranoid about file sizes.


# 1.26 10-Aug-2014 espie

if pkg_create is run as non-root, restory correct group/owner to root/bin.

also, remove write permissions without explicit modes. Allows fake installs
to keep directories/files writable while producing correct package.


Revision tags: OPENBSD_5_6_BASE
# 1.25 22-Apr-2014 espie

turns out there are exactly 3 ports that actually use longnames:

eclipse-plugins-wtp-sdk
openclipart
qt4-html

so switch to pax extended headers now, the transition period is not
really needed. :)


Revision tags: OPENBSD_5_5_BASE
# 1.24 25-Jan-2014 espie

more ArcCheck nits: don't allow a file to be u-r/g-r without an explicit
@mode annotation.

This mostly fixes packaging bugs (like documentation only readable by root
and such nonsense), and also force *actual* mode settings for security
reasons to be apparent in the packing-list.


# 1.23 17-Jan-2014 espie

make ArcCheck less confusing, don't archive stuff that WON'T survive
extraction anyways (those metadatas ARE in the packing-list anyways).


# 1.22 23-Dec-2013 espie

get rid of "copy_long", we don't really need to recheck names while copying
a package contents.

Allow -o/-S for output/signature dirs for batch operations.
Fix copying of packages while signing, add progressmeter.


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.21 02-Jan-2011 espie

create formatted manpages as temporary files we remove after the fact.


# 1.20 24-Dec-2010 espie

handle failures from ports tree with more care.
this does avoid infinite loops in case of wrong plists.
necessary since print-plist-with-depends CAN fail...


# 1.19 02-Oct-2010 espie

whitespace


Revision tags: OPENBSD_4_8_BASE
# 1.18 28-Jul-2010 espie

pass state to Ustar objects, use it to display those pesky error and
fatal messages.

zap $opt_x from pkg_mklocated, do things like other commands do.


# 1.17 30-Jun-2010 espie

allow say and errsay to work without parameters, as it's ways common.
create verbose_system up in state, because it makes sense without verbose.


# 1.16 30-Jun-2010 espie

whitespace cleanup


# 1.15 10-May-2010 espie

whitespace fixes


Revision tags: OPENBSD_4_7_BASE
# 1.14 11-Nov-2009 espie

remove extra warnings


# 1.13 10-Nov-2009 espie

bad espie: use strict/warnings consistently, and fix two nits and two
actual errors !


Revision tags: OPENBSD_4_6_BASE
# 1.12 22-Apr-2009 naddy

fix creating packages with long names in plist; from espie@


# 1.11 19-Apr-2009 espie

synch with my new style search/location changes
It's likely there will be some fallout, but it's getting a bit too large
to keep around.
This does kill a few very old oddities as well.


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.10 12-Jun-2007 espie

tidy error messages: uses $! more consistently, do not append \n on die,
do append \n on warn.

Fix the two cases where the temp dir vanished too soon: not copying +DESC
should have been apparent. Not finding a +DISPLAY file is not a reason for
burping all over the place.


# 1.9 04-Jun-2007 espie

some minor systematic changes.
- mark all regexps I can with /o if they can be compiled once.
- turn $o->method() into $o->method
- remove unneeded prototypes
- reduce split /re/ into split "string" where possible.


# 1.8 25-May-2007 espie

until people finally fix their @group issues in packages, at least refuse
flat-out to write packages with no @group annotations on fishy stuff
(writable directories, setuid/setgid stuff)


# 1.7 25-May-2007 espie

move the mode checker code from pkg_create into ArcCheck, so that pkg_add
can reuse it.


# 1.6 02-May-2007 espie

$o->method() becomes $o->method


# 1.5 15-Apr-2007 espie

update copyright years, standardize licence.
reword the introduction to the stuff originally from FreeBSD to clarify
slightly.


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.4 31-Jul-2006 espie

cosmetic: comments, and better method name.


Revision tags: OPENBSD_3_9_BASE
# 1.3 24-Sep-2005 espie

pass actual items to prepare_long and check_name so that we can also
verify that modes/groups/owners are correct (code to come)


# 1.2 24-Sep-2005 espie

move uname/gname existence check into ArcCheck: Ustar archives deal with
this differently. Namely, use specific variables that default to the
numeric value if the uid/gid don't exist in mkheader.
Since the entry fields are not filled, ArcCheck gets all it needs for
the package check.


Revision tags: OPENBSD_3_8_BASE
# 1.1 07-Aug-2005 espie

wrapper around Ustar that replaces long names/links with LongName#/LongLink#.

The archive will unpack correctly with tar, except that those names won't
be preserved.

The wrapper checks names against the packing-list to restore the correct names
on the fly.

Put into a separate file, as it is an extension of Ustar proper, and we're
going to do more archive checking in the future.

Lots of tests by Bernd Ahlers. Comments by Tom Cosgrove.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.34 14-May-2016 espie

use twice the same code for prepare_long and verify_modes so that it can't
diverge.

tested for a few days and okay aja@


# 1.33 08-May-2016 espie

allow root files to be root-writable.

common work with aja@, okay aja@


# 1.32 02-Apr-2016 espie

streamline the code that checks meta information before extracting files
- verify_modes should only verify modes
- put the whole checking code in one single routine in validate_meta, makes
the size checking code more obvious
- document what's going on
- prevent PkgCreate from creating impossible packages, only a few Ustar
objects are actually usable.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.31 23-Dec-2014 espie

tweak meta-info checking a bit.
- remove IsLink tests, there's no reason to treat them specially.
- files are forced to root, no need to allow for bin anymore.

- force libraries to be not executable, if there's no explicit @mode
annotation


# 1.30 30-Nov-2014 espie

much simpler checks, always enforce root/bin (or root/wheel for symlinks)
for files without @owner/@group annotations, independently of who you are.

This should fix building-as-root for good, even without twiddling
FAKE_AS_ROOT.


# 1.29 16-Sep-2014 espie

if a @ts annotation is detected, wipe tarball timestamp. Archives will
look as if all files were born in 1970. The useful side-effect is that
meta-data for content-identical files WILL be identical as well.


# 1.28 09-Sep-2014 espie

register @newuser/@newgroup so that we try creating tarballs with the correct
users (which doesn't really matter all that much, as the owner/group in
the plist are what matters)

Otherwise, if we're not root, dismiss user id and groups, replace
with root/bin (significant fix from previous version: this interprets $(
correctly). Should help with FAKE_AS_ROOT=No


# 1.27 01-Sep-2014 espie

be a wee bit more paranoid about file sizes.


# 1.26 10-Aug-2014 espie

if pkg_create is run as non-root, restory correct group/owner to root/bin.

also, remove write permissions without explicit modes. Allows fake installs
to keep directories/files writable while producing correct package.


Revision tags: OPENBSD_5_6_BASE
# 1.25 22-Apr-2014 espie

turns out there are exactly 3 ports that actually use longnames:

eclipse-plugins-wtp-sdk
openclipart
qt4-html

so switch to pax extended headers now, the transition period is not
really needed. :)


Revision tags: OPENBSD_5_5_BASE
# 1.24 25-Jan-2014 espie

more ArcCheck nits: don't allow a file to be u-r/g-r without an explicit
@mode annotation.

This mostly fixes packaging bugs (like documentation only readable by root
and such nonsense), and also force *actual* mode settings for security
reasons to be apparent in the packing-list.


# 1.23 17-Jan-2014 espie

make ArcCheck less confusing, don't archive stuff that WON'T survive
extraction anyways (those metadatas ARE in the packing-list anyways).


# 1.22 23-Dec-2013 espie

get rid of "copy_long", we don't really need to recheck names while copying
a package contents.

Allow -o/-S for output/signature dirs for batch operations.
Fix copying of packages while signing, add progressmeter.


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.21 02-Jan-2011 espie

create formatted manpages as temporary files we remove after the fact.


# 1.20 24-Dec-2010 espie

handle failures from ports tree with more care.
this does avoid infinite loops in case of wrong plists.
necessary since print-plist-with-depends CAN fail...


# 1.19 02-Oct-2010 espie

whitespace


Revision tags: OPENBSD_4_8_BASE
# 1.18 28-Jul-2010 espie

pass state to Ustar objects, use it to display those pesky error and
fatal messages.

zap $opt_x from pkg_mklocated, do things like other commands do.


# 1.17 30-Jun-2010 espie

allow say and errsay to work without parameters, as it's ways common.
create verbose_system up in state, because it makes sense without verbose.


# 1.16 30-Jun-2010 espie

whitespace cleanup


# 1.15 10-May-2010 espie

whitespace fixes


Revision tags: OPENBSD_4_7_BASE
# 1.14 11-Nov-2009 espie

remove extra warnings


# 1.13 10-Nov-2009 espie

bad espie: use strict/warnings consistently, and fix two nits and two
actual errors !


Revision tags: OPENBSD_4_6_BASE
# 1.12 22-Apr-2009 naddy

fix creating packages with long names in plist; from espie@


# 1.11 19-Apr-2009 espie

synch with my new style search/location changes
It's likely there will be some fallout, but it's getting a bit too large
to keep around.
This does kill a few very old oddities as well.


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.10 12-Jun-2007 espie

tidy error messages: uses $! more consistently, do not append \n on die,
do append \n on warn.

Fix the two cases where the temp dir vanished too soon: not copying +DESC
should have been apparent. Not finding a +DISPLAY file is not a reason for
burping all over the place.


# 1.9 04-Jun-2007 espie

some minor systematic changes.
- mark all regexps I can with /o if they can be compiled once.
- turn $o->method() into $o->method
- remove unneeded prototypes
- reduce split /re/ into split "string" where possible.


# 1.8 25-May-2007 espie

until people finally fix their @group issues in packages, at least refuse
flat-out to write packages with no @group annotations on fishy stuff
(writable directories, setuid/setgid stuff)


# 1.7 25-May-2007 espie

move the mode checker code from pkg_create into ArcCheck, so that pkg_add
can reuse it.


# 1.6 02-May-2007 espie

$o->method() becomes $o->method


# 1.5 15-Apr-2007 espie

update copyright years, standardize licence.
reword the introduction to the stuff originally from FreeBSD to clarify
slightly.


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.4 31-Jul-2006 espie

cosmetic: comments, and better method name.


Revision tags: OPENBSD_3_9_BASE
# 1.3 24-Sep-2005 espie

pass actual items to prepare_long and check_name so that we can also
verify that modes/groups/owners are correct (code to come)


# 1.2 24-Sep-2005 espie

move uname/gname existence check into ArcCheck: Ustar archives deal with
this differently. Namely, use specific variables that default to the
numeric value if the uid/gid don't exist in mkheader.
Since the entry fields are not filled, ArcCheck gets all it needs for
the package check.


Revision tags: OPENBSD_3_8_BASE
# 1.1 07-Aug-2005 espie

wrapper around Ustar that replaces long names/links with LongName#/LongLink#.

The archive will unpack correctly with tar, except that those names won't
be preserved.

The wrapper checks names against the packing-list to restore the correct names
on the fly.

Put into a separate file, as it is an extension of Ustar proper, and we're
going to do more archive checking in the future.

Lots of tests by Bernd Ahlers. Comments by Tom Cosgrove.