Commit Graph

840 Commits

Author SHA1 Message Date
Dan McGee 5aa873edb6 sync.c: add sanity check so we don't dereference a null pointer
Originally noticed in FS#9024, but was fixed in previous changes anyway.
However, it doesn't hurt to still check it.

Also add a pactest from Chantry Xavier for the original problem to ensure
we can't reproduce it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 17:35:43 -06:00
Chantry Xavier 85a8b150ed conflict.c : fix for upgrade042.
Thanks to the proactive backup handling, we don't need to add the moving
file to the skip_add list.
The backup handling will make sure nothing gets overwritten.

Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010610.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 16:49:09 -06:00
Chantry Xavier 601a85082d add.c : fix upgrade026 pactest.
This was the case of the bash packaging error where a file was removed from
the package but not the backup array.
I just added a sanity check so that only the files from the backup array
that are also in the filelist are used.

I had to edit upgrade026 pactest slightly : it required the file to be
copied to .pacsave instead of moved. But just moving it should be enough, as
we agreed on the ML :
http://www.archlinux.org/pipermail/pacman-dev/2007-December/010440.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 13:47:49 -06:00
Matthias Gorissen 04472f925a Update of German translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 13:47:35 -06:00
Dan McGee c18191ba5b Small code cleanups with indents/spaces
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-01 20:03:24 -06:00
Dan McGee 4abd710ec9 Remove gettext calls from debug-level messages
These used FUNCTION output level and not DEBUG, so I didn't catch them way
back when I removed those gettext calls. Remove them now (which exposed a
nice little memory access error elsewhere in the code). This should have a
slight speedup effect on the code too as we no longer have to make the
gettext call even when these messages aren't printed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-01 20:03:24 -06:00
Dan McGee 553ce8323c Fix another usage of pkg_new in _alpm_sync_addtarget
Use _alpm_pkg_dup instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-01 20:03:24 -06:00
Dan McGee d18686a563 Switch pkg_new -> pkg_dup in find_replacements
Ugh, it was a pain to figure out why the Total Removed Size was showing up
wrong in the output of removed packages, but this was why- we used a stupid
_alpm_pkg_new call instead of just duping the package. Fix this. In the long
run, we really need to figure out better ways to not duplicate all this
package information.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-01 20:03:24 -06:00
Chantry Xavier ac0605b9c2 new upgade042 pactest + bugfix in chk_filedifference.
This adds a pactest for the relocation of a config file between two packages
(case of etc/profile moving from bash to filesystem).
While running this pactest, I found out that chk_filedifference didn't work
correctly with an empty list as second argument. So that's fixed now.

Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010610.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-01 20:03:18 -06:00
Dan McGee fbd88a8212 Remove .FILELIST generation from makepkg (and elsewhere)
This is something pacman can do on its own straight from the archive, and we
will reduce the chance of problems occurring becuase of inproper FILELIST
generation as we have had in the past with special characters in filenames.

Once we remove it from makepkg. we can remove any usage of it from all of
our other tools, including pacman, pactest, and contrib/ utilities.

Note that removing it from pacman uncovered a few other bugs anyway, so this
was probably a good move.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-29 11:58:23 -06:00
Chantry Xavier 01930400a5 add a new upgrade026 pactest for backup handling.
This is the bash case when the /etc/profile file was removed by error from
the package, but stayed in the backup array.

Ref:
http://www.archlinux.org/pipermail/arch-dev-public/2007-December/003556.html

Also fixed a little typo in add.c, but it's disabled code.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-29 11:17:20 -06:00
Chantry Xavier c913c53322 libalpm/add.c: disable buggy backup handling code that didn't do anything.
As I mentioned earlier on the ML :
http://www.archlinux.org/pipermail/pacman-dev/2007-December/010416.html
the first part of commit 843d368ef6 had no effect because of a bug.

