code:
This patch comes from upstream.  It corresponds to a patch applied to
the generated C source code for llhttp included in Node.js 14.16.0
(see commit 641f786bb1a1f6eb1ff8750782ed939780f2b31a).  That commit
fixes CVE-2020-8287.  With this patch, the output of our
llhttp-bootstrap package matches the files included in Node.js 14.16.0
exactly.

commit e9b36ea64709c35ca66094d5cf3787f444029601
Author: Fedor Indutny <fedor@indutny.com>
Date:   Sat Oct 10 19:56:01 2020 -0700

    http: unset `F_CHUNKED` on new `Transfer-Encoding`

    Duplicate `Transfer-Encoding` header should be a treated as a single,
    but with original header values concatenated with a comma separator. In
    the light of this, even if the past `Transfer-Encoding` ended with
    `chunked`, we should be not let the `F_CHUNKED` to leak into the next
    header, because mere presence of another header indicates that `chunked`
    is not the last transfer-encoding token.

diff --git a/src/llhttp/http.ts b/src/llhttp/http.ts
index f4f1a6e..0a0c365 100644
--- a/src/llhttp/http.ts
+++ b/src/llhttp/http.ts
@@ -460,11 +460,19 @@ export class HTTP {
       .match([ ' ', '\t' ], n('header_value_discard_ws'))
       .otherwise(checkContentLengthEmptiness);

+    // Multiple `Transfer-Encoding` headers should be treated as one, but with
+    // values separate by a comma.
+    //
+    // See: https://tools.ietf.org/html/rfc7230#section-3.2.2
+    const toTransferEncoding = this.unsetFlag(
+      FLAGS.CHUNKED,
+      'header_value_te_chunked');
+
     n('header_value_start')
       .otherwise(this.load('header_state', {
         [HEADER_STATE.UPGRADE]: this.setFlag(FLAGS.UPGRADE, fallback),
         [HEADER_STATE.TRANSFER_ENCODING]: this.setFlag(
-          FLAGS.TRANSFER_ENCODING, 'header_value_te_chunked'),
+          FLAGS.TRANSFER_ENCODING, toTransferEncoding),
         [HEADER_STATE.CONTENT_LENGTH]: n('header_value_content_length_once'),
         [HEADER_STATE.CONNECTION]: n('header_value_connection'),
       }, 'header_value'));
@@ -847,6 +855,11 @@ export class HTTP {
     return span.start(span.end(this.node(next)));
   }

