Commit Graph

4553 Commits

Author SHA1 Message Date
Dan McGee 6a1d3948a6 Use correct size in memset
We were using the size of a pointer, not the size of the whole
archive_read_buffer struct. Thanks to Clang/LLVM 3.0 and Allan/Dave in
IRC for finding this one.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 23:21:56 -06:00
Dan McGee 17e0be9e6a repo-add: enforce maximum .sig file size
This prevents user error in adding a file generated via `gpg --sign`
rather than `--detach-sign`, for example. The same 16KiB limit is used
we use in our pacman download code.

The section is moved above the checksum generation to avoid presenting
info messages to the user if the signature isn't valid.

Addresses a shortcoming pointed out in FS#27453.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 10:48:47 -06:00
Dan McGee d85d0ddcfe Enforce signature download size limit on -U <url> operations
We had a 16 KiB limit on database signatures, we should do the same here
too to have a slight sanity check, even if we can't do so for the
package itself yet.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 10:07:05 -06:00
Lukas Fleischer 61ce2ca1bb contrib/paclist: Add "--help" command line parameter
Be consistent with all other contrib scripts and support the "--help"
command line switch. Fixes FS#27258.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 09:22:12 -06:00
Dave Reisner 5490cd6eb2 makepkg.5: fix typo s/tar,bz2/tar.bz2/
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:30:22 -06:00
Dave Reisner a521cea96f makepkg: avoid using comm for diff'ing package lists
Whereas comm will check inputs to see if they're sorted (and warn when
they aren't), grep doesn't even care about ordering. In this particular
instance -- neither do we. We're only interested that the two lists are
equivalent.

Fixes FS#26580.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee 15aa57d51b _alpm_ldconfig: return value from _alpm_run_chroot
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee d7f8838294 Add two new pactests for pacman upgrade behavior
Both currently marked as failing.

* sync303.py encapsulates the broken behavior reported in FS#27214.
* sync304.py shows how packages depending on a specific version of a
  package in SyncFirst can cause breakage of the dependency resolver.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee f5820c8bd6 Miscellaneous post-4.0.1 updates
Some late-arriving translation updates and add the correct dates to the
index.txt releases table.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee 507a2d15e6 Final changes before 4.0.1 release
* Add last-minute changes to NEWS
* Don't treat '_' or '_n' special in scripts when finding translatable
  strings; this breaks with one use of `read` and a dummy _ variable

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:29:46 -06:00
Dave Reisner b8ef22312b makepkg: trim trailing space from whitespace sensitive vars
This applies to pkgver, pkgrel, and epoch and ensures that any trailing
whitespace outside of the context of the variable declaration itself is
properly trimmed. The Bash parser will ignore this, and so should we.

We don't need to worry about leading space because it would force a
syntax error, or fail validation.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:17:43 -06:00
Dan McGee c79c068fe9 Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-16 14:45:25 -06:00
Dave Reisner ad09db3c55 makepkg.conf: disable motd printing for rsync DLAGENT
Fixes FS#26806.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 09:37:42 -06:00
Dan McGee 9363e7dc22 Allow sync_prepare to work in certain cases without sync databases
When doing a bare -U operation on a local package that doesn't pull in
any dependencies from the sync databases, we can get away with missing
database files. This makes the check conditional on no sync targets
found in the target list. This is not the prettiest code here so we have
a bit of hackish behavior required to straighten both the behavior and
the nonsensical error message out.

