summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorXZS2016-03-23 20:32:20 +0100
committerXZS2016-03-23 20:32:20 +0100
commite69e6cfb8b5286bd9122f993ef1ab821dcf44786 (patch)
tree2f8cc1edceec5640c5128d43835e8d3d1db2d214
parent2cf9fcb2d270912b4f522ff3e23fd7ee435ce10a (diff)
downloadaur-e69e6cfb8b5286bd9122f993ef1ab821dcf44786.tar.gz
end grep trickery, it has been busted
Unbelievably, also traditional tools like grep are regularly updated still today. Version 2.24 forbid the combination of some features with the -z option. This was exactly what was exploited here to make grep ignore newlines so they would not interrupt JSON dissection. More information about the change can be found at the bottom of the respective release notes. [1] Fixing it costs an invocation of tr to remove the bothersome newlines. Because the files are read within "find -exec" where input redirection is not readily possible, cat has to be invoked to start the pipeline. The grep script got only a tiny bit simpler by adhering to the new restriction and leaving newlines to tr. Thanks to AUR users jmauss, Asher256 and vinadoros for pointing to the critical line. [1]: http://savannah.gnu.org/forum/forum.php?forum_id=8477
-rw-r--r--PKGBUILD3
1 files changed, 2 insertions, 1 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 937ba40bd7f..966c12e40a8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -79,7 +79,8 @@ depends[125]=gnome-shell
package_20_version() {
local compatibles=($(\
find -path ./pkg -type d -prune -o \
- -name metadata.json -exec grep -Pzo '(?s)(?<="shell-version": \[)[^\[\]]*(?=\])' '{}' \; | \
+ -name metadata.json -exec cat '{}' \; | \
+ tr -d '\n' | grep -Po '(?<="shell-version": \[)[^\[\]]*(?=\])' | \
tr '\n," ' '\n' | sed 's/3\.//g;/^$/d' | sort -n -t. -k 1,1))
depends+=("gnome-shell>=3.${compatibles[0]}")
local max="${compatibles[-1]}"