+  private unsetFlag(flag: FLAGS, next: string | Node): Node {
+    const p = this.llparse;
+    return p.invoke(p.code.and('flags', ~flag), this.node(next));
+  }
+
   private setFlag(flag: FLAGS, next: string | Node): Node {
     const p = this.llparse;
     return p.invoke(p.code.or('flags', flag), this.node(next));
diff --git a/test/request/transfer-encoding.md b/test/request/transfer-encoding.md
index a7d1681..b0891d6 100644
--- a/test/request/transfer-encoding.md
+++ b/test/request/transfer-encoding.md
@@ -353,6 +353,38 @@ off=106 headers complete method=3 v=1/1 flags=200 content_length=0
 off=106 error code=15 reason="Request has invalid `Transfer-Encoding`"
 ```

+## POST with `chunked` and duplicate transfer-encoding
+
+<!-- meta={"type": "request", "noScan": true} -->
+```http
+POST /post_identity_body_world?q=search#hey HTTP/1.1
+Accept: */*
+Transfer-Encoding: chunked
+Transfer-Encoding: deflate
+
+World
+```
+
+```log
+off=0 message begin
+off=5 len=38 span[url]="/post_identity_body_world?q=search#hey"
+off=44 url complete
+off=54 len=6 span[header_field]="Accept"
+off=61 header_field complete
+off=62 len=3 span[header_value]="*/*"
+off=67 header_value complete
+off=67 len=17 span[header_field]="Transfer-Encoding"
+off=85 header_field complete
+off=86 len=7 span[header_value]="chunked"
+off=95 header_value complete
+off=95 len=17 span[header_field]="Transfer-Encoding"
+off=113 header_field complete
+off=114 len=7 span[header_value]="deflate"
+off=123 header_value complete
+off=125 headers complete method=3 v=1/1 flags=200 content_length=0
+off=125 error code=15 reason="Request has invalid `Transfer-Encoding`"
+```
+
 ## POST with `chunked` before other transfer-coding (lenient)

 TODO(indutny): should we allow it even in lenient mode? (Consider disabling


code:
This patch was downloaded from https://sft.its.cern.ch/jira/browse/ROOT-7047.
It fixes the build of clang 3.5 with GCC 5.  File paths have been adjusted.

From 00f3ed6eee41da871799ad0fd19153c7682d61fe Mon Sep 17 00:00:00 2001
From: Alexander Klimov <alserkli@inbox.ru>
Date: Mon, 26 Jan 2015 18:45:23 +0200
Subject: [PATCH] [ADT/IntrusiveRefCntPtr] Give friend access to
 IntrusiveRefCntPtr<X> so the relevant move constructor can
 access 'Obj'.

From LLVM upstream:
Author: Argyrios Kyrtzidis <akyrtzi@gmail.com>
Date:   Tue Sep 23 06:06:43 2014 +0000
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218295 91177308-0d34-0410-b5e6-96231b3b80d8
---
 interpreter/llvm/src/include/llvm/ADT/IntrusiveRefCntPtr.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/llvm/ADT/IntrusiveRefCntPtr.h b/include/llvm/ADT/IntrusiveRefCntPtr.h
index f9df378..c859c98 100644
--- a/include/llvm/ADT/IntrusiveRefCntPtr.h
+++ b/include/llvm/ADT/IntrusiveRefCntPtr.h
@@ -197,6 +197,9 @@ public:
   private:
     void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); }
     void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); }
+
+    template <typename X>
+    friend class IntrusiveRefCntPtr;
   };

   template<class T, class U>
--
1.7.10.4

repo_name: maximed/guix

license: mit


code:
From f8e146f3430de3a6cd904f3f3f7aa1bfaefee14c Mon Sep 17 00:00:00 2001
From: Bjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Date: Thu, 28 Nov 2019 23:18:28 +0100
Subject: [PATCH] [InstCombine] Fix big-endian miscompile of (bitcast
 (zext/trunc (bitcast)))

Summary:
optimizeVectorResize is rewriting patterns like:
  %1 = bitcast vector %src to integer
  %2 = trunc/zext %1
  %dst = bitcast %2 to vector

Since bitcasting between integer an vector types gives
different integer values depending on endianness, we need
to take endianness into account. As it happens the old
implementation only produced the correct result for little
endian targets.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=44178

Reviewers: spatel, lattner, lebedev.ri

Reviewed By: spatel, lebedev.ri

Subscribers: lebedev.ri, hiraditya, uabelho, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70844

(cherry picked from commit a9d6b0e5444741d08ff1df7cf71d1559e7fefc1f)
---
 .../InstCombine/InstCombineCasts.cpp          | 79 +++++++++++++------
 llvm/test/Transforms/InstCombine/cast.ll      |  6 +-
 2 files changed, 60 insertions(+), 25 deletions(-)

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 2c9ba203fbf3..0af3de300e77 100644
--- llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -18,6 +18,7 @@
 #include "llvm/IR/DIBuilder.h"
 #include "llvm/IR/PatternMatch.h"
 #include "llvm/Support/KnownBits.h"
+#include <numeric>
 using namespace llvm;
 using namespace PatternMatch;

@@ -1820,12 +1821,24 @@ Instruction *InstCombiner::visitPtrToInt(PtrToIntInst &CI) {
 }

 /// This input value (which is known to have vector type) is being zero extended
-/// or truncated to the specified vector type.
+/// or truncated to the specified vector type. Since the zext/trunc is done
+/// using an integer type, we have a (bitcast(cast(bitcast))) pattern,
+/// endianness will impact which end of the vector that is extended or
+/// truncated.
+///
+/// A vector is always stored with index 0 at the lowest address, which
+/// corresponds to the most significant bits for a big endian stored integer and
+/// the least significant bits for little endian. A trunc/zext of an integer
+/// impacts the big end of the integer. Thus, we need to add/remove elements at
+/// the front of the vector for big endian targets, and the back of the vector
+/// for little endian targets.
+///
 /// Try to replace it with a shuffle (and vector/vector bitcast) if possible.
 ///
 /// The source and destination vector types may have different element types.
-static Instruction *optimizeVectorResize(Value *InVal, VectorType *DestTy,
-                                         InstCombiner &IC) {
+static Instruction *optimizeVectorResizeWithIntegerBitCasts(Value *InVal,
+                                                            VectorType *DestTy,
+                                                            InstCombiner &IC) {
   // We can only do this optimization if the output is a multiple of the input
   // element size, or the input is a multiple of the output element size.
   // Convert the input type to have the same element type as the output.
@@ -1844,31 +1857,53 @@ static Instruction *optimizeVectorResize(Value *InVal, VectorType *DestTy,
     InVal = IC.Builder.CreateBitCast(InVal, SrcTy);
   }

+  bool IsBigEndian = IC.getDataLayout().isBigEndian();
+  unsigned SrcElts = SrcTy->getNumElements();
+  unsigned DestElts = DestTy->getNumElements();
+
+  assert(SrcElts != DestElts && "Element counts should be different.");
+
   // Now that the element types match, get the shuffle mask and RHS of the
   // shuffle to use, which depends on whether we're increasing or decreasing the
   // size of the input.
-  SmallVector<uint32_t, 16> ShuffleMask;
+  SmallVector<uint32_t, 16> ShuffleMaskStorage;
+  ArrayRef<uint32_t> ShuffleMask;
   Value *V2;

-  if (SrcTy->getNumElements() > DestTy->getNumElements()) {
-    // If we're shrinking the number of elements, just shuffle in the low
-    // elements from the input and use undef as the second shuffle input.
-    V2 = UndefValue::get(SrcTy);
-    for (unsigned i = 0, e = DestTy->getNumElements(); i != e; ++i)
-      ShuffleMask.push_back(i);
+  // Produce an identify shuffle mask for the src vector.
+  ShuffleMaskStorage.resize(SrcElts);
+  std::iota(ShuffleMaskStorage.begin(), ShuffleMaskStorage.end(), 0);

+  if (SrcElts > DestElts) {
+    // If we're shrinking the number of elements (rewriting an integer
+    // truncate), just shuffle in the elements corresponding to the least
+    // significant bits from the input and use undef as the second shuffle
+    // input.
+    V2 = UndefValue::get(SrcTy);
+    // Make sure the shuffle mask selects the "least significant bits" by
+    // keeping elements from back of the src vector for big endian, and from the
+    // front for little endian.
+    ShuffleMask = ShuffleMaskStorage;
+    if (IsBigEndian)
+      ShuffleMask = ShuffleMask.take_back(DestElts);
+    else
+      ShuffleMask = ShuffleMask.take_front(DestElts);
   } else {
-    // If we're increasing the number of elements, shuffle in all of the
-    // elements from InVal and fill the rest of the result elements with zeros
-    // from a constant zero.
+    // If we're increasing the number of elements (rewriting an integer zext),
+    // shuffle in all of the elements from InVal. Fill the rest of the result
+    // elements with zeros from a constant zero.
     V2 = Constant::getNullValue(SrcTy);
-    unsigned SrcElts = SrcTy->getNumElements();
-    for (unsigned i = 0, e = SrcElts; i != e; ++i)
-      ShuffleMask.push_back(i);
-
-    // The excess elements reference the first element of the zero input.
-    for (unsigned i = 0, e = DestTy->getNumElements()-SrcElts; i != e; ++i)
-      ShuffleMask.push_back(SrcElts);
+    // Use first elt from V2 when indicating zero in the shuffle mask.
+    uint32_t NullElt = SrcElts;
+    // Extend with null values in the "most significant bits" by adding elements
+    // in front of the src vector for big endian, and at the back for little
+    // endian.
+    unsigned DeltaElts = DestElts - SrcElts;
+    if (IsBigEndian)
+      ShuffleMaskStorage.insert(ShuffleMaskStorage.begin(), DeltaElts, NullElt);
+    else
+      ShuffleMaskStorage.append(DeltaElts, NullElt);
+    ShuffleMask = ShuffleMaskStorage;
   }

   return new ShuffleVectorInst(InVal, V2,
@@ -2359,8 +2394,8 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
         CastInst *SrcCast = cast<CastInst>(Src);
         if (BitCastInst *BCIn = dyn_cast<BitCastInst>(SrcCast->getOperand(0)))
           if (isa<VectorType>(BCIn->getOperand(0)->getType()))
-            if (Instruction *I = optimizeVectorResize(BCIn->getOperand(0),
-                                               cast<VectorType>(DestTy), *this))
+            if (Instruction *I = optimizeVectorResizeWithIntegerBitCasts(
+                    BCIn->getOperand(0), cast<VectorType>(DestTy), *this))
               return I;
       }

diff --git a/llvm/test/Transforms/InstCombine/cast.ll b/llvm/test/Transforms/InstCombine/cast.ll
index b6d1eda0601d..3ce8de033422 100644
--- llvm/test/Transforms/InstCombine/cast.ll
+++ llvm/test/Transforms/InstCombine/cast.ll
@@ -824,7 +824,7 @@ define i64 @test59(i8 %A, i8 %B) {

 define <3 x i32> @test60(<4 x i32> %call4) {
 ; CHECK-LABEL: @test60(
-; CHECK-NEXT:    [[P10:%.*]] = shufflevector <4 x i32> [[CALL4:%.*]], <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2>
+; CHECK-NEXT:    [[P10:%.*]] = shufflevector <4 x i32> [[CALL4:%.*]], <4 x i32> undef, <3 x i32> <i32 1, i32 2, i32 3>
 ; CHECK-NEXT:    ret <3 x i32> [[P10]]
 ;
   %p11 = bitcast <4 x i32> %call4 to i128
@@ -836,7 +836,7 @@ define <3 x i32> @test60(<4 x i32> %call4) {

 define <4 x i32> @test61(<3 x i32> %call4) {
 ; CHECK-LABEL: @test61(
-; CHECK-NEXT:    [[P10:%.*]] = shufflevector <3 x i32> [[CALL4:%.*]], <3 x i32> <i32 0, i32 undef, i32 undef>, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+; CHECK-NEXT:    [[P10:%.*]] = shufflevector <3 x i32> [[CALL4:%.*]], <3 x i32> <i32 0, i32 undef, i32 undef>, <4 x i32> <i32 3, i32 0, i32 1, i32 2>
 ; CHECK-NEXT:    ret <4 x i32> [[P10]]
 ;
   %p11 = bitcast <3 x i32> %call4 to i96
@@ -848,7 +848,7 @@ define <4 x i32> @test61(<3 x i32> %call4) {
 define <4 x i32> @test62(<3 x float> %call4) {
 ; CHECK-LABEL: @test62(
 ; CHECK-NEXT:    [[TMP1:%.*]] = bitcast <3 x float> [[CALL4:%.*]] to <3 x i32>
-; CHECK-NEXT:    [[P10:%.*]] = shufflevector <3 x i32> [[TMP1]], <3 x i32> <i32 0, i32 undef, i32 undef>, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+; CHECK-NEXT:    [[P10:%.*]] = shufflevector <3 x i32> [[TMP1]], <3 x i32> <i32 0, i32 undef, i32 undef>, <4 x i32> <i32 3, i32 0, i32 1, i32 2>
 ; CHECK-NEXT:    ret <4 x i32> [[P10]]
 ;
   %p11 = bitcast <3 x float> %call4 to i96
--
2.26.2


code:
From 011fb5bf8b31316472fccb1a19c91912246df9b2 Mon Sep 17 00:00:00 2001
From: Reid Kleckner <rnk@google.com>
Date: Sat, 28 Mar 2020 11:03:14 -0700
Subject: [PATCH] [CodeGen] Fix sinking local values in lpads with phis

There was already a test case for landingpads to handle this case, but I
had forgotten to consider PHI instructions preceding the EH_LABEL in the
landingpad.

PR45261
---
 llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 17 +++++++++-
 llvm/test/CodeGen/X86/sink-local-value.ll  | 36 ++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 5ac3606dc662..2638b1e8a05c 100644
--- llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -225,6 +225,21 @@ static bool isRegUsedByPhiNodes(unsigned DefReg,
   return false;
 }

+static bool isTerminatingEHLabel(MachineBasicBlock *MBB, MachineInstr &MI) {
+  // Ignore non-EH labels.
+  if (!MI.isEHLabel())
+    return false;
+
+  // Any EH label outside a landing pad must be for an invoke. Consider it a
+  // terminator.
+  if (!MBB->isEHPad())
+    return true;
+
+  // If this is a landingpad, the first non-phi instruction will be an EH_LABEL.
+  // Don't consider that label to be a terminator.
+  return MI.getIterator() != MBB->getFirstNonPHI();
+}
+
 /// Build a map of instruction orders. Return the first terminator and its
 /// order. Consider EH_LABEL instructions to be terminators as well, since local
 /// values for phis after invokes must be materialized before the call.
@@ -233,7 +248,7 @@ void FastISel::InstOrderMap::initialize(
   unsigned Order = 0;
   for (MachineInstr &I : *MBB) {
     if (!FirstTerminator &&
-        (I.isTerminator() || (I.isEHLabel() && &I != &MBB->front()))) {
+        (I.isTerminator() || isTerminatingEHLabel(MBB, I))) {
       FirstTerminator = &I;
       FirstTerminatorOrder = Order;
     }
diff --git a/llvm/test/CodeGen/X86/sink-local-value.ll b/llvm/test/CodeGen/X86/sink-local-value.ll
index b0e511ac1189..f7d861ac9b6c 100644
--- llvm/test/CodeGen/X86/sink-local-value.ll
+++ llvm/test/CodeGen/X86/sink-local-value.ll
@@ -145,6 +145,42 @@ try.cont:                                         ; preds = %entry, %lpad
 ; CHECK:         retl

+define i32 @lpad_phi() personality i32 (...)* @__gxx_personality_v0 {
+entry:
+  store i32 42, i32* @sink_across
+  invoke void @may_throw()
+          to label %try.cont unwind label %lpad
+
+lpad:                                             ; preds = %entry
+  %p = phi i32 [ 11, %entry ]  ; Trivial, but -O0 keeps it
+  %0 = landingpad { i8*, i32 }
+          catch i8* null
+  store i32 %p, i32* @sink_across
+  br label %try.cont
+
+try.cont:                                         ; preds = %entry, %lpad
+  %r.0 = phi i32 [ 13, %entry ], [ 55, %lpad ]
+  ret i32 %r.0
+}
+
+; The constant materialization should be *after* the stores to sink_across, but
+; before any EH_LABEL.
+
+; CHECK-LABEL: lpad_phi:
+; CHECK:         movl    $42, sink_across
+; CHECK:         movl    $13, %{{[a-z]*}}
+; CHECK: .Ltmp{{.*}}:
+; CHECK:         calll   may_throw
+; CHECK: .Ltmp{{.*}}:
+; CHECK:         jmp     .LBB{{.*}}
+; CHECK: .LBB{{.*}}:                                # %lpad
+; CHECK-NEXT: .Ltmp{{.*}}:
+; CHECK:         movl    {{.*}}, sink_across
+; CHECK:         movl    $55, %{{[a-z]*}}
+; CHECK: .LBB{{.*}}:                                # %try.cont
+; CHECK:         retl
+
+
 ; Function Attrs: nounwind readnone speculatable
 declare void @llvm.dbg.value(metadata, metadata, metadata) #0


code:
Guix note: this got detected with the test suite of rustc 1.41.1, but
the issue potentially affects all consumers of LLVM.

From 58e8c793d0e43150a6452e971a32d7407a8a7401 Mon Sep 17 00:00:00 2001
From: Tim Northover <tnorthover@apple.com>
Date: Mon, 30 Sep 2019 07:46:52 +0000
Subject: [PATCH] Revert "[SCEV] add no wrap flag for SCEVAddExpr."

This reverts r366419 because the analysis performed is within the context of
the loop and it's only valid to add wrapping flags to "global" expressions if
they're always correct.

llvm-svn: 373184
---
 llvm/lib/Analysis/ScalarEvolution.cpp              | 2 +-
 llvm/test/Analysis/ScalarEvolution/limit-depth.ll  | 2 +-
 llvm/test/Analysis/ScalarEvolution/nsw.ll          | 2 +-
 llvm/test/Analysis/ScalarEvolution/trip-count12.ll | 2 +-
 llvm/test/Analysis/ScalarEvolution/trip-count9.ll  | 8 ++++----
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 354ae05bb841..c29fc5dbccfb 100644
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -4992,7 +4992,7 @@ const SCEV *ScalarEvolution::createSimpleAffineAddRec(PHINode *PN,
   // overflow.
   if (auto *BEInst = dyn_cast<Instruction>(BEValueV))
     if (isLoopInvariant(Accum, L) && isAddRecNeverPoison(BEInst, L))
-      (void)getAddRecExpr(getAddExpr(StartVal, Accum, Flags), Accum, L, Flags);
+      (void)getAddRecExpr(getAddExpr(StartVal, Accum), Accum, L, Flags);

   return PHISCEV;
 }
diff --git a/llvm/test/Analysis/ScalarEvolution/limit-depth.ll b/llvm/test/Analysis/ScalarEvolution/limit-depth.ll
index db68a4f84c91..6fdf8c5df974 100644
--- llvm/test/Analysis/ScalarEvolution/limit-depth.ll
+++ llvm/test/Analysis/ScalarEvolution/limit-depth.ll
@@ -46,7 +46,7 @@ define void @test_mul(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) {
 define void @test_sext(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) {
 ; CHECK-LABEL: @test_sext
 ; CHECK:        %se2 = sext i64 %iv2.inc to i128
-; CHECK-NEXT:   -->  {(1 + (sext i64 {(sext i32 (1 + %a)<nsw> to i64),+,1}<nsw><%loop> to i128))<nsw>,+,1}<nsw><%loop2>
+; CHECK-NEXT:   -->  {(1 + (sext i64 {(sext i32 (1 + %a) to i64),+,1}<nsw><%loop> to i128))<nsw>,+,1}<nsw><%loop2>
 entry:
   br label %loop

diff --git a/llvm/test/Analysis/ScalarEvolution/nsw.ll b/llvm/test/Analysis/ScalarEvolution/nsw.ll
index 69427368625d..ca24f9d4a04b 100644
--- llvm/test/Analysis/ScalarEvolution/nsw.ll
+++ llvm/test/Analysis/ScalarEvolution/nsw.ll
@@ -163,7 +163,7 @@ bb5:                                              ; preds = %bb2
 declare void @f(i32)

 ; CHECK-LABEL: nswnowrap
-; CHECK: --> {(1 + %v)<nsw>,+,1}<nsw><%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (2 + %v)
+; CHECK: --> {(1 + %v)<nsw>,+,1}<nsw><%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (1 + ((1 + %v)<nsw> smax %v))
 define void @nswnowrap(i32 %v, i32* %buf) {
 entry:
   %add = add nsw i32 %v, 1
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count12.ll b/llvm/test/Analysis/ScalarEvolution/trip-count12.ll
index 5e7d72d5e4f3..d0086ee2e6ac 100644
--- llvm/test/Analysis/ScalarEvolution/trip-count12.ll
+++ llvm/test/Analysis/ScalarEvolution/trip-count12.ll
@@ -1,7 +1,7 @@
 ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s

 ; CHECK: Determining loop execution counts for: @test
-; CHECK: Loop %for.body: backedge-taken count is ((-2 + %len)<nsw> /u 2)
+; CHECK: Loop %for.body: backedge-taken count is ((-2 + %len) /u 2)
 ; CHECK: Loop %for.body: max backedge-taken count is 1073741823

 define zeroext i16 @test(i16* nocapture %p, i32 %len) nounwind readonly {
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count9.ll b/llvm/test/Analysis/ScalarEvolution/trip-count9.ll
index c0a1d12fa00e..9a080b34743f 100644
--- llvm/test/Analysis/ScalarEvolution/trip-count9.ll
+++ llvm/test/Analysis/ScalarEvolution/trip-count9.ll
@@ -179,7 +179,7 @@ exit:
 }

 ; CHECK: Determining loop execution counts for: @nsw_startx
-; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x)<nsw> smax %n))
+; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
 ; CHECK: Loop %loop: max backedge-taken count is -1
 define void @nsw_startx(i4 %n, i4 %x) {
 entry:
@@ -195,7 +195,7 @@ exit:
 }

 ; CHECK: Determining loop execution counts for: @nsw_startx_step2
-; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x)<nsw> smax %n)) /u 2)
+; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2)
 ; CHECK: Loop %loop: max backedge-taken count is 7
 define void @nsw_startx_step2(i4 %n, i4 %x) {
 entry:
@@ -381,7 +381,7 @@ exit:
 }

 ; CHECK: Determining loop execution counts for: @even_nsw_startx
-; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x)<nsw> smax (2 * %n)))
+; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
 ; CHECK: Loop %loop: max backedge-taken count is -2
 define void @even_nsw_startx(i4 %n, i4 %x) {
 entry:
@@ -398,7 +398,7 @@ exit:
 }

 ; CHECK: Determining loop execution counts for: @even_nsw_startx_step2
-; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x)<nsw> smax (2 * %n))) /u 2)
+; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
 ; CHECK: Loop %loop: max backedge-taken count is 7
 define void @even_nsw_startx_step2(i4 %n, i4 %x) {
 entry:


code:
fancontrol: Deal with moving hwmon attributes

Several kernel drivers have already moved their attributes from the
hardware device to the hwmon class device, and others will follow.
Teach fancontrol about this possibility and let it adjust the attribute
paths transparently.

Patch by Jean Delvare <khali@linux-fr.org>.
See <http://www.lm-sensors.org/changeset/6216>.

--- lm-sensors/prog/pwm/fancontrol	(revision 6172)
+++ lm-sensors/prog/pwm/fancontrol	(revision 6216)
@@ -207,4 +207,63 @@
 }

+function FixupDeviceFiles
+{
+	local DEVICE="$1"
+	local fcvcount pwmo tsen fan
+
+	let fcvcount=0
+	while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
+	do
+		pwmo=${AFCPWM[$fcvcount]}
+		AFCPWM[$fcvcount]=${pwmo//$DEVICE\/device/$DEVICE}
+		if [ "${AFCPWM[$fcvcount]}" != "$pwmo" ]
+		then
+			echo "Adjusing $pwmo -> ${AFCPWM[$fcvcount]}"
+		fi
+		let fcvcount=$fcvcount+1
+	done
+
+	let fcvcount=0
+	while (( $fcvcount < ${#AFCTEMP[@]} )) # go through all temp inputs
+	do
+		tsen=${AFCTEMP[$fcvcount]}
+		AFCTEMP[$fcvcount]=${tsen//$DEVICE\/device/$DEVICE}
+		if [ "${AFCTEMP[$fcvcount]}" != "$tsen" ]
+		then
+			echo "Adjusing $tsen -> ${AFCTEMP[$fcvcount]}"
+		fi
+		let fcvcount=$fcvcount+1
+	done
+
+	let fcvcount=0
+	while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs
+	do
+		fan=${AFCFAN[$fcvcount]}
+		AFCFAN[$fcvcount]=${fan//$DEVICE\/device/$DEVICE}
+		if [ "${AFCFAN[$fcvcount]}" != "$fan" ]
+		then
+			echo "Adjusing $fan -> ${AFCFAN[$fcvcount]}"
+		fi
+		let fcvcount=$fcvcount+1
+	done
+}
+
+# Some drivers moved their attributes from hard device to class device
+function FixupFiles
+{
+	local DEVPATH="$1"
+	local entry device
+
+	for entry in $DEVPATH
+	do
+		device=`echo "$entry" | sed -e 's/=[^=]*$//'`
+
+		if [ -e "$device/name" ]
+		then
+			FixupDeviceFiles "$device"
+		fi
+	done
+}
+
 # Check that all referenced sysfs files exist
 function CheckFiles
@@ -306,4 +365,8 @@
 	echo "Configuration appears to be outdated, please run pwmconfig again" >&2
 	exit 1
+fi
+if [ "$DIR" = "/sys/class/hwmon" ]
+then
+	FixupFiles "$DEVPATH"
 fi
 CheckFiles || exit 1


code:
Normally localed would do an approximate parsing of the Xorg config file
to determine the XKB keyboard layout.  This doesn't make sense on Guix
where there's no such file in /etc, and where the keyboard layout is
known statically at configuration time.

This patch removes the XOrg configuration parsing and expects to read the
configuration from environment variables instead.  It also removes the
stateful bits that would write configuration to /etc/vconsole.conf
and /etc/X11, which are unused in Guix anyway.

Patch by Ludovic Courtès <ludo@gnu.org>.

diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
index 6b6b32a591..46aab472b0 100644
--- a/src/locale/keymap-util.c
+++ b/src/locale/keymap-util.c
@@ -174,32 +174,16 @@ int vconsole_read_data(Context *c, sd_bus_message *m) {
                 c->vc_cache = sd_bus_message_ref(m);
         }

-        if (stat("/etc/vconsole.conf", &st) < 0) {
-                if (errno != ENOENT)
-                        return -errno;
-
-                c->vc_mtime = USEC_INFINITY;
-                context_free_vconsole(c);
-                return 0;
-        }
-
-        /* If mtime is not changed, then we do not need to re-read */
-        t = timespec_load(&st.st_mtim);
-        if (c->vc_mtime != USEC_INFINITY && t == c->vc_mtime)
-                return 0;
-
-        c->vc_mtime = t;
+        c->vc_mtime = USEC_INFINITY;
         context_free_vconsole(c);
-
-        r = parse_env_file(NULL, "/etc/vconsole.conf",
-                           "KEYMAP",        &c->vc_keymap,
-                           "KEYMAP_TOGGLE", &c->vc_keymap_toggle);
-        if (r < 0)
-                return r;
-
         return 0;
 }

+static char *getenv_strdup(const char *variable) {
+        const char *value = getenv(variable);
+        return value == NULL ? NULL : strdup(value);
+}
+
 int x11_read_data(Context *c, sd_bus_message *m) {
         _cleanup_fclose_ FILE *f = NULL;
         bool in_section = false;
@@ -216,258 +200,27 @@ int x11_read_data(Context *c, sd_bus_message *m) {
                 c->x11_cache = sd_bus_message_ref(m);
         }

-        if (stat("/etc/X11/xorg.conf.d/00-keyboard.conf", &st) < 0) {
-                if (errno != ENOENT)
-                        return -errno;
-
-                c->x11_mtime = USEC_INFINITY;
-                context_free_x11(c);
-                return 0;
-        }
-
-        /* If mtime is not changed, then we do not need to re-read */
-        t = timespec_load(&st.st_mtim);
-        if (c->x11_mtime != USEC_INFINITY && t == c->x11_mtime)
-                return 0;
-
-        c->x11_mtime = t;
+        c->x11_mtime = 0;
         context_free_x11(c);

-        f = fopen("/etc/X11/xorg.conf.d/00-keyboard.conf", "re");
-        if (!f)
-                return -errno;
-
-        for (;;) {
-                _cleanup_free_ char *line = NULL;
-                char *l;
-
-                r = read_line(f, LONG_LINE_MAX, &line);
-                if (r < 0)
-                        return r;
-                if (r == 0)
-                        break;
-
-                l = strstrip(line);
-                if (IN_SET(l[0], 0, '#'))
-                        continue;
-
-                if (in_section && first_word(l, "Option")) {
-                        _cleanup_strv_free_ char **a = NULL;
-
-                        r = strv_split_extract(&a, l, WHITESPACE, EXTRACT_QUOTES);
-                        if (r < 0)
-                                return r;
-
-                        if (strv_length(a) == 3) {
-                                char **p = NULL;
-
-                                if (streq(a[1], "XkbLayout"))
-                                        p = &c->x11_layout;
-                                else if (streq(a[1], "XkbModel"))
-                                        p = &c->x11_model;
-                                else if (streq(a[1], "XkbVariant"))
-                                        p = &c->x11_variant;
-                                else if (streq(a[1], "XkbOptions"))
-                                        p = &c->x11_options;
-
-                                if (p) {
-                                        free_and_replace(*p, a[2]);
-                                }
-                        }
-
-                } else if (!in_section && first_word(l, "Section")) {
-                        _cleanup_strv_free_ char **a = NULL;
-
-                        r = strv_split_extract(&a, l, WHITESPACE, EXTRACT_QUOTES);
-                        if (r < 0)
-                                return -ENOMEM;
-
-                        if (strv_length(a) == 2 && streq(a[1], "InputClass"))
-                                in_section = true;
-
-                } else if (in_section && first_word(l, "EndSection"))
-                        in_section = false;
-        }
+        c->x11_layout = getenv_strdup("GUIX_XKB_LAYOUT");
+        c->x11_model = getenv_strdup("GUIX_XKB_MODEL");
+        c->x11_variant = getenv_strdup("GUIX_XKB_VARIANT");
+        c->x11_options = getenv_strdup("GUIX_XKB_OPTIONS");

         return 0;
 }

 int locale_write_data(Context *c, char ***settings) {
-        _cleanup_strv_free_ char **l = NULL;
-        struct stat st;
-        int r, p;
-
-        /* Set values will be returned as strv in *settings on success. */
-
-        for (p = 0; p < _VARIABLE_LC_MAX; p++) {
-                _cleanup_free_ char *t = NULL;
-                char **u;
-                const char *name;
-
-                name = locale_variable_to_string(p);
-                assert(name);
-
-                if (isempty(c->locale[p]))
-                        continue;
-
-                if (asprintf(&t, "%s=%s", name, c->locale[p]) < 0)
-                        return -ENOMEM;
-
-                u = strv_env_set(l, t);
-                if (!u)
-                        return -ENOMEM;
-
-                strv_free_and_replace(l, u);
-        }
-
-        if (strv_isempty(l)) {
-                if (unlink("/etc/locale.conf") < 0)
-                        return errno == ENOENT ? 0 : -errno;
-
-                c->locale_mtime = USEC_INFINITY;
-                return 0;
-        }
-
-        r = write_env_file_label("/etc/locale.conf", l);
-        if (r < 0)
-                return r;
-
-        *settings = TAKE_PTR(l);
-
-        if (stat("/etc/locale.conf", &st) >= 0)
-                c->locale_mtime = timespec_load(&st.st_mtim);
-
-        return 0;
+        return -ENOSYS;
 }

 int vconsole_write_data(Context *c) {
-        _cleanup_strv_free_ char **l = NULL;
-        struct stat st;
-        int r;
-
-        r = load_env_file(NULL, "/etc/vconsole.conf", &l);
-        if (r < 0 && r != -ENOENT)
-                return r;
-
-        if (isempty(c->vc_keymap))
-                l = strv_env_unset(l, "KEYMAP");
-        else {
-                _cleanup_free_ char *s = NULL;
-                char **u;
-
-                s = strappend("KEYMAP=", c->vc_keymap);
-                if (!s)
-                        return -ENOMEM;
-
-                u = strv_env_set(l, s);
-                if (!u)
-                        return -ENOMEM;
-
-                strv_free_and_replace(l, u);
-        }
-
-        if (isempty(c->vc_keymap_toggle))
-                l = strv_env_unset(l, "KEYMAP_TOGGLE");
-        else  {
-                _cleanup_free_ char *s = NULL;
-                char **u;
-
-                s = strappend("KEYMAP_TOGGLE=", c->vc_keymap_toggle);
-                if (!s)
-                        return -ENOMEM;
-
-                u = strv_env_set(l, s);
-                if (!u)
-                        return -ENOMEM;
-
-                strv_free_and_replace(l, u);
-        }
-
-        if (strv_isempty(l)) {
-                if (unlink("/etc/vconsole.conf") < 0)
-                        return errno == ENOENT ? 0 : -errno;
-
-                c->vc_mtime = USEC_INFINITY;
-                return 0;
-        }
-
-        r = write_env_file_label("/etc/vconsole.conf", l);
-        if (r < 0)
-                return r;
-
-        if (stat("/etc/vconsole.conf", &st) >= 0)
-                c->vc_mtime = timespec_load(&st.st_mtim);
-
-        return 0;
+        return -ENOSYS;
 }

 int x11_write_data(Context *c) {
-        _cleanup_fclose_ FILE *f = NULL;
-        _cleanup_free_ char *temp_path = NULL;
-        struct stat st;
-        int r;
-
-        if (isempty(c->x11_layout) &&
-            isempty(c->x11_model) &&
-            isempty(c->x11_variant) &&
-            isempty(c->x11_options)) {
-
-                if (unlink("/etc/X11/xorg.conf.d/00-keyboard.conf") < 0)
-                        return errno == ENOENT ? 0 : -errno;
-
-                c->vc_mtime = USEC_INFINITY;
-                return 0;
-        }
-
-        mkdir_p_label("/etc/X11/xorg.conf.d", 0755);
-
-        r = fopen_temporary("/etc/X11/xorg.conf.d/00-keyboard.conf", &f, &temp_path);
-        if (r < 0)
-                return r;
-
-        (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
-        (void) fchmod(fileno(f), 0644);
-
-        fputs("# Written by systemd-localed(8), read by systemd-localed and Xorg. It's\n"
-              "# probably wise not to edit this file manually. Use localectl(1) to\n"
-              "# instruct systemd-localed to update it.\n"
-              "Section \"InputClass\"\n"
-              "        Identifier \"system-keyboard\"\n"
-              "        MatchIsKeyboard \"on\"\n", f);
-
-        if (!isempty(c->x11_layout))
-                fprintf(f, "        Option \"XkbLayout\" \"%s\"\n", c->x11_layout);
-
-        if (!isempty(c->x11_model))
-                fprintf(f, "        Option \"XkbModel\" \"%s\"\n", c->x11_model);
-
-        if (!isempty(c->x11_variant))
-                fprintf(f, "        Option \"XkbVariant\" \"%s\"\n", c->x11_variant);
-
-        if (!isempty(c->x11_options))
-                fprintf(f, "        Option \"XkbOptions\" \"%s\"\n", c->x11_options);
-
-        fputs("EndSection\n", f);
-
-        r = fflush_sync_and_check(f);
-        if (r < 0)
-                goto fail;
-
-        if (rename(temp_path, "/etc/X11/xorg.conf.d/00-keyboard.conf") < 0) {
-                r = -errno;
-                goto fail;
-        }
-
-        if (stat("/etc/X11/xorg.conf.d/00-keyboard.conf", &st) >= 0)
-                c->x11_mtime = timespec_load(&st.st_mtim);
-
-        return 0;
-
-fail:
-        if (temp_path)
-                (void) unlink(temp_path);
-
-        return r;
+        return -ENOSYS;
 }

 static int read_next_mapping(const char* filename,


code:
Patch taken from the Sage packaging system.

From 4a5e1c8c3c11efdb1cbb4239825a6bf4bf1c52f8 Mon Sep 17 00:00:00 2001
From: Anders Skovsted Buch <asbuch@math.rutgers.edu>
Date: Sun, 29 Nov 2015 16:25:56 -0500
Subject: [PATCH] Patch by Jeroen Demeyer to change include <vector.h> to
 "vector.h", plus similar cases.

---
 src/lrcalc.c   | 2 +-
 src/maple.c    | 4 ++--
 src/schublib.h | 2 +-
 src/symfcn.c   | 6 +++---
 src/symfcn.h   | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/lrcalc.c b/src/lrcalc.c
index aff3f75..60df49e 100644
--- a/src/lrcalc.c
+++ b/src/lrcalc.c
@@ -8,7 +8,7 @@
 #include <stdlib.h>
 extern char *optarg;

-#include <vectarg.h>
+#include "vectarg.h"

 #include "symfcn.h"
 #include "maple.h"
diff --git a/src/maple.c b/src/maple.c
index fdc0768..a5f4d14 100644
--- a/src/maple.c
+++ b/src/maple.c
@@ -4,8 +4,8 @@
  */

 #include <stdio.h>
-#include <vector.h>
-#include <hashtab.h>
+#include "vector.h"
+#include "hashtab.h"
 #include "maple.h"

diff --git a/src/schublib.h b/src/schublib.h
index a8e8511..864850c 100644
--- a/src/schublib.h
+++ b/src/schublib.h
@@ -1,7 +1,7 @@
 #ifndef _SCHUBLIB_H
 #define _SCHUBLIB_H

-#include <hashtab.h>
+#include "hashtab.h"

 hashtab *trans(vector *w, int vars, hashtab *res);
 hashtab *monk(int i, hashtab *slc, int rank);
diff --git a/src/symfcn.c b/src/symfcn.c
index 4ffbe4b..fd5df5d 100644
--- a/src/symfcn.c
+++ b/src/symfcn.c
@@ -5,9 +5,9 @@

 #include <stdio.h>

-#include <alloc.h>
-#include <vector.h>
-#include <hashtab.h>
+#include "alloc.h"
+#include "vector.h"
+#include "hashtab.h"

 #include "symfcn.h"

diff --git a/src/symfcn.h b/src/symfcn.h
index b8543b1..29bb00d 100644
--- a/src/symfcn.h
+++ b/src/symfcn.h
@@ -1,8 +1,8 @@
 #ifndef _SYMFCN_H
 #define _SYMFCN_H

-#include <hashtab.h>
-#include <vector.h>
+#include "hashtab.h"
+#include "vector.h"

 int part_itr_sz(vector *part);
 int part_itr_sub(vector *part, vector *outer);
--
2.1.1.1.g1fb337f


code:
--- a/src/server_x11.c	2016-08-01 11:58:54.714647794 +0200
+++ b/src/server_x11.c	2016-08-01 11:58:46.606563478 +0200
@@ -151,7 +151,7 @@ DEFINE_COMMAND(open_forwarded_x11)
 #define X11_MIN_DISPLAY 10
 #define X11_MAX_DISPLAY 1000

-/* FIXME: Create the /tmp/.X11-unix directory, if needed. Figure out
+/* FIXME: Figure out
  * if and how we should use /tmp/.X17-lock. Consider using display
  * "unix:17" instead of just ":17".
  */
@@ -253,6 +253,7 @@ open_x11_socket(struct ssh_channel *chan

   old_umask = umask(0077);

+  mkdir(X11_SOCKET_DIR, S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX);
   old_cd = lsh_pushd(X11_SOCKET_DIR, &dir, 0, 0);
   if (old_cd < 0)
     {


code:
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Mon, 23 Nov 2020 05:36:53 +0100
Subject: [PATCH] gnu: lsof: Make test failures fatal.

Submitted upstream[0].

[0]: https://github.com/lsof-org/lsof/pull/144

diff --git a/tests/Makefile b/tests/Makefile
index 08574a0..2923bb8 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -27,7 +27,7 @@ all:	${CKTSTDB} ${BASTST} ${STDTST} FRC
 	  exit 1 ;\
 	fi
 	@rm -f config.LT*
-	-@err=0; \
+	@err=0; \
 	echo ""; \
 	echo "Basic test:"; \
 	./${BASTST}; \
@@ -54,8 +54,11 @@ all:	${CKTSTDB} ${BASTST} ${STDTST} FRC
 	    echo "Suggestion: try the optional tests: \"make opt\""; \
 	    echo ""; \
 	  fi; \
-	fi;
-	@rm -f config.LT*
+	fi; \
+	rm -f config.LT*; \
+	if [ $$err -ne 0 ]; then \
+	  exit 1; \
+	fi

 auto:	ckDB silent FRC

@@ -112,7 +115,7 @@ LTunix: LTunix.c ${CONFIG} ${LIBOBJ} ${HDR} config.ldflags

 opt:	${CKTSTDB} ${OPTTST} FRC
 	@rm -f config.LT*
-	-@err=0; \
+	@err=0; \
 	echo ""; \
 	echo "Optional tests:"; \
 	for i in ${OPTTST}; do \
@@ -126,8 +129,11 @@ opt:	${CKTSTDB} ${OPTTST} FRC
 	else \
 	  echo "All optional tests succeeded."; \
 	fi; \
-	echo "";
-	@rm -f config.LT*
+	echo ""; \
+	rm -f config.LT*; \
+	if [ $$err -ne 0 ]; then \
+	  exit 1; \
+	fi

 optional: opt


code:
From: Enrico Tassi <gareuselesinge@debian.org>
Date: Tue, 26 Aug 2014 16:20:55 +0200
Subject: Fix stack overflow in vararg functions

---
 src/ldo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ldo.c b/src/ldo.c
index d1bf786..30333bf 100644
--- a/src/ldo.c
+++ b/src/ldo.c
@@ -274,7 +274,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
     CallInfo *ci;
     StkId st, base;
     Proto *p = cl->p;
-    luaD_checkstack(L, p->maxstacksize);
+    luaD_checkstack(L, p->maxstacksize + p->numparams);
     func = restorestack(L, funcr);
       base = func + 1;


code:
This applies to Lua 5.2 and 5.3.

From 7a1b4e0829124976878ca2765a8e546667a92ceb Mon Sep 17 00:00:00 2001
From: Leo Famulari <leo@famulari.name>
Date: Fri, 30 Oct 2015 19:11:31 -0400
Subject: [PATCH] apply existing non-executable library patch and install
 libraries as executable

---
 Makefile     | 6 +++---
 src/Makefile | 8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 1aea8e6..bfcfed9 100644
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ INTERPRETER= lua
 COMPILER= luac
 TO_BIN= $(INTERPRETER) $(COMPILER)
 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.a liblua.so liblua.so.${V}
 TO_PC=  lua-$(V).pc
 TO_MAN= lua.1 luac.1

@@ -56,7 +56,7 @@ R= $V.3
 all:	$(PLAT)

 $(PLATS):
-	cd src && $(MAKE) $@
+	cd src && $(MAKE) $@ V=$(V) R=$(R)

 clean:
 	cd src && $(MAKE) $@
@@ -69,7 +69,7 @@ install: dummy $(TO_PC)
 	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_PC) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
 	cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
-	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+	cd src && $(INSTALL_EXEC) $(TO_LIB) $(INSTALL_LIB)
 	cd src && $(INSTALL_DATA) ../$(TO_PC) $(INSTALL_PC)
 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)

diff --git a/src/Makefile b/src/Makefile
index 7b4b2b7..c86476e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -29,6 +29,7 @@ MYOBJS=
 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris

 LUA_A=	liblua.a
+LUA_SO= liblua.so
 CORE_O=	lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
 	lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
 	ltm.o lundump.o lvm.o lzio.o
@@ -43,7 +44,7 @@ LUAC_T=	luac
 LUAC_O=	luac.o

 ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
 ALL_A= $(LUA_A)

 # Targets start here.
@@ -55,6 +56,11 @@ o:	$(ALL_O)

 a:	$(ALL_A)

+$(LUA_SO): $(CORE_O) $(LIB_O)
+	$(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+	ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
+	ln -sf $(LUA_SO).$(R) $(LUA_SO)
+
 $(LUA_A): $(BASE_O)
 	$(AR) $@ $(BASE_O)
 	$(RANLIB) $@
--
2.6.1


code:
Enables generating Lua's pkg-config file.

http://lua-users.org/lists/lua-l/2015-03/msg00338.html

--- a/Makefile	2014-10-30 00:14:41.000000000 +0100
+++ b/Makefile	2015-03-26 18:54:37.678374827 +0100
@@ -14,6 +14,7 @@
 INSTALL_BIN= $(INSTALL_TOP)/bin
 INSTALL_INC= $(INSTALL_TOP)/include
 INSTALL_LIB= $(INSTALL_TOP)/lib
+INSTALL_PC= $(INSTALL_LIB)/pkgconfig
 INSTALL_MAN= $(INSTALL_TOP)/man/man1
 INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
 INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
@@ -39,9 +40,12 @@
 PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris

 # What to install.
-TO_BIN= lua luac
+INTERPRETER= lua
+COMPILER= luac
+TO_BIN= $(INTERPRETER) $(COMPILER)
 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
 TO_LIB= liblua.a
+TO_PC=  lua-$(V).pc
 TO_MAN= lua.1 luac.1

 # Lua version and release.
@@ -51,23 +55,29 @@
 # Targets start here.
 all:	$(PLAT)

-$(PLATS) clean:
+$(PLATS):
 	cd src && $(MAKE) $@

+clean:
+	cd src && $(MAKE) $@
+	$(RM) $(TO_PC)
+
 test:	dummy
 	src/lua -v

-install: dummy
-	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
+install: dummy $(TO_PC)
+	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_PC) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
 	cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
 	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+	cd src && $(INSTALL_DATA) ../$(TO_PC) $(INSTALL_PC)
 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)

 uninstall:
 	cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
 	cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC)
 	cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB)
+	cd src && cd $(INSTALL_PC)  && $(RM) $(TO_PC)
 	cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN)

 local:
@@ -90,11 +100,13 @@
 	@echo "TO_BIN= $(TO_BIN)"
 	@echo "TO_INC= $(TO_INC)"
 	@echo "TO_LIB= $(TO_LIB)"
+	@echo "TO_PC= $(TO_PC)"
 	@echo "TO_MAN= $(TO_MAN)"
 	@echo "INSTALL_TOP= $(INSTALL_TOP)"
 	@echo "INSTALL_BIN= $(INSTALL_BIN)"
 	@echo "INSTALL_INC= $(INSTALL_INC)"
 	@echo "INSTALL_LIB= $(INSTALL_LIB)"
+	@echo "INSTALL_PC= $(INSTALL_PC)"
 	@echo "INSTALL_MAN= $(INSTALL_MAN)"
 	@echo "INSTALL_LMOD= $(INSTALL_LMOD)"
 	@echo "INSTALL_CMOD= $(INSTALL_CMOD)"
@@ -103,12 +115,28 @@

 # echo pkg-config data
 pc:
-	@echo "version=$R"
-	@echo "prefix=$(INSTALL_TOP)"
-	@echo "libdir=$(INSTALL_LIB)"
-	@echo "includedir=$(INSTALL_INC)"
+	@echo 'prefix=$(INSTALL_TOP)'
+	@echo 'libdir=$(INSTALL_LIB)'
+	@echo 'includedir=$(INSTALL_INC)'
+	@echo 'bindir=$(INSTALL_BIN)'
+	@echo
+	@echo 'INSTALL_LMOD=$(INSTALL_LMOD)'
+	@echo 'INSTALL_CMOD=$(INSTALL_CMOD)'
+	@echo 'INTERPRETER=$${bindir}/$(INTERPRETER)'
+	@echo 'COMPILER=$${bindir}/$(COMPILER)'
+	@echo
+	@echo 'Name: Lua'
+	@echo 'Description: A powerful, fast, lightweight, embeddable scripting language'
+	@echo 'Version: $(R)'
+	@echo
+	@echo 'Libs: -L$${libdir} -llua -lm'
+	@echo 'Cflags: -I$${includedir}'
+
+pkg-config: $(TO_PC)
+$(TO_PC):
+	@$(MAKE) -s pc > $@

 # list targets that do not create files (but not all makes understand .PHONY)
-.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
+.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho pkg-config

 # (end of Makefile)


code:
Patch the two Makefile to also create liblua.so
Original patch by Allan McRae <allan@archlinux.org>
for Archlinux

diff -ruN lua-5.1.5/Makefile lua-5.1.5-new/Makefile
--- lua-5.1.5/Makefile	2012-02-10 10:50:23.000000000 +0100
+++ lua-5.1.5-new/Makefile	2014-09-10 20:17:28.913951433 +0200
@@ -43,7 +43,7 @@
 # What to install.
 TO_BIN= lua luac
 TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.a liblua.so liblua.so.${V}
 TO_MAN= lua.1 luac.1

 # Lua version and release.
@@ -53,7 +53,7 @@
 all:	$(PLAT)

 $(PLATS) clean:
-	cd src && $(MAKE) $@
+	cd src && $(MAKE) $@ V=$(V) R=$(R)

 test:	dummy
 	src/lua test/hello.lua
diff -ruN lua-5.1.5/src/Makefile lua-5.1.5-new/src/Makefile
--- lua-5.1.5/src/Makefile	2012-02-13 21:41:22.000000000 +0100
+++ lua-5.1.5-new/src/Makefile	2014-09-10 20:16:09.982952152 +0200
@@ -8,7 +8,7 @@
 PLAT= none

 CC= gcc
-CFLAGS= -O2 -Wall $(MYCFLAGS)
+CFLAGS= -O2 -Wall $(MYCFLAGS) -fPIC
 AR= ar rcu
 RANLIB= ranlib
 RM= rm -f
@@ -34,9 +34,10 @@

 LUAC_T=	luac
 LUAC_O=	luac.o print.o
+LUA_SO= liblua.so

 ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
 ALL_A= $(LUA_A)

 default: $(PLAT)
@@ -57,6 +58,13 @@
 $(LUAC_T): $(LUAC_O) $(LUA_A)
 	$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)

+$(LUA_SO): $(CORE_O) $(LIB_O)
+	$(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+	ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
+	ln -sf $(LUA_SO).$(R) $(LUA_SO)
+
+
+
 clean:
 	$(RM) $(ALL_T) $(ALL_O)


code:
Enables generating Lua's pkg-config file.

http://lua-users.org/lists/lua-l/2015-03/msg00338.html

--- a/Makefile	2016-08-16 19:44:27.363614964 +0200
+++ b/Makefile	2016-08-16 19:49:22.623070005 +0200
@@ -13,6 +13,7 @@
 INSTALL_BIN= $(INSTALL_TOP)/bin
 INSTALL_INC= $(INSTALL_TOP)/include
 INSTALL_LIB= $(INSTALL_TOP)/lib
+INSTALL_PC= $(INSTALL_LIB)/pkgconfig
 INSTALL_MAN= $(INSTALL_TOP)/man/man1
 #
 # You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with
@@ -41,9 +42,12 @@
 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris

 # What to install.
-TO_BIN= lua luac
+INTERPRETER= lua
+COMPILER= luac
+TO_BIN= $(INTERPRETER) $(COMPILER)
 TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
 TO_LIB= liblua.a liblua.so liblua.so.${V}
+TO_PC= lua-$(V).pc
 TO_MAN= lua.1 luac.1

 # Lua version and release.
@@ -52,17 +56,22 @@

 all:	$(PLAT)

-$(PLATS) clean:
+$(PLATS):
 	cd src && $(MAKE) $@ V=$(V) R=$(R)

+clean:
+	cd src && $(MAKE) $@
+	$(RM) $(TO_PC)
+
 test:	dummy
 	src/lua test/hello.lua

-install: dummy
-	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
+install: dummy $(TO_PC)
+	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_PC) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
 	cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
 	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+	cd src && $(INSTALL_DATA) ../$(TO_PC) $(INSTALL_PC)
 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)

 ranlib:
@@ -95,6 +104,7 @@
 	@echo "INSTALL_BIN = $(INSTALL_BIN)"
 	@echo "INSTALL_INC = $(INSTALL_INC)"
 	@echo "INSTALL_LIB = $(INSTALL_LIB)"
+	@echo "INSTALL_PC = $(INSTALL_PC)"
 	@echo "INSTALL_MAN = $(INSTALL_MAN)"
 	@echo "INSTALL_LMOD = $(INSTALL_LMOD)"
 	@echo "INSTALL_CMOD = $(INSTALL_CMOD)"
@@ -111,6 +121,7 @@
 	@echo "TO_BIN = $(TO_BIN)"
 	@echo "TO_INC = $(TO_INC)"
 	@echo "TO_LIB = $(TO_LIB)"
+	@echo "TO_PC = $(TO_PC)"
 	@echo "TO_MAN = $(TO_MAN)"

 # echo config parameters as Lua code
@@ -122,7 +133,29 @@
 	@$(MAKE) echo | grep = | sed -e 's/= /= "/' -e 's/$$/"/' #-e 's/""/nil/'
 	@echo "-- EOF"

+pc:
+	@echo 'prefix=$(INSTALL_TOP)'
+	@echo 'libdir=$(INSTALL_LIB)'
+	@echo 'includedir=$(INSTALL_INC)'
+	@echo 'bindir=$(INSTALL_BIN)'
+	@echo
+	@echo 'INSTALL_LMOD=$(INSTALL_LMOD)'
+	@echo 'INSTALL_CMOD=$(INSTALL_CMOD)'
+	@echo 'INTERPRETER=$${bindir}/$(INTERPRETER)'
+	@echo 'COMPILER=$${bindir}/$(COMPILER)'
+	@echo
+	@echo 'Name: Lua'
+	@echo 'Description: A powerful, fast, lightweight, embeddable scripting language'
+	@echo 'Version: $(R)'
+	@echo
+	@echo 'Libs: -L$${libdir} -llua -lm'
+	@echo 'Cflags: -I$${includedir}'
+
+pkg-config: $(TO_PC)
+$(TO_PC):
+	@$(MAKE) -s pc > $@
+
 # list targets that do not create files (but not all makes understand .PHONY)
-.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
+.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho pkg-config

 # (end of Makefile)


code:
From 629200f48e18dc1a3a5229739748bad0e2a6a0a2 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Tom=C3=A1=C5=A1=20=C4=8Cech?= <sleep_walker@suse.cz>
Date: Wed, 4 Feb 2015 11:37:16 +0100
Subject: [PATCH] Do not silently and prematurely end install when ldconfig is
 missing

---
 Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 343ecb5..4667146 100644
--- a/Makefile
+++ b/Makefile
@@ -112,9 +112,10 @@ install: $(INSTALL_DEP)
 	$(RM) $(INSTALL_TSYM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2)
 	cd src && test -f $(FILE_SO) && \
 	  $(INSTALL_X) $(FILE_SO) $(INSTALL_DYN) && \
-	  $(LDCONFIG) $(INSTALL_LIB) && \
-	  $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
-	  $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || :
+	  ( $(LDCONFIG) $(INSTALL_LIB) ; \
+	    $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
+	    $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || : \
+	  )
 	cd etc && $(INSTALL_F) $(FILE_MAN) $(INSTALL_MAN)
 	cd etc && $(SED_PC) $(FILE_PC) > $(FILE_PC).tmp && \
 	  $(INSTALL_F) $(FILE_PC).tmp $(INSTALL_PC) && \
--
2.2.2


code:
See https://bugs.freedesktop.org/show_bug.cgi?id=47792;
should become obsolete with the next release.

diff -u luit-1.1.1.orig/sys.c luit-1.1.1/sys.c
--- luit-1.1.1.orig/sys.c	2012-03-23 05:23:07.000000000 +0100
+++ luit-1.1.1/sys.c	2013-11-27 22:45:53.000000000 +0100
@@ -20,6 +20,8 @@
 THE SOFTWARE.
 */

+#define _XOPEN_SOURCE 600
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif


code:
Fix static linking of 'lvm.static', which indirectly depend on libpthread
and libm via libdevmapper.a.

--- LVM2.2.02.166/tools/Makefile.in	2016-11-22 21:31:15.521045149 +0100
+++ LVM2.2.02.166/tools/Makefile.in	2016-11-22 21:31:24.085082767 +0100
@@ -137,7 +137,7 @@
 lvm.static: $(OBJECTS) lvm-static.o $(LVMINTERNAL_LIBS)
 	@echo "    [CC] $@"
 	$(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ $+ \
-	      $(DMEVENT_LIBS) $(STATIC_LIBS) $(LVMLIBS)
+	      $(DMEVENT_LIBS) $(STATIC_LIBS) $(LVMLIBS) $(PTHREAD_LIBS)

 liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
 	@echo "    [AR] $@"
--- a/make.tmpl.in     2018-07-31 22:00:39.969983104 +0200
+++ b/make.tmpl.in     2018-07-31 22:00:58.467613682 +0200
@@ -63,7 +63,7 @@

 LIBS += @LIBS@ $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(RT_LIBS) $(M_LIBS)
 # Extra libraries always linked with static binaries
-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
+STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(M_LIBS)
 DEFS += @DEFS@
 # FIXME set this only where it's needed, not globally?
 CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
--- a/libdm/make.tmpl.in	2018-12-18 15:22:34.000000000 +0100
+++ b/libdm/make.tmpl.in	2019-01-29 21:45:33.637345799 +0100
@@ -57,7 +57,7 @@
 LIBS = @LIBS@
 LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(RT_LIBS) -lm
 # Extra libraries always linked with static binaries
-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
+STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(PTHREAD_LIBS) $(M_LIBS)
 DEFS += @DEFS@
 # FIXME set this only where it's needed, not globally?
 CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@


code:
Adjust the bundled gnulib to cope with removal of libio interface in
glibc 2.28.

Based on this upstream patch, without hunks that do not apply to m4:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4af4a4a71827c0bc5e0ec67af23edef4f15cee8e

diff --git a/lib/fflush.c b/lib/fflush.c
index 983ade0..a6edfa1 100644
--- a/lib/fflush.c
+++ b/lib/fflush.c
@@ -33,7 +33,7 @@
 #undef fflush

-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */

 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
 static void
@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)

 #endif

-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)

 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
   if (stream == NULL || ! freading (stream))
     return fflush (stream);

-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */

   clear_ungetc_buffer_preserving_position (stream);

diff --git a/lib/fpending.c b/lib/fpending.c
index c84e3a5..789f50e 100644
--- a/lib/fpending.c
+++ b/lib/fpending.c
@@ -32,7 +32,7 @@ __fpending (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, because they need it for implementing getc() and putc() as
      fast macros.  */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   return fp->_IO_write_ptr - fp->_IO_write_base;
 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
diff --git a/lib/fpurge.c b/lib/fpurge.c
index b1d417c..3aedcc3 100644
--- a/lib/fpurge.c
+++ b/lib/fpurge.c
@@ -62,7 +62,7 @@ fpurge (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, because they need it for implementing getc() and putc() as
      fast macros.  */
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   fp->_IO_read_end = fp->_IO_read_ptr;
   fp->_IO_write_ptr = fp->_IO_write_base;
   /* Avoid memory leak when there is an active ungetc buffer.  */
diff --git a/lib/freadahead.c b/lib/freadahead.c
index c2ecb5b..23ec76e 100644
--- a/lib/freadahead.c
+++ b/lib/freadahead.c
@@ -30,7 +30,7 @@ extern size_t __sreadahead (FILE *);
 size_t
 freadahead (FILE *fp)
 {
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   if (fp->_IO_write_ptr > fp->_IO_write_base)
     return 0;
   return (fp->_IO_read_end - fp->_IO_read_ptr)
diff --git a/lib/freading.c b/lib/freading.c
index 73c28ac..c24d0c8 100644
--- a/lib/freading.c
+++ b/lib/freading.c
@@ -31,7 +31,7 @@ freading (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, because they need it for implementing getc() and putc() as
      fast macros.  */
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   return ((fp->_flags & _IO_NO_WRITES) != 0
           || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
               && fp->_IO_read_base != NULL));
diff --git a/lib/fseeko.c b/lib/fseeko.c
index 0101ab5..193f4e8 100644
--- a/lib/fseeko.c
+++ b/lib/fseeko.c
@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
 #endif

   /* These tests are based on fpurge.c.  */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   if (fp->_IO_read_end == fp->_IO_read_ptr
       && fp->_IO_write_ptr == fp->_IO_write_base
       && fp->_IO_save_base == NULL)
@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
           return -1;
         }

-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
       fp->_flags &= ~_IO_EOF_SEEN;
       fp->_offset = pos;
 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 78d896e..05c5752 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -18,6 +18,12 @@
    the same implementation of stdio extension API, except that some fields
    have different naming conventions, or their access requires some casts.  */

+/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
+   problem by defining it ourselves.  FIXME: Do not rely on glibc
+   internals.  */
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
+# define _IO_IN_BACKUP 0x100
+#endif

 /* BSD stdio derived implementations.  */


code:
From 5ca6382fe8adb5bc436a6d873c8b86c69d5abfd1 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Sun, 13 Sep 2020 14:43:46 +0300
Subject: [PATCH] Fix uninitialized variable in readmsg

* readmsg/readmsg.c (main): Initialize weedc.
---
 readmsg/readmsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/readmsg/readmsg.c b/readmsg/readmsg.c
index 9f305bb9c..3a9f420db 100644
--- a/readmsg/readmsg.c
+++ b/readmsg/readmsg.c
@@ -466,7 +466,7 @@ main (int argc, char **argv)
   mu_mailbox_t mbox = NULL;
   struct mu_wordsplit ws;
   char **weedv;
-  int weedc;
+  int weedc = 0;
   int unix_header = 0;

   /* Native Language Support */
--
2.28.0


code:
Purity: don't look for library dependencies (of the form `-lfoo') in
/lib and /usr/lib.  Likewise, when searching for included Makefiles,
don't look in /usr/include and friends.

Patch from Nixpkgs, by Eelco Dolstra.

diff -rc make-3.81-orig/src/read.c make-3.81/src/read.c
*** make-3.81-orig/src/read.c	2006-03-17 15:24:20.000000000 +0100
--- make-3.81/src/read.c	2007-05-24 17:16:31.000000000 +0200
***************
*** 99,107 ****
--- 99,109 ----
  #endif
      INCLUDEDIR,
  #ifndef _AMIGA
+ #if 0
      "/usr/gnu/include",
      "/usr/local/include",
      "/usr/include",
+ #endif
  #endif
      0
    };