Addresses FS#26899.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 09:12:18 -06:00
Allan McRae 37ff0f5658 Update documentation regarding signature extensions
Commit e7b56f48 allowed makepkg to handle pgp signatures with the
.sign extension.  Update the man page to reflect this.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 08:17:08 -06:00
Dan McGee c0ce10397a Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-13 22:21:02 -06:00
Dan McGee fcf0a8b203 Updates in preparation for 4.0.1 release
Bump the version, update the translation template files, and fill in
NEWS with relevant commits and changes since 4.0.0.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-13 21:55:52 -06:00
Dave Reisner 42e2f8bfbf makepkg: check for value before using eval'd var
This prevent bsdtar from exploding when install= or changelog= are
present without a value.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-10 09:22:17 -06:00
Allan McRae e7b56f48d7 makepkg: handle pgp signatures with .sign extension
Detached sgnature files with extension .sign are accepted by gnupg.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-07 09:14:09 -06:00
Dan McGee 601c808b8d Fix download progress rounding edge case
Allan's original message: Occasionally when the download rate showed
100.0 the output got messed up. This was caused by the rounding of a
number between 99.95 and 100.  Adjust the threshold to avoid this
rounding issue.

Dan: make this fix, but also show values between 0 and 9.995 with two
decimal places since we have the room.

Original-fix-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-03 09:54:33 -05:00
Dan McGee 1953fe4368 Fix thinko in _alpm_strip_newline
The point of this early compare to NULL byte check was so we could bail
early and skip the strcmp() call. Given we weren't doing the check
right, this never exited early. Fix it to work as intended.

Noticed-by: Pepe Juárez <trulustapa@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 19:17:26 -05:00
Dave Reisner d98ff04cc9 src/util: link vercmp against .lo, not the .o
This seems to fix FS#26652.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 10:25:15 -05:00
Dave Reisner 4c259d51f7 dload: remove redundant conditional
Replacing the strdup when after the first NULL check assures that we get
continue with payload->remote_name defined.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-27 17:49:09 -05:00
Dave Reisner f4875fab9b dload: chmod tempfiles to respect umask
Dan: fix mask calculation, add it to the success/fail block instead.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-27 17:46:48 -05:00
Dan McGee 3343185473 Introduce ALPM_BUFFER_SIZE constant
This takes the place of three previously used constants:
ARCHIVE_DEFAULT_BYTES_PER_BLOCK, BUFFER_SIZE, and CPBUFSIZE.

In libarchive 3.0, the first constant will be no more, so we can ensure
we are forward-compatible by removing our usage of it now. The rest are
unified for consistency.

By default, we will use the value of BUFSIZ provided by <stdio.h>, which
is 8192 on Linux. If that is undefined, a default value is provided.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-27 14:59:24 -05:00
Dave Reisner 1052709921 paccache: add vim modeline
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-26 17:46:59 -05:00
Dave Reisner 24881034f6 paccache: ensure seen/seenarch vars are set
Doesn't do a whole lot of good to compare against values that are never
set. Fixes bug where -vvv output wasn't grouping packages together
properly.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-26 17:46:53 -05:00
Dan McGee 8a9ce12a27 Fix issues with replacing unowned symlinks
There aretwo seperate issues in the same block of file conflict
checking code here:
1) If realpath errored, such as when a symlink was broken, we would call
   'continue' rather than simply exit this particular method of
   resolution. This was likely just a copy-paste mistake as the previous
   resolving steps all use loops where continue makes sense. Refactor
   the check so we only proceed if realpath is successful, and continue
   with the rest of the checks either way.
2) The real problem this code was trying to solve was canonicalizing
   path component (e.g., directory) symlinks. The final component, if
   not a directory, should not be handled at all in this loop. Add a
   !S_ISLNK() condition to the loop so we only call this for real files.

There are few other small cleanups to the debug messages that I made
while debugging this problem- we don't need to keep printing the file
name, and ensure every block that sets resolved_conflict to true prints
a debug message so we know how it was resolved.

This fixes the expected failures from symlink010.py and symlink011.py,
while still ensuring the fix for fileconflict007.py works.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-26 17:32:46 -05:00
Dan McGee 5c1885b55e Add some unowned symlink replacement tests
These should all prevent installation, and yet two of the three tests
currently fail. Not good.