So I fixed the bug, but since this would change backup handling behavior,
and possibly require other bigger changes to work right, I decided to just
disable that part temporarily, and left a TODO in the code.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-28 19:57:11 -06:00
Chantry Xavier 630541a72e french translation : one broken message caused a segfault.
pacman segfaulted on sync012 pactest because of one broken translation.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-28 19:56:14 -06:00
Chantry Xavier 457692b928 libalpm/remove.c : switch back to lstat usage.
commit b55abdce7a changed every instance of lstat to alpm_stat to remove an
eventual trailing /, but in remove.c, this is not wanted.

Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010451.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-28 19:55:38 -06:00
Allan McRae 14d6832ef2 Allow NULL parameter in alpm_trans_commit
Fixes FS#7380: alpm crashes on passing NULL to alpm_trans_commit in
a sync operation.  Adds check that data parameter is not NULL in
several functions.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
[Dan: fix whitespace]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-28 19:46:21 -06:00
Allan McRae cca4ec647e Add remove counterparts to alpm_option_add_* functions
Fixes FS#7428. Added functions to remove cachedir, noupgrade, noextract,
ignorepkg, holdpkg and ignoregrp.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
[Dan: fix whitespace]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-28 19:43:59 -06:00
Nathan Jones 7fdb2ee48a Check ignored packages in _alpm_sync_addtarget().
This will allow someone to install a group but ignore individual
packages inside the group.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-21 11:09:24 -06:00
Nathan Jones b43301428e Fix memory leak in shortest_delta_path.
It is possible for the if statement to never succeed, causing path to
never be freed. It is also possible for the if statement to succeed more
than once per loop, which could have caused a segfault.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-21 11:08:05 -06:00
Vojtěch Gondžala 9a6582a8fd Add new Czech translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-21 11:05:44 -06:00
Chantry Xavier 020629a371 Finish french translation.
It's probably far from perfect, but at least I tried to translate
everything.
I noticed a missing newline at libalpm/trans.c , line 573 :
_alpm_log(PM_LOG_ERROR, _("call to popen failed (%s)"),

I don't think it's possible to fix it now (string freeze?), so I didn't.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-21 11:05:44 -06:00
Nagy Gabor c0845db8f7 Updated Hungarian translation
1 untranslated message translated and 1 message fixed

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-20 08:05:54 -06:00
Nagy Gabor 13dd2864ca PM_DEP_MOD_LT and PM_DEP_MOD_GT depmods added
You can use foo<2.0 and foo>2.0 as depend
add046.py and add047.py pactests were added to check this

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-19 14:48:05 -06:00
Nagy Gabor 47f4c5a480 Updated Hungarian translation
* Updated libalpm translation
* Regenerated hu.po files, because the 'call-for-translators version' was outdated

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-19 13:30:04 -06:00
Giovanni Scafora 16ed9ad19b Updated Italian Translation
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>

	modified:   lib/libalpm/po/it.po
	modified:   po/it.po
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-18 18:27:23 -06:00
Giovanni Scafora a11b2065af Updated Italian Translation for pacman 3.1
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-17 20:43:12 -06:00
Dan McGee ce424a356f Check for errors on descfile extraction
If /tmp was full during the early stages of package extraction, we were
unable to extract the package description file with the call to
archive_read_data_into_fd(archive, fd) becuase we never checked the return
code. Add a check to ensure the extraction was successful and print and
return an error if it was not instead of falling through to a possibly
untrue error message.

This should fix FS #8885.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-16 22:45:57 -06:00
Aaron Griffin 9558639d80 popen does NOT require /bin/sh in a subchroot
I appears that when chrooted, the /bin/sh used by popen is that of the parent
process. This is true until the process forks once chrooted, which we do not
want to do.

As such, this actually makes things nicer. We don't need a /bin/sh in a chroot
to run install scriptlets, and don't need to check for it in the root directory

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10 23:03:16 -06:00
Aaron Griffin 565d2eeed5 Correct scriptlet usage pattern
The new pattern is as follows:
    . /path/to/scriptlet
    post_upgrade X Y

This requires less frameworking in the install scripts (the three lines that
shift and eval a function are nasty)

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10 23:02:07 -06:00
Dan McGee 9781d0d637 Update GNU GPL boilerplate and copyright dates
Update the GPL boilerplate to direct people to the GNU website for a copy of
the license, as well as bump all of Judd's copyrights to 2007.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10 22:55:39 -06:00
Dan McGee 7249c08bdf Improve changelog handling through addition of open/read/close functions
Thanks to Allan for inspiring all this work on what was one little TODO item
in the codebase. :)

Change changelog handling so we can now dump a changelog from both installed
packages and package files (fixes FS#7371). We do this by moving all of the
machinery to the backend where it should have been in the first place.

The changelog reading is now done through a open/read/close interface
similar to the fopen/fread/fclose functions (can you guess how it is done?).
It is buffered by the frontend, so programs using the library can read as
much or as little as they want at a time.

Unfortunately, I could not implement a changelog_feof function due to some
shortcomings of libarchive. However, I left the stub code in there,
commented out, in case it becomes possible later or anyone wants to take a
stab at it.

Original-work-by: Allan McRae <mcrae_allan@hotmail.com>
Improved-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-09 11:33:08 -06:00
Chantry Xavier 2ef78355fc _alpm_unpack: return 1 when the file is not found.
If _alpm_unpack has a specific file to extract (not NULL), but doesn't find
it, it'll now return 1, for indicating the failure.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-08 21:54:46 -06:00
Chantry Xavier 97fe3d3f5a libalpm/server.c : fix segfault when downloading failed.
The alpm_list_free(complete) needs to be done OUTSIDE the loop walking
through the server list.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-07 09:45:20 -06:00
Nagy Gabor 43eacf2852 Remove duplicated PM_TRANS_CONV_INSTALL_IGNOREPKG message
Now alpm_checkdeps first search for literals, then search for no-literal satisfiers

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: fix spelling of INTALL, fix line wrapping]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-05 11:28:47 -06:00
Chantry Xavier 87d95f14f7 libalpm/backup.c : simple refactoring.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-04 17:59:45 -06:00
Giovanni Scafora 0d1cb03756 Update it translation for 3.1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-03 09:11:34 -06:00
Jeff Bailes 4ce004a846 Update en_GB translation for 3.1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 22:36:18 -06:00
Dan McGee 3170106149 Update all translation files in anticipation of 3.1 release
Update all of the pot and po files with the latest messages available.