diff -rc make-3.81-orig/src/remake.c make-3.81/src/remake.c
*** make-3.81-orig/src/remake.c	2006-03-20 03:36:37.000000000 +0100
--- make-3.81/src/remake.c	2007-05-24 17:06:54.000000000 +0200
***************
*** 1452,1460 ****
--- 1452,1462 ----
    static char *dirs[] =
      {
  #ifndef _AMIGA
+ #if 0
        "/lib",
        "/usr/lib",
  #endif
+ #endif
  #if defined(WINDOWS32) && !defined(LIBDIR)
  /*
   * This is completely up to the user at product install time. Just define


code:
Adapted from Debian: https://salsa.debian.org/qt-kde-team/kde/marble/-/blob/debian/4%2517.08.3-3.1/debian/patches/qt5.11.patch
Upstream status: Probably irrelevant, as this is an old version of this software.

diff --git a/src/lib/marble/MergedLayerDecorator.cpp b/src/lib/marble/MergedLayerDecorator.cpp
index 40f3ddb..bafff50 100644
--- a/src/lib/marble/MergedLayerDecorator.cpp
+++ b/src/lib/marble/MergedLayerDecorator.cpp
@@ -36,6 +36,7 @@

 #include <QPointer>
 #include <QPainter>
+#include <QPainterPath>

 using namespace Marble;

diff --git a/src/lib/marble/VisiblePlacemark.cpp b/src/lib/marble/VisiblePlacemark.cpp
index cfe08af..1a84006 100644
--- a/src/lib/marble/VisiblePlacemark.cpp
+++ b/src/lib/marble/VisiblePlacemark.cpp
@@ -22,6 +22,7 @@

 #include <QApplication>
 #include <QPainter>
+#include <QPainterPath>
 #include <QPalette>
 #include <QPixmapCache>

diff --git a/src/lib/marble/graphicsview/FrameGraphicsItem.cpp b/src/lib/marble/graphicsview/FrameGraphicsItem.cpp
index 8a90526..065f245 100644
--- a/src/lib/marble/graphicsview/FrameGraphicsItem.cpp
+++ b/src/lib/marble/graphicsview/FrameGraphicsItem.cpp
@@ -18,6 +18,7 @@
 // Qt
 #include <QSizeF>
 #include <QPainter>
+#include <QPainterPath>
 #include <QPixmapCache>
 #include <QMargins>
 #include <qdrawutil.h>
diff --git a/src/lib/marble/layers/GroundLayer.cpp b/src/lib/marble/layers/GroundLayer.cpp
index 58d409f..df6d226 100644
--- a/src/lib/marble/layers/GroundLayer.cpp
+++ b/src/lib/marble/layers/GroundLayer.cpp
@@ -14,6 +14,9 @@
 #include "ViewportParams.h"
 #include "RenderState.h"

+#include <QPainter>
+#include <QPainterPath>
+
 namespace Marble
 {

diff --git a/src/plugins/render/compass/CompassFloatItem.cpp b/src/plugins/render/compass/CompassFloatItem.cpp
index d8dc021..66095cc 100644
--- a/src/plugins/render/compass/CompassFloatItem.cpp
+++ b/src/plugins/render/compass/CompassFloatItem.cpp
@@ -19,6 +19,7 @@
 #include <QRect>
 #include <QColor>
 #include <QPainter>
+#include <QPainterPath>
 #include <QPushButton>
 #include <QSvgRenderer>

diff --git a/src/plugins/render/elevationprofilefloatitem/ElevationProfileFloatItem.cpp b/src/plugins/render/elevationprofilefloatitem/ElevationProfileFloatItem.cpp
index a790c16..96f5bed 100644
--- a/src/plugins/render/elevationprofilefloatitem/ElevationProfileFloatItem.cpp
+++ b/src/plugins/render/elevationprofilefloatitem/ElevationProfileFloatItem.cpp
@@ -31,6 +31,7 @@
 #include <QContextMenuEvent>
 #include <QRect>
 #include <QPainter>
+#include <QPainterPath>
 #include <QPushButton>
 #include <QMenu>
 #include <QMouseEvent>
diff --git a/src/plugins/render/foursquare/FoursquareItem.cpp b/src/plugins/render/foursquare/FoursquareItem.cpp
index d9e1f57..ef80472 100644
--- a/src/plugins/render/foursquare/FoursquareItem.cpp
+++ b/src/plugins/render/foursquare/FoursquareItem.cpp
@@ -13,6 +13,8 @@
 #include "ViewportParams.h"

 #include <QFontMetrics>
+#include <QPainter>
+#include <QPainterPath>

 namespace Marble
 {
diff --git a/src/plugins/render/gpsinfo/GpsInfo.cpp b/src/plugins/render/gpsinfo/GpsInfo.cpp
index 522e907..20fd75a 100644
--- a/src/plugins/render/gpsinfo/GpsInfo.cpp
+++ b/src/plugins/render/gpsinfo/GpsInfo.cpp
@@ -21,6 +21,8 @@
 #include "ViewportParams.h"
 #include "GeoDataAccuracy.h"

+#include <QIcon>
+
 namespace Marble
 {

diff --git a/src/plugins/render/license/License.cpp b/src/plugins/render/license/License.cpp
index 511dfc0..9436083 100644
--- a/src/plugins/render/license/License.cpp
+++ b/src/plugins/render/license/License.cpp
@@ -23,6 +23,7 @@
 #include <QCommonStyle>
 #include <QContextMenuEvent>
 #include <QPainter>
+#include <QPainterPath>
 #include <QLabel>
 #include <QMenu>
 #include <QMouseEvent>
diff --git a/src/plugins/render/notes/NotesItem.cpp b/src/plugins/render/notes/NotesItem.cpp
index 9d0961f..0c9fe99 100644
--- a/src/plugins/render/notes/NotesItem.cpp
+++ b/src/plugins/render/notes/NotesItem.cpp
@@ -9,6 +9,7 @@
 #include "MarbleDirs.h"

 #include <QPainter>
+#include <QPainterPath>
 #include <QRect>

 using namespace Marble;
diff --git a/src/plugins/render/postalcode/PostalCodeItem.cpp b/src/plugins/render/postalcode/PostalCodeItem.cpp
index 772c0b2..0ff7957 100644
--- a/src/plugins/render/postalcode/PostalCodeItem.cpp
+++ b/src/plugins/render/postalcode/PostalCodeItem.cpp
@@ -17,6 +17,7 @@
 // Qt
 #include <QFontMetrics>
 #include <QPainter>
+#include <QPainterPath>

 using namespace Marble;

diff --git a/src/plugins/render/progress/ProgressFloatItem.cpp b/src/plugins/render/progress/ProgressFloatItem.cpp
index a465857..6e2452c 100644
--- a/src/plugins/render/progress/ProgressFloatItem.cpp
+++ b/src/plugins/render/progress/ProgressFloatItem.cpp
@@ -22,6 +22,7 @@
 #include <QColor>
 #include <QPaintDevice>
 #include <QPainter>
+#include <QPainterPath>

 namespace Marble
 {
diff --git a/src/plugins/render/satellites/SatellitesPlugin.cpp b/src/plugins/render/satellites/SatellitesPlugin.cpp
index 04d8321..0a43d24 100644
--- a/src/plugins/render/satellites/SatellitesPlugin.cpp
+++ b/src/plugins/render/satellites/SatellitesPlugin.cpp
@@ -25,6 +25,7 @@

 #include "ui_SatellitesConfigDialog.h"

+#include <QAction>
 #include <QUrl>
 #include <QMouseEvent>

diff --git a/src/plugins/render/speedometer/Speedometer.cpp b/src/plugins/render/speedometer/Speedometer.cpp
index 6e9c532..f40a174 100644
--- a/src/plugins/render/speedometer/Speedometer.cpp
+++ b/src/plugins/render/speedometer/Speedometer.cpp
@@ -19,6 +19,8 @@
 #include "MarbleGraphicsGridLayout.h"
 #include "ViewportParams.h"

+#include <QIcon>
+
 namespace Marble
 {

diff --git a/src/plugins/render/stars/StarsPlugin.cpp b/src/plugins/render/stars/StarsPlugin.cpp
index 6599545..482680f 100644
--- a/src/plugins/render/stars/StarsPlugin.cpp
+++ b/src/plugins/render/stars/StarsPlugin.cpp
@@ -19,6 +19,8 @@
 #include <QContextMenuEvent>
 #include <QMenu>
 #include <QColorDialog>
+#include <QPainter>
+#include <QPainterPath>
 #include <qmath.h>

 #include "MarbleClock.h"


code:
From 7580701e6279900fec40822952a3b874732289cf Mon Sep 17 00:00:00 2001
From: Sergei Golubchik <serg@mariadb.org>
Date: Thu, 18 Feb 2021 14:20:48 +0100
Subject: [PATCH] make @@wsrep_provider and @@wsrep_notify_cmd read-only

this should simplify run-time cluster management
---
 mysql-test/suite/galera/disabled.def          |  2 +
 .../galera/include/galera_load_provider.inc   | 19 --------
 .../galera/include/galera_unload_provider.inc |  3 +-
 .../suite/galera/r/galera_ist_rsync.result    |  2 +-
 .../galera/r/galera_sst_mysqldump.result      |  2 +-
 .../suite/galera/r/mysql-wsrep#33.result      |  2 +-
 .../suite/sys_vars/r/sysvars_wsrep.result     |  4 +-
 .../sys_vars/r/wsrep_notify_cmd_basic.result  | 47 -------------------
 .../sys_vars/r/wsrep_provider_basic.result    | 40 ----------------
 .../r/wsrep_provider_options_basic.result     | 46 ------------------
 .../sys_vars/t/wsrep_notify_cmd_basic.test    | 43 -----------------
 .../sys_vars/t/wsrep_provider_basic.test      | 39 ---------------
 .../t/wsrep_provider_options_basic.test       | 41 ----------------
 mysql-test/suite/wsrep/disabled.def           |  2 +
 mysql-test/suite/wsrep/r/variables.result     | 12 ++---
 mysql-test/suite/wsrep/t/variables.test       | 32 +++----------
 sql/sys_vars.cc                               |  8 ++--
 17 files changed, 25 insertions(+), 319 deletions(-)
 delete mode 100644 mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result
 delete mode 100644 mysql-test/suite/sys_vars/r/wsrep_provider_basic.result
 delete mode 100644 mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
 delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test
 delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_provider_basic.test
 delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test

diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index d940c702d54..83f26e81636 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -49,3 +49,5 @@ partition : MDEV-19958 Galera test failure on galera.partition
 query_cache: MDEV-15805 Test failure on galera.query_cache
 sql_log_bin : MDEV-21491 galera.sql_log_bin
 versioning_trx_id : MDEV-18590 galera.versioning_trx_id
+galera_wsrep_provider_unset_set: wsrep_provider is read-only for security reasons
+pxc-421: wsrep_provider is read-only for security reasons
diff --git a/mysql-test/suite/galera/include/galera_load_provider.inc b/mysql-test/suite/galera/include/galera_load_provider.inc
index 0f843597d9c..28010cc5b71 100644
--- a/mysql-test/suite/galera/include/galera_load_provider.inc
+++ b/mysql-test/suite/galera/include/galera_load_provider.inc
@@ -1,25 +1,6 @@
 --echo Loading wsrep provider ...

 --disable_query_log
---eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
-
-#
-# count occurences of successful node starts in error log
-#
-perl;
-  use strict;
-   my $test_log=$ENV{'LOG_FILE'} or die "LOG_FILE not set";
-   my $test_log_copy=$test_log . '.copy';
-   if (-e $test_log_copy) {
-      unlink $test_log_copy;
-   }
-
-EOF
---copy_file $LOG_FILE $LOG_FILE.copy
-
-#
-#  now join to the cluster
-#
 --eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';

 --enable_query_log
diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_unload_provider.inc
index cd841f51fbc..ed7e9bc41f0 100644
--- a/mysql-test/suite/galera/include/galera_unload_provider.inc
+++ b/mysql-test/suite/galera/include/galera_unload_provider.inc
@@ -1,7 +1,6 @@
 --echo Unloading wsrep provider ...

 --let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
---let $wsrep_provider_orig = `SELECT @@wsrep_provider`
 --let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
 --let $wsrep_error_log_orig = `SELECT @@log_error`
 if(!$wsrep_log_error_orig)
@@ -12,4 +11,4 @@ if(!$wsrep_log_error_orig)
 }
 --let LOG_FILE= $wsrep_log_error_orig

-SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_cluster_address = '';
diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result
index 13f7d898a59..70a87c73df7 100644
--- a/mysql-test/suite/galera/r/galera_ist_rsync.result
+++ b/mysql-test/suite/galera/r/galera_ist_rsync.result
@@ -23,7 +23,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
 INSERT INTO t1 VALUES ('node2_committed_before');
 COMMIT;
 Unloading wsrep provider ...
-SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_cluster_address = '';
 connection node_1;
 SET AUTOCOMMIT=OFF;
 START TRANSACTION;
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
index 4ed679ba477..145b3a94775 100644
--- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
@@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
 INSERT INTO t1 VALUES ('node2_committed_before');
 COMMIT;
 Unloading wsrep provider ...
-SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_cluster_address = '';
 connection node_1;
 SET AUTOCOMMIT=OFF;
 START TRANSACTION;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result
index fb0b593cc96..45c6a3f660a 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#33.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result
@@ -32,7 +32,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
 INSERT INTO t1 VALUES ('node2_committed_before');
 COMMIT;
 Unloading wsrep provider ...
-SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_cluster_address = '';
 connection node_1;
 SET AUTOCOMMIT=OFF;
 START TRANSACTION;
diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
index 4b6abf85434..f73bfbd13e7 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
@@ -403,7 +403,7 @@ NUMERIC_MIN_VALUE	NULL
 NUMERIC_MAX_VALUE	NULL
 NUMERIC_BLOCK_SIZE	NULL
 ENUM_VALUE_LIST	NULL
-READ_ONLY	NO
+READ_ONLY	YES
 COMMAND_LINE_ARGUMENT	REQUIRED
 GLOBAL_VALUE_PATH	NULL
 VARIABLE_NAME	WSREP_ON
@@ -463,7 +463,7 @@ NUMERIC_MIN_VALUE	NULL
 NUMERIC_MAX_VALUE	NULL
 NUMERIC_BLOCK_SIZE	NULL
 ENUM_VALUE_LIST	NULL
-READ_ONLY	NO
+READ_ONLY	YES
 COMMAND_LINE_ARGUMENT	REQUIRED
 GLOBAL_VALUE_PATH	NULL
 VARIABLE_NAME	WSREP_PROVIDER_OPTIONS
diff --git a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result b/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result
deleted file mode 100644
index 056ff8c817b..00000000000
--- a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# wsrep_notify_cmd
-#
-call mtr.add_suppression("WSREP: Failed to get provider options");
-# save the initial value
-SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd;
-# default
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-
-
-# scope
-SELECT @@session.wsrep_notify_cmd;
-ERROR HY000: Variable 'wsrep_notify_cmd' is a GLOBAL variable
-SET @@global.wsrep_notify_cmd='notify_cmd';
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-notify_cmd
-
-# valid values
-SET @@global.wsrep_notify_cmd='command';
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-command
-SET @@global.wsrep_notify_cmd='hyphenated-command';
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-hyphenated-command
-SET @@global.wsrep_notify_cmd=default;
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-
-SET @@global.wsrep_notify_cmd=NULL;
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-NULL
-
-# invalid values
-SET @@global.wsrep_notify_cmd=1;
-ERROR 42000: Incorrect argument type to variable 'wsrep_notify_cmd'
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-NULL
-
-# restore the initial value
-SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved;
-# End of test
diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result
deleted file mode 100644
index 3e4ac8ca883..00000000000
--- a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# wsrep_provider
-#
-# save the initial value
-SET @wsrep_provider_global_saved = @@global.wsrep_provider;
-# default
-SELECT @@global.wsrep_provider;
-@@global.wsrep_provider
-none
-
-# scope
-SELECT @@session.wsrep_provider;
-ERROR HY000: Variable 'wsrep_provider' is a GLOBAL variable
-SELECT @@global.wsrep_provider;
-@@global.wsrep_provider
-none
-
-# valid values
-SET @@global.wsrep_provider=default;
-SELECT @@global.wsrep_provider;
-@@global.wsrep_provider
-none
-
-# invalid values
-SET @@global.wsrep_provider='/invalid/libgalera_smm.so';
-ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/invalid/libgalera_smm.so'
-SET @@global.wsrep_provider=NULL;
-ERROR 42000: Variable 'wsrep_provider' can't be set to the value of 'NULL'
-SELECT @@global.wsrep_provider;
-@@global.wsrep_provider
-none
-SET @@global.wsrep_provider=1;
-ERROR 42000: Incorrect argument type to variable 'wsrep_provider'
-SELECT @@global.wsrep_provider;
-@@global.wsrep_provider
-none
-
-# restore the initial value
-SET @@global.wsrep_provider = @wsrep_provider_global_saved;
-# End of test
diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
deleted file mode 100644
index 15949a14e39..00000000000
--- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# wsrep_provider_options
-#
-call mtr.add_suppression("WSREP: Failed to get provider options");
-# default
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-
-
-# scope
-SELECT @@session.wsrep_provider_options;
-ERROR HY000: Variable 'wsrep_provider_options' is a GLOBAL variable
-SET @@global.wsrep_provider_options='option1';
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-
-
-# valid values
-SET @@global.wsrep_provider_options='name1=value1;name2=value2';
-ERROR HY000: WSREP (galera) not started
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-
-SET @@global.wsrep_provider_options='hyphenated-name:value';
-ERROR HY000: WSREP (galera) not started
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-
-SET @@global.wsrep_provider_options=default;
-ERROR HY000: WSREP (galera) not started
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-
-
-# invalid values
-SET @@global.wsrep_provider_options=1;
-ERROR 42000: Incorrect argument type to variable 'wsrep_provider_options'
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-
-SET @@global.wsrep_provider_options=NULL;
-Got one of the listed errors
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-
-# End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test b/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test
deleted file mode 100644
index 6d1535ba148..00000000000
--- a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test
+++ /dev/null
@@ -1,43 +0,0 @@
---source include/have_wsrep.inc
-
---echo #
---echo # wsrep_notify_cmd
---echo #
-
-call mtr.add_suppression("WSREP: Failed to get provider options");
-
---echo # save the initial value
-SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd;
-
---echo # default
-SELECT @@global.wsrep_notify_cmd;
-
---echo
---echo # scope
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.wsrep_notify_cmd;
-SET @@global.wsrep_notify_cmd='notify_cmd';
-SELECT @@global.wsrep_notify_cmd;
-
---echo
---echo # valid values
-SET @@global.wsrep_notify_cmd='command';
-SELECT @@global.wsrep_notify_cmd;
-SET @@global.wsrep_notify_cmd='hyphenated-command';
-SELECT @@global.wsrep_notify_cmd;
-SET @@global.wsrep_notify_cmd=default;
-SELECT @@global.wsrep_notify_cmd;
-SET @@global.wsrep_notify_cmd=NULL;
-SELECT @@global.wsrep_notify_cmd;
-
---echo
---echo # invalid values
---error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wsrep_notify_cmd=1;
-SELECT @@global.wsrep_notify_cmd;
-
---echo
---echo # restore the initial value
-SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved;
-
---echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test
deleted file mode 100644
index 1190ab41bb0..00000000000
--- a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test
+++ /dev/null
@@ -1,39 +0,0 @@
---source include/have_wsrep.inc
-
---echo #
---echo # wsrep_provider
---echo #
-
---echo # save the initial value
-SET @wsrep_provider_global_saved = @@global.wsrep_provider;
-
---echo # default
-SELECT @@global.wsrep_provider;
-
---echo
---echo # scope
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.wsrep_provider;
-SELECT @@global.wsrep_provider;
-
---echo
---echo # valid values
-SET @@global.wsrep_provider=default;
-SELECT @@global.wsrep_provider;
-
---echo
---echo # invalid values
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.wsrep_provider='/invalid/libgalera_smm.so';
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.wsrep_provider=NULL;
-SELECT @@global.wsrep_provider;
---error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wsrep_provider=1;
-SELECT @@global.wsrep_provider;
-
---echo
---echo # restore the initial value
-SET @@global.wsrep_provider = @wsrep_provider_global_saved;
-
---echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
deleted file mode 100644
index 6eb3a94b6a4..00000000000
--- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
+++ /dev/null
@@ -1,41 +0,0 @@
---source include/have_wsrep.inc
-
---echo #
---echo # wsrep_provider_options
---echo #
-
-call mtr.add_suppression("WSREP: Failed to get provider options");
-
---echo # default
-SELECT @@global.wsrep_provider_options;
-
---echo
---echo # scope
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.wsrep_provider_options;
---error 0,ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options='option1';
-SELECT @@global.wsrep_provider_options;
-
---echo
---echo # valid values
---error ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options='name1=value1;name2=value2';
-SELECT @@global.wsrep_provider_options;
---error ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options='hyphenated-name:value';
-SELECT @@global.wsrep_provider_options;
---error ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options=default;
-SELECT @@global.wsrep_provider_options;
-
---echo
---echo # invalid values
---error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wsrep_provider_options=1;
-SELECT @@global.wsrep_provider_options;
---error ER_WRONG_ARGUMENTS,ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options=NULL;
-SELECT @@global.wsrep_provider_options;
-
---echo # End of test
diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def
index 11577bfe8b0..3d204db6945 100644
--- a/mysql-test/suite/wsrep/disabled.def
+++ b/mysql-test/suite/wsrep/disabled.def
@@ -10,3 +10,5 @@
 #
 ##############################################################################

+
+mdev_6832: wsrep_provider is read-only for security reasons
diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result
index a9988fd1628..e57440125ee 100644
--- a/mysql-test/suite/wsrep/r/variables.result
+++ b/mysql-test/suite/wsrep/r/variables.result
@@ -14,7 +14,6 @@ SET SESSION wsrep_replicate_myisam= ON;
 ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL
 SET GLOBAL wsrep_replicate_myisam= ON;
 SET GLOBAL wsrep_replicate_myisam= OFF;
-SET GLOBAL wsrep_provider=none;
 #
 # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
 # variables when using "_"
@@ -151,7 +150,6 @@ wsrep_local_state_comment	#
 # Should show nothing.
 SHOW STATUS LIKE 'x';
 Variable_name	Value
-SET GLOBAL wsrep_provider=none;

 SHOW STATUS LIKE 'wsrep_local_state_uuid';
 Variable_name	Value
@@ -160,7 +158,6 @@ wsrep_local_state_uuid	#
 SHOW STATUS LIKE 'wsrep_last_committed';
 Variable_name	Value
 wsrep_last_committed	#
-SET GLOBAL wsrep_provider=none;

 #
 # MDEV#6206: wsrep_slave_threads subtracts from max_connections
@@ -174,7 +171,7 @@ SELECT @@global.wsrep_slave_threads;
 1
 SELECT @@global.wsrep_cluster_address;
 @@global.wsrep_cluster_address
-
+gcomm://
 SELECT @@global.wsrep_on;
 @@global.wsrep_on
 1
@@ -183,14 +180,14 @@ Variable_name	Value
 Threads_connected	1
 SHOW STATUS LIKE 'wsrep_thread_count';
 Variable_name	Value
-wsrep_thread_count	0
+wsrep_thread_count	2

 SELECT @@global.wsrep_provider;
 @@global.wsrep_provider
 libgalera_smm.so
 SELECT @@global.wsrep_cluster_address;
 @@global.wsrep_cluster_address
-
+gcomm://
 SELECT @@global.wsrep_on;
 @@global.wsrep_on
 1
@@ -199,11 +196,10 @@ Variable_name	Value
 Threads_connected	1
 SHOW STATUS LIKE 'wsrep_thread_count';
 Variable_name	Value
-wsrep_thread_count	0
+wsrep_thread_count	2

 # Setting wsrep_cluster_address triggers the creation of
 # applier/rollbacker threads.
-SET GLOBAL wsrep_cluster_address= 'gcomm://';
 # Wait for applier thread to get created 1.
 # Wait for applier thread to get created 2.
 SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test
index f2c3a0a3b78..fd352b61a3a 100644
--- a/mysql-test/suite/wsrep/t/variables.test
+++ b/mysql-test/suite/wsrep/t/variables.test
@@ -23,7 +23,7 @@ SET GLOBAL wsrep_replicate_myisam= ON;

 # Reset it back.
 SET GLOBAL wsrep_replicate_myisam= OFF;
-SET GLOBAL wsrep_provider=none;
+#SET GLOBAL wsrep_provider=none;

 --echo #
 --echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
@@ -32,9 +32,6 @@ SET GLOBAL wsrep_provider=none;

 CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*");

---disable_query_log
-eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
---enable_query_log

 --replace_column 2 #
 SHOW GLOBAL STATUS LIKE 'wsrep%';
@@ -50,11 +47,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment';
 SHOW STATUS LIKE 'x';

 # Reset it back.
-SET GLOBAL wsrep_provider=none;
+#SET GLOBAL wsrep_provider=none;

---disable_query_log
-eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
---enable_query_log
+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';

 # The following 2 variables are used by mariabackup
 # SST.
@@ -66,7 +61,7 @@ SHOW STATUS LIKE 'wsrep_local_state_uuid';
 SHOW STATUS LIKE 'wsrep_last_committed';

 # Reset it back.
-SET GLOBAL wsrep_provider=none;
+#SET GLOBAL wsrep_provider=none;

 --echo
 --echo #
@@ -74,9 +69,7 @@ SET GLOBAL wsrep_provider=none;
 --echo #
 call mtr.add_suppression("WSREP: Failed to get provider options");

---disable_query_log
-eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
---enable_query_log
+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';

 --replace_regex /.*libgalera_smm.*/libgalera_smm.so/
 SELECT @@global.wsrep_provider;
@@ -87,9 +80,7 @@ SHOW STATUS LIKE 'threads_connected';
 SHOW STATUS LIKE 'wsrep_thread_count';
 --echo

---disable_query_log
-eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
---enable_query_log
+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';

 --replace_regex /.*libgalera_smm.*/libgalera_smm.so/
 SELECT @@global.wsrep_provider;
@@ -101,7 +92,7 @@ SHOW STATUS LIKE 'wsrep_thread_count';

 --echo # Setting wsrep_cluster_address triggers the creation of
 --echo # applier/rollbacker threads.
-SET GLOBAL wsrep_cluster_address= 'gcomm://';
+#SET GLOBAL wsrep_cluster_address= 'gcomm://';

 --echo # Wait for applier thread to get created 1.
 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
@@ -162,15 +153,6 @@ SET @@global.wsrep_sst_auth= NULL;
 SELECT @@global.wsrep_sst_auth;
 SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;

-# Reset (for mtr internal checks)
-
---disable_query_log
-SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
-eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
-SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved;
-SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved;
---enable_query_log
-
 --source include/galera_wait_ready.inc

 --echo # End of test.
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 64040243df0..8c67a4d432a 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -5669,8 +5669,8 @@ static Sys_var_tz Sys_time_zone(

 static Sys_var_charptr_fscs Sys_wsrep_provider(
        "wsrep_provider", "Path to replication provider library",
-       PREALLOCATED GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG),
-       DEFAULT(WSREP_NONE),
+       PREALLOCATED READ_ONLY GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG),
+       DEFAULT(WSREP_NONE),
        NO_MUTEX_GUARD, NOT_IN_BINLOG,
        ON_CHECK(wsrep_provider_check), ON_UPDATE(wsrep_provider_update));