The best way to see what is going on here is to diff the three new tests
side by side- there is only a small difference between the three tests,
and that is in the destination of the symlink in question that should
never be overwritten.

  symlink010.py: myprogsuffix -> myprog
  symlink011.py: myprogsuffix -> broken
  symlink012.py: myprogsuffix -> otherprog

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-26 17:31:43 -05:00
Dan McGee 7a6b01d46c Don't realloc a 0-length files array when loading packages
There is some pecular behavior going on here when a package is loaded
that has no files, as is very common in our test suite. When we enter
the realloc/sort code, a package without files will call the following:

    files = realloc(NULL, 0);

One would assume this is a no-op, returning a NULL pointer, but that is
not the case and valgrind later reports we are leaking memory. Fix the
whole thing by skipping the reallocation and sort steps if the pointer
is NULL, as we have nothing to do.

Note that the package still gets marked as 'files loaded', becuase
although there were none, we tried and were successful.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-26 15:44:55 -05:00
Dave Reisner 2da59e1aa9 lib/sync: inform callers of compute_download_size of a partial
Extend the return values of compute_download_size to allow callers to
know that a .part file exists for the package.

This extra value isn't currently used, but it'll be needed later on.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-25 10:38:12 -05:00
Allan McRae 571f2f7814 Fix libtool detection of --as-needed flag
The fix for -Wl,--as-needed in commit b0f9477f assumes that
--as-needed/--no-as-needed is the only option given in a -Wl line.
However, it is perfectly valid to specify multiple flags comma
separated after a single -Wl (e.g. the default LDFLAGS in Arch
Linux makepkg.conf).

Adjust the fix so it detect --as-needed in a more general context

