Commit Graph

6306 Commits

Author SHA1 Message Date
Allan McRae 8a373096f5 Detect potential conflict when symlink to directory is changing to directory
When a symlink to a directory is changing to a directory, any package file
inside the new directory can create an unexpected conflict with the filesystem.

Reported by Neofytos and Luca from Chakra.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 17:46:11 +10:00
Allan McRae 088649534e Add large file support CFLAGS to pkgconfig file
Large file support is enabled by our configure script as required.  If anything
linking to libalpm does not also define large file support, there will be
differences in the size of off_t which are not caught until runtime.

Add the required CFLAGS to the pkg-config file so that users of libalpm know
what flags are required.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-04 11:06:49 +10:00
Andrew Gregory dfa4dcb16d run_chroot: always clear script output buffer
If the script output does not end in a newline there could still be data
in the buffer after the poll loop.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-29 08:12:44 +10:00
Evangelos Foutras 34bbe4cf7b pacdiff: do not require DIFFPROG for -o/--output
Signed-off-by: Evangelos Foutras <evangelos@foutrelis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 22:57:24 +10:00
Andrew Gregory 5312e683fc hooks: pass matched targets to hooks
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 22:53:24 +10:00
Andrew Gregory 8ad893732d allow specifying input to scriptlets
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 22:52:11 +10:00
Andrew Gregory b42d0852f3 allow arguments in hook Exec fields
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 16:26:51 +10:00
Andrew Gregory e0607f6ae2 tap.py: replace newlines with escape sequence
Newlines clutter tap output and can potentially confuse TAP parsers.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 16:23:56 +10:00
Andrew Gregory e03fa67445 pmrule.py: add FILE_CONTENTS rule
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 16:23:08 +10:00
Allan McRae 23f128ad5e lint_pkgbuild/variable: increase robustness
Approach the detection of variables of the wrong type using an approach
similar to that used for construction of .SRCINFO files. While doing silly
things in bash could still result in false negatives, this approach should
be very robust to generatinf false positives results.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 16:03:33 +10:00
Allan McRae 663c74150a makepkg: merge arch dependent variables after PKGBUILD linting
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 16:02:32 +10:00
Allan McRae ef1fb0ef81 makepkg: remove obsolete comment
Behaviour changed in commit dce82f9d.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 11:13:39 +10:00
Allan McRae c26e5b81e5 lint_pkgbuild: explicitly return value
Set the return value to be local and always explictly returns it.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 11:13:39 +10:00
Silvan Jegen 947dfda515 Refactor strtrim function
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-11 14:03:49 +10:00
Rikard Falkeborn 9e22e75fa1 Use correct format specifiers
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-11 13:47:08 +10:00
Aaron Campbell bf0e8e6b43 Refactor lint_source to work with earlier versions of Bash
Negative subscripts to indexed arrays are not supported before 4.2.  However,
since substring expansion works on arrays, we can specify an offset of -1 to
be taken relative to one greater than the maximum index of the specified
array (see Parameter Expansion section of the bash man page).  This works with
both Bash 4.1 and 4.2, and 4.1 is already the oldest supported by pacman.

Signed-off-by: Aaron Campbell <aaron@monkey.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-05 11:55:17 +10:00
Andrew Gregory 8fa02036c3 files_search: reset found for each target
Otherwise any invalid targets following a successful match will not get
an error message.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 15:06:21 +10:00
Andrew Gregory 726712aa08 files_search: free compiled regex
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 15:06:08 +10:00
Andrew Gregory 978b197120 files: do not unnecessarily strdup targets
Targets are never modified so we can just use the original copy.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 15:05:52 +10:00
Andrew Gregory 0d877ec429 files.c: add vim modeline
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 14:51:49 +10:00
Andrew Gregory 08b0b6de96 add detail to broken dependency errors
The difference between a sync target having an unmet dependency and
breaking a dependency for an installed package is a common source of
confusion.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 14:50:57 +10:00
Andrew Gregory 556c56d4d5 add --quiet to -Fh
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 14:50:57 +10:00
Andrew Gregory 6eac7258cd ensure realloc has a positive size
If given size 0 POSIX allows realloc to return a pointer that is not
suitable for use.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03 21:45:09 +10:00
Mohammad Alsaleh 0fd6d354a6 zsh_completion: Handle --ignore/--ignoregroup correctly
Completion now works as expected with a comma-separated sequence.

Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03 15:07:11 +10:00
Pierre Neidhardt d5b0f0c26f package.c: Fix incorrect buffersize and constant-folding
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03 14:41:25 +10:00
Florian Pritz 906dc0ce24 Add -F --machinereadable option
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03 14:36:59 +10:00
Florian Pritz 697377aae3 Document pacman -F
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03 14:36:53 +10:00
Allan McRae d8621b981e scripts/po: fix translated file name
This file was renamed during review and its entry in POTFILES.in was not
updated.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-28 17:04:08 +10:00
Andrew Gregory dcc1b22cb3 _alpm_hook_run: check path length before copying
If a hook path equals or exceeds PATH_MAX characters the path will be
left unterminated.  Pre-calculating the path length also allows us to
use the more efficient memcpy over strncpy.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-28 14:22:09 +10:00
Benjamin Yates 1142a32c7f makepkg: fix $pkgname element duplication
run_split_packaging did not preserve the $pkgname array correctly, and
would create duplicate entries in the list during restore.

