Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package gawk for openSUSE:Factory checked in 
at 2022-09-25 15:34:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/gawk (Old)
 and      /work/SRC/openSUSE:Factory/.gawk.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "gawk"

Sun Sep 25 15:34:30 2022 rev:51 rq:1005742 version:5.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/gawk/gawk.changes        2022-09-16 
13:32:06.933225048 +0200
+++ /work/SRC/openSUSE:Factory/.gawk.new.2275/gawk.changes      2022-09-25 
15:34:34.851518565 +0200
@@ -1,0 +2,13 @@
+Sat Sep 24 08:40:01 UTC 2022 - Andreas Schwab <[email protected]>
+
+- double-free.patch: Yet another fix for Node_elem_new
+
+-------------------------------------------------------------------
+Tue Sep 20 07:45:49 UTC 2022 - Andreas Schwab <[email protected]>
+
+- double-free.patch: Fix Node_elem_new op, replacing upref.patch
+- pma.patch: Replace with upstream solution
+- nan-sign.patch: Fix negative NaN issue on RiscV, replacing
+  nan-tests.patch
+
+-------------------------------------------------------------------

Old:
----
  nan-tests.patch
  upref.patch

New:
----
  double-free.patch
  nan-sign.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ gawk.spec ++++++
--- /var/tmp/diff_new_pack.ACMaUc/_old  2022-09-25 15:34:35.415519924 +0200
+++ /var/tmp/diff_new_pack.ACMaUc/_new  2022-09-25 15:34:35.423519943 +0200
@@ -28,8 +28,8 @@
 Source3:        
http://savannah.gnu.org/people/viewgpg.php?user_id=80653#/gawk.keyring
 Source4:        gawk.rpmlintrc
 Patch0:         pma.patch
-Patch1:         nan-tests.patch
-Patch2:         upref.patch
+Patch1:         nan-sign.patch
+Patch2:         double-free.patch
 Provides:       awk
 BuildRequires:  mpfr-devel
 BuildRequires:  readline-devel

++++++ double-free.patch ++++++
diff --git a/interpret.h b/interpret.h
index 57d060e6..26010ada 100644
--- a/interpret.h
+++ b/interpret.h
@@ -213,7 +213,7 @@ top:
                        case Node_var_new:
 uninitialized_scalar:
                                if (op != Op_push_arg_untyped) {
-                                       /* convert untyped to scalar */
+                                       /* convert very original untyped to 
scalar */
                                        m->type = Node_var;
                                        m->var_value = dupnode(Nnull_string);
                                }
@@ -222,6 +222,7 @@ uninitialized_scalar:
                                                _("reference to uninitialized 
argument `%s'") :
                                                _("reference to uninitialized 
variable `%s'"),
                                                                
save_symbol->vname);
+                               // set up local param by value
                                if (op != Op_push_arg_untyped)
                                        m = dupnode(Nnull_string);
                                UPREF(m);
@@ -230,14 +231,20 @@ uninitialized_scalar:
 
                        case Node_elem_new:
                                if (op != Op_push_arg_untyped) {
-                                       /* convert untyped to scalar */
-                                       m = elem_new_to_scalar(m);
+                                       /* convert very original untyped to 
scalar */
+                                       m->type = Node_var;
+                                       m->var_value = dupnode(Nnull_string);
                                }
                                if (do_lint)
                                        lintwarn(isparam ?
                                                _("reference to uninitialized 
argument `%s'") :
                                                _("reference to uninitialized 
variable `%s'"),
                                                                
save_symbol->vname);
+                               // set up local param by value
+                               if (op != Op_push_arg_untyped) {
+                                       m = dupnode(Nnull_string);
+                               }
+
                                PUSH(m);
                                break;
 



++++++ nan-sign.patch ++++++
diff --git a/eval.c b/eval.c
index 1069570b7..44f614d22 100644
--- a/eval.c
+++ b/eval.c
@@ -39,6 +39,8 @@ static int num_exec_hook = 0;
 static Func_pre_exec pre_execute[MAX_EXEC_HOOKS];
 static Func_post_exec post_execute = NULL;
 
+static double fix_nan_sign(double left, double right, double result);
+
 extern void frame_popped();
 
 int OFSlen;
@@ -1901,3 +1903,16 @@ elem_new_to_scalar(NODE *n)
 
        return n;
 }
