Re: Bug in aclocal.m4 / configure ? BASH_STRUCT_WEXITSTATUS_OFFSET

2020-09-14 Thread Andreas K . Hüttel
> 
> Yes, thanks. It's a typo, but has no effect on obtaining the right answer.
> On some weird yet-to-be-encountered system, if the exit status were not
> available at some offset in the status word, it would result in an infinite
> loop.
>

Indeed, and that's what I observed. Trying to figure out right now whether 
qemu or glibc (both ~ git master) are at fault... Thanks! -Andreas

-- 
Andreas K. Hüttel
dilfri...@gentoo.org
Gentoo Linux developer 
(council, qa, toolchain, base-system, perl, libreoffice)

signature.asc
Description: This is a digitally signed message part.


Re: Bug in aclocal.m4 / configure ? BASH_STRUCT_WEXITSTATUS_OFFSET

2020-09-14 Thread Chet Ramey
On 9/13/20 6:17 PM, Andreas K. Hüttel wrote:
> Hi, 
> 
> in aclocal.m4 (and thus also configure), the test for 
> BASH_STRUCT_WEXITSTATUS_OFFSET contains
> 
>   /* crack s */
>   for (i = 0; i < (sizeof(s) - 8); i++)
> 
> Shouldnt this be 
> 
>   /* crack s */
>   for (i = 0; i < (sizeof(s) * 8); i++)
> 
> (* instead of -), see attached trivial patch? The minus sign makes no sense 
> at 
> all since even on x86-64 sizeof(int)=4 ...

Yes, thanks. It's a typo, but has no effect on obtaining the right answer.
On some weird yet-to-be-encountered system, if the exit status were not
available at some offset in the status word, it would result in an infinite
loop.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Bug in aclocal.m4 / configure ? BASH_STRUCT_WEXITSTATUS_OFFSET

2020-09-13 Thread Andreas K . Hüttel
Hi, 

in aclocal.m4 (and thus also configure), the test for 
BASH_STRUCT_WEXITSTATUS_OFFSET contains

  /* crack s */
  for (i = 0; i < (sizeof(s) - 8); i++)

Shouldnt this be 

  /* crack s */
  for (i = 0; i < (sizeof(s) * 8); i++)

(* instead of -), see attached trivial patch? The minus sign makes no sense at 
all since even on x86-64 sizeof(int)=4 ...

[I found this when tracking down weird behaviour in a highly experimental 
riscv32 / glibc / qemu chroot, where s=10240 ... that's a different bug in 
another moving piece though...]

Best,
Andreas

-- 
Andreas K. Hüttel
dilfri...@gentoo.org
Gentoo Linux developer 
(council, qa, toolchain, base-system, perl, libreoffice)From 4cac8db12745e2fced2ff4224f741470019ae069 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= 
Date: Mon, 14 Sep 2020 00:36:26 +0300
Subject: [PATCH] Fix typo (-8 instead of *8) when testing for bit shift
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Andreas K. Hüttel 
---
 aclocal.m4 | 2 +-
 configure  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 1413267f..318b9318 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -4172,7 +4172,7 @@ main(c, v)
 exit (255);
 
   /* crack s */
-  for (i = 0; i < (sizeof(s) - 8); i++)
+  for (i = 0; i < (sizeof(s) * 8); i++)
 {
   n = (s >> i) & 0xff;
   if (n == 42)
diff --git a/configure b/configure
index 2f626629..ca247e47 100755
--- a/configure
+++ b/configure
@@ -14258,7 +14258,7 @@ main(c, v)
 exit (255);
 
   /* crack s */
-  for (i = 0; i < (sizeof(s) - 8); i++)
+  for (i = 0; i < (sizeof(s) * 8); i++)
 {
   n = (s >> i) & 0xff;
   if (n == 42)
-- 
2.26.2



signature.asc
Description: This is a digitally signed message part.