After restoring the backup (a b c) would become (a b c b c).

This probably went unnoticed because during --install, pacman would
reconcile the duplicates.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-28 13:26:25 +10:00
Allan McRae 960b64553d libmakepkg: fix pkgver checking
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 20:44:57 +10:00
Andrew Gregory 6fdc589fc6 add alpm-hooks man page
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 19:39:22 +10:00
Andrew Gregory 5b6526a2ad hook.c: print invalid option name
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 19:38:57 +10:00
Andrew Gregory b46bdeea14 order hooks by file name
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 19:38:32 +10:00
Pierre Neidhardt 3c67127018 Align titles automatically in information display
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 18:52:05 +10:00
Rikard Falkeborn 0c5dbdbfec Alpm, check for NULL in free-functions
Also, use FREE() instead of free() in _alpm_backup_free()
to set the pointers to NULL.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 14:22:30 +10:00
Mohammad Alsaleh 4c5bf09eec zsh_completion: Add --asdeps/--asexplicit to -U options
Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 14:03:15 +10:00
Pierre Neidhardt 456ebe8f8e Use ARRAYSIZE macro for non-string array size computation
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 13:53:18 +10:00
Mohammad Alsaleh 9809102237 makepkg: Fix hard-coded debug suffix
Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-22 09:40:37 +10:00
Rikard Falkeborn e28aff4d87 pacsort: clean up if error
* free memory
* close open file

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-21 15:12:25 +10:00
Rikard Falkeborn aa8a674b6b pacsort: don't overwrite memory if realloc fails
That makes it impossible to free it later.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-21 15:11:27 +10:00
Rikard Falkeborn 19d373c9b9 pacsort: handle failing list_add
Since it can fail, check the return value.
If it fails, we need to free the memory of the object we wanted
to add to the list.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-21 15:06:25 +10:00
Pierre Neidhardt 4b3df10d5d HACKING: Allow the use of 'sizeof' on values
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-21 14:50:56 +10:00
Jan Alexander Steffens (heftig) 2c72c8b822 makepkg: Set CCACHE_BASEDIR to make paths in $srcdir relative
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:33:30 +10:00
Jan Alexander Steffens (heftig) 2627b423ff makepkg: Correctly layer distcc and ccache
ccache expects further compiler wrappers to be specified via
CCACHE_PREFIX. Otherwise, ccache will hash the wrapper executable
instead of the real one.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:33:17 +10:00
Jan Alexander Steffens (heftig) 70e6875ad9 libmakepkg: Add check_buildoption for distcc and ccache
makepkg used to check OPTIONS too, which could override
BUILDENV. Implement a new function that handles these
options more like OPTIONS.

This also reduces code duplication a bit.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:32:59 +10:00
Allan McRae 5d4a3f101c makepkg: separate "sourcefile" into two words
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:25:35 +10:00
Allan McRae 5301d3fe8f Remove space before ellipses
Makes all use of ellipses consistent...

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 13:48:56 +10:00
Allan McRae 29d4dcf767 Pluralize malloc failure string
Not particularly useful in English (will always be plural), but useful in
languages that have multiple plural forms.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 13:48:56 +10:00
Allan McRae 501242a35b Ignore cov-int directory for Coverity scan
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 13:48:56 +10:00