+
+/* fix_nan_sign --- fix NaN sign on RiscV */
+
+static double
+fix_nan_sign(double left, double right, double result)
+{
+       if (isnan(left) && signbit(left))
+               return copysign(result, -1.0);
+       else if (isnan(right) && signbit(right))
+               return copysign(result, -1.0);
+       else
+               return result;
+}
diff --git a/interpret.h b/interpret.h
index 26010ada1..955d918f1 100644
--- a/interpret.h
+++ b/interpret.h
@@ -583,6 +583,7 @@ uninitialized_scalar:
 plus:
                        t1 = TOP_NUMBER();
                        r = make_number(t1->numbr + x2);
+                       r->numbr = fix_nan_sign(t1->numbr, x2, r->numbr);
                        DEREF(t1);
                        REPLACE(r);
                        break;
@@ -597,6 +598,7 @@ plus:
 minus:
                        t1 = TOP_NUMBER();
                        r = make_number(t1->numbr - x2);
+                       r->numbr = fix_nan_sign(t1->numbr, x2, r->numbr);
                        DEREF(t1);
                        REPLACE(r);
                        break;

++++++ pma.patch ++++++
--- /var/tmp/diff_new_pack.ACMaUc/_old  2022-09-25 15:34:35.499520125 +0200
+++ /var/tmp/diff_new_pack.ACMaUc/_new  2022-09-25 15:34:35.499520125 +0200
@@ -2,12 +2,40 @@
 ===================================================================
 --- gawk-5.2.0.orig/support/pma.c
 +++ gawk-5.2.0/support/pma.c
-@@ -346,6 +346,7 @@ static void * addrgap(off_t n) {  // fin
-   for (U = 1; ; U *= 2)  // double upper bound until failure
-     if (MAP_FAILED == (A = MMAP(U))) break;
-     else                   MUNMAP(A, U);
-+  if (U == 0) U = -1;
-   while (1 + L < U) {  // binary search between bounds
+@@ -340,16 +340,20 @@ static void flr(ao_t *p) {  // remove ao
+ #define MMAP(N) mmap(NULL, (N), PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | 
MAP_NORESERVE, -1, 0)
+ #define MUNMAP(A, N) do { if (0 != munmap((A), (N))) { ERR("munmap()" ERN); 
SERN; } } while (0)
+ static void * addrgap(off_t n) {  // find big gap in address space to map n 
bytes
+-  void *A, *Amax = NULL;  size_t L = 0, U, Max = 0, N = (size_t)n;  char *r;
++  void *A, *Amax = NULL;  size_t L, U, Max = 0, N = (size_t)n;  char *r;
+   FYI("addrgap(%jd)\n", (intmax_t)n);  // TODO: better way to handle off_t
+   if (N < sizeof(pma_hdr_t) + 40960) { ERR("file size %zu too small\n", N); 
SERN; }
+-  for (U = 1; ; U *= 2)  // double upper bound until failure
+-    if (MAP_FAILED == (A = MMAP(U))) break;
+-    else                   MUNMAP(A, U);
+-  while (1 + L < U) {  // binary search between bounds
++  // Binary search to find max length of successfull mmap().
++  // Invariants:
++  //   Larger max might lie in range [L,U] inclusive.
++  //   If a previous max has been found, it must lie in [1,L-1].
++  //   A larger max cannot lie in [U+1,UINT64_MAX].
++  L = 1;  // mmap fails if length == 0 (SUSv3)
++  U = UINT64_MAX;
++  while (L <= U) {
      size_t M = L + (U - L) / 2;  // avoid overflow
-     if (MAP_FAILED == (A = MMAP(M))) {      U = M; }
+-    if (MAP_FAILED == (A = MMAP(M))) {      U = M; }
+-    else { Amax = A; Max = M; MUNMAP(A, M); L = M; }
++    if (MAP_FAILED != (A = MMAP(M))) { assert(Max < M); Max = M; Amax = A; 
MUNMAP(A, M); if (UINT64_MAX == M) break; L = M + 1; }
++    else                             { assert(0   < M);                       
                                       U = M - 1; }
+   }
+   FYI("max gap: %zu bytes at %p\n", Max, Amax);
+   if (Max < N + (size_t)ALGN * 2) {  // safety margin
+@@ -392,6 +396,7 @@ int pma_init(int verbose, const char *fi
+   assert((himask | lomask) == ~((uintptr_t)0));
+   if (! (WDSZ == sizeof(void *) && // in C11 we'd static_assert()
+          WDSZ == sizeof(size_t) &&
++         WDSZ == sizeof(off_t)  &&
+          WDSZ == sizeof(unsigned long))) { ERR("word size not 64 bits\n"); 
SERL; }
+   assert(0 == sizeof(pma_hdr_t) % WDSZ);
+   if (NULL == file) {
 

Reply via email to