@@ -5886,8 +5886,8 @@ static Sys_var_ulong Sys_wsrep_max_ws_rows (

 static Sys_var_charptr Sys_wsrep_notify_cmd(
        "wsrep_notify_cmd", "",
-       GLOBAL_VAR(wsrep_notify_cmd),CMD_LINE(REQUIRED_ARG),
-       DEFAULT(""));
+       READ_ONLY GLOBAL_VAR(wsrep_notify_cmd), CMD_LINE(REQUIRED_ARG),
+       DEFAULT(""));

 static Sys_var_mybool Sys_wsrep_certify_nonPK(
        "wsrep_certify_nonPK", "Certify tables with no primary key",
--
2.31.0


code:
Remove install target for non-existant directory.

--- a/src/CMakeLists.txt	2015-09-13 20:52:28.517344327 +0200
+++ b/src/CMakeLists.txt	2015-09-13 20:53:04.842453987 +0200
@@ -122,12 +122,6 @@
 		DESTINATION
 			${CMAKE_INSTALL_PREFIX}/share/applications
 	)
-	install(
-		FILES
-			${MARS_SOURCE_DIR}/resources/mars
-		DESTINATION
-			${CMAKE_INSTALL_PREFIX}/share/menu
-	)

 else(UNIX)
 	# executable


