This allows us to remove the hack in the frontend where we added a newline
to everything coming out of the pm_printf functions, and instead let the
developer put newlines where they want them. This should be the last hangover
of that auto-newline stuff.
Signed-off-by: Dan McGee <dan@archlinux.org>
As reported by JGC in FS #7652, the check for EACCES is not exactly correct.
We need to check for the ETXTBSY error as well. This is necessary on FreeBSD.
Signed-off-by: Dan McGee <dan@archlinux.org>
A bunch of changes related to my first "real" install of pacman-git into
/usr/local and trying to use it.
* Shift some uses of free -> FREE in libalpm.
* Move stat and sanity checks of config paths into libalpm from the
config and argument parsing in pacman.c.
* Fix issue where dbpath still was not defined early enough due to its
requirement for being used in alpm_db_register. This should be rewritten
so it doesn't have this dependency, but this will work for now.
Signed-off-by: Dan McGee <dan@archlinux.org>
This patch cleans up and fix the _alpm_trans_update_depends function
and ensure that all requiredby fields are filled in case of multiple satisfiers
(previously, the handling of mutliple satisfiers in that function was inconsistent).
This makes a special case handling of requiredby in commit_single_pkg() obsolete,
and so allows cleaning that code as well.
Also fixed upgrade056 pactest because :
1) the requiredby fields were wrong, and this wouldn't happen with the fixed _alpm_trans_update_depends().
2) this is a very unusual case anyway (and handling all corner cases combined to a broken database
seems nearly impossible to achieve).
References :
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008919.htmlhttp://www.archlinux.org/pipermail/pacman-dev/2007-July/008920.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
In order to best resolve bug 6404, move some cachedir handling stuff out of
sync.c and into util.c and create two new functions: filecache_find and
filecache_setup. sync.c was rewritten to use these, and alpm_fetch_pkgurl
now also uses these routines.
Signed-off-by: Dan McGee <dan@archlinux.org>
In my opinion, a commiting transaction that failed isn't equivalent
to a prepared transaction.
Some things could have been done in the meantime.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Move alpm md5 functions to lib/libalpm/util.c
* Remove unneeded includes for md5.h
* Replace md5 implementation with one from http://www.xyssl.org
Dan: clean up XySSL code by removing parts we don't use, and add a note
saying what changed.
Dan: fix alpm_get_md5sum, off by one error on the malloc call and other
small things.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
There's no need for a second hashing algorithm. MD5 serves the purpose
of verifying that a package file hasn't been corrupted during download.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
This basically moves the code from alpm_release, which was mostly about
unregistering all databases, to a safer alpm_db_unregister_all.
This allows to avoid modifying the dbs_sync list while iterating over it,
and and also prevent alpm_release from looping infinitely when a database
can't be unregistered.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This prevents alpm_release to loop infinitely in case of
an interrupted transaction, where the database wasn't
unregistered.
alpm_release should probably also be fixed, as it can
still loop if db_unregister fails for another reason.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
We were using a void *data element in pmpkg_t before, which is unsafe by its
nature of being untyped. Reimplement data as origin_data being a union that
can hold either a path to a package file or a pointer to a cache database,
and make the other necesary updates in the code to reflect this. See package.h
for details.
Signed-off-by: Dan McGee <dan@archlinux.org>
Remove the commented desc_localized stuff, we can find it later in version
control. Also remove some unnecessary includes of the stat header and
use -fstack-protector-all which is a bit more broad.
Signed-off-by: Dan McGee <dan@archlinux.org>
A side effect of the previous commit ( ea9a756eea )
is that it's now possible to use versioned conflicts.
Add two new conflict pactests for showing it.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
I didn't like the patch proposed by Nagy for the sync1002 pactest here:
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008971.html
So here is another attempt of fixing it.
In case of the DEPENDSONLY flag :
1) pass an empty list to resolvedeps instead of the list of targets
2) empty the trans->packages targets list before adding the resolved deps.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
That function wasn't big, but this might be useful
for later refactoring of the search for satisfier code.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The _alpm_sortbydeps function has two main part :
1) initialization of the graph structure
2) the sorting itself
So it didn't seem bad to move the first part to a second function.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
.gitignore works recursively, so we don't need Makefile and Makefile.in
in all of the subdirectory .gitignore files.
Signed-off-by: Dan McGee <dan@archlinux.org>
This is a full refactoring of _alpm_add_commit into multiple functions and a
better layout for later. Some highlights:
* No regressions in pactest performance.
* Much cleaner layout. add_commit is split into four functions:
upgrade_remove, extract_single_file, commit_single_pkg, _alpm_add_commit
* No more super-functions, the heaviest (extract_single_file) is finally
under 400 lines, with much improved commenting as well.
* Incorporation of Andrew Fyfe's ideas for fixing FS #7484. Try to handle
all possible cases of extraction combinations with files, symlinks, dirs,
and non-existant entries on the filesystem. This should make our dealings
with libarchive fall more into our control.
Signed-off-by: Dan McGee <dan@archlinux.org>
This replaces the former -D operation that was undocumented and rather
hacky. It can be used with add, upgrade, or sync transactions and will affect
all packages installed. Should close FS #7193.
Also tell makepkg to use this new flag.
Signed-off-by: Dan McGee <dan@archlinux.org>
This fixes the failure of the requiredby004 pactest in a not so pretty way,
but it gets the job done. I purposely used the extremely long name of
PM_TRANS_TYPE_REMOVEUPGRADE to be both clear and in the hope that someone
else will figure out a better solution.
Original idea from Nagy Gabor, patch updated and cleaned for current code.
Signed-off-by: Dan McGee <dan@archlinux.org>
remove _alpm_ldconfig call from _alpm_sync_commit,
since sync operation causes an upgrade transaction,
where ldconfig is already run.
Reference:
http://www.archlinux.org/pipermail/pacman-dev/2007-April/008132.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
In 1c9f30b9fa
This change should be done AFTER the TODO in recursedeps is implemented.
Then we'll be able to first sort the list, then call recursedeps which keeps
it sorted. For now, the sorting should still be done as the last step.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Patch from Nagy that makes removedeps use alpm_depcmp.
I also renamed removedeps to recursedeps, as it can have
a more general usage, and added an include_explicit argument,
so we can control if packages explictly installed are added or not.
Note: Small changes made by me (Dan) as well- mostly some English grammar
correction and a few other cleanups.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Currently the d (nodeps) option skips the s (recursive) part,
rendering the Rsd combination totally useless.
This patch makes a recursive removal still possible using the nodeps option,
as Romashka asked there :
http://bugs.archlinux.org/task/6057#comment17784
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Remove versioncmp.c by moving all functions to locations that make sense.
Move replacement functions (for building without glibc) into util.c where
they belong, and do proper checks for them instead of using __sun__, etc.
Signed-off-by: Dan McGee <dan@archlinux.org>
Remove unused buildtype field from pmpkg_t struct and anything associated
with it, as it is unused at the moment. If we need to readd it, it is an
easy revert of this commit.
Signed-off-by: Dan McGee <dan@archlinux.org>
The three chk_ functions overlap for packages both in targets and in the
database. This caused the same conflict to be found in both direction
(A conflicts with B, and B conflicts with A).
This patch avoids this duplication. which shouldn't be needed, but other
changes might be required for that to work correctly.
This also has the unexpected side effect to hide the failure of sync022
pactest, for FS #7415. That's maybe not a good thing though..
Note from Dan: sync022 does succeed, but a sync023 pactest added to check
regressions also seems to pass. This may be a valid fix to this 'problem'
sync022 was meant to find.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Because of this commit:
ea1fef69ad
we lost a lot of gettext-ized messages on the libalpm side. Remove them
in order to clean out these files a bit.
Signed-off-by: Dan McGee <dan@archlinux.org>
There is no real reason to burden our translators with these messages, as
anyone helping to debug these will probably want them in English.
Signed-off-by: Dan McGee <dan@archlinux.org>
We shouldn't translate log messages to pacman.log so it is consistant and
can be parsed by other tools. Remove all gettext _() around these strings.
Signed-off-by: Dan McGee <dan@archlinux.org>
Move the translations from src/pacman/po to just po/ so we can include the
scripts gettext translations in the same message catalog as that of the
pacman frontend. The libalpm message catalog, for now, will remain a separate
existence.
Signed-off-by: Dan McGee <dan@archlinux.org>
I ran flawfinder and sparse over the pacman source code and found a few
things that were worth fixing (and were quick fixes).
Signed-off-by: Dan McGee <dan@archlinux.org>
Adds the ARCHIVE_EXTRACT_NO_OVERWRITE libarchive flags
for extracting files and directories.
This will prevent symlinks for being overwritten by directories.
All other files that need to be extracted should already have
been deleted previously by pacman.
This flag is not used for extracting files in backup array
to /tmp/alpm_XXXX, because this file is created by mkstemp first,
and so needs to be overwritten by the file from the archive.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
With libarchive 2.2.3 (previously 1.3.1), archive_read_extract now returns ARCHIVE_WARN
when a package is extracted as user, because for example, UID=0 or SUID bit can't be set.
This patch makes pacman not treating these warnings as errors anymore,
but simply ignoring them.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
I previously introduced some patches to make just about every path in
pacman/libalpm configurable; doing this with the lockfile seemed a bit too
far and we really should just place the lockfile where it belongs- with the
DB that needs locking.
More details in this thread:
http://archlinux.org/pipermail/pacman-dev/2007-June/008499.html
Signed-off-by: Dan McGee <dan@archlinux.org>
The scriptlet calling had some unneeded complexity for the time being
which we aren't using here. Let's get rid of it until we find a good way
to implement it correctly.
Signed-off-by: Dan McGee <dan@archlinux.org>
First reported here:
http://bbs.archlinux.org/viewtopic.php?pid=261861
Newly created files were done with the standard umask, so those that are
extracted seperately and copied to a .pacnew extension will have the wrong
permissions. This should hopefully fix this.
Signed-off-by: Dan McGee <dan@archlinux.org>
The alpm_splitdep function formerly overwrote the input string, causing
a few issues. Fix this.
Signed-off-by: Nagy Gabor <ngaba@petra.hos.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
For future possibilities, don't extract any files that start with '.'.
This will allow us to add features such as the ChangeLog viewing without
having to wait to include these files in packages, because older versions
of pacman will be forward compatable with 'hidden' files at the root level
of the package.
Signed-off-by: Dan McGee <dan@archlinux.org>
This was a bad way to fix a problem upstream. Doing this resulted in
symlink permissions being applied to files installed on the system, leaving
some binaries with 77 permission, etc.
This reverts commit 4e6b7c1cde.
This function is an absolute disaster, so we'll take it one step at a time
here. This was a quick once-over of the whole thing, trying to straighten
out some of the spaghetti code and fix some mistakes that others found.
We are now down to two failing pactests again: sync300 and upgrade051.
Signed-off-by: Dan McGee <dan@archlinux.org>
This should hopefully allow multiple cache dirs to be specified in
pacman.conf and/or on the command line, and allow pacman to test
each one for the package file. The first one found to be writeable is
used as the download cache.
Signed-off-by: Dan McGee <dan@archlinux.org>
* Readd default logmask of ERROR and WARNING
* Remove DOWNLOAD log level as it no longer applies
* Add 'no targets' logic back in where it applies
* Switch some prints in parseconfig to ERROR
Signed-off-by: Dan McGee <dan@archlinux.org>
Remove the logmask functionality from the backend as it has been moved to
the frontend, and change the logging callback function to use pm_printf.
In addition, make much better use of va_list- use the args list instead
of a arbitrarily chosen string to print to in the logging functions.
Signed-off-by: Dan McGee <dan@archlinux.org>
Add some 'const' keywords all over the code to make it a bit more strict on
what you can and can't do with data. This is especially important when we
return pointers to the pacman frontend- ideally this would always be
untouchable data.
Signed-off-by: Dan McGee <dan@archlinux.org>
'inline' keyword in C99 is not correctly recognized, so compilation fails on
the warning it spits. This fixes this.
Signed-off-by: Dan McGee <dan@archlinux.org>
The db variable was left unset when calling alpm_db_register, leading
to a failure to ever register a sync db. Also added a check to ensure
DBPath was set when trying to register a database.
Signed-off-by: Dan McGee <dan@archlinux.org>
Switch over to the new frontend parseconfig.
* Fix a few issues in parseconfig
* Remove unused callback upon database registration
* Remove conf file related errors from error.c/alpm.h
Signed-off-by: Dan McGee <dan@archlinux.org>
alpm.h is the only "publically viewable" file, so there is no reason to have
functions in alpm.c that belong in package.c, db.c, etc. Move the functions
where they belong and leave only the library init functions in alpm.c.
Signed-off-by: Dan McGee <dan@archlinux.org>
* Add vim modeline to Makefile.am and configure.ac
* Fix white space in Makefile.am and configure.ac
* Add contrib/wget-xdelta.sh to EXTRA_DIST in Makefile.am
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
Remove any use of the former path variables defined by the Makefiles or
config.h. These are now runtime configurable only with pacman.conf (or by
using flags on the command line).
Signed-off-by: Dan McGee <dan@archlinux.org>
Move the defaults for RootDir, CacheDir, DBPath, and LockFile into
pacman.conf, just as LogFile was done before. Add a section to
alpm_parse_config to look for a LockFile directive.
Signed-off-by: Dan McGee <dan@archlinux.org>
This code depends on /etc/mtab existance, which is not very reliable in all
cases, especially in a chroot or non-Linux environment. Dump it for now
until we can find a better way.
Signed-off-by: Dan McGee <dan@archlinux.org>
Also cleaned up some duplicate printf lines related to the ShowSize option.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This change allows us to use all autoconf specified paths, most notably
$(localstatedir). It is quite a change and touches a lot of files, as
all references to the DB and cache were done with the ROOTDIR as a prefix.
* add --lock command-line option to pacman to specify the location of the
lockfile (this can now be specified at configure time by setting the
$localstatedir path).
* Rip quite a few settings out of configure.ac as they are now picked by
setting the paths during configure or make.
* Fix bug with /tmp fallback for sync downloads not working correctly
(related to root location, now the system tmp dir is used).
* Simplified the parameters to some libalpm functions, and added get/set
for the new lockfile option.
* Renamed several of the DEFS to names without the PM_ prefix.
Signed-off-by: Dan McGee <dan@archlinux.org>
Small change (addition of a 'strreplace' function) which replaces
any $repo tokens found in a server line with the name of the repo
or section being processed.
While this is more simplistic than suggestions on flyspray, it works
and I think it is cleaner. Merits can be discussed further.
Ref: FS#6389
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Reorder package version checking so there is no output when a
package is listed in IgnorePkg.
Closes FS#7111
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Fix for FS#7133 - when DB scanning finds an invalid named entry,
scanning is currently aborted. Instead we will simply skip it
and find the next valid package.
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>