> readelf -d lib/libalpm/.libs/libalpm.so.?.?.? | grep NEEDED | wc -l
Before: 13
After: 5

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-25 10:37:30 -05:00
Allan McRae 0d9e7da309 Update libtool files
Update for libtool-2.4.2 while keeping the fix for --as-needed from
commit b0f9477f.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-25 10:37:21 -05:00
Dan McGee 5853025137 Add more logging to download code
This adds a logger to the CURLE_OK case so we can always know the return
code if it was >= 400, and debug log it regardless. Also adjust another
logger to use the cURL error message directly, as well as use fstat()
when we have an open file handle rather than stat().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-24 13:49:14 -05:00
lolilolicon d6e3446e70 bacman: pkgrel does not have to be an integer
pkgrel, as with pkgver, simply mustn't contain hyphens.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 12:31:24 -05:00
Dan McGee 20a47aba8e Remove remaining usages of fprintf() from frontend
These can either be replaced with pm_printf() if they are error related,
or in the fprintf(stdout, ...) case a bare printf() will do.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 10:51:49 -05:00
Dan McGee 9e9ecf2183 Remove pm_fprintf() in favor of pm_printf()
Now that pm_printf() always prints to stderr, we don't need this second
function that was always used with stderr as the first argument. Thus,
this patch removes the function and makes the following sed replacement:

    sed -i -e 's#pm_fprintf(stderr, #pm_printf(#g' src/pacman/*.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 10:45:18 -05:00
Dan McGee 45f86ca1ca Use stderr as output stream for pm_printf()
This matches what we now do in our backend callback function- all
debug/info/warning/error/etc. messages should be on stderr. These are
all the messages with a "warning:" or other type prefix, so does not
affect general pacman output.

This should fix the output confusion noted in FS#26555.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 10:38:02 -05:00
Dan McGee 4bada45464 pacman-key: add a default keyserver timeout value on --init
The default is supposidely 30 seconds from the gpg manpage, but that
sure wasn't what I was seeing- it was somewhere closer to two minutes of
silence. Add a more reasonable 10 second timeout value which should be
good enough for any keyserver that doesn't totally stink at it's job.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 09:42:46 -05:00
Dan McGee bac670ddc9 Show an error message on failed remote key lookup
The absolutely terrible part about this is the failure on GPGME's part
to distinguish between "key not found" and "keyserver timeout". Instead,
it returns the same silly GPG_ERR_EOF in both cases (why isn't
GPG_ERR_TIMEOUT being used?), leaving us helpless to tell them apart.

Spit out a generic enough error message that covers both cases;
unfortunately we can't provide much guidance to the user because we
aren't sure what actually happened.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 09:38:35 -05:00
Dan McGee 842c4422ed Table display: print message with warning: prefix
Use the normal error functions here rather than a bare fprintf().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 08:28:57 -05:00
Dan McGee 020bdb4298 makepkg: don't attach traps until after argument parsing
Nothing we do in our traps is necessary this early in the script. This
fixes FS#26196.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 08:16:06 -05:00
Dan McGee 185cbb8a44 Add missing #ifdef around cURL error code in download struct
Thanks to Eduardo Tongson on the mailing list.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 07:38:58 -05:00
Dan McGee 5b5b250443 Coding style cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 15:16:59 -05:00
Dan McGee 86bc36412e curl_gethost() potential bug fixups
This is in the realm of "probably not going to happen", but if someone
were to translate "disk" to a string longer than 256 characters, we
would have a smashed/corrupted stack due to our unchecked strcpy() call.
Rework the function to always length-check the value we copy into the
hostname buffer, and do it with memcpy rather than the more cumbersome
and unnecessary snprintf.

Finally, move the magic 256 value into a constant and pass it into the
function which is going to get inlined anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 15:16:10 -05:00
Dan McGee 1ebe5dc197 doc/index.txt: Reformat past releases chart
This makes it a three-column deal with releases all the way back to 1.0.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 14:54:49 -05:00
Dan McGee 43cad9c871 doc: update .gitignore, add CSS override for new tables usage
* Make all docs depend on Makefile; if we change flags here we want them
  rebuilt.
* Add explicit filenames to .gitignore so we can add our own CSS
  override file, and add an asciidoc-override.css resource.
* Adjust a few asciidoc options when generating HTML.
* Remove asciidoc-manpage.css; apparantly this doesn't exist anymore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 14:53:52 -05:00
Dan McGee 04fd320e97 Update NEWS for missing 4.0 stuff and 4.0.1 changes so far
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 11:22:50 -05:00
Lukas Fleischer 241946ccea scripts/*.sh.in: Fix signal handler error messages
This includes some fixes to the messages that are displayed when a
signal is caught in makepkg or repo-add:

* Instead of always showing "==> ERROR: TERM signal caught. Exiting...",
  replace "TERM" by whatever signal is actually caught.

* Fix a typo in the SIGERR error message in repo-add ("occurred" instead
  of "occured"). Francois already fixed this for makepkg in 1e51b81c.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 11:20:12 -05:00
Lukas Fleischer d4c97ea2f6 repo-add: Avoid race condition in signal handlers
There is a small chance that a user sends SIGINT (or any other signal
that is trapped) when we're already in clean_up() which used to lead to
trap_exit() being executed and the remaining code in clean_up() being
skipped due to the bash signal/trap handler blocking EXIT (since its
handler is already being executed, even if it's interrupted).

In practice, this behaviour caused unexpected results (primarily because
pressing ^C at the wrong time left a lock file behind):

    $ ./repo-add extra.db.tar.gz foobar
    ==> Extracting database to a temporary location...
    ^C
    ==> ERROR: Aborted by user! Exiting...
    $ ./repo-add extra.db.tar.gz foobar
    ==> Extracting database to a temporary location...
    ==> ERROR: File 'foobar' not found.
    ==> No packages modified, nothing to do.
    ^C
    ==> ERROR: Aborted by user! Exiting...
    $ ./repo-add extra.db.tar.gz foobar
    ==> ERROR: Failed to acquire lockfile: extra.db.tar.gz.lck.
    ==> ERROR: Held by process 18522

Fix this and reduce the chance of race conditions in signal handlers by:

* Unhooking all traps in both clean_up() and trap_exit().

* Call clean_up() explicitly in trap_exit() to make sure we remove the
  lock file and the temporary directory even if we send SIGINT when
  clean_up() is already being executed but didn't reach the unhook code
  yet.

Also, add an optional parameter to clean_up() to allow for setting an
explicit exit code when we call clean_up() from trap_exit().

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 11:20:03 -05:00