code:
This is a concatenation of the following two patches:

  https://github.com/jcowgill/M.A.R.S./commit/33d5affabf8ff84f2c028b9303c6a9e83cc824ad.patch
  https://patch-diff.githubusercontent.com/raw/thelaui/M.A.R.S./pull/2.patch

Their purpose is to allow Mars to be built against the latest version of SFML.

From 33d5affabf8ff84f2c028b9303c6a9e83cc824ad Mon Sep 17 00:00:00 2001
From: James Cowgill <james410@cowgill.org.uk>
Date: Sat, 9 May 2015 01:54:14 +0100
Subject: [PATCH] Remove dependency on GLU - fixes build with SFML 2.3

---
 premake4.lua           |  8 ++++----
 src/Shaders/postFX.cpp |  2 +-
 src/System/window.cpp  | 12 ++++++------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/premake4.lua b/premake4.lua
index 023dddd..5af4495 100755
--- a/premake4.lua
+++ b/premake4.lua
@@ -11,11 +11,11 @@ project "mars"
     defines { "NDEBUG" }
     flags   { "Optimize" }
     if os.get() == "windows" then
-      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "glu32", "opengl32", "fribidi-0", "tag" }
+      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "opengl32", "fribidi-0", "tag" }
     elseif os.get() == "macosx" then
       links { "sfml-graphics.framework", "sfml-audio.framework", "sfml-system.framework", "sfml-window.framework", "opengl.framework", "fribidi", "tag" }
     else
