aboutsummaryrefslogtreecommitdiffstats
path: root/community/libsass
diff options
context:
space:
mode:
authorBart Ribbers <bribbers@disroot.org>2019-10-24 14:26:16 +0200
committerLeo <thinkabit.ukim@gmail.com>2019-10-24 09:42:17 -0300
commit8f5fa5aa3c69e9105de898c8cb2641026167573b (patch)
tree1eef4a125881d62e9826ecf6adfa5bb0c2793b31 /community/libsass
parent0c67cd1eba2f8985bf99a3d59c014e31866f0e35 (diff)
downloadaports-8f5fa5aa3c69e9105de898c8cb2641026167573b.tar.bz2
aports-8f5fa5aa3c69e9105de898c8cb2641026167573b.tar.xz
community/libsass: fix some cases of "extend" causing an endless loop
breeze-gtk encountered this and had to be prevented from upgrading because of it
Diffstat (limited to 'community/libsass')
-rw-r--r--community/libsass/APKBUILD10
-rw-r--r--community/libsass/fix-extend-issue-being-stuck-in-endless-loop.patch122
-rw-r--r--community/libsass/fix-trim-loop-condition-and-outer-continue.patch36
3 files changed, 165 insertions, 3 deletions
diff --git a/community/libsass/APKBUILD b/community/libsass/APKBUILD
index 1f71fbd515..d98e95948d 100644
--- a/community/libsass/APKBUILD
+++ b/community/libsass/APKBUILD
@@ -2,7 +2,7 @@
# Contributor: Thomas Boerger <thomas@webhippie.de>
pkgname=libsass
pkgver=3.6.2
-pkgrel=0
+pkgrel=1
pkgdesc="C/C++ implementation of a Sass compiler"
options="!check" # No tests are run when make check is run
url="https://sass-lang.com/libsass"
@@ -10,7 +10,9 @@ arch="all"
license="MIT"
makedepends="autoconf automake libtool"
subpackages="$pkgname-dev"
-source="$pkgname-$pkgver.tar.gz::https://github.com/sass/libsass/archive/$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::https://github.com/sass/libsass/archive/$pkgver.tar.gz
+ fix-extend-issue-being-stuck-in-endless-loop.patch
+ fix-trim-loop-condition-and-outer-continue.patch"
prepare() {
default_prepare
@@ -31,4 +33,6 @@ package() {
rm -f "$pkgdir"/usr/lib/*.la
}
-sha512sums="b1ee92de64f4eeabe2d4bfc693349ac124a81115554228669526e863d18f3c67ab44698414cf204f545eb4a4126ca350a1c7f7658e9ebac447f8b2e7533d9772 libsass-3.6.2.tar.gz"
+sha512sums="b1ee92de64f4eeabe2d4bfc693349ac124a81115554228669526e863d18f3c67ab44698414cf204f545eb4a4126ca350a1c7f7658e9ebac447f8b2e7533d9772 libsass-3.6.2.tar.gz
+e4684766f05cabe7ed360b7c1b0ed282d7f19223c3667e10b4a204492fadf21ed91289f9876ae7fa30c124c3edd73e117418329a2dd30b4d830657dba1193008 fix-extend-issue-being-stuck-in-endless-loop.patch
+f2fe27d12cf9250024481e6de3a532a64d1d08931c34138a05411bfefc44937a1917e4fc61aa33cbb5e92d369baed3ae46b7d2a4905be1aad1294021c6c07e26 fix-trim-loop-condition-and-outer-continue.patch"
diff --git a/community/libsass/fix-extend-issue-being-stuck-in-endless-loop.patch b/community/libsass/fix-extend-issue-being-stuck-in-endless-loop.patch
new file mode 100644
index 0000000000..6ade4efdc9
--- /dev/null
+++ b/community/libsass/fix-extend-issue-being-stuck-in-endless-loop.patch
@@ -0,0 +1,122 @@
+From 1ec3876afc071a79bb2d104b0b79306392e20bc4 Mon Sep 17 00:00:00 2001
+From: Marcel Greter <marcel.greter@ocbnet.ch>
+Date: Fri, 18 Oct 2019 07:22:52 +0200
+Subject: [PATCH] Fix extend issue being stuck in endless loop
+
+Fixes https://github.com/sass/libsass/issues/3006
+---
+ src/eval_selectors.cpp | 6 +++---
+ src/expand.cpp | 29 +++++++++++++++++++++++------
+ src/expand.hpp | 3 +++
+ src/extender.hpp | 4 ++--
+ 4 files changed, 31 insertions(+), 11 deletions(-)
+
+diff --git a/src/eval_selectors.cpp b/src/eval_selectors.cpp
+index cc7d3409c..db797e5bd 100644
+--- a/src/eval_selectors.cpp
++++ b/src/eval_selectors.cpp
+@@ -46,10 +46,10 @@ namespace Sass {
+ SelectorList* Eval::operator()(ComplexSelector* s)
+ {
+ bool implicit_parent = !exp.old_at_root_without_rule;
+- if (is_in_selector_schema) exp.pushToSelectorStack({});
++ if (is_in_selector_schema) exp.pushNullSelector();
+ SelectorListObj other = s->resolve_parent_refs(
+- exp.getSelectorStack(), traces, implicit_parent);
+- if (is_in_selector_schema) exp.popFromSelectorStack();
++ exp.getOriginalStack(), traces, implicit_parent);
++ if (is_in_selector_schema) exp.popNullSelector();
+
+ for (size_t i = 0; i < other->length(); i++) {
+ ComplexSelectorObj sel = other->at(i);
+diff --git a/src/expand.cpp b/src/expand.cpp
+index 1b9bf9158..0380e1cec 100644
+--- a/src/expand.cpp
++++ b/src/expand.cpp
+@@ -62,6 +62,23 @@ namespace Sass {
+ return 0;
+ }
+
++ void Expand::pushNullSelector()
++ {
++ pushToSelectorStack({});
++ pushToOriginalStack({});
++ }
++
++ void Expand::popNullSelector()
++ {
++ popFromOriginalStack();
++ popFromSelectorStack();
++ }
++
++ SelectorStack Expand::getOriginalStack()
++ {
++ return originalStack;
++ }
++
+ SelectorStack Expand::getSelectorStack()
+ {
+ return selector_stack;
+@@ -153,15 +170,15 @@ namespace Sass {
+ Block* bb = operator()(r->block());
+ Keyframe_Rule_Obj k = SASS_MEMORY_NEW(Keyframe_Rule, r->pstate(), bb);
+ if (r->schema()) {
+- pushToSelectorStack({});
++ pushNullSelector();
+ k->name(eval(r->schema()));
+- popFromSelectorStack();
++ popNullSelector();
+ }
+ else if (r->selector()) {
+ if (SelectorListObj s = r->selector()) {
+- pushToSelectorStack({});
++ pushNullSelector();
+ k->name(eval(s));
+- popFromSelectorStack();
++ popNullSelector();
+ }
+ }
+
+@@ -288,10 +305,10 @@ namespace Sass {
+ Block* ab = a->block();
+ SelectorList* as = a->selector();
+ Expression* av = a->value();
+- pushToSelectorStack({});
++ pushNullSelector();
+ if (av) av = av->perform(&eval);
+ if (as) as = eval(as);
+- popFromSelectorStack();
++ popNullSelector();
+ Block* bb = ab ? operator()(ab) : NULL;
+ Directive* aa = SASS_MEMORY_NEW(Directive,
+ a->pstate(),
+diff --git a/src/expand.hpp b/src/expand.hpp
+index db5852ce4..90edbf4ca 100644
+--- a/src/expand.hpp
++++ b/src/expand.hpp
+@@ -22,7 +22,10 @@ namespace Sass {
+ SelectorListObj& selector();
+ SelectorListObj& original();
+ SelectorListObj popFromSelectorStack();
++ SelectorStack getOriginalStack();
+ SelectorStack getSelectorStack();
++ void pushNullSelector();
++ void popNullSelector();
+ void pushToSelectorStack(SelectorListObj selector);
+
+ SelectorListObj popFromOriginalStack();
+diff --git a/src/extender.hpp b/src/extender.hpp
+index 4b00cc3a0..5f161786a 100644
+--- a/src/extender.hpp
++++ b/src/extender.hpp
+@@ -126,8 +126,8 @@ namespace Sass {
+ std::unordered_map<
+ SimpleSelectorObj,
+ size_t,
+- ObjHash,
+- ObjEquality
++ ObjPtrHash,
++ ObjPtrEquality
+ > sourceSpecificity;
+
+ // ##########################################################################
diff --git a/community/libsass/fix-trim-loop-condition-and-outer-continue.patch b/community/libsass/fix-trim-loop-condition-and-outer-continue.patch
new file mode 100644
index 0000000000..b1c2acf455
--- /dev/null
+++ b/community/libsass/fix-trim-loop-condition-and-outer-continue.patch
@@ -0,0 +1,36 @@
+From fdf63e4c93d40c1c4da43fdf13010d590dc133e0 Mon Sep 17 00:00:00 2001
+From: Marcel Greter <marcel.greter@ocbnet.ch>
+Date: Sun, 20 Oct 2019 04:45:29 +0200
+Subject: [PATCH] Fix trim loop condition and outer continue
+
+---
+ src/extender.cpp | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/extender.cpp b/src/extender.cpp
+index 2ae54df98..b0add3857 100644
+--- a/src/extender.cpp
++++ b/src/extender.cpp
+@@ -1070,10 +1070,10 @@ namespace Sass {
+ // the result so that, if two selectors are identical, we keep the first one.
+ std::vector<ComplexSelectorObj> result; size_t numOriginals = 0;
+
+- // Use label to quit outer loop
+- redo:
++ size_t i = selectors.size();
++ outer: // Use label to continue loop
++ while (--i != std::string::npos) {
+
+- for (size_t i = selectors.size() - 1; i != std::string::npos; i--) {
+ const ComplexSelectorObj& complex1 = selectors[i];
+ // Check if selector in known in existing "originals"
+ // For custom behavior dart-sass had `isOriginal(complex1)`
+@@ -1083,7 +1083,7 @@ namespace Sass {
+ for (size_t j = 0; j < numOriginals; j++) {
+ if (ObjEqualityFn(result[j], complex1)) {
+ rotateSlice(result, 0, j + 1);
+- goto redo;
++ goto outer;
+ }
+ }
+ result.insert(result.begin(), complex1);