Translators- you are encouraged to do this as well every time you update the
translation, and the directions in 'translation-help' should help. Also feel
free to delete all the old translations that end up at the bottom of these
files and only clutter things up.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 21:44:40 -06:00
Chantry Xavier 594f1fbbb1 alpm_list : change the alpm_list_find* to return the matching item.
alpm_list_find and alpm_list_find_ptr will now return a void *, and
alpm_list_find_str will return a char *, instead of an int.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 18:12:41 -06:00
Dan McGee 0b6d73a5b4 Remove _alpm_depmiss_isin
This is unneeded now that commit 2ed6b482d2
has eliminated the last user of this function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 17:25:34 -06:00
Dan McGee 7341d09541 Add 4 new pactests to get better code coverage by pactest
I started playing around with gcov today and it showed a few places in the
code that we don't test at all. This is the start of ensuring that we
execute most of the code in our codebase.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 17:24:22 -06:00
Chantry Xavier 250331a636 Add new --needed option for -S.
During a pacman operation such as a group install, pacman can ask several
questions such as "local version is up to date. Upgrade anyway?". They are
usually all answered either by yes or by no:
* yes when you want to reinstall all the targets.
* no when you only want to install the missing ones (either because you are
installing a group, or because you are copying a pacman -S line from wiki or
whatever).

So instead of asking this question for each target, it is now now configured
with a flag.  Yes will be the default -S behavior, No will be achieved with
the --needed flag.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 11:14:13 -06:00
Chantry Xavier 22c2043160 Minor fixes in sync.c and deps.c.
* memleak found by Nagy in checkdeps
* an useless line found by Nagy in resolvedeps
* data wasn't set to the missing dependencies in sync_prepare
* use the MALLOC macro in resolvedeps

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-01 11:10:22 -06:00
Aaron Griffin 5f811dc020 Ensure 0644 permissions for install and changelog files
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-01 10:43:16 -06:00
Dan McGee cff1e2a58f Remove alpm_depcmp DEBUG output
alpm_depcmp is simple enough that we shouldn't need constant debug logging,
and the logging we do have in there negatively impacts our speed regardless
of whether we actually are seeing it or not. If it ever needs debugging, it
would be trivial to reimplement it by just temporarily reverting this
commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-30 23:02:06 -06:00
Dan McGee e95e346ac7 Remove some null checks in _alpm_checkdeps
Hopefully these are unnecessary, as they were probably added originally to
cover up a problem instead of finding the root cause. I'd rather fail hard
in these cases anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-30 22:57:47 -06:00
Nagy Gabor 2ed6b482d2 alpm_checkdeps clean-up
No bugfixes, just makes the code human-readable

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-30 21:17:04 -06:00
Nagy Gabor 72f40b3876 _alpm_checkconflicts split
_alpm_innerconflicts: check for target<->target conflicts
_alpm_outerconflicts: check for target<->localpkg conflicts
This will be useful in sync.c clean-up and in testdb.c

As an application the patch also fixes a misleading message (and a memleak)
in add.c

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25 16:14:16 -06:00
Nagy Gabor 7d37d9278d Fix for sync1003 and sync1004 pactests
checkdeps and resolvedeps now take both a remove list and an install list as
arguments, allowing dependencies to be calculated correctly.

This broke the sync990 pactest, but this pactest used dependencies and
provides in an unusual way, so it has been changed.

Dan: the sync990 pactest was just plain wrong. It didn't satisfy the
dependencies correctly, so should never have succeeded.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: some variable renaming, clarification in commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25 15:29:37 -06:00
Aaron Griffin 6e8daa553b Force mode of all database files to 644
In the case of a packaging error where install or changelog had bad permissions,
pacman respected the original permissions without trying to fix it - this means
that some operations (changelog) artificially required root permissions to run

In addition, minor function housekeeping on _alpm_unpack

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-25 14:03:13 -06:00
Aaron Griffin c7879e77a7 Additionally search for non-regex strings on a db search operation
This closes out FS#6500 and covers cases where the package names contain regex
characters (i.e. the case of dvd+rw-tools)

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-25 14:02:25 -06:00