-      links { "GLU", "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
+      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
       libdirs { "/usr/lib", "/usr/local/lib" }
     end

@@ -23,10 +23,10 @@ project "mars"
     defines { "_DEBUG", "DEBUG" }
     flags   { "Symbols" }
     if os.get() == "windows" then
-      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "glu32", "opengl32", "fribidi-0", "tag" }
+      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "opengl32", "fribidi-0", "tag" }
     elseif os.get() == "macosx" then
       links { "sfml-graphics.framework", "sfml-audio.framework", "sfml-system.framework", "sfml-window.framework", "opengl.framework", "fribidi", "tag" }
     else
-      links { "GLU", "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
+      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
       libdirs { "/usr/lib", "/usr/local/lib" }
     end
diff --git a/src/Shaders/postFX.cpp b/src/Shaders/postFX.cpp
index 987f411..f767a47 100644
--- a/src/Shaders/postFX.cpp
+++ b/src/Shaders/postFX.cpp
@@ -78,7 +78,7 @@ namespace postFX {
             postFX_.loadFromFile(settings::C_dataPath + "shaders/bump.frag", sf::Shader::Fragment);
             bumpMap_.create(SPACE_X_RESOLUTION*0.5f, SPACE_Y_RESOLUTION*0.5f);
             glViewport(0,0,SPACE_X_RESOLUTION*0.5f,SPACE_Y_RESOLUTION*0.5f);
-            gluOrtho2D(0, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0);
+            glOrtho(0, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0, -1, 1);
             glEnable(GL_BLEND);
             glMatrixMode(GL_MODELVIEW);
             postFX_.setParameter("BumpMap", bumpMap_.getTexture());
diff --git a/src/System/window.cpp b/src/System/window.cpp
index e9a099a..8e12dcc 100644
--- a/src/System/window.cpp
+++ b/src/System/window.cpp
@@ -222,7 +222,7 @@ namespace window {
         glLoadIdentity();

         // Setup translation (according to left-upper corner)
-        gluOrtho2D(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f);
+        glOrtho(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f, -1, 1);

         // probably improves performance...
         glDisable(GL_LIGHTING);
@@ -247,7 +247,7 @@ namespace window {

         glMatrixMode(GL_PROJECTION);
         glLoadIdentity();
-        gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
+        glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
         glMatrixMode(GL_MODELVIEW);
         glLoadIdentity();

@@ -255,7 +255,7 @@ namespace window {

         glMatrixMode(GL_PROJECTION);
         glLoadIdentity();
-        gluOrtho2D(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f);
+        glOrtho(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f, -1, 1);
         glMatrixMode(GL_MODELVIEW);
         glLoadIdentity();
     }
@@ -270,7 +270,7 @@ namespace window {
             glLoadIdentity();
             setViewPort();

-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
+            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);

             glMatrixMode(GL_MODELVIEW);
             glLoadIdentity();
@@ -284,7 +284,7 @@ namespace window {
             glLoadIdentity();
             setViewPort();

-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
+            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);

             glMatrixMode(GL_MODELVIEW);
             glLoadIdentity();
@@ -294,7 +294,7 @@ namespace window {
         else {
             glMatrixMode(GL_PROJECTION);
             glLoadIdentity();
-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
+            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
             glMatrixMode(GL_MODELVIEW);
             glLoadIdentity();
         }

From a97d0d6a19b5b43e3c53081e36f1f1747b6674e6 Mon Sep 17 00:00:00 2001
From: Sylvain BOILARD <boilard@crans.org>
Date: Wed, 23 Jan 2013 02:02:47 +0100
Subject: [PATCH] Use sf::Shader::Bind() correctly after latest update of the
 SFML's API.

---
 src/System/window.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/System/window.cpp b/src/System/window.cpp
index e9a099a..3ffcf65 100644
--- a/src/System/window.cpp
+++ b/src/System/window.cpp
@@ -307,13 +307,11 @@ namespace window {
         window_.setActive(true);
         glEnable(GL_TEXTURE_2D);

-        if (shader)
-            shader->bind();
+        sf::Shader::bind(shader);

         window_.draw(toBeDrawn, states);

-        if (shader)
-            shader->unbind();
+        sf::Shader::bind(NULL);

         window_.popGLStates();
         glPopMatrix();