- Install and erase are radically different in when and what they
stat, and what they do with the info. Let them do their own
stating where most appropriate...
- fsmStat() zeroes out the stat buf on error so we can just look
at st_nlink to see whether something exists or not - no existing
file can have zero nlink.
- fsmBackup() used to update exists on successful rename but it
shouldn't make a difference, at least anymore...
- Stripped payload doesn't need all the goo we look up via rpmfiStat()
but it does need corrected size for symlinks, hardlinks and all...
which we get from rpmfiStat(). For plain old cpio archives this
eliminates the whole manual fi -> stat mapping, obviously.
- We have no use for the symlink target stored as file content, the
data from header is used instead. With this change only regular
files ever have non-zero expected payload size on return.
- There's now a possibility of IO-error after validating the mapping
index, differentiate between rc / fx on return to avoid bad
values to rpmfiSetFound()
- For regular cpio archives we'll need to get a path, otherwise funny
stuff might happen... so decide on path, not fx
- Validate fx is within bounds for both archive styles
- Explicitly set expected file size for cpio archives too
- fi->next() shouldn't need to call rpmfiSetFX(), it gets set on
return from the iterator function and use rpmfilesFLinks() instead
of the iterator version to provide random access to files, that's
what its for.
- Iterator points to previous file (or nothing at all) inside
the iter next function, need to use the indexed rpmfiles interfaces.
There used to be a rpmfiSetFX() call here at some point which would've
made this work but the next function is not supposed to be setting
the iterator, only figuring the next index.
- fsmVerify() first, then read, validate archive, create entry
as necessary.
- We dont really need the payload content for anything as we have the
target in rpmfi already, but since we have to skip over it somehow
we might as well validate the content matches expectations.
- urlGetFile() can only handle one file at a time, so globbing does
not make sense and only confuses us. Besides, useful things like
'rpm -Uvh http://somewhere.org/foo-1.2-1.{i386,x86_64}.rpm'
work just as well without curl-level globbing.
- Incidentally this is also the documented workaround for using
IPv6 numerical addresses with curl (RhBug:1076277)
- We already free the path in fsmInit() so the free was redundant anyway,
and everything else has been stripped down to the one fsmFsPath() call
which we can just as well do from fsmInit()
- The prepare hook is used for things like selinux label lookups
which depend on exact filenames, and .rpmnew suffix will almost
certainly mess up such a lookup, and could cause bad permissions
(selabel or similar) if admin does 'mv foo.conf.rpmnew foo.conf'