On 14/03/2023 23:05, Bruno Haible wrote:
On Alpine Linux 3.17 (which uses musl libc), I get 2 test failures:

FAIL: tests/misc/stty-invalid

repro'd on alpine 3.15.
Getting error "unable to perform all requested operations"
when trying to reapply the settings returned by `stty -g`.

I confirmed the attached fixes this on alpine 3.15

FAIL: tests/cp/preserve-mode

There is a mismatch between the modes of a dir created with mkdir and cp.

mkdir mode    = 42755
cp mkdir mode = 40755

So mkdir has set-group-ID bit set.
cp should be creating dir with that bit set also?

In any case created subdirectories should inherit the setgid bit from parent.

I can't repro this on the alpine 3.15 system at least,
nor on a local system with setgid bit set on the test dirs.

cheers,
Pádraig
From eb745e3b95a79bdad98aaa9c4e753145f995c313 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Sun, 19 Mar 2023 22:22:18 +0000
Subject: [PATCH] stty: ensure arbitrary data is not displayed

* src/stty.c (main): Use static structures to ensure
they're initialized (to zero), so that random data is
not displayed, or compared resulting in a inaccurate
failure reported to users.  This was seen on musl libc
where some parts of the termios c_cc array were
not initialized by tcgetattr().
Reported by Bruno Haible.
---
 src/stty.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/stty.c b/src/stty.c
index fb7feefab..607a4e7bb 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -1290,7 +1290,9 @@ apply_settings (bool checking, char const *device_name,
 int
 main (int argc, char **argv)
 {
-  struct termios mode;
+  /* Initialize to all zeroes so there is no risk memcmp will report a
+     spurious difference in an uninitialized portion of the structure.  */
+  static struct termios mode;
 
   enum output_type output_type;
   int optc;
@@ -1426,7 +1428,9 @@ main (int argc, char **argv)
 
   if (require_set_attr)
     {
-      struct termios new_mode;
+      /* Initialize to all zeroes so there is no risk memcmp will report a
+         spurious difference in an uninitialized portion of the structure.  */
+      static struct termios new_mode;
 
       if (tcsetattr (STDIN_FILENO, tcsetattr_options, &mode))
         die (EXIT_FAILURE, errno, "%s", quotef (device_name));
-- 
2.26.